Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread getting stuck for more than 10 minutes during login #578

Closed
SubhasishDey opened this issue Sep 24, 2020 · 10 comments
Closed

Thread getting stuck for more than 10 minutes during login #578

SubhasishDey opened this issue Sep 24, 2020 · 10 comments

Comments

@SubhasishDey
Copy link

Hi,

We are finding that the SMBJ client stucks during connect for a period of 10 mins or more even if the socket timeouts are set in the SMBConfig.

We see the below thread dump, any hint from anyone will be deeply appreciated.

Id=488 in TIMED_WAITING
at sun.misc.Unsafe.park(Native Method)
- waiting on <0x08e6d37d> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2163)
at com.hierynomus.protocol.commons.concurrent.Promise.tryRetrieve(Promise.java:170)
at com.hierynomus.protocol.commons.concurrent.Promise.retrieve(Promise.java:134)
at com.hierynomus.protocol.commons.concurrent.PromiseBackedFuture.get(PromiseBackedFuture.java:58)
at com.hierynomus.protocol.commons.concurrent.CancellableFuture.get(CancellableFuture.java:84)
at com.hierynomus.protocol.commons.concurrent.Futures.get(Futures.java:38)
at com.hierynomus.smbj.connection.Connection.multiProtocolNegotiate(Connection.java:340)
at com.hierynomus.smbj.connection.Connection.negotiateDialect(Connection.java:310)
at com.hierynomus.smbj.connection.Connection.connect(Connection.java:120)
at com.hierynomus.smbj.SMBClient.getEstablishedOrConnect(SMBClient.java:103)
- locked <0x04f57371> (a com.hierynomus.smbj.SMBClient)

@ecki
Copy link

ecki commented Sep 24, 2020

Can you show the other threads as well?

Without looking too deep into it, my experience in this area are broken DFS scenarios with dangling Server references. Did you try to target a server directly and turn DFS of?

@SubhasishDey
Copy link
Author

Hi ecki,

 Thanks for your reply, I have not set the dfs explicitly so I think it is false by default.
  But I will explicitly set it false and retry and look for any occurrence as this issue doesnot happen always.

Thanks and Regards,
Subhasish

@hierynomus
Copy link
Owner

@SubhasishDey Any update on this?

@SubhasishDey
Copy link
Author

Hi @hierynomus / @ecki ,

I toggled the dfs setting for different server and dfs shares and then figured that the actual issue occurs when we try to connect to a non DFS server with DFS enabled in the smbj client.
We have set the timeout, but we still see this thread stack.
This hangs forever.

"HTTP Handler 127.0.0.1" Id=21030 in WAITING at [email protected]/jdk.internal.misc.Unsafe.park(Native Method) - waiting on <0x7273ba4c> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at [email protected]/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194) at [email protected]/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081) at com.hierynomus.protocol.commons.concurrent.Promise.tryRetrieve(Promise.java:167) at com.hierynomus.protocol.commons.concurrent.Promise.retrieve(Promise.java:122) at com.hierynomus.protocol.commons.concurrent.PromiseBackedFuture.get(PromiseBackedFuture.java:49) at com.hierynomus.protocol.commons.concurrent.CancellableFuture.get(CancellableFuture.java:79) at com.hierynomus.protocol.commons.concurrent.Futures.get(Futures.java:27) at com.hierynomus.smbj.paths.DFSPathResolver.getReferral(DFSPathResolver.java:414) at com.hierynomus.smbj.paths.DFSPathResolver.sendDfsReferralRequest(DFSPathResolver.java:403) at com.hierynomus.smbj.paths.DFSPathResolver.step6(DFSPathResolver.java:238) at com.hierynomus.smbj.paths.DFSPathResolver.step5(DFSPathResolver.java:199) at com.hierynomus.smbj.paths.DFSPathResolver.step2(DFSPathResolver.java:137) at com.hierynomus.smbj.paths.DFSPathResolver.step1(DFSPathResolver.java:120) at com.hierynomus.smbj.paths.DFSPathResolver.resolve(DFSPathResolver.java:107) at com.hierynomus.smbj.paths.DFSPathResolver.resolve(DFSPathResolver.java:95) at com.hierynomus.smbj.share.DiskShare.resolveAndCreateFile(DiskShare.java:77) at com.hierynomus.smbj.share.DiskShare.open(DiskShare.java:66) at com.hierynomus.smbj.share.DiskShare.getFileInformation(DiskShare.java:261) at com.hierynomus.smbj.share.DiskShare.getFileInformation(DiskShare.java:254) at com.softwareag.mft.client.SMBClientV2p.stat(SMBClientV2p.java:182) at com.softwareag.mft.client.SMBClientV2p.doCWD(SMBClientV2p.java:696)

