smbj icon indicating copy to clipboard operation
smbj copied to clipboard

STATUS_INSUFFICIENT_RESOURCES (0xc000009a):

Open xianhaiGitHub opened this issue 4 years ago • 14 comments
trafficstars

com.hierynomus.mssmb2.SMBApiException: STATUS_INSUFFICIENT_RESOURCES (0xc000009a): Create failed for \xx\c$\Program Files\StoreLine
at com.hierynomus.smbj.share.Share.receive(Share.java:371) at com.hierynomus.smbj.share.Share.sendReceive(Share.java:351) at com.hierynomus.smbj.share.Share.createFile(Share.java:159) at com.hierynomus.smbj.share.DiskShare.createFileAndResolve(DiskShare.java:97) at com.hierynomus.smbj.share.DiskShare.resolveAndCreateFile(DiskShare.java:79) at com.hierynomus.smbj.share.DiskShare.open(DiskShare.java:66) at com.hierynomus.smbj.share.DiskShare.exists(DiskShare.java:193) at com.hierynomus.smbj.share.DiskShare.folderExists(DiskShare.java:189) at com.watsons.dep.cdsagent.service.SMBFileService.createDirectory(SMBFileService.java:147) at com.watsons.dep.cdsagent.service.SMBFileService.create(SMBFileService.java:78) at com.watsons.dep.cdsagent.service.impl.FileServiceImpl.create(FileServiceImpl.java:55)

xianhaiGitHub avatar Jun 01 '21 03:06 xianhaiGitHub

