thewca / tnoodle

Development for the official WCA scramble server
https://www.worldcubeassociation.org/regulations/scrambles/
GNU Affero General Public License v3.0
393 stars 93 forks source link

NullPointerException when generating zip file #171

Closed jfly closed 6 years ago

jfly commented 10 years ago

Tim: i'm getting a NullPointerException when generating scrambles using the TNoodle jar i just downloaded me: darn! stacktrace? Tim: at net.gnehzr.tnoodle.server.webscrambles.ScrambleRequest.requestsToZip(ScrambleRequest.java:907)

907 is this:

 907         for(ScrambleRequest scrambleRequest : scrambleRequests) {

Tim started up TNoodle-WCA-0.8.4 for the first time (this means he had no 444 pruning table yet), and generated a bunch of scrambles, including 444. When clicking "Scramble", he received a text/plain document with the stacktrace.

My gut feeling is that this is not a bug with the server, but is rather a race condition with our ajax-ing on the client side.

The problem goes away when you open a new tab, and doesn't seem to happen when restarting TNoodle. It looks like you have to delete the tnoodle_resources directory, and then start TNoodle to potentially hit it.

jfly commented 10 years ago

Unfortunately, I have been unable to reproduce this after a few tries.

pedrosino commented 10 years ago

So here it is:

-open jar file -> fires up the window on firefox -wait for scrambles to generate, click scramble -get this: java.lang.NullPointerException at net.gnehzr.tnoodle.server.webscrambles.ScrambleRequest.requestsToZip(ScrambleRequest.java:907) at net.gnehzr.tnoodle.server.webscrambles.ScrambleViewHandler.wrappedService(ScrambleViewHandler.java:241) at net.gnehzr.tnoodle.server.SafeHttpServlet.service(SafeHttpServlet.java:41) at javax.servlet.http.HttpServlet.service(HttpServlet.java:45) at winstone.ServletConfiguration.execute(ServletConfiguration.java:249) at winstone.RequestDispatcher.forward(RequestDispatcher.java:335) at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:378) at net.gnehzr.tnoodle.server.HtmlInjectFilter.doFilter(HtmlInjectFilter.java:40) at winstone.FilterConfiguration.execute(FilterConfiguration.java:195) at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:368) at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:389) at winstone.FilterConfiguration.execute(FilterConfiguration.java:195) at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:368) at winstone.RequestDispatcher.forward(RequestDispatcher.java:333) at winstone.RequestHandlerThread.processRequest(RequestHandlerThread.java:244) at winstone.RequestHandlerThread.run(RequestHandlerThread.java:150) at java.lang.Thread.run(Unknown Source)

pedrosino commented 10 years ago

Oh, also... Hit backspace, copy URL, paste into Chrome. Works :)

jfly commented 10 years ago

You saw this without adding any additional rounds beyond the default single round of 333?

pedrosino commented 10 years ago

Both with just default and adding different stuff.

An interesting thing happened later, though. I opened Chrome and got the scrambles, then closed the window. But the server was still running. So later I right-clicked it and chose Open. It then opened the tab on Firefox, and to my surprise, this time it generated the scrambles :)

jfly commented 10 years ago

Yeah, that's consistent with the analysis in the bug description. How are you with javascript? Do you have the time and interest to track this one down?

jfly commented 6 years ago

It's been a few years, and we haven't had this happen again, so I'm going to optimistically close this.