Okay, you're right, those things do happen and I'd missed them. Confirmation bias is fun! I'll keep digging.
Why else might onStopRequest occur at the receiving end without onDataAvailable called for the last available chunk? This is the code in question <https://searchfox.org/comm-central/rev/efd73857b11670549913de1be0e1ef11a935689e/mail/components/accountcreation/modules/GuessConfig.sys.mjs#1140-1243> although large chunks of it are irrelevant. I am lurking in #necko now, although I suspect you are not around, given the time of day. GL On Wednesday, December 13, 2023 at 5:53:11 PM UTC+13 Randell Jesup wrote: > On 12/12/2023 8:39 PM, 'Geoff Lankow' via [email protected] wrote: > > Hi all, I'm fighting with a race condition. I'm calling output.write and > transport.close but the call to close sometimes happens on the main > thread before the socket thread completes the write: > > [Parent 4048037: Main Thread]: D/nsSocketTransport nsSocketTransport::Close > 7fc2ecb6f000 reason=0 > [Parent 4048037: Main Thread]: D/nsSocketTransport > nsSocketInputStream::CloseWithStatus [this=7fc2ecb6f290 reason=80470002] > [Parent 4048037: Main Thread]: D/nsSocketTransport > nsSocketOutputStream::CloseWithStatus [this=7fc2ecb6f2c8 reason=80470002] > [Parent 4048037: Socket Thread]: D/nsSocketTransport > nsSocketOutputStream::Write [this=7fc2ecb6f2c8 count=52] > > When this happens the receiving end doesn't get all of the data and my > tests fail. > > How can I be sure the output stream is ready before closing it? There > doesn't appear to be any checks in the code. Is this expected behaviour or > a bug? > > > So nsSocketOutputStream::CloseWithStatus() with a non-zero reason will > call transport->OnOutputClosed(). If that's called off the socket thread, > it sends a MSG_OUTPUT_CLOSED to the socket thread, so this should be > processed on the socket thread after your write. This should cause a > SOCKET_LOG((" MSG_OUTPUT_CLOSED")) and then a > nsSocketTransport::OnMsgOutputClosed log. Do these happen before or after > the ::Write on Socket Thread? > > > To help more we'd need more details/code/complete logs. Can you join us > in #necko on matrix? > > Thanks! > > Randell Jesup, Mozilla Network team > -- You received this message because you are subscribed to the Google Groups "[email protected]" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/a0764eee-2afe-4e86-8317-125a8d57fb24n%40mozilla.org.