What is your question? Please answer your other ticket also (#636). Without a proper question, I do not know what to answer.

hierynomus avatar Jun 01 '21 07:06 hierynomus

What is your question? Please answer your other ticket also (#636). Without a proper question, I do not know what to answer.

I use smb to copy pic to target ip window, i met this problem ,and i have see the source code , but i don't know why have this error ,STATUS_INSUFFICIENT_RESOURCES , i need your help~ many tks~

xianhaiGitHub avatar Jun 01 '21 07:06 xianhaiGitHub

This is a server side problem. There aren't enough resources to fulfill your request. What does the server log say?

hierynomus avatar Jun 01 '21 13:06 hierynomus

In our case it was due not closing the resources (outputStreams, Files, Directories, DiskShares etc.). After some amount of time we ran out of resources on server side. Verify the smbClient instance for Connection count and all nested objects. There is number of closeable classes in SMBJ.

JozefDropco avatar Jun 16 '21 07:06 JozefDropco

@xianhaiGitHub Did the comment from @JozefDropco help? Please update the issue.

hierynomus avatar Jun 28 '21 11:06 hierynomus

@xianhaiGitHub Did the comment from @JozefDropco help? Please update the issue.

yes,but i met another problem Caused by: com.hierynomus.smbj.common.SMBRuntimeException: java.util.concurrent.TimeoutException: Timeout expired

xianhaiGitHub avatar Jul 19 '21 07:07 xianhaiGitHub

@xianhaiGitHub Did the comment from @JozefDropco help? Please update the issue.

at com.xxx.xx.cdsagent.service.SMBFileService.<init>(SMBFileService.java:62)
at com.xxx.xx..cdsagent.service.impl.FileServiceImpl.init(FileServiceImpl.java:39)
at com.xxx.xx..cdsagent.service.impl.CdsAgentServiceImpl.delFileAndCache(CdsAgentServiceImpl.java:667)
at com.xxx.xx..cdsagent.mqtt.MqttCallback.parseExecuteMessage(MqttCallback.java:41)
at com.xxx.xx..cdsagent.mqtt.MqttCallback$$FastClassBySpringCGLIB$$dd6c08a7.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749)
at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Caused by: java.util.concurrent.ExecutionException: com.hierynomus.smbj.common.SMBRuntimeException: java.util.concurrent.TimeoutException: Timeout expired at com.hierynomus.protocol.commons.concurrent.PromiseBackedFuture.get(PromiseBackedFuture.java:60) at com.hierynomus.protocol.commons.concurrent.CancellableFuture.get(CancellableFuture.java:84) at com.hierynomus.protocol.commons.concurrent.Futures.get(Futures.java:38) ... 20 common frames omitted Caused by: com.hierynomus.smbj.common.SMBRuntimeException: java.util.concurrent.TimeoutException: Timeout expired at com.hierynomus.smbj.common.SMBRuntimeException$1.wrap(SMBRuntimeException.java:27) at com.hierynomus.smbj.common.SMBRuntimeException$1.wrap(SMBRuntimeException.java:21) at com.hierynomus.protocol.commons.concurrent.Promise.retrieve(Promise.java:136) at com.hierynomus.protocol.commons.concurrent.PromiseBackedFuture.get(PromiseBackedFuture.java:58) ... 22 common frames omitted Caused by: java.util.concurrent.TimeoutException: Timeout expired

xianhaiGitHub avatar Jul 19 '21 07:07 xianhaiGitHub

Hi @xianhaiGitHub, I had the same issue recently. I found out that the issue is caused by caching myself connection. I had a simple test to replicate the issue where config was set timeout and soTimeout to 30secs and once connection was retrieved I did a Thread.sleep to 35 seconds. In my code I used connection.isConnected() this was returning true and then it failed when used afterwards with same exception. Instead of caching myself I did simply smbClient.connect(smbServer) again (internally its cached anyways - but seems the reconnect is handled internally).

JozefDropco avatar Jul 19 '21 07:07 JozefDropco

Hi @xianhaiGitHub, I had the same issue recently. I found out that the issue is caused by caching myself connection. I had a simple test to replicate the issue where config was set timeout and soTimeout to 30secs and once connection was retrieved I did a Thread.sleep to 35 seconds. In my code I used connection.isConnected() this was returning true and then it failed when used afterwards with same exception. Instead of caching myself I did simply smbClient.connect(smbServer) again (internally its cached anyways - but seems the reconnect is handled internally).

my problem case by init try { iFileService.init(targetIp); } catch (Exception e) { log.error("\n Copy =================>>> 【{}】SMB Client connection Exception!!!", targetIp, e); return StackTraceUtil.getStackTrace(e); }

xianhaiGitHub avatar Jul 19 '21 07:07 xianhaiGitHub

@xianhaiGitHub Did the comment from @JozefDropco help? Please update the issue.

yes,but i met another problem Caused by: com.hierynomus.smbj.common.SMBRuntimeException: java.util.concurrent.TimeoutException: Timeout expired

com.hierynomus veision: 0.10.0 <groupId>com.hierynomus</groupId> <artifactId>smbj</artifactId> 0.10.0

xianhaiGitHub avatar Jul 19 '21 09:07 xianhaiGitHub

@xianhaiGitHub Without some actual logging and code, it is impossible to know where this exception is coming from. Is it always immediately failing, or only after some time? We need a whole lot of more information than just a stacktrace and a claim it's not working.

hierynomus avatar Jul 19 '21 10:07 hierynomus

@xianhaiGitHub Without some actual logging and code, it is impossible to know where this exception is coming from. Is it always immediately failing, or only after some time? We need a whole lot of more information than just a stacktrace and a claim it's not working.

tks anyway, i will check again~

xianhaiGitHub avatar Jul 19 '21 10:07 xianhaiGitHub

@xianhaiGitHub Without some actual logging and code, it is impossible to know where this exception is coming from. Is it always immediately failing, or only after some time? We need a whole lot of more information than just a stacktrace and a claim it's not working.

hi, i use smb 0.10.0 and target os is XP 2000 ,and i use java junit test to connect it ,but Timeout expired,and this is my junit test like below: @Test public void TestSmbConnect() throws Exception{ //xp ip example : "10..33.128", String[] targetIps = {"10..33.128"}; for(String targetIp: targetIps){ try { iFileService.init(targetIp); } catch (Exception e) { log.error("=================>>> 【{}】SMB Client connection Exception!!!", targetIp, e); } File file = new File("C:\18\2021-3-12_crossBU_472x265.jpg"); StringBuilder targetPath = new StringBuilder(); targetPath.append(targetPathMiddle).append("2021-3-12_crossBU_472x265.jpg"); try (InputStream is = new FileInputStream(file)) { Path path = Paths.get(targetPath.toString()); if(iFileService.exist(path)){ log.debug("path is exist start delete"); // iFileService.delete(path, false); }else{ iFileService.create(path, IOUtils.toByteArray(is), false); log.debug("file copy successfule "); } } iFileService.colse(); log.debug("===================>>>>close targetIp:{}", targetIp); } }

============================================================ and this is exception like below: 2021-07-28 13:45:16,061 [058513715c684fd4b6259075f52bfdbf] [main] [ERROR] (SmbTest.java:37) - [com.xx.xx.service.smb.SmbTest] =================>>> 【10.*.33.128】SMB Client connection Exception!!! com.hierynomus.protocol.transport.TransportException: java.util.concurrent.ExecutionException: com.hierynomus.smbj.common.SMBRuntimeException: java.util.concurrent.TimeoutException: Timeout expired at com.hierynomus.protocol.transport.TransportException$1.wrap(TransportException.java:29) at com.hierynomus.protocol.transport.TransportException$1.wrap(TransportException.java:23) at com.hierynomus.protocol.commons.concurrent.Futures.get(Futures.java:43) at com.hierynomus.smbj.connection.Connection.sendAndReceive(Connection.java:305) at com.hierynomus.smbj.connection.Connection.smb2OnlyNegotiate(Connection.java:347) at com.hierynomus.smbj.connection.Connection.negotiateDialect(Connection.java:332) at com.hierynomus.smbj.connection.Connection.connect(Connection.java:122) at com.hierynomus.smbj.SMBClient.getEstablishedOrConnect(SMBClient.java:106) at com.hierynomus.smbj.SMBClient.connect(SMBClient.java:77) at com.watsons.dep.cdsagent.service.SMBFileService.(SMBFileService.java:62) at com.watsons.dep.cdsagent.service.impl.FileServiceImpl.init(FileServiceImpl.java:39) at com.watsons.dep.service.smb.SmbTest.TestSmbConnect(SmbTest.java:35) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) Caused by: java.util.concurrent.ExecutionException: com.hierynomus.smbj.common.SMBRuntimeException: java.util.concurrent.TimeoutException: Timeout expired at com.hierynomus.protocol.commons.concurrent.PromiseBackedFuture.get(PromiseBackedFuture.java:60) at com.hierynomus.protocol.commons.concurrent.CancellableFuture.get(CancellableFuture.java:84) at com.hierynomus.protocol.commons.concurrent.Futures.get(Futures.java:38) ... 39 common frames omitted Caused by: com.hierynomus.smbj.common.SMBRuntimeException: java.util.concurrent.TimeoutException: Timeout expired at com.hierynomus.smbj.common.SMBRuntimeException$1.wrap(SMBRuntimeException.java:27) at com.hierynomus.smbj.common.SMBRuntimeException$1.wrap(SMBRuntimeException.java:21) at com.hierynomus.protocol.commons.concurrent.Promise.retrieve(Promise.java:136) at com.hierynomus.protocol.commons.concurrent.PromiseBackedFuture.get(PromiseBackedFuture.java:58) ... 41 common frames omitted Caused by: java.util.concurrent.TimeoutException: Timeout expired ... 43 common frames omitted

xianhaiGitHub avatar Jul 28 '21 05:07 xianhaiGitHub

@xianhaiGitHub Without some actual logging and code, it is impossible to know where this exception is coming from. Is it always immediately failing, or only after some time? We need a whole lot of more information than just a stacktrace and a claim it's not working.

smb 0.10.0 is not support XP OS? I use target os is XP 2000,and i can't to connect it when i junit test ,exception said "Timeout expired"

xianhaiGitHub avatar Jul 28 '21 06:07 xianhaiGitHub