Sudden "Read timed out" Error on jPOS Channel – What Could Cause This?

18 views
Skip to first unread message

Ardhi Putra Mahardika

unread,
Sep 17, 2025, 11:03:44 PM (3 days ago) Sep 17
to jPOS Users

Hi all,

I’m experiencing a sudden timeout issue on my jPOS channel. Everything was working fine, but now I’m getting the following error right after sending a message:

<log realm="post-channel/x.x.x.x:xxxxx" at="Mon Jul 07 13:50:21.920 WIB 2025" lifespan="1ms"> <send> <isomsg direction="outgoing"> ... <field id="0" value="0800"/> <field id="7" value="0707135021"/> <field id="11" value="576477"/> <field id="70" value="301"/> </isomsg> </send> </log> <log realm="post-channel/x.x.x.x:xxxxx" at="Mon Jul 07 13:50:22.013 WIB 2025"> <got-message-length-err> <exception name="Read timed out"> java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ... at org.jpos.iso.channel.EAIChannel.getMessageLength(EAIChannel.java:90) at org.jpos.iso.channel.EAIChannel.receive(EAIChannel.java:134) ... </exception> </got-message-length-err> </log>

Has anyone encountered this before? What could be the possible reasons for a sudden SocketTimeoutException: Read timed out after sending a message? and the timeframe is very short

chhil

unread,
Sep 17, 2025, 11:30:52 PM (3 days ago) Sep 17
to jpos-...@googlegroups.com
Your channel configuration has a timeout value which waits for a message to arrive within that period.
There was no activity on the line so you got the exception.

https://github.com/jpos/jPOS/blob/main/doc/src/asciidoc/ch08/channel_adaptor.adoc
 See point 6
Channel level timeout in milliseconds. If the channel does not receive any traffic in the configured timeout, it will disconnect. Having a channel level timeout as described here is highly recommended.

There seems to be some customization involved here, I have not seen </got-message-length-err> before.

-chhil

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/jpos-users/2568f83e-0cee-491c-af80-9add0cc1138cn%40googlegroups.com.

Ardhi Putra Mahardika

unread,
Sep 18, 2025, 12:18:24 AM (3 days ago) Sep 18
to jPOS Users

I noticed that the timeout exception occurred immediately after there was outgoing traffic on the channel. Based on the logs, a message was sent and then the channel disconnected due to a timeout almost right away.

Does this mean there actually was traffic on the line?
Why would the timeout trigger right after sending a message, instead of after a period of inactivity?
Is this expected behavior, or could there be something wrong with the channel configuration or the way the timeout is being handled? 

this is my configuration

<channel-adaptor name="channel-adaptor1" class="org.jpos.q2.iso.CustomChannelAdaptor" logger="Q2">
   <channel class="org.jpos.iso.channel.CustomChannel" logger="Q2" realm="post-channel" packager="org.jpos.iso.packager.BASE24Packager" header="ISO006000060">
      <property name="host" value="x.x.x.x"/>
      <property name="port" value="xxxxx"/>
      <property name="override-header" value="false"/>
      <property name="packager-logger" value="Q2"/>
      <property name="processMessageLengthOnReceive" value="true"/>
      <property name="processTrailerOnReceive" value="true"/>
      <property name="processMessageLengthOnSend" value="true"/>
      <property name="processTrailerOnSend" value="true"/>
   </channel>
   <!--session></session-->
   <in>send_mux1</in>
   <out>receive_mux1</out>
   <reconnect-delay>300000</reconnect-delay>
   <max-idle-time>10000</max-idle-time>
   <mux>mux.eft-mux1</mux>
   <messages>
      <echo><![CDATA[<isomsg>
<header>49534F303035303030303430</header>


<field id='0' value='0800'/>

<field id='7' value='${datetime}'/>
<field id='11' value='${tracenumber}'/>


<field id='70' value='301'/>

</isomsg>]]></echo>
      <signon><![CDATA[<isomsg>
<header>49534F303035303030303430</header>


<field id='0' value='0800'/>

<field id='7' value='${datetime}'/>
<field id='11' value='${tracenumber}'/>
                        <field id='48' value='6011001112M003602'/>
<field id='70' value='001'/>
</isomsg>]]></signon>
      <!--signoff></signoff-->
   </messages>
</channel-adaptor>

chhil

unread,
Sep 18, 2025, 2:19:28 AM (3 days ago) Sep 18
to jpos-...@googlegroups.com
The sender and receiver threads are different. The channel waits for any message to arrive.
You have not configured the timeout value in your config for the custom channel, I believe it defaults to 0. Please refer to the link I had shared that refers to the documentation of a channel adaptor configuration.

-chhil

Ardhi Putra Mahardika

unread,
Sep 18, 2025, 5:13:48 AM (3 days ago) Sep 18
to jPOS Users
  • Is the timeout parameter at point 6 the same as max idle?
  • If the channel reaches a timeout, will it then attempt to reconnect after waiting for the reconnect delay period?

chhil

unread,
Sep 18, 2025, 7:23:59 AM (3 days ago) Sep 18
to jpos-...@googlegroups.com
I am not aware of anything called max-idle-time in jPOS channel adaptor configuration.

Here is a simple test that you can do and play around with your config.
Run netcat on 127.0.0.1 listening on the port your channel connects to.

I had 
nc -l 50060

I ran jPOS with one channel deploy file that connects to IP 127.0.0.1 on port 50060. timeout property was not configured.

It disconnected after 5 minutes and it attempts to reconnect after the reconnect delay.

You have custom code and your mileage may vary as I do not know what your CustomChannelAdaptor does. 

This is the log. the channel 

<log realm="Q2.system" at="2025-09-18T16:45:19.983091" lifespan="38ms">
  <info>
    deploy: 10_epphost_channel_1.xml
  </info>
</log>
<log realm="epp-channel-1/127.0.0.1:50060" at="2025-09-18T16:45:20.020888" lifespan="9ms">
  <connect>
    Try 0 127.0.0.1:50060
      Connection established to 127.0.0.1:50060
  </connect>
</log>
<log realm="epp-channel-1/127.0.0.1:50060" at="2025-09-18T16:50:20.027229" lifespan="300006ms">
  <receive>
    <io-timeout/>
  </receive>
</log>
<log realm="org.jpos.q2.iso.ChannelAdaptor" at="2025-09-18T16:50:20.028373">
  <warn>
    channel-receiver-epp1-receive
    Read timeout / EOF - reconnecting
  </warn>
</log>
<log realm="epp-channel-1/127.0.0.1:50060" at="2025-09-18T16:50:30.066183" lifespan="1ms">
  <connect>
    Try 0 127.0.0.1:50060
      Connection established to 127.0.0.1:50060
  </connect>
</log>

-chhil

Andrés Alcarraz

unread,
Sep 18, 2025, 8:24:27 AM (3 days ago) Sep 18
to jpos-...@googlegroups.com
  • Is the timeout parameter at point 6 the same as max idle?

You have a custom channel adaptor, so we have no way to know what that means. That read timeout is because there was no incoming traffic in the socket, you probably need to send your echo messages more frequently.

In standard channel adaptor, sender and receiver threads are different, the scenario you are describing could happen if, let's say you have a timeout of 5 minutes, and you send the echo at minute 5. But being a custom implementation we can't know if that's the case.

Best regards
Andrés Alcarraz
Reply all
Reply to author
Forward
0 new messages