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

Null pointer exception when generating 777 page #125

Closed jfly closed 10 years ago

jfly commented 10 years ago

Here's the curl:

curl 'http://localhost:8080/view/777nullpointer.pdf' --data 'scrambles=%5B%7B%22scrambles%22%3A%5B%22Dw2+R+3Uw%27+3Fw%27+3Bw+F%27+3Uw2+Bw+F%27+Rw%27+B2+Rw2+3Bw%27+3Rw2+3Dw2+3Uw+3Fw2+Dw%27+Rw2+3Dw+Dw2+F%27+U2+Dw2+F+Lw+3Fw+R%27+3Bw+3Rw%27+3Lw%27+3Uw2+3Fw+Lw+3Fw+Rw2+3Fw2+Bw+3Uw%27+Fw%27+3Lw%27+3Uw%27+F2+Dw+3Lw%27+U%27+Rw2+U+Uw2+Rw%27+F2+B%27+Rw+Uw2+D%27+3Bw+3Uw%27+3Rw2+Bw+3Dw%27+Rw2+Uw+3Uw2+Dw+3Rw%27+3Bw+F+L2+3Uw%27+L2+Dw2+3Lw%27+U+3Fw+L%27+Dw%27+3Bw2+3Uw%27+F%27+Rw2+3Bw2+3Fw2+Fw+Bw%27+3Dw%27+Uw%27+R2+D2+B%27+3Uw2+L2+3Dw%27+Lw+3Uw%27+3Rw+L%27+3Dw%27+Uw%27+Bw%27+3Lw%27%22%2C%22F%27+3Rw+Dw+3Uw2+3Dw2+Rw+L2+F2+3Rw2+R%27+3Fw%27+L%27+R2+3Fw+Fw2+Lw+3Lw2+B2+3Uw%27+F2+3Fw+Lw%27+R2+Fw+3Bw+B2+F%27+3Lw+3Bw2+R%27+D2+L+Fw+Lw2+R%27+L%27+3Rw%27+3Lw%27+Uw+B+D2+3Lw2+3Bw+3Fw+Bw2+U+3Fw%27+Fw2+R2+3Dw%27+Rw2+3Bw%27+Rw+3Lw+Uw+3Rw2+Dw%27+3Uw+3Bw+Rw2+Fw2+3Fw2+Bw2+3Lw2+F2+D2+R2+Dw%27+3Dw+3Lw+L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2+F%27+Rw%27+3Dw%27+3Uw2+Rw+3Bw%27+L%27+U2+F+D2+3Rw2+U2+Bw+3Dw%27+B2+Uw%27+D%27+3Dw%27+3Rw%27+Dw+B+U%27+Bw2+B2+Uw%27+F2+B2+Bw%27+3Bw2+3Uw%27+R+Fw%27+U%27+3Lw+3Rw+3Bw+Uw2+L%27+3Fw%27+3Uw%27+R+3Bw%27+3Lw2+Rw%27+B+U%27+F%22%2C%22U2+F+U%27+Fw2+L2+Fw+Bw+3Dw2+U2+Lw%27+Dw2+Fw2+L2+B2+Bw2+U2+Uw%27+3Rw+R%27+3Dw2+3Bw2+Lw2+3Bw+3Fw2+Lw2+R2+3Fw+Dw2+L+U+Bw2+Fw+Dw+Fw+3Bw2+L2+F2+Lw%27+3Dw2+Fw2+R+3Lw%27+Rw+3Dw2+Fw%27+D+3Bw+F2+D2+R2+3Rw+3Uw%27+3Bw+3Uw2+L2+B2+3Fw+L+Uw+3Bw%27+Bw%27+3Uw2+Lw2+3Rw%27+L%27+Rw%27+3Lw2+Dw2+U2+R+Bw+L+3Fw%27+3Lw%27+3Rw2+F2+U2+3Uw+D+Uw+F%27+3Fw2+Rw+3Dw2+Uw2+3Lw%27+Lw2+L2+3Bw+R2+L+3Dw%27+3Lw2+3Dw2+Bw2+Fw2+Uw2+D+Dw%27+3Fw%27%22%5D%2C%22copies%22%3A1%2C%22scrambler%22%3A%22777%22%2C%22title%22%3A%227x7+Cube+Round+5%22%2C%22fmc%22%3Afalse%7D%5D'
jfly commented 10 years ago

Hmmm... the curl command seems to just be returning "java.lang.NullPointerException", no backtrace. This is annoying. Maybe the server is trying to send the backtrace, but it's not getting properly flushed?

jfly commented 10 years ago

After restarting the tnoodle server, I discovered that this problem is still reproducible. I'm getting a full backtrace now, too:

java.lang.NullPointerException
        at net.gnehzr.tnoodle.server.webscrambles.ScrambleRequest.padTurnsUniformly(ScrambleRequest.java:691)
        at net.gnehzr.tnoodle.server.webscrambles.ScrambleRequest.createTable(ScrambleRequest.java:608)
        at net.gnehzr.tnoodle.server.webscrambles.ScrambleRequest.addScrambles(ScrambleRequest.java:561)
        at net.gnehzr.tnoodle.server.webscrambles.ScrambleRequest.createPdf(ScrambleRequest.java:241)
        at net.gnehzr.tnoodle.server.webscrambles.ScrambleRequest.requestsToPdf(ScrambleRequest.java:843)
        at net.gnehzr.tnoodle.server.webscrambles.ScrambleViewHandler.wrappedService(ScrambleViewHandler.java:210)
        at net.gnehzr.tnoodle.server.SafeHttpServlet.service(SafeHttpServlet.java:40)
        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)

Reproducing the truncated backtrace problem is going to be a real problem, though.

jfly commented 10 years ago

This is a problem with the frontend. For some reason, it's sending null scrambles to the backend. I think this is reproducible by clicking aggressively on the front end.

lgarron commented 10 years ago

In which case... this is sort of a known issue? It would be nice if TNoodle didn't crash on bad input, but we really just need it to be reliable enough for occasional delegate use.

Is this still a blocker for making 0.7.10 official?

»Lucas Garron

On Mon, Sep 30, 2013 at 4:32 PM, Jeremy Fleischman <notifications@github.com

wrote:

This is a problem with the frontend. For some reason, it's sending null scrambles to the backend. I think this is reproducible by clicking aggressively on the front end.

— Reply to this email directly or view it on GitHubhttps://github.com/cubing/tnoodle/issues/125#issuecomment-25415364 .

jfly commented 10 years ago

This was a known issue? Who ran into this before? #119 was for a different (although possibly related) issue.

Anyways, I found the bug and fixed it. @lgarron, I've created a pull request and assigned it to you https://github.com/cubing/tnoodle/pull/126.