hierynomus / smbj

Server Message Block (SMB2, SMB3) implementation in Java
Other
707 stars 180 forks source link

close operation on smbclient is extremely slow when I run in Java 8 #423

Open vamshikrishna1 opened 5 years ago

vamshikrishna1 commented 5 years ago

I have attached the code snippet that creates 10 files in a loop with runtime IBM JDK 8.

In every loop, I calculated the time took to close the smbclient.

Few iterations took 60017ms to close the smbclient.

I see a substantial increase in the smbclient close time as I increase the number of iterations.

I have also attached the packet trace that also includes responses from the server.

We don't observe this slowness in JAVA 7

We see this slowness with smbclient close only with runtime JAVA 8.

SMBJ vendor.zip

neoxpert commented 5 years ago

Is there a particular reason why you are only closing the client but not the file, session and connection? Or why don't you reuse the connected client to create the files before closing it instead of recreating a client, connection, share .. within every iteration step?

I don't tink that the observed slowness is purely based on usage of Java 8 but also by your approach of using the client and its sessions / connections. So in a first step I would try to treat the closeable resources mentioned as they should be and see if that causes a different behavior.