Java NIO disconnects unnoticed?

R

Remon van Vliet

Hello,

I have (what i believe is) a particulary odd problem. I made a NIO based
server, and all worked fine until i started load testing. Local load testing
(both server and load test client running on my development machine) worked
fine and nothing odd happened when i closed the load testing client
(generating up to 4000 simultaneous disconnects until connection count
reached 0 as expected).

However, now that i started running the load test client on other machines
and the server locally i've run into an odd problem. It sees the first 100
or so disconnects if i close the load test client, but after that it just
stops noticing them. The selector thread (that does selector.select())
blocks nicely on the select as if no keys are ready to be read (obviously
all the disconnects should have set the ready ops for their associated keys
to OP_READ). I assumed the ready ops were just lost somehow, but when i
suspend the selector thread and inspect the keys it actually shows all as of
yet undisconnected keys as having readyOps neatly set to OP_READ. In other
words, all the keys related to the channels that were disconnected actually
have read operations waiting, but for some reason the select does not
actually return. My problem isnt fixed with using selectNow, if i do that
it'll run through the loop without ever selecting keys.

Does anyone have any idea what i may doing wrong, i was assuming all
channels will at some point notice they're disconnected (EOF-ed), which they
seem to do since their readyOps of their key are set accordingly, but
shouldnt this cause selector.select() to fill it's selectedKeys()
collection?

Kind regards,

Remon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top