Dylan Werner-Meier created TINKERPOP-3120:
---------------------------------------------

             Summary: Closing a session with an Authorizer enabled throws an 
Exception
                 Key: TINKERPOP-3120
                 URL: https://issues.apache.org/jira/browse/TINKERPOP-3120
             Project: TinkerPop
          Issue Type: Bug
          Components: server
    Affects Versions: 3.7.0
            Reporter: Dylan Werner-Meier


When:
 * an _Authorizer_ is enabled
 * the _WebSocketChannelizer_ is selected
 * a session is used remotely

Then closing of the session results in the following stacktrace:

{noformat}
16:38:32 WARN  org.apache.tinkerpop.gremlin.driver.Connection.shutdown - 
Encountered an error trying to close connection on 
3ffde9a5-b225-473f-a9ac-36fc70c5f96c - force closing - server will close 
session on shutdown or expiration.
java.util.concurrent.ExecutionException: 
org.apache.tinkerpop.gremlin.driver.exception.ResponseException: Failed to 
authorize: This AuthorizationHandler only handles requests with OPS_BYTECODE or 
OPS_EVAL.
    at 
java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
 ~[?:?]
    at 
java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
 ~[?:?]
    at 
org.apache.tinkerpop.gremlin.driver.Connection.shutdown(Connection.java:328) 
[gremlin-driver-3.7.3.jar:3.7.3]
    at 
org.apache.tinkerpop.gremlin.driver.Connection.closeAsync(Connection.java:203) 
[gremlin-driver-3.7.3.jar:3.7.3]
    at 
org.apache.tinkerpop.gremlin.driver.ConnectionPool.killAvailableConnections(ConnectionPool.java:289)
 [gremlin-driver-3.7.3.jar:3.7.3]
    at 
org.apache.tinkerpop.gremlin.driver.ConnectionPool.closeAsync(ConnectionPool.java:269)
 [gremlin-driver-3.7.3.jar:3.7.3]
    at 
org.apache.tinkerpop.gremlin.driver.Client$SessionedClient.closeAsync(Client.java:852)
 [gremlin-driver-3.7.3.jar:3.7.3]
    at org.apache.tinkerpop.gremlin.driver.Client.close(Client.java:406) 
[gremlin-driver-3.7.3.jar:3.7.3]
    at 
org.apache.tinkerpop.gremlin.console.jsr223.DriverRemoteAcceptor.close(DriverRemoteAcceptor.java:208)
 [gremlin-console-3.7.3.jar:3.7.3]
    at 
org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321) 
[groovy-4.0.23.jar:4.0.23]
    at 
org.apache.tinkerpop.gremlin.console.commands.RemoteCommand$_closure8.doCall(RemoteCommand.groovy:119)
 [gremlin-console-3.7.3.jar:3.7.3]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method) ~[?:?]
    at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
 ~[?:?]
    at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[?:?]
    at java.base/java.lang.reflect.Method.invoke(Method.java:569) ~[?:?]
    at 
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343) 
[groovy-4.0.23.jar:4.0.23]
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328) 
[groovy-4.0.23.jar:4.0.23]
    at 
org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:279)
 [groovy-4.0.23.jar:4.0.23]
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1007) 
[groovy-4.0.23.jar:4.0.23]
    at 
org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321) 
[groovy-4.0.23.jar:4.0.23]
    at 
org.apache.groovy.groovysh.ComplexCommandSupport.executeFunction(ComplexCommandSupport.groovy:81)
 [groovy-groovysh-4.0.23.jar:4.0.23]
    at 
org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321) 
[groovy-4.0.23.jar:4.0.23]
    at 
org.apache.groovy.groovysh.ComplexCommandSupport.execute(ComplexCommandSupport.groovy:68)
 [groovy-groovysh-4.0.23.jar:4.0.23]
    at 
org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321) 
[groovy-4.0.23.jar:4.0.23]
    at org.apache.groovy.groovysh.Shell.execute(Shell.groovy:103) 
[groovy-groovysh-4.0.23.jar:4.0.23]
    at org.apache.groovy.groovysh.Groovysh.executeCommand(Groovysh.groovy:309) 
[groovy-groovysh-4.0.23.jar:4.0.23]
    at org.apache.groovy.groovysh.Groovysh.execute(Groovysh.groovy:176) 
[groovy-groovysh-4.0.23.jar:4.0.23]
    at 
