Sun 23 Dec 2007
So our new JRuby console is pretty sporty. Created inside an Emissary P2P Workflow node, made accessible by our custom MVC stuff over Jetty, nice CSS and Javascript that makes it pretty nice to use, including command history on the up-arrow.
But there is a small problem that is driving me bonkers.
Sometimes, more often while debugging something and doing a Shift-Reload on the JRuby Console web page, but sometimes without that — I get TWO JRuby environments and the interactions using AJAX alternate between them. Like this:
=> i=5 5 => i=6 6 => i 5 => i 6
This doesn’t happen all the time and I really don’t know what is going on. There could very well be some fundamental thing about the Bean Scripting Framework’s BSFManager that I just don’t grok. In fact, after looking into the BSFManager a little, I’m worried about the multi-threaded nature of running that inside the emissary node. We could have multiple users each creating a JRuby console which could be living on separate HttpSessions. Should be ok as far as all of my code goes, but that BSFManager factory/singleton is starting to look suspiciously like an anti-pattern I once knew.
It looks like whatever you’re using to associate a JRuby instance with a given session may be faulty here. If it looks like there’s a JRuby problem, please contact us or report a bug.
It now seems like multiple Http sessions are being created, I have gotten up to three. Something is still wrong but I don’t think it is JRuby.
Jetty is telling me that request.getSession() the session.isNew() is true multiple times for the same session id. It looks like this could be related both to xhr requests and using Shift-Reload on the jsp page that holds the form I’m using to drive the JRuby console. Now the same session ID can be isNew() == true more than once has me scratching my head at the moment.