<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    I missed adding the mutex lock to mbuf_append() and mbuf_trim().<br>
    <br>
    Fix is pushed, remember to also do "git submodule update".<br>
    <br>
    Regards,<br>
    Michael<br>
    <br>
    <br>
    <div class="moz-cite-prefix">Am 25.05.2018 um 09:29 schrieb Michael
      Balzer:<br>
    </div>
    <blockquote type="cite"
      cite="mid:22b7e884-8bb3-9851-182b-4529be72c6a0@expeedo.de">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <br>
      <div class="moz-cite-prefix">Am 25.05.2018 um 04:01 schrieb Mark
        Webb-Johnson:<br>
      </div>
      <blockquote type="cite"
        cite="mid:FF887488-E021-49C4-8E4F-5EC76803AD06@webb-johnson.net">
        <pre wrap="">Michael,

This seems a very neat solution, at a fundamental level, to the problem. I just worry if there are other parts of mongoose (other than buffers) that are going to hit this multi-threaded issue. I think, for safety, we need to make sure as much as possible is done inside the mongoose task.</pre>
      </blockquote>
      <br>
      Yes, that's an important note for all developers: <b>this does
        not make mongoose thread safe</b>.<br>
      <br>
      This only makes the connection buffer access thread safe so
      mg_send() can be called from other tasks, e.g. from event or
      metric listeners. This can be done if sends are atomic on the
      protocol level (as done in the v2 server by Transmit()). A clean
      "mongoose style" solution for this would be to queue all
      transmissions and only send from the mongoose event handler or a
      mongoose broadcast handler.<br>
      <br>
      All other concurrent accesses to mongoose connections still must
      be avoided. Even API calls that seem to only do read accesses
      (e.g. mg_conn_addr_to_str) can have hidden side effects if called
      from another context.<br>
      <br>
      <br>
      <blockquote type="cite"
        cite="mid:FF887488-E021-49C4-8E4F-5EC76803AD06@webb-johnson.net">
        <pre wrap="">Please let us know if it solves the problem you are seeing.</pre>
      </blockquote>
      <br>
      This was happening mostly on the Twizy because it currently does
      the most custom telemetry.<br>
      <br>
      Looks very good so far. I rolled out the build yesterday evening,
      so I will have some more data on this over the weekend.<br>
      <br>
      Regards,<br>
      Michael<br>
      <br>
      <br>
      <blockquote type="cite"
        cite="mid:FF887488-E021-49C4-8E4F-5EC76803AD06@webb-johnson.net">
        <pre wrap="">Regards, Mark.

</pre>
        <blockquote type="cite">
          <pre wrap="">On 24 May 2018, at 11:30 PM, Michael Balzer <a class="moz-txt-link-rfc2396E" href="mailto:dexter@expeedo.de" moz-do-not-send="true"><dexter@expeedo.de></a> wrote:

Re: <a class="moz-txt-link-freetext" href="https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/issues/120" moz-do-not-send="true">https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/issues/120</a>

I've pushed an update to our mongoose clone that should solve the spurious crashes in mbuf_insert().

After the next git pull, you will also need to do a git submodule update.

Please test for your setups and report if the crash still occurs or any new issues come up.

Regards,
Michael

-- 
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26

_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.openvehicles.com" moz-do-not-send="true">OvmsDev@lists.openvehicles.com</a>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev" moz-do-not-send="true">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre>
        </blockquote>
        <pre wrap="">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.openvehicles.com" moz-do-not-send="true">OvmsDev@lists.openvehicles.com</a>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev" moz-do-not-send="true">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre>
      </blockquote>
      <br>
      <pre class="moz-signature" cols="160">-- 
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
</pre>
      <!--'"--><br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.openvehicles.com">OvmsDev@lists.openvehicles.com</a>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="160">-- 
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
</pre>
  </body>
</html>