jdev - 2020-08-10


  1. lovetox

    so im running into a problem with ejabberd since a long time

  2. lovetox

    when i join many MUCs (hence much traffic)

  3. lovetox

    it seems ejabberd sends me stanzas and i dont get the chance to ack them until ejabberd runs into some stream management queue limit

  4. lovetox

    and aborts the connection

  5. lovetox

    so back then i just thought ok maybe my network code is shitty, lets rewrite this, but its still happening, and i dont really get what i could do better

  6. lovetox

    there is a outgoing connection and incoming connection, i have callbacks on both when they are "ready"

  7. lovetox

    and if they are ready, i write or receive data

  8. lovetox

    and if they are ready is decided by GLib

  9. lovetox

    so i didnt write the socket code

  10. lovetox

    i dont know why the outgoing connection does not become ready .. maybe because of the other side, but thats just a guess

  11. lovetox

    does any developer here have special code that somehow handles this case

  12. Kev

    You haven't got something going on like "I'll only write to the socket once I'm done reading from it" have you?

  13. Kev

    That's what the problem sounds like.

  14. lovetox

    no i definitly dont have that

  15. lovetox

    GLib abstracts that

  16. jonas’

    lovetox, are you sure that glib will let you alternate between read and write if both are possible?

  17. lovetox

    i get a callback when the socket is ready, either to receive or to write

  18. lovetox

    and when i get that callback i use it to do exactly that

  19. lovetox

    no im not sure, but how do other devs tackle that problem, do you explicitly after X bytes received, send stuff?

  20. jonas’

    my event loop takes care of that

  21. jonas’

    but I don’t trust glib

  22. lovetox

    how?

  23. jonas’

    (my event loop = asyncio.whateverthedefaulteventlooponlinuxis)

  24. jonas’

    but asyncio has write queues, so I *expect* it to write things from the queues when possible and only then hand me read callbacks.

  25. lovetox

    ok i expect also things from GLib, so you don't handle that case yourself

  26. jonas’

    lovetox, I suggest you go and read the glib source code

  27. lovetox

    thing is i had that problem when i used python network code

  28. lovetox

    and i only ever had it with ejabberd

  29. jonas’

    prosody has no stream management queue size limits AFAIK

  30. jonas’

    s/prosody/the unofficial mod_smacks/

  31. jonas’

    ok, I checked asyncio; it will alternate between readers and writers. each iteration of the loop collects ready events and then processes them

  32. Kev

    I don't know what the issue is, but what you're describing is 100% the behaviour you'd get if you don't bother writing until you're done reading, and there's a lot of data to read.

  33. Kev

    So I'm aware of implementations that manually alternate to avoid reading from the queue forever.

  34. lovetox

    yeah i know this sounds like that

  35. lovetox

    maybe it is, maybe i should ask the GLib guys if they alternate between the streams

  36. jonas’

    lovetox, just read the source

  37. jonas’

    that’s the least ambiguous answer you’ll get