bugdone / headshotbox

https://headshotbox.github.io
MIT License
163 stars 25 forks source link

api/steamids/info?steamids doesnt handle deleted accounts #211

Closed ajohnsen closed 6 years ago

ajohnsen commented 6 years ago

I have played against this account and he deleted the it. And it should then remember the last vac status of the player since it can never check it again.

/api/steamids/info?steamids=76561197973528156

That account has been deleted, and now it fails to convert it into a long.

2018-07-25 23:45:31.813:WARN:oejs.HttpChannel:qtp32413615-109: /api/steamids/info?steamids=76561197973528156 java.lang.NumberFormatException: null at java.lang.Long.parseLong(Long.java:552) at java.lang.Long.parseLong(Long.java:631) at hsbox.steamapi$get_steamids_info_from_api$fn__8154.invoke(steamapi.clj:29) at clojure.lang.ArrayChunk.reduce(ArrayChunk.java:58) at clojure.core.protocols$fn__6750.invokeStatic(protocols.clj:136) at clojure.core.protocols$fn__6750.invoke(protocols.clj:124) at clojure.core.protocols$fn__6710$G__6705__6719.invoke(protocols.clj:19) at clojure.core.protocols$seq_reduce.invokeStatic(protocols.clj:31) at clojure.core.protocols$fn__6738.invokeStatic(protocols.clj:75) at clojure.core.protocols$fn__6738.invoke(protocols.clj:75) at clojure.core.protocols$fn__6684$G__6679__6697.invoke(protocols.clj:13) at clojure.core$reduce.invokeStatic(core.clj:6545) at clojure.core$reduce.invoke(core.clj:6527) at hsbox.steamapi$get_steamids_info_from_api.invokeStatic(steamapi.clj:29) at hsbox.steamapi$get_steamids_info_from_api.invoke(steamapi.clj:15) at clojure.core$map$fn__4785.invoke(core.clj:2646) at clojure.lang.LazySeq.sval(LazySeq.java:40) at clojure.lang.LazySeq.seq(LazySeq.java:49) at clojure.lang.RT.seq(RT.java:521) at clojure.core$seq__4357.invokeStatic(core.clj:137) at clojure.core$apply.invokeStatic(core.clj:641) at clojure.core$apply.invoke(core.clj:641) at hsbox.steamapi$get_steamids_info.invokeStatic(steamapi.clj:55) at hsbox.steamapi$get_steamids_info.doInvoke(steamapi.clj:47) at clojure.lang.RestFn.invoke(RestFn.java:410) at hsbox.handler$fn__10344$fn__10347.invoke(handler.clj:145) at compojure.core$make_route$fn__1534.invoke(core.clj:135) at compojure.core$wrap_route_middleware$fn__1527.invoke(core.clj:122) at compojure.core$wrap_route_info$fn__1531.invoke(core.clj:126) at compojure.core$if_route$fn__1489.invoke(core.clj:45) at compojure.core$if_method$fn__1479.invoke(core.clj:27) at compojure.core$routing$fn__1541.invoke(core.clj:151) at clojure.core$some.invokeStatic(core.clj:2592) at clojure.core$some.invoke(core.clj:2583) at compojure.core$routing.invokeStatic(core.clj:151) at compojure.core$routing.doInvoke(core.clj:148) at clojure.lang.RestFn.applyTo(RestFn.java:139) at clojure.core$apply.invokeStatic(core.clj:648) at clojure.core$apply.invoke(core.clj:641) at compojure.core$routes$fn__1545.invoke(core.clj:156) at clojure.lang.Var.invoke(Var.java:379) at compojure.core$routing$fn__1541.invoke(core.clj:151) at clojure.core$some.invokeStatic(core.clj:2592) at clojure.core$some.invoke(core.clj:2583) at compojure.core$routing.invokeStatic(core.clj:151) at compojure.core$routing.doInvoke(core.clj:148) at clojure.lang.RestFn.invoke(RestFn.java:423) at hsbox.handler$fn__10344.invokeStatic(handler.clj:132) at hsbox.handler$fn__10344.invoke(handler.clj:132) at compojure.core$if_context$fn__1563.invoke(core.clj:220) at compojure.core$routing$fn__1541.invoke(core.clj:151) at clojure.core$some.invokeStatic(core.clj:2592) at clojure.core$some.invoke(core.clj:2583) at compojure.core$routing.invokeStatic(core.clj:151) at compojure.core$routing.doInvoke(core.clj:148) at clojure.lang.RestFn.applyTo(RestFn.java:139) at clojure.core$apply.invokeStatic(core.clj:648) at clojure.core$apply.invoke(core.clj:641) at compojure.core$routes$fn__1545.invoke(core.clj:156) at ring.middleware.json$wrap_json_response$fn__9543.invoke(json.clj:87) at ring.middleware.json$wrap_json_body$fn__9526.invoke(json.clj:46) at ring.middleware.cors$wrap_cors$fn__9507.invoke(cors.clj:156) at compojure.core$routing$fn__1541.invoke(core.clj:151) at clojure.core$some.invokeStatic(core.clj:2592) at clojure.core$some.invoke(core.clj:2583) at compojure.core$routing.invokeStatic(core.clj:151) at compojure.core$routing.doInvoke(core.clj:148) at clojure.lang.RestFn.invoke(RestFn.java:423) at hsbox.handler$fn__10389.invokeStatic(handler.clj:205) at hsbox.handler$fn__10389.invoke(handler.clj:205) at compojure.core$if_context$fn__1563.invoke(core.clj:220) at compojure.core$routing$fn__1541.invoke(core.clj:151) at clojure.core$some.invokeStatic(core.clj:2592) at clojure.core$some.invoke(core.clj:2583) at compojure.core$routing.invokeStatic(core.clj:151) at compojure.core$routing.doInvoke(core.clj:148) at clojure.lang.RestFn.applyTo(RestFn.java:139) at clojure.core$apply.invokeStatic(core.clj:648) at clojure.core$apply.invoke(core.clj:641) at compojure.core$routes$fn__1545.invoke(core.clj:156) at ring.middleware.http_response$wrap_http_response$fn__9550.invoke(http_response.clj:8) at hsbox.handler$wrap_exception$fn__10393.invoke(handler.clj:221) at hsbox.handler$wrap_cache_control$fn__10398.invoke(handler.clj:228) at ring.middleware.keyword_params$wrap_keyword_params$fn__1669.invoke(keyword_params.clj:35) at ring.middleware.nested_params$wrap_nested_params$fn__1713.invoke(nested_params.clj:86) at ring.middleware.params$wrap_params$fn__1641.invoke(params.clj:64) at ring.middleware.multipart_params$wrap_multipart_params$fn__1754.invoke(multipart_params.clj:133) at ring.middleware.flash$wrap_flash$fn__2709.invoke(flash.clj:35) at ring.middleware.session$wrap_session$fn__2695.invoke(session.clj:103) at ring.adapter.jetty$proxy_handler$fn__10469.invoke(jetty.clj:24) at ring.adapter.jetty.proxy$org.eclipse.jetty.server.handler.AbstractHandler$ff19274a.handle(Unknown Source) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:497) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) at java.lang.Thread.run(Thread.java:748) 18-07-25 21:45:34 Tower ERROR [hsbox.handler:223] - java.lang.Thread.run Thread.java: 748 org.eclipse.jetty.util.thread.QueuedThreadPool$3.run QueuedThreadPool.java: 555 org.eclipse.jetty.util.thread.QueuedThreadPool.runJob QueuedThreadPool.java: 635 org.eclipse.jetty.io.AbstractConnection$2.run AbstractConnection.java: 540 org.eclipse.jetty.server.HttpConnection.onFillable HttpConnection.java: 257 org.eclipse.jetty.server.HttpChannel.handle HttpChannel.java: 310 org.eclipse.jetty.server.Server.handle Server.java: 497 org.eclipse.jetty.server.handler.HandlerWrapper.handle HandlerWrapper.java: 97 ring.adapter.jetty.proxy$org.eclipse.jetty.server.handler.AbstractHandler$ff19274a.handle ring.adapter.jetty/proxy-handler/fn jetty.clj: 24 ring.middleware.session/wrap-session/fn session.clj: 103 ring.middleware.flash/wrap-flash/fn flash.clj: 35 ring.middleware.multipart-params/wrap-multipart-params/fn multipart_params.clj: 133 ring.middleware.params/wrap-params/fn params.clj: 64 ring.middleware.nested-params/wrap-nested-params/fn nested_params.clj: 86 ring.middleware.keyword-params/wrap-keyword-params/fn keyword_params.clj: 35 hsbox.handler/wrap-cache-control/fn handler.clj: 228 hsbox.handler/wrap-exception/fn handler.clj: 221 ring.middleware.http-response/wrap-http-response/fn http_response.clj: 8 compojure.core/routes/fn core.clj: 156 clojure.core/apply core.clj: 648 ... compojure.core/routing core.clj: 148 compojure.core/routing core.clj: 151 clojure.core/some core.clj: 2592 compojure.core/routing/fn core.clj: 151 compojure.core/if-context/fn core.clj: 220 hsbox.handler/fn handler.clj: 205 ... compojure.core/routing core.clj: 148 compojure.core/routing core.clj: 151 clojure.core/some core.clj: 2592 compojure.core/routing/fn core.clj: 151 ring.middleware.cors/wrap-cors/fn cors.clj: 156 ring.middleware.json/wrap-json-body/fn json.clj: 46 ring.middleware.json/wrap-json-response/fn json.clj: 87 compojure.core/routes/fn core.clj: 156 clojure.core/apply core.clj: 648 ... compojure.core/routing core.clj: 148 compojure.core/routing core.clj: 151 clojure.core/some core.clj: 2592 compojure.core/routing/fn core.clj: 151 compojure.core/if-context/fn core.clj: 220 hsbox.handler/fn handler.clj: 132 ... compojure.core/routing core.clj: 148 compojure.core/routing core.clj: 151 clojure.core/some core.clj: 2592 compojure.core/routing/fn core.clj: 151 ... compojure.core/routes/fn core.clj: 156 clojure.core/apply core.clj: 648 ... compojure.core/routing core.clj: 148 compojure.core/routing core.clj: 151 clojure.core/some core.clj: 2592 compojure.core/routing/fn core.clj: 151 compojure.core/if-method/fn core.clj: 27 compojure.core/if-route/fn core.clj: 45 compojure.core/wrap-route-info/fn core.clj: 126 compojure.core/wrap-route-middleware/fn core.clj: 122 compojure.core/make-route/fn core.clj: 135 hsbox.handler/fn/fn handler.clj: 145 ... hsbox.steamapi/get-steamids-info steamapi.clj: 47 hsbox.steamapi/get-steamids-info steamapi.clj: 55 clojure.core/apply core.clj: 641 clojure.core/seq core.clj: 137 ... clojure.core/map/fn core.clj: 2646 hsbox.steamapi/get-steamids-info-from-api steamapi.clj: 29 clojure.core/reduce core.clj: 6545 clojure.core.protocols/fn/G protocols.clj: 13 clojure.core.protocols/fn protocols.clj: 75 clojure.core.protocols/seq-reduce protocols.clj: 31 clojure.core.protocols/fn/G protocols.clj: 19 clojure.core.protocols/fn protocols.clj: 136 ... hsbox.steamapi/get-steamids-info-from-api/fn steamapi.clj: 29 java.lang.Long.parseLong Long.java: 631 java.lang.Long.parseLong Long.java: 552 java.lang.NumberFormatException: null

bugdone commented 6 years ago

The actual problem here is that instead of responding with an empty array of players when all steamids in the request don't exist the Steam API player summaries call returns an array with an empty object.

ajohnsen commented 6 years ago

I don't think this one was completely fixed, i'm still getting a NumberFormatException in the logs and the call gets a 500 error.

Checking the failing one alone works: api/steamids/info?steamids=76561197973528156 returns {}

But when its checking with multiple others it still fails: api/steamids/info?steamids=76561198051013882,76561198044296933,76561198295734977,76561197973528156,76561198215105767,76561198073511715,76561198176903513,76561198018465721,76561197982155999,76561198044996066,76561198183907773,76561198032804040,76561198091277000,76561198047920567,76561198137402931,76561198033003662,76561198055362523,76561198003627617,76561198034633808,76561198148465673,76561198323758354,76561198328023821,76561198059110882,76561198202457007,76561198201749581,76561198347651379,76561198262761691,76561198082132733,76561198031147813,76561197995609469,76561198028302546,76561197972221400,76561198099020135,76561198162624111,76561198364783175,76561198211040173,76561197978220972,76561198197647335,76561197983407055,76561198314269349

The error seems really weird, because i confirm that the error is there, and then remove one more from the list, and then it suddenly works, and when i go back to the last one that failed that one can suddenly start working too.

