dswitzer
09/12/2023, 1:42 PMtc command in Linux to drop packets to the database server. Once I resume traffic, the Lucee thread will continue to run waiting on a response from the JDBC server.
I'm playing around with different "connection" settings now, but does anyone know of a graceful way to deal with this?zackster
09/12/2023, 1:44 PMzackster
09/12/2023, 1:44 PMdswitzer
09/12/2023, 1:46 PM100.0% - 59.864s java.lang.Thread.run(Thread.java)
53 Collapsed Methods (show)
100.0% - 59.864s lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java)
55.5% - 33.229s lucee.runtime.listener.ModernAppListener.call(ModernAppListener.java)
64 Collapsed Methods (show)
55.5% - 33.229s java.net.SocketInputStream.socketRead0(Native Method)
55.5% - 33.229s Self Time
44.5% - 26.634s lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java)
25 Collapsed Methods (show)
44.5% - 26.634s java.net.SocketInputStream.socketRead0(Native Method)
44.5% - 26.634s Self Timedswitzer
09/12/2023, 1:47 PMhttp-nio-8080-exec-3" Id=76 RUNNABLE (in native)
java.lang.Thread.State: RUNNABLE
at java.base@11.0.20/java.net.SocketInputStream.socketRead0(Native Method)
at java.base@11.0.20/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)
at java.base@11.0.20/java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.base@11.0.20/java.net.SocketInputStream.read(SocketInputStream.java:140)
at com.microsoft.sqlserver.jdbc.TDSChannel$ProxyInputStream.readInternal(IOBuffer.java:1193)
at com.microsoft.sqlserver.jdbc.TDSChannel$ProxyInputStream.read(IOBuffer.java:1179)
at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:2151)
at com.microsoft.sqlserver.jdbc.TDSReader.readPacket(IOBuffer.java:6895)
at com.microsoft.sqlserver.jdbc.TDSReader.nextPacket(IOBuffer.java:6788)
at com.microsoft.sqlserver.jdbc.TDSReader.ensurePayload(IOBuffer.java:6760)
at com.microsoft.sqlserver.jdbc.TDSReader.peekTokenType(IOBuffer.java:6985)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:66)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1691)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.processResults(SQLServerStatement.java:1356)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.processBatch(SQLServerStatement.java:1347)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.processExecuteResults(SQLServerStatement.java:1339)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.processResponse(SQLServerPreparedStatement.java:546)
at com.microsoft.sqlserver.jdbc.TDSCommand.close(IOBuffer.java:7755)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.discardLastExecutionResults(SQLServerStatement.java:155)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.closeInternal(SQLServerStatement.java:697)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.closeInternal(SQLServerPreparedStatement.java:338)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.$fr$close(SQLServerStatement.java:712)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.close(SQLServerStatement.java)
at lucee.commons.db.DBUtil.closeEL(DBUtil.java:71)
at lucee.runtime.type.QueryImpl.executeMSSQL(QueryImpl.java:505)
at lucee.runtime.type.QueryImpl.execute(QueryImpl.java:257)
at lucee.runtime.type.QueryImpl.(QueryImpl.java:235)
at lucee.runtime.tag.Query.executeDatasoure(Query.java:1135)
at lucee.runtime.tag.Query._doEndTag(Query.java:700)
at lucee.runtime.tag.Query.doEndTag(Query.java:566)
at tags.query_cfc$cf.udfCall(/basecom/tags/Query.cfc:322)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:698)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:586)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1933)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1775)
at shared.gateways.sessionstoragegateway_cfc$cf.udfCall1(/rootcom/shared/gateways/SessionStorageGateway.cfc:89)
at shared.gateways.sessionstoragegateway_cfc$cf.udfCall(/rootcom/shared/gateways/SessionStorageGateway.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:698)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:586)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1933)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1775)
at base.service.basesessionservice_cfc$cf.udfCall2(/rootcom/base/service/BaseSessionService.cfc:418)
at base.service.basesessionservice_cfc$cf.udfCall(/rootcom/base/service/BaseSessionService.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:698)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:586)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1933)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1775)
at onrequestend_cfm$cf.call(/OnRequestEnd.cfm:31)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1056)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:948)
at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:929)
at application_cfc$cf.udfCall1(/Application.cfc:359)
at application_cfc$cf.udfCall(/Application.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:698)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:586)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1933)
at lucee.runtime.listener.ModernAppListener.call(ModernAppListener.java:444)
at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:230)
at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:44)
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2493)
at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2478)
at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2449)
at lucee.runtime.engine.Request.exe(Request.java:45)
at lucee.runtime.engine.CFMLEngineImpl._service(CFMLEngineImpl.java:1216)
at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:1162)
at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:97)
at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:779)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.cfmlprojects.regexpathinfofilter.RegexPathInfoFilter.doFilter(RegexPathInfoFilter.java:47)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at jdk.internal.reflect.GeneratedMethodAccessor134.invoke(Unknown Source)
at java.base@11.0.20/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base@11.0.20/java.lang.reflect.Method.invoke(Method.java:566)
at com.intergral.fusionreactor.j2ee.filterchain.WrappedFilterChain.doFilter(WrappedFilterChain.java:134)
at com.intergral.fusionreactor.j2ee.filter.FusionReactorRequestHandler.doNext(FusionReactorRequestHandler.java:772)
at com.intergral.fusionreactor.j2ee.filter.FusionReactorRequestHandler.doHttpServletRequest(FusionReactorRequestHandler.java:344)
at com.intergral.fusionreactor.j2ee.filter.FusionReactorRequestHandler.doFusionRequest(FusionReactorRequestHandler.java:207)
at com.intergral.fusionreactor.j2ee.filter.FusionReactorRequestHandler.handle(FusionReactorRequestHandler.java:809)
at com.intergral.fusionreactor.j2ee.filter.FusionReactorCoreFilter.doFilter(FusionReactorCoreFilter.java:36)
at jdk.internal.reflect.GeneratedMethodAccessor133.invoke(Unknown Source)
at java.base@11.0.20/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base@11.0.20/java.lang.reflect.Method.invoke(Method.java:566)
at com.intergral.fusionreactor.j2ee.filterchain.WrappedFilterChain.doFilter(WrappedFilterChain.java:71)
at jdk.internal.reflect.GeneratedMethodAccessor132.invoke(Unknown Source)
at java.base@11.0.20/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base@11.0.20/java.lang.reflect.Method.invoke(Method.java:566)
at app//com.intergral.fusionreactor.agent.filter.FusionReactorStaticFilter.doFilter(FusionReactorStaticFilter.java:54)
at app//com.intergral.fusionreactor.agent.pointcuts.NewFilterChainPointCut$1.invoke(NewFilterChainPointCut.java:42)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:769)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:891)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1784)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
- locked org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@5f2091a7
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base@11.0.20/java.lang.Thread.run(Thread.java:829)
Locked ownable synchronizers:
- org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker <0x1b5e8a1a>
- java.util.concurrent.locks.ReentrantLock$NonfairSync <0x7a77d166>
- java.util.concurrent.locks.ReentrantLock$NonfairSync <0x18ef4410>
- java.util.concurrent.locks.ReentrantLock$NonfairSync <0x5ba93a58>zackster
09/12/2023, 1:57 PMdswitzer
09/12/2023, 2:09 PMdswitzer
09/12/2023, 2:16 PMsocketTimeout is if the query does not return results within the setting value, it will throw an exception.
So if a query is legimately running for longer than the setting, then it would timeout prematurely.
Ideally I'm trying to detect if the connection was dropped and would no longer respond.jamiejackson
09/12/2023, 4:17 PMdswitzer
09/12/2023, 5:06 PMdswitzer
09/12/2023, 5:07 PMsocketTimeout setting, which affects all queries and would need to be set higher than the longest running query you want to run, which for our current purposes wouldn't really help us much because it's not really going to kill the threads any faster than they're being killed today.dawesi
09/13/2023, 1:15 AMdswitzer
09/13/2023, 10:59 AMdawesi
09/13/2023, 2:43 PMdswitzer
09/13/2023, 6:47 PMsocketTimeout or queryTimeout connection setting, the JDBC driver has no when an existing connection has dropped. Seemed like it should be able to determine the connection was lost, but it doesn't.zackster
09/13/2023, 6:48 PMdswitzer
09/13/2023, 6:49 PMdswitzer
09/13/2023, 6:50 PMzackster
09/13/2023, 6:51 PMdswitzer
09/13/2023, 6:52 PMdswitzer
09/13/2023, 6:53 PMzackster
09/13/2023, 6:55 PMdswitzer
09/13/2023, 7:01 PMcancelQueryTimeout would probably be perfect if it didn't require the queryTimeout too.dswitzer
09/13/2023, 7:04 PMzackster
09/13/2023, 7:13 PMdswitzer
09/13/2023, 7:13 PMzackster
09/13/2023, 7:14 PMdswitzer
09/13/2023, 7:14 PMdswitzer
09/13/2023, 7:15 PMdswitzer
09/13/2023, 9:32 PMQueryImpl in Lucee. One could argue it's actually in the MSSQL JDBC driver, but it's something I believe Lucee could at least work around.
One thing I noticed is that my queryTimeout values never seemed to be honored correctly. When I discovered is that if the stat ends up throwing an exception due to a timeout, QueryImpl still tries to call the close() method on the stat object. When this happens and the connection was broken, then the thread will wait until the socketTimeout before the code will continue, or if there is no socketTimeout, which is the default, it will just wait indefinitely. This is because the close() method on the statement is still waiting for a response from the server.
I'm not sure if I can get you a test case, because part of the process involves triggering off a command to kill the established connection, but I can definitely show it to you tomorrow if you want to see it.