Thanks and Regards,
Subhasish

@hierynomus
Copy link
Owner

@SubhasishDey Current master contains a fix for the hanging of the getReferral call. I'm not sure why your server does not respond.

@SubhasishDey
Copy link
Author

Thanks @hierynomus …I will take the update.
Our suspect on why the server doesnot respond was because its not a DFS server in a network restricted area.

Anyways.. thanks again...I will test wit your inputs.

@hierynomus
Copy link
Owner

I'm adding one additional fix, should be ready end of day today.

@hierynomus
Copy link
Owner

Additional fix is also merged. Good luck testing.

@shanthankumar24
Copy link

Hi @hierynomus

The fix is working fine for us , will it be part of the official release of 0.11.2? If so when can we expect it to be released?

@hierynomus
Copy link
Owner

Yes, it will be part of the next release.

hierynomus added a commit that referenced this issue Jul 3, 2023
* Ignore VSCode

* Add NtStatus.STATUS_UNSUCCESSFUL

* Add NtStatus.STATUS_INSUFF_SERVER_RESOURCES (#611)

* Add NtStatus.STATUS_IO_REPARSE_TAG_NOT_HANDLED (#514)

* Update gradle build

* Update release plugin

* Release version: 0.11.0

* Fix signing task dependency

* Release version: 0.11.1

* Use BCSecurityProvider by default for SMB3 compatibility (Fixes #638)

* Ensure DFS Path Referral times out after transactTimeout (Fixes #578)

* Only add DFSPathResolver if both client and server support DFS (#640)

* Only add DFSPathResolver if both client and server support DFS

* Fix indentation problems

* Fix incorrectly reformatted javadoc

* Format using java formatter

* One more indentation fix

* Upgrade Bouncy Castle to 1.68 to fix vulnerability report (#641)

* address issue #604 - stop closing the dfs share connection immediately. (#609)

* stop closing the dfs share connection immediately.

* Add explanatory comment

Co-authored-by: Jeroen van Erp <[email protected]>

* Add support for unregistering server from serverlist (Fixes #644) (#647)

* Add support for unregistering server from serverlist (Fixes #644)

* Fix indentation

* Reducing logging for smb3 (#650)

For each smb3 packet there's an info log message which produces a tremendous amount of output.
I would suggest to reduce log level to debug (or trace; similarly as in one of the other packet reciever classes).

* Consolidate SMBv1 error messages

* Upgrade BouncyCastle to 1.69

* Release version: 0.11.2

* Ensure artifact is signed

* Release version: 0.11.3

* Fix #665: Allow JCE KDF to work (#666)

* Fix #665: Allow JCE KDF to work

* Add header

* Add KDF unit test

* Use correct maxPayloadSize for encrypted packets (Fixes #668) (#683)

* Read fileId as long (#693)

* Read fileId of FileIdBothDirectoryInformation into a long
* Read fileId of FileIdFullDirectoryInformation into a long

* File the issue that nested folder creation throw NAME EXIST error. (#685)

* File the issue that nested folder creation throw NAME EXIST error.

* formatting

* Updated build status badges (#684)

- Added GitHub badge for Build SMBJ
- Corrected Codacy badge link
- Removed bintray badge link
- Removed Travis CI badge and configuration
- Removed Java profiler link
- Removed CircleCI configuration
- Removed unused github-ci configuration

* Use AceSize field when reading ACEs (#696)

Fixes issue seen in the wild where unnecessary padding at the end of an ACE
confused Smbj (but not Windows).

* Ensure that enough bytes are cached from InputStream to get a correct bytesLeft count for SMB2Write (fixes #669)

* GzipOutputStream integration test

* Ensure that enough bytes are cached from InputStream to get a correct bytesLeft count for SMB2Write

Co-authored-by: Stanislav Kardashov <[email protected]>
Co-authored-by: Jeroen van Erp <[email protected]>

* Add GH workflow for publishing

* Update dependencies and build file

* Rename test class to *Spec

* Release version: 0.11.5

* Use the hostname part of the TargetHint for DFS step 9 (fixes \#419) (#722)

* Slightly reduce the locking in Connection.send and DirectTcpTransport (fixes \#732)

* Fixed indentation

* Converting bytes written to long (Fixes #740)

Signed-off-by: Jeroen van Erp <[email protected]>

* Upgrading gradle to 8.0.2

Signed-off-by: Jeroen van Erp <[email protected]>

* Add Implementation manifest attributes (Fixes #743)

* Revert accidental comment of integration docker tasks

* Do not send SMB2EncryptionCapabilities NegotiationContext is !isEncry… (#752)

* Do not send SMB2EncryptionCapabilities NegotiationContext is !isEncryptionSupported (Fixes #747)

* Add test for SMB2EncryptionCapabilities

* Add preliminary changelog for new release

* Ensure we call flip() on Buffer to avoid Java8 problems (Fixes #705)

Signed-off-by: Jeroen van Erp <[email protected]>

* Ensure path is set for rmdir to prevent accidents (Fixes #756)

Signed-off-by: Jeroen van Erp <[email protected]>

* Add support for reading / writing NIO ByteBuffers (#759)

* Add support for reading / writing NIO ByteBuffers

Currently one can transfer data using streams or array, but it would be
great to have the opportunity to use NIO buffers.

This adds two new method to the File class that accept a NIO ByteBuffer.

* Implemented ByteBuffer write using ByteChunkProvider

Signed-off-by: Jeroen van Erp <[email protected]>

---------

Signed-off-by: Jeroen van Erp <[email protected]>
Co-authored-by: Christoph Läubrich <[email protected]>
Co-authored-by: Jeroen van Erp <[email protected]>

* Fix some sonatype warnings

* resolve conflict with master

* Ignore non-semver tags for release workflow

* Small warning cleanup

Signed-off-by: Jeroen van Erp <[email protected]>

* Setup ConnectionContext and AuthenticationContext for NTLM improvements

Signed-off-by: Jeroen van Erp <[email protected]>

* Refactor TargetInfo/AvPairs

* Added null check and rename field

* Refactor NtlmFunctions

* Change hierarchy of Ntlm messages

Signed-off-by: Jeroen van Erp <[email protected]>

* Next step of NTLM refactor

* NtlmNegotiate sends Domain/Workstation/Version fields

* Filter negotiateflags and use clientTargetInfo

* Rework keys in NtlmAuthenticator

Signed-off-by: Jeroen van Erp <[email protected]>

* Change to structure of NtlmAuthenticate

Signed-off-by: Jeroen van Erp <[email protected]>

* Added last changes

Required to put withIntegrity = false still, due to missing mechListMIC

Signed-off-by: Jeroen van Erp <[email protected]>

---------

Signed-off-by: Jeroen van Erp <[email protected]>
Co-authored-by: Nicholas DiPiazza <[email protected]>
Co-authored-by: ndimitry <[email protected]>
Co-authored-by: Patrick Boyd <[email protected]>
Co-authored-by: Hannes <[email protected]>
Co-authored-by: pyzhou <[email protected]>
Co-authored-by: exceptionfactory <[email protected]>
Co-authored-by: Chris Pacejo <[email protected]>
Co-authored-by: Stanislav Kardashov <[email protected]>
Co-authored-by: Stanislav Kardashov <[email protected]>
Co-authored-by: Christoph Läubrich <[email protected]>
Co-authored-by: Christoph Läubrich <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants