DRB-IT / blacktiger

Blacktiger server code written in Java.
2 stars 1 forks source link

Loggen er fuld af SocketException's #121

Closed michaelkrog closed 9 years ago

michaelkrog commented 9 years ago

Det ser ud til at der foretages nogle handlinger der forårsager en del SocketExceptions.

Loggen er fuld af følgende:

Mar 17, 2015 7:00:03 PM org.apache.coyote.AbstractProcessor setErrorState
INFO: An error occurred in processing while on a non-container thread. The connection will be closed immediately
java.net.SocketException: Broken pipe
    at java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:159)
    at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:215)
    at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:480)
    at org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:119)
    at org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:800)
    at org.apache.coyote.Response.action(Response.java:172)
    at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:363)
    at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:331)
    at org.apache.catalina.connector.Response.flushBuffer(Response.java:580)
    at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:306)
    at javax.servlet.ServletResponseWrapper.flushBuffer(ServletResponseWrapper.java:160)
    at javax.servlet.ServletResponseWrapper.flushBuffer(ServletResponseWrapper.java:160)
    at javax.servlet.ServletResponseWrapper.flushBuffer(ServletResponseWrapper.java:160)
    at org.springframework.security.web.context.SaveContextOnUpdateOrErrorResponseWrapper.flushBuffer(SaveContextOnUpdateOrErrorResponseWrapper.java:135)
    at org.springframework.http.server.ServletServerHttpResponse.flush(ServletServerHttpResponse.java:90)
    at org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJsSession.writeFrameInternal(AbstractHttpSockJsSession.java:345)
    at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.writeFrame(AbstractSockJsSession.java:325)
    at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.sendHeartbeat(AbstractSockJsSession.java:249)
    at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession$1.run(AbstractSockJsSession.java:269)
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
michaelkrog commented 9 years ago

Jeg anbefaler at fjerne support for SockJS. Jeg har gjort det lokalt for at afprøve det. Udover at systemet ikke længere danner ovenstående exception, så bliver setup'et også en smule mere enkelt.

xToMMeRx commented 9 years ago

Det lyder fornuftigt - jo simplere vi kan lave setup'et jo bedre. Vi bør ihvertfald sikre os at det stadig virker uden SockJS på f.eks. ældre Android tablets (hvor man har installeret Chrome), og evt. Safari på iPads da en del rigssale nok vil bruge disse tablets på podiet.

michaelkrog commented 9 years ago

Yeps. Chrome, Safari og IE11 understøtter alle alm. Websockets. Der er ikke behov for SockJS for at understøtte dem

xToMMeRx commented 9 years ago

Hvad var årsagen til vi implementerede det? Var det i et forsøgt på at få legacy Android browsere til at virke?

michaelkrog commented 9 years ago

Ja, det var for at have support for legacy browsere, både på Android men også fx. IE9. Det er nemt ekstremt let at slå til(men virkede dog ikke efter hensigten).

Server før

public void registerStompEndpoints(StompEndpointRegistry r) {
    r.addEndpoint("/socket").withSockJS();
}

Server nu

public void registerStompEndpoints(StompEndpointRegistry r) {
    r.addEndpoint("/socket");
}

Klient før

var ws = new SockJS(url);
this.stompClient = Stomp.over(ws);

Klient nu

this.stompClient = Stomp.client(url);

Det der er blevet mere enkelt er ikke så meget koden, men mere det at vi nu kun vil have én måde at kommunikere events ud til klienterne på.