sbt / ipcsocket

IPC: Unix Domain Socket and Windows Named Pipes for Java
Other
45 stars 16 forks source link

java.io.IOException: ConnectNamedPipe() failed with: 535 #20

Closed dolly22 closed 1 year ago

dolly22 commented 2 years ago

I tried to upgrade to latest version (from 1.0.1 to 1.4.0) of the library and started getting this error sometimes.

    2021-10-05T07:46:06 ERR java.io.IOException: ConnectNamedPipe() failed with: 535
    2021-10-05T07:46:06 ERR     at org.scalasbt.ipcsocket.Win32NamedPipeServerSocket.accept(Win32NamedPipeServerSocket.java:192)

The last working version that is not exhibiting this problem for me is 1.0.1. OS is windows 10.

Error code 535 is ERROR_PIPE_CONNECTED and it seems to me it should be handled in the source, but somehow it is not.

eed3si9n commented 2 years ago

Thanks for the report. We now have JNA and JNI implementations (for GraalVM JNI works better) so I wonder if the check is done one but not the other.

dolly22 commented 2 years ago

@eed3si9n I searched in the source code and this looks somewhat suspicious. Do you think it's intentional?

  @Override
  public int ERROR_PIPE_CONNECTED() {
    return WinError.ERROR_NO_DATA;
  }
eed3si9n commented 2 years ago

I am guessing that was a typo? /cc @eatkins

eatkins commented 2 years ago

Definitely looks like a typo. @dolly2 can you work around the problem with sbt -Dsbt.ipcsocket.jni=true? That should toggle the server to use the JNI implementation that theoretically should not hit the typo.

dolly22 commented 2 years ago

@eatkins Using JNI explicitly resolved the issue for me. Thanks for workaround!

eed3si9n commented 1 year ago

This was fixed in https://github.com/sbt/ipcsocket/pull/21