Message4090

Author amak
Recipients amak, glyph
Date 2009-01-27.18:32:55
SpamBayes Score 4.826217e-10
Marked as misclassified No
Message-id <1233081177.2.0.91600488903.issue1121@psf.upfronthosting.co.za>
In-reply-to
Content
On re-reading this bug report, I see that fix checked in earlier is
incorrect.

The title of the bug report is very precise: "listening socket shutdown
expects the wrong kind of socket".

That is correct because the existing jython shutdown method for TCP
sockets indeed expects a connected socket, with input and output channels.

But shutdown is also a valid operation on listening sockets.

From what I can see in the java documentation, there is no "shutdown"
method for java ServerSockets or ServerSocketChannels, only a "close"
method. But, the close method is appropriate for a "shutdown" operation,
because it closes the listening socket and cancels all pending
connections in the queue, which is what "shutdown" should do.

http://java.sun.com/j2se/1.5.0/docs/api/java/net/ServerSocket.html#close()

According to my reading, the difference between shutdown and close on
listening sockets is only relevant when multiple processes have the same
socket file descriptor open. For example, this document

http://docs.hp.com/en/J2793-90048/ch03s05.html

says

"""
The shutdown() and close() calls differ in that shutdown() takes effect
regardless of the number of open socket descriptors, while close() takes
effect only when the last process with an open socket descriptor makes
the call. 
"""

But java servers are always multi-threaded, and multiple-process
concerns do not apply.

I will apply a fix in a few days which maps the "shutdown" call on
listening sockets to the underlying ServerSocketChannel.

All opinions are welcome.
History
Date User Action Args
2009-01-27 18:32:57amaksetmessageid: <1233081177.2.0.91600488903.issue1121@psf.upfronthosting.co.za>
2009-01-27 18:32:57amaksetrecipients: + amak, glyph
2009-01-27 18:32:57amaklinkissue1121 messages
2009-01-27 18:32:55amakcreate