Could it possibly be something to do with the stale marking / cache too?

Stacktrace: `18-08-14 08:57:13 Tower ERROR [hsbox.handler:223] - java.lang.Thread.run Thread.java: 844 org.eclipse.jetty.util.thread.QueuedThreadPool$3.run QueuedThreadPool.java: 555 org.eclipse.jetty.util.thread.QueuedThreadPool.runJob QueuedThreadPool.java: 635 org.eclipse.jetty.io.AbstractConnection$2.run AbstractConnection.java: 540 org.eclipse.jetty.server.HttpConnection.onFillable HttpConnection.java: 257 org.eclipse.jetty.server.HttpChannel.handle HttpChannel.java: 310 org.eclipse.jetty.server.Server.handle Server.java: 497 org.eclipse.jetty.server.handler.HandlerWrapper.handle HandlerWrapper.java: 97 ring.adapter.jetty.proxy$org.eclipse.jetty.server.handler.AbstractHandler$ff19274a.handle ring.adapter.jetty/proxy-handler/fn jetty.clj: 24 ring.middleware.session/wrap-session/fn session.clj: 103 ring.middleware.flash/wrap-flash/fn flash.clj: 35 ring.middleware.multipart-params/wrap-multipart-params/fn multipart_params.clj: 133 ring.middleware.params/wrap-params/fn params.clj: 64 ring.middleware.nested-params/wrap-nested-params/fn nested_params.clj: 86 ring.middleware.keyword-params/wrap-keyword-params/fn keyword_params.clj: 35 hsbox.handler/wrap-cache-control/fn handler.clj: 228 hsbox.handler/wrap-exception/fn handler.clj: 221 ring.middleware.http-response/wrap-http-response/fn http_response.clj: 8 compojure.core/routes/fn core.clj: 156 clojure.core/apply core.clj: 648 ... compojure.core/routing core.clj: 148 compojure.core/routing core.clj: 151 clojure.core/some core.clj: 2592 compojure.core/routing/fn core.clj: 151 compojure.core/if-context/fn core.clj: 220 hsbox.handler/fn handler.clj: 205 ... compojure.core/routing core.clj: 148 compojure.core/routing core.clj: 151 clojure.core/some core.clj: 2592 compojure.core/routing/fn core.clj: 151 ring.middleware.cors/wrap-cors/fn cors.clj: 156 ring.middleware.json/wrap-json-body/fn json.clj: 46 ring.middleware.json/wrap-json-response/fn json.clj: 87 compojure.core/routes/fn core.clj: 156 clojure.core/apply core.clj: 648 ... compojure.core/routing core.clj: 148 compojure.core/routing core.clj: 151 clojure.core/some core.clj: 2592 compojure.core/routing/fn core.clj: 151 compojure.core/if-context/fn core.clj: 220 hsbox.handler/fn handler.clj: 132 ... compojure.core/routing core.clj: 148 compojure.core/routing core.clj: 151 clojure.core/some core.clj: 2592 compojure.core/routing/fn core.clj: 151 ... compojure.core/routes/fn core.clj: 156 clojure.core/apply core.clj: 648 ... compojure.core/routing core.clj: 148 compojure.core/routing core.clj: 151 clojure.core/some core.clj: 2592 compojure.core/routing/fn core.clj: 151 compojure.core/if-method/fn core.clj: 27 compojure.core/if-route/fn core.clj: 45 compojure.core/wrap-route-info/fn core.clj: 126 compojure.core/wrap-route-middleware/fn core.clj: 122 compojure.core/make-route/fn core.clj: 135 hsbox.handler/fn/fn handler.clj: 145 ... hsbox.steamapi/get-steamids-info steamapi.clj: 52 hsbox.steamapi/get-steamids-info steamapi.clj: 60 clojure.core/apply core.clj: 641 clojure.core/seq core.clj: 137 ... clojure.core/map/fn core.clj: 2646 hsbox.steamapi/get-steamids-info-from-api steamapi.clj: 34 clojure.core/reduce core.clj: 6545 clojure.core.protocols/fn/G protocols.clj: 13 clojure.core.protocols/fn protocols.clj: 75 clojure.core.protocols/seq-reduce protocols.clj: 31 clojure.core.protocols/fn/G protocols.clj: 19 clojure.core.protocols/fn protocols.clj: 136 ... hsbox.steamapi/get-steamids-info-from-api/fn steamapi.clj: 34 java.lang.Long.parseLong Long.java: 817 java.lang.Long.parseLong Long.java: 655 java.lang.NumberFormatException: null

`