-
Notifications
You must be signed in to change notification settings - Fork 60
OutputWriter can't handle multiple writers #38
Comments
Reported by sdo@java.net |
Was assigned to oleksiys@java.net |
oleksiys@java.net said: |
jfarcand@java.net said: |
jfarcand@java.net said: |
jfarcand@java.net said: |
jfarcand@java.net said: |
Marked as fixed on Wednesday, December 16th 2009, 6:14:11 pm |
This issue was imported from java.net JIRA GRIZZLY-38 |
The OutputWriter class is intended to wait up to 1 minute (default wait time)
for output space to be available to complete writing the data. In an HTTP mode
(or for similar protocols), that works just fine.
For protocols (like SIP) where multiple threads are writing to the same socket,
buffer contention will cause OutputWriter to report an error prematurely. Say
there are 10 threads writing on the socket that fills up; all 10 will get a
selector and enter the select() call. When the socket buffer empties, all 10
will get notified that they can write data, and all will attempt to write their
data – but while the socket is still draining, it's likely that only 1 will
succeed and the remaining will write 0 bytes again. If this process is repeated
twice, the remaining sockets will give up (based on the attempts value in
OutputWriter) and close the socket. This entire process takes only a few
milliseconds, since during that time there will be two successful writes.
The async queueing model should take this into account, or we should develop a
selector-per-socket model such that only one thread can wake up from the select
at a time.
Environment
Operating System: All
Platform: All
The text was updated successfully, but these errors were encountered: