I am currently working on the Mule 4.4 On-Prem application which runs on Unix container based. the app is trying to create new folder and creates new file on the folder. I am using smb connector 3.1.1 and it works well with few requests and keeps getting connection reset by peer error after 5 or 10 minutes (once the first error occurs it never reconnects).
Code looks like below:-
<smb:config name="SMB_Connector_Config" doc:name="SMB Connector Config" doc:id="4cb53c1c-edbe-4068-8694-6ed860730b1d" >
<smb:connection host="xx.xx.xxx.xx" share="TCS" username="mule" password="****" fileAgeUnit="MINUTES" fileAge="60" socketTimeout="10" socketTimeoutUnit="MINUTES" domain="******.NET"/>
</smb:config>
<flow name="test-smbFlow" doc:id="657bcb88-1dea-4e67-8390-9567fdfc5c5b" >
<http:listener doc:name="Listener" doc:id="8db8d8e0-9cfb-4d5b-afcf-4bcce6d67fc5" config-ref="HTTP_Listener_config" path="test2"/>
<ee:transform doc:name="Transform Message" doc:id="a1e88ffe-3d64-4093-97ac-c1bb81040790" >
<ee:message >
</ee:message>
<ee:variables >
<ee:set-variable variableName="cachedResponse" ><![CDATA[%dw 2.0
output application/json
---
{
'message' : "xyz"
}]]></ee:set-variable>
<ee:set-variable variableName="fileName" ><![CDATA[output application/java
---
"$(correlationId).json"]]></ee:set-variable>
<ee:set-variable variableName="folderName" ><![CDATA[%dw 2.0
output application/java
---
correlationId]]></ee:set-variable>
</ee:variables>
</ee:transform>
<flow-ref doc:name="test-smbSub_Flow" doc:id="8908444f-6d76-4df6-beff-f03e604e69ea" name="test-smbSub_Flow"/>
<logger level="INFO" doc:name="Logger" doc:id="00c0343c-21cc-4af1-8427-2542f0415f0a" />
</flow>
<flow name="test-smbSub_Flow" doc:id="bfe3935a-e4ed-44be-b4c5-f148821c395c" >
<smb:directory-create doc:name="Directory Create" doc:id="cf111d1a-41f3-4e48-8461-e5f6b1f47849" config-ref="SMB_Connector_Config" dirName="#['\Input\Folder' ++ '\\' ++ vars.folderName]">
<reconnect-forever />
</smb:directory-create>
<smb:file-write doc:name="File Write" doc:id="9d654a52-6006-4aae-a21c-de731799ea51" config-ref="SMB_Connector_Config" fileName="#[vars.fileName]" dirName="#['\Input\Folder' ++ '\\' ++ correlationId]">
<reconnect-forever frequency="6000" blocking="false" />
<smb:file-content><![CDATA[#[vars.cachedResponse]]]></smb:file-content>
</smb:file-write>
</flow>
Error I am getting is like :-
Message : com.hierynomus.protocol.transport.TransportException: java.SocketException: Connection reset by peer: socket write error
Element : test-smbSub_Flow/processors/0 @ test-smb:test-smb.xml:45 (Directory Create)
I tried all possibility of old version of connector, with different mule runtimes etc. Nothing seems to be working. I could not able to get much help from the Share server team as well. As this app is part of mule3 to mule4 application migration there share believe to be working. I referred all thsoe available mule4 support document related to smb connector nothing helps. If anyone could suggests any workaround this issue or alternative to smb connector really helps. if any reference to existing java solution also helps. Thanks in advance
I am currently working on the Mule 4.4 On-Prem application which runs on Unix container based. the app is trying to create new folder and creates new file on the folder. I am using smb connector 3.1.1 and it works well with few requests and keeps getting connection reset by peer error after 5 or 10 minutes (once the first error occurs it never reconnects).
Code looks like below:-
<smb:config name="SMB_Connector_Config" doc:name="SMB Connector Config" doc:id="4cb53c1c-edbe-4068-8694-6ed860730b1d" >
<smb:connection host="xx.xx.xxx.xx" share="TCS" username="mule" password="****" fileAgeUnit="MINUTES" fileAge="60" socketTimeout="10" socketTimeoutUnit="MINUTES" domain="******.NET"/>
</smb:config>
<flow name="test-smbFlow" doc:id="657bcb88-1dea-4e67-8390-9567fdfc5c5b" >
<http:listener doc:name="Listener" doc:id="8db8d8e0-9cfb-4d5b-afcf-4bcce6d67fc5" config-ref="HTTP_Listener_config" path="test2"/>
<ee:transform doc:name="Transform Message" doc:id="a1e88ffe-3d64-4093-97ac-c1bb81040790" >
<ee:message >
</ee:message>
<ee:variables >
<ee:set-variable variableName="cachedResponse" ><![CDATA[%dw 2.0
output application/json
---
{
'message' : "xyz"
}]]></ee:set-variable>
<ee:set-variable variableName="fileName" ><![CDATA[output application/java
---
"$(correlationId).json"]]></ee:set-variable>
<ee:set-variable variableName="folderName" ><![CDATA[%dw 2.0
output application/java
---
correlationId]]></ee:set-variable>
</ee:variables>
</ee:transform>
<flow-ref doc:name="test-smbSub_Flow" doc:id="8908444f-6d76-4df6-beff-f03e604e69ea" name="test-smbSub_Flow"/>
<logger level="INFO" doc:name="Logger" doc:id="00c0343c-21cc-4af1-8427-2542f0415f0a" />
</flow>
<flow name="test-smbSub_Flow" doc:id="bfe3935a-e4ed-44be-b4c5-f148821c395c" >
<smb:directory-create doc:name="Directory Create" doc:id="cf111d1a-41f3-4e48-8461-e5f6b1f47849" config-ref="SMB_Connector_Config" dirName="#['\Input\Folder' ++ '\\' ++ vars.folderName]">
<reconnect-forever />
</smb:directory-create>
<smb:file-write doc:name="File Write" doc:id="9d654a52-6006-4aae-a21c-de731799ea51" config-ref="SMB_Connector_Config" fileName="#[vars.fileName]" dirName="#['\Input\Folder' ++ '\\' ++ correlationId]">
<reconnect-forever frequency="6000" blocking="false" />
<smb:file-content><![CDATA[#[vars.cachedResponse]]]></smb:file-content>
</smb:file-write>
</flow>
Error I am getting is like :-
Message : com.hierynomus.protocol.transport.TransportException: java.net.SocketException: Connection reset by peer: socket write error
Element : test-smbSub_Flow/processors/0 @ test-smb:test-smb.xml:45 (Directory Create)
I tried all possibility of old version of connector, with different mule runtimes etc. Nothing seems to be working. I could not able to get much help from the Share server team as well. As this app is part of mule3 to mule4 application migration there share believe to be working. I referred all thsoe available mule4 support document related to smb connector nothing helps. If anyone could suggests any workaround this issue or alternative to smb connector really helps. if any reference to existing java solution also helps. Thanks in advance
Share Improve this question edited Feb 7 at 17:59 Infinity asked Feb 7 at 10:51 InfinityInfinity 5242 gold badges9 silver badges23 bronze badges 3- 1 Asking for recommendation of libraries or any off site resources is off topic in Stack Overflow. You should only ask for a solution to the specific problem you are having. – aled Commented Feb 7 at 11:00
- How much time passed between the last operation and the error? Have you tried with the newest version of the connector? Note that the SMB connector is not provided by MuleSoft. It was developed by a company called Apisero. MuleSoft doesn't provide any support for it. – aled Commented Feb 7 at 18:37
- tried with latest version of connector . Same issue as reported here : github.com/sos-berlin/js7/issues/10 – Infinity Commented Feb 8 at 2:52
1 Answer
Reset to default 1First of all,
SMB connector is not reliable connector. Alternative you should use JAVA library like smbj which is SMB client Implementation.
Now coming to your issues: Try below
- Server is closing connections due to too many open connections from the client as SMB connector does not support connection Pooling which might be one of reason. So just to validate my answer or fix the issues, Capture the TCPDump or Packet traffic from MuleSoft server and check why RST flag coming from server, which would tell you everything. Trust me.
- Work with Network Team and server team to fix such issues.
- As I do not have access to log , do one thing Wrap SMB operations in a try-catch block.There might be case that reconnecton is not coming into effect.
- You should not set socket timeout like 10 minutes or 20 minutes ,because If server has shorter Ideal timeout it would reset the connection and your application acting as a client would be in trouble because of 10 mintutes.