org.apache.tinkerpop.gremlin.console.GremlinGroovysh.super$3$execute(GremlinGroovysh.groovy)
 [gremlin-console-3.7.3.jar:3.7.3]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method) ~[?:?]
    at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
 ~[?:?]
    at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[?:?]
    at java.base/java.lang.reflect.Method.invoke(Method.java:569) ~[?:?]
    at 
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343) 
[groovy-4.0.23.jar:4.0.23]
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328) 
[groovy-4.0.23.jar:4.0.23]
    at groovy.lang.MetaClassImpl.doInvokeMethod(MetaClassImpl.java:1333) 
[groovy-4.0.23.jar:4.0.23]
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1088) 
[groovy-4.0.23.jar:4.0.23]
    at 
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:146)
 [groovy-4.0.23.jar:4.0.23]
    at 
org.apache.tinkerpop.gremlin.console.GremlinGroovysh.execute(GremlinGroovysh.groovy:87)
 [gremlin-console-3.7.3.jar:3.7.3]
    at 
org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321) 
[groovy-4.0.23.jar:4.0.23]
    at org.apache.groovy.groovysh.Shell.leftShift(Shell.groovy:121) 
[groovy-groovysh-4.0.23.jar:4.0.23]
    at 
org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321) 
[groovy-4.0.23.jar:4.0.23]
    at org.apache.groovy.groovysh.ShellRunner.work(ShellRunner.groovy:93) 
[groovy-groovysh-4.0.23.jar:4.0.23]
    at 
org.apache.groovy.groovysh.InteractiveShellRunner.work(InteractiveShellRunner.groovy:124)
 [groovy-groovysh-4.0.23.jar:4.0.23]
    at 
org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321) 
[groovy-4.0.23.jar:4.0.23]
    at org.apache.groovy.groovysh.ShellRunner.run(ShellRunner.groovy:57) 
[groovy-groovysh-4.0.23.jar:4.0.23]
    at 
org.apache.groovy.groovysh.InteractiveShellRunner.run(InteractiveShellRunner.groovy:96)
 [groovy-groovysh-4.0.23.jar:4.0.23]
    at 
org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321) 
[groovy-4.0.23.jar:4.0.23]
    at org.apache.tinkerpop.gremlin.console.Console.<init>(Console.groovy:175) 
[gremlin-console-3.7.3.jar:3.7.3]
    at 
org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321) 
[groovy-4.0.23.jar:4.0.23]
    at org.apache.tinkerpop.gremlin.console.Console.main(Console.groovy:574) 
[gremlin-console-3.7.3.jar:3.7.3]
Caused by: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: 
Failed to authorize: This AuthorizationHandler only handles requests with 
OPS_BYTECODE or OPS_EVAL.
    at 
org.apache.tinkerpop.gremlin.driver.Handler$GremlinResponseHandler.channelRead0(Handler.java:246)
 ~[gremlin-driver-3.7.3.jar:3.7.3]
    at 
org.apache.tinkerpop.gremlin.driver.Handler$GremlinResponseHandler.channelRead0(Handler.java:201)
 ~[gremlin-driver-3.7.3.jar:3.7.3]
    at 
io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
org.apache.tinkerpop.gremlin.driver.Handler$GremlinSaslAuthenticationHandler.channelRead0(Handler.java:127)
 ~[gremlin-driver-3.7.3.jar:3.7.3]
    at 
org.apache.tinkerpop.gremlin.driver.Handler$GremlinSaslAuthenticationHandler.channelRead0(Handler.java:69)
 ~[gremlin-driver-3.7.3.jar:3.7.3]
    at 
io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
 ~[netty-codec-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
 ~[netty-codec-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.handler.codec.http.websocketx.Utf8FrameValidator.channelRead(Utf8FrameValidator.java:98)
 ~[netty-codec-http-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:289)
 ~[netty-handler-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
 ~[netty-codec-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
 ~[netty-codec-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
 ~[netty-codec-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1407)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:918)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) 
~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
 ~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) 
~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) 
~[netty-transport-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:994)
 ~[netty-common-4.1.112.Final.jar:4.1.112.Final]
    at 
io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) 
~[netty-common-4.1.112.Final.jar:4.1.112.Final]
    at java.base/java.lang.Thread.run(Thread.java:840) ~[?:?]
{noformat}

This is because support for `Tokens.OPS_CLOSE` was briefly dropped, then 
reintroduced.

Support was correctly reintroduced in `UnifiedHandler` here: 
[https://github.com/apache/tinkerpop/blob/3.7-dev/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/UnifiedHandler.java#L141]
 

But not in WebSocketAuthorizationHandler here: 
[https://github.com/apache/tinkerpop/blob/3.7-dev/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/WebSocketAuthorizationHandler.java#L80]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to