smbj
smbj copied to clipboard
STATUS_INSUFFICIENT_RESOURCES (0xc000009a):
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)
What is your question? Please answer your other ticket also (#636). Without a proper question, I do not know what to answer.
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~
This is a server side problem. There aren't enough resources to fulfill your request. What does the server log say?
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.
@xianhaiGitHub Did the comment from @JozefDropco help? Please update the issue.
@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 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
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).
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 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
@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.
@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 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.
@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"