Closed glassfishrobot closed 14 years ago
@glassfishrobot Commented Reported by jfarcand@java.net
@glassfishrobot Commented jfarcand@java.net said: Possible fix. I suspect there is other corner case this fix isn't covering, hence not closing the issue for now.
Sending comet/src/main/java/com/sun/grizzly/comet/CometContext.java Sending comet/src/main/java/com/sun/grizzly/comet/CometEngine.java Sending comet/src/main/java/com/sun/grizzly/comet/CometSelector.java Transmitting file data ... Committed revision 2644.
@glassfishrobot Commented jfarcand@java.net said: Fix title
@glassfishrobot Commented gustav3d@java.net said: Sending java/grizzly/trunk/code/modules/comet/src/main/java/com/sun/grizzly/comet/CometEngine.java Transmitting file data ... Committed revision 2661.
selectionkeys used by comet in grizzly main selector are geting their attachment set to Long within a few ms after cometselector registration, this triggers cometselector idletimeout code path that detects Long attachment in the mainkey and cancels the cometkey and removes its attachment, leading to failed resumes due to cometselector.cancelkey returns false when the attachment already is null.
to mitigate this problem i set the attachment to "comet" instead of null in cometengine.handle so is this a new problem, or has it existed all the way back to when i removed the bannedkey list in grizzly keep alive code ?. its very strange if this has managed to stay undetected for several months, it fails the comet unit tests rather badly.
later today i will be able to test on non linux platforms to see if the recent cometcontext fixes are still needed or not. (cometD-client tests works rather well regardless of these fixes here, comet unit tests however dont)
@glassfishrobot Commented jfarcand@java.net said: Bump version
@glassfishrobot Commented jfarcand@java.net said: Bump version
@glassfishrobot Commented gustav3d@java.net said: this issue is invalid: cometD is completely single threaded so its impossible for it to cause such threadrace.
@glassfishrobot Commented gustav3d@java.net said: bah, wrong by me !, there is still a chance that servlet post execute will overlap with a resume.
cometD could perhaps wait for onInitialize before making the handler available for cometD operations ?.
@glassfishrobot Commented jfarcand@java.net said: FYI, The CometSelector runs on another thread so they are still possible racing issue (until we merge your change ) Your recommendation will improve the situation for sure...
@glassfishrobot Commented jfarcand@java.net said: This is fixed by:
@glassfishrobot Commented Was assigned to jfarcand@java.net
@glassfishrobot Commented This issue was imported from java.net JIRA GRIZZLY-483
@glassfishrobot Commented Marked as fixed on Wednesday, December 16th 2009, 6:13:09 pm
The current cometd-client test fail from time to time and as Shing Wai observed, the test fail because the resumeCometHandler return false (failed resume) instead of true. The issue is caused by a race (produced by the cometd module) where addCometHandler has not finished to execute when resumeCometHandler gets invoked.
Internally the CometTask has not yet been attached to cometKey and hence resume fail. It may also be caused because the same CometHandler is resumed twice.
Environment
Operating System: All Platform: All
Affected Versions
[1.9.8]