<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello Nicolas,</p>
    <p>I am afraid you are right in your idea: there could be tasks
      closed in midPoint repository but still marked as "running" in
      Quartz.</p>
    <p>Maybe the synchronizer could be rewritten to be less memory
      intensive. But, honestly, I did not expect there could be an
      environment with 14.000 tasks. :)</p>
    <p>What are these? Are they approval tasks? Why are they so many?</p>
    <p>In the near future (4.0) we will stop using tasks for approvals,
      so this problem will go away by itself.</p>
    <p>Best regards,<br>
    </p>
    <pre class="moz-signature" cols="72">Pavol Mederly
Software developer
evolveum.com
</pre>
    <div class="moz-cite-prefix">On 01.05.2019 0:46, Nicolas Rossi
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAAxX8ciWVh4=jV5qOnjtTqEgLJLKdsjePhkCJKsasYh9dCCp4A@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr">
          <div dir="ltr">
            <div dir="ltr">
              <div class="gmail_default"
style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(7,55,99)">Hi
                guys, we have found that MP can fail to start due to
                memory issues if there are a lot of tasks in the db.
                Looking at the logs we found that Quartz queries all the
                tasks on the database and then iterates over each one
                when it is initialized. That process was eating the
                memory on our environment with 14.000 tasks.   </div>
              <div class="gmail_default"
style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(7,55,99)"><br>
              </div>
              <div class="gmail_default"><font face="arial, helvetica,
                  sans-serif" color="#073763">I modified the </font><a
href="https://github.com/Evolveum/midpoint/blob/b08206d0c0e5b3c6a7155bf7d8addbfee4672236/repo/task-quartz-impl/src/main/java/com/evolveum/midpoint/task/quartzimpl/execution/TaskSynchronizer.java#L97"
style="color:rgb(7,55,99);font-family:arial,helvetica,sans-serif;font-size:small"
                  moz-do-not-send="true">TaskSynchronizer</a><font
                  face="arial, helvetica, sans-serif" color="#073763">
                  class to filter closed tasks on the
                  'synchronizeJobStores' method and it fixed
                  the problem. Is there any reason to get all tasks on
                  this process ? Maybe because some task can be closed
                  on the db and running in memory ?</font></div>
              <div class="gmail_default"
style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(7,55,99)"><br>
              </div>
              <div class="gmail_default"
style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(7,55,99)">I
                can create a PR on github if you agree with this
                change. <br>
              </div>
              <div class="gmail_default"
style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(7,55,99)"><br>
              </div>
              <div class="gmail_default"
style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(7,55,99)">Any
                thoughts?</div>
              <div class="gmail_default"
style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(7,55,99)"><br>
              </div>
              <div class="gmail_default"
style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(7,55,99)"><br>
              </div>
              <div>
                <div dir="ltr" class="gmail_signature">
                  <div dir="ltr">
                    <div>
                      <div dir="ltr">
                        <div>
                          <div dir="ltr">
                            <div>
                              <div dir="ltr">
                                <div>
                                  <div dir="ltr">
                                    <div>
                                      <div dir="ltr">
                                        <div>
                                          <div dir="ltr">
                                            <div>
                                              <div dir="ltr">
                                                <div>
                                                  <div dir="ltr"><font
                                                      face="arial,
                                                      helvetica,
                                                      sans-serif"><br>
                                                      <br>
                                                      <font
                                                        color="#444444">Ing
                                                        Nicolás Rossi</font><br>
                                                      <font
                                                        color="#999999">Identicum
                                                        S.A.</font><br>
                                                      <font
                                                        color="#999999">Jorge
                                                        Newbery 3226</font><br>
                                                      <font
                                                        color="#999999">Oficina:
                                                        +54
                                                        (11) 4552-3050</font></font></div>
                                                  <div dir="ltr"><font
                                                      face="arial,
                                                      helvetica,
                                                      sans-serif"><font
                                                        color="#999999">Móvil:
                                                        +54 (911)
                                                        6041-3920<br>
                                                        <a
                                                          href="http://www.identicum.com"
target="_blank" moz-do-not-send="true">www.identicum.com</a></font></font><br>
                                                  </div>
                                                </div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
    </blockquote>
  </body>
</html>