I am on Jetty Websocket (jetty-all-9.4.5.v20170502-uber.jar) on the server side getting one time out :
**java.util.concurrent.TimeoutException: Idle timeout expired: 300011/300000 ms**
Socket Closed: CloseReason[1001,Idle Timeout]
Socket Closed: CloseReason[1001,Idle Timeout]
at org.eclipse.jetty.io.IdleTimeout.checkIdleTimeout(IdleTimeout.java:166)
at org.eclipse.jetty.io.IdleTimeout$1.run(IdleTimeout.java:50)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)**
This is a unique event at the beginning and everything else works perfectly!
I tried to change this:
_context = new ServletContextHandler(ServletContextHandler.SESSIONS);
_context.setContextPath("/");
System.out.println(_context.getStopTimeout());
_context.setStopTimeout(0);
_server.setHandler(_context);
~ without success !
No idea.
WARNING: Don't use jetty-all for your project, its not meant to be used outside of the Jetty Quickstart Documentation.
Idle Timeout in WebSocket is controlled by the WebSocketPolicy.
The Idle Timeout can be specified on the WebSocket Container (eg: WebSocketClient or WebSocketServletFactory) or even on the individual connected WebSocket Sessions.
Your code example doesn't show anything to do with WebSocket, so I cannot provide you the specific information you need to configure your websocket behavior.
Related
I am receiving the below error when trying to run a JMeter script . The API works fine in Loadrunner .
I had set the https.default.protocol=TLSv1.2 in user.properties for the SSL version. What could cause the below error .
org.apache.http.conn.HttpHostConnectException: Connect to rXXXXX.XXXX-XXXX.XXXXXX.net:443 [XXXXXX.XXXXXX-XXXXXX.XXXXXX.XXXXXX/21.60.245.182] failed: Connection timed out: connect
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:156)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl$JMeterDefaultHttpClientConnectionOperator.connect(HTTPHC4Impl.java:326)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:374)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:850)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:561)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:67)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1282)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection timed out: connect
e
Given you send the same request you should get the same response no matter what tool is being used for sending the request.
If you're getting different responses or not getting a response either you're sending not the same request or there is a difference in the tools configuration.
The most possible reason could be proxy, by default Loadrunner respects underlying operating system proxy settings and in JMeter you need to configure the upstream proxy connection manually, see Using JMeter behind a proxy article for more details
Another reason could be incorrect request configuration, i.e. protocol/host/port/path mismatch
And last but not the least, maybe your connect/response timeouts are too low, try ramping them up, the relevant setting lives under "Advanced" tab of the HTTP Request sampler (or even better go for HTTP Request Defaults)
Make sure that whatever the endpoint you try to access with this Jmeter script does not expect mutual SSL validation.
Then make sure that your token is generated from CA signed token generator before making the request.
Make sure that your connection timeout is not enough to respond after the request is made and make sure that the timeout is larger than the ramp-up time period.
I have 3 node Nifi cluster running(1.5 version).
I have built the pipeline with handlehttprequest and intermediate set of processor for transformation/cleaning the incoming data followed by handlehttpresponse.
I have provided the http end point to client applications.
There are various client applications which would be posting the data through the rest end point provided by nifi.
I had issue with Handlehttprequest running with execution mode as all nodes. Nifi UI becomes unresponsive after some time and I could see below error message in the nifi-app.log and I could see error message in the processor(handlehttprequest).
Changing the execution to primary node, solves the issue.
So need help with below:
Handlehttprequest can't work on multinode cluster environment?
If so, how to make use of multiple nodes to handle high throughput of incoming data posted by client applications?
how to put load balancer for handlehttprequest endpoint and distribute the incoming data to multiple nodes on the cluster?
error message at processor level:
HandleHttpRequest[id=74ee1128-2de6-3979-a818-2b598186f7aa] HandleHttpRequest[id=74ee1128-2de6-3979-a818-2b598186f7aa] failed to process due to org.apache.nifi.processor.exception.ProcessException: Failed to initialize the server; rolling back session: Failed to initialize the server
==========================
Nifi-app.log
2018-08-03 14:45:22,551 INFO [Timer-Driven Process Thread-6] org.eclipse.jetty.server.Server jetty-9.4.3.v20170317
2018-08-03 14:45:22,551 ERROR [Timer-Driven Process Thread-3] o.a.n.p.standard.HandleHttpRequest HandleHttpRequest[id=74ee1128-2de6-3979-a818-2b598186f7aa] Failed to process session due to org.apache.nifi.processor.exception.ProcessException: Failed to initialize the server: {}
org.apache.nifi.processor.exception.ProcessException: Failed to initialize the server
at org.apache.nifi.processors.standard.HandleHttpRequest.onTrigger(HandleHttpRequest.java:488)
at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1122)
at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:147)
at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47)
at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:128)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.BindException: Cannot assign requested address
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
==============================================
Any help in providing the direction is appreciated.
Thanks,
Vish
This error generally means there is an issue with the server binding to the host or port. Since it sounds like the port is available it is probably an issue with the hostname.
In a cluster you would have to leave the hostname property blank in HandleHttpRequest so it will bind to the address of each node, or you could use a dynamic expression like ${hostname}.
For load balancing, it should be the same as any other configuration to put a load balancer in front of a web application. There are some articles that cover it already:
https://pierrevillard.com/2017/02/10/haproxy-load-balancing-in-front-of-apache-nifi/
We're using Spring's SockJS with Stomp to send push messages to the browser.
It works fine so far, but when a client (browser) disconnects, we get an ERROR log everytime because the scheduled hearbeat fails:
11:11:18.241 [MessageBroker-1] ERROR [org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler] - Unexpected error occurred in scheduled task.
org.springframework.web.socket.sockjs.SockJsTransportFailureException: Failed to write SockJsFrame content='h'; nested exception is org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe
at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.writeFrame(AbstractSockJsSession.java:339) ~[spring-websocket-4.3.4.RELEASE.jar:4.3.4.RELEASE]
at org.springframework.web.socket.sockjs.transport.session.PollingSockJsSession.writeFrame(PollingSockJsSession.java:82) ~[spring-websocket-4.3.4.RELEASE.jar:4.3.4.RELEASE]
at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.sendHeartbeat(AbstractSockJsSession.java:255) ~[spring-websocket-4.3.4.RELEASE.jar:4.3.4.RELEASE]
at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession$HeartbeatTask.run(AbstractSockJsSession.java:451) ~[spring-websocket-4.3.4.RELEASE.jar:4.3.4.RELEASE]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE]
But only when the client uses XHR-Polling fallback, websocket doesn't cause any errors. We use nginx as reverse proxy in front of tomcat 8.0.39. Nginx logs 499 (client closed connection) a few seconds before the SockJsTransportFailureException is risen
Is there a way to get rid of the ERROR logs when a heartbeat fails? I don't want to disable all logging from org.springframework.scheduling.support.TaskUtils as we might miss important errors.
I'm trying to build DIY application on OpenShift that implements WebSockets. I started with this example:
https://www.openshift.com/blogs/how-to-build-java-websocket-applications-using-the-jsr-356-api
If I run it locally, it works perfectly. When I upload the code to a DIY OpenShift cartridge and compile it, I get an error. I modified the code so that the Server connects to $OPENSHIFT_DIY_IP on port 8000, but when the code reaches the line server.start(); it crashes with the following error.
What am I doing wrong? I tried other ports (17500 and on) without any luck.
Error:
Binding server to 127.7.177.1:8000
Jun 04, 2014 10:28:02 AM org.glassfish.tyrus.server.ServerContainerFactory create
INFO: Provider class loaded: org.glassfish.tyrus.container.grizzly.GrizzlyEngine
java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:444)
at sun.nio.ch.Net.bind(Net.java:436)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler.bindToChannelAndAddress(TCPNIOBindingHandler.java:131)
at org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler.bind(TCPNIOBindingHandler.java:87)
at org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler.bind(TCPNIOBindingHandler.java:64)
at org.glassfish.grizzly.AbstractBindingHandler.bind(AbstractBindingHandler.java:140)
at org.glassfish.grizzly.AbstractBindingHandler.bind(AbstractBindingHandler.java:159)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.bind(TCPNIOTransport.java:470)
at org.glassfish.grizzly.http.server.NetworkListener.start(NetworkListener.java:658)
at org.glassfish.grizzly.http.server.HttpServer.start(HttpServer.java:264)
at org.glassfish.tyrus.container.grizzly.GrizzlyEngine$1.start(GrizzlyEngine.java:88)
at org.glassfish.tyrus.server.TyrusServerContainer.start(TyrusServerContainer.java:119)
at org.glassfish.tyrus.server.Server.start(Server.java:122)
at org.neo.wordgame.server.WebSocketServer.runServer(WebSocketServer.java:23)
at org.neo.wordgame.server.WebSocketServer.main(WebSocketServer.java:11)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
at java.lang.Thread.run(Thread.java:744)
Please press a key to stop the server.Jun 04, 2014 10:28:04 AM org.glassfish.tyrus.server.Server stop
INFO: Websocket Server stopped.
Your application needs to listen on port 8080 on your $OPENSHIFT_DIY_IP, but you need to connect to it from the outside at http://app-domain.rhcloud.com:8000 or http://app-domain.rhcloud.com:8443 (ssl). Binding to port 8000 on your $OPENSHIFT_DIY_IP won't work.
It is just as developercorey says. Latest news about WebSockets on OpenShift I could find is this blog post, clearly saying that you have to access 8000/8443 from outside.
As a live example, I've deployed application using WebSockets into OpenShift. If you access it using http://vinbudin-openshift.anthavio.net/ui
Although application still works, because it can degrade to long-polling silently,
when you look into Chrome Developer Tool Network Tab, you can see rejected WebSocket upgrade request
Request URL:ws://vinbudin-openshift.anthavio.net/ui/PUSH/?v-uiId=0&v-csrfToken=bcd0c9a6-2a6f-4ddb-8332-7929e4337b2d&X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.1.5.vaadin4-jquery&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&X-Cache-Date=0&Content-Type=application/json;%20charset=UTF-8&X-atmo-protocol=true
Request Method:GET
Status Code:501 Not Implemented
But using url with port 8000 http://vinbudin-openshift.anthavio.net:8000/ui yields better result
Request URL:ws://vinbudin-openshift.anthavio.net:8000/ui/PUSH/?v-uiId=0&v-csrfToken=bcd0c9a6-2a6f-4ddb-8332-7929e4337b2d&X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.1.5.vaadin4-jquery&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&X-Cache-Date=0&Content-Type=application/json;%20charset=UTF-8&X-atmo-protocol=true
Request Method:GET
Status Code:101 Switching Protocols
For testing purposes I try to run Netty 3.9.0 echo server example (can be found in Netty examples) inside Oracle database.
It starts correctly and I can see service running on port (with nmap), but whenever try to send message I get below exception:
java.net.SocketException: recv() failed, errno = 104
Connection reset by peer
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:33)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:198)
at sun.nio.ch.IOUtil.read(IOUtil.java:166)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:245)
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:64)
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java)
at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
kgskupdbalance: time_used[58236668] greater than threshold[30000000] current_time[12380314910] time_start[12322078242]
Remarks:
Code works when run outside (in shell)
privileges are granted (and no other exception found)
My 1st suspect would be java.nio in database
Somebody has explanation ?
NOTE: Just to repeat, it's just for testing purposes.
Do not ask for motivation :-)
Thank you
It goes in zone which is not supported (native methods).