wl-online-payments-direct / sdk-java

Other
3 stars 1 forks source link

JAVA SDK 4.22 java.net.SocketTimeoutException #6

Open hberges-web opened 1 month ago

hberges-web commented 1 month ago

Alsa changed the version of their SDK server (Java) from version 4.12 to version 4.22. They mentioned that they did not modify anything in the code, but they are now encountering the following error:

12:15:30,917 ERROR [http-nio-80-exec-2][PurchasePortlet:1733] [8EBC37ACA305FDA0E984647831C452E2]treatError en PurchasePortlet con error [com.onlinepayments.CommunicationException: java.net.SocketTimeoutException: Read timed out][[paymentProcessAction] Error al procesar el pago] java.lang.Exception: com.onlinepayments.CommunicationException: java.net.SocketTimeoutException: Read timed out       at com.babel.alsa.manager.service.impl.WorldlineServiceImpl.createHostedCheckout(WorldlineServiceImpl.java:149)       at com.babel.alsa.utils.payment.WorldlineUtils.initPayWorldline(WorldlineUtils.java:89)    9:42:00,495 ERROR [GoToPaymentStepActionCommand:134] [7E1D6135C1F98AFD32CD340E7EEC9CE9] Error en AlsaSuizaPurchasePortlet al ir a la plataforma de pago: [com.onlinepayments.CommunicationException: java.net.SocketTimeoutException: Read timed out] java.lang.Exception: com.onlinepayments.CommunicationException: java.net.SocketTimeoutException: Read timed out

When they revert to the previous version, everything works fine.

Do you know what could be causing this issue?

Thank you! Best regards

worldline-direct-support-team commented 1 month ago

Hello @hberges-web,

Thank you for bringing the issue you're experiencing with the SDK upgrade to our attention.

Upon careful analysis of the stack trace you provided, it is evident that the error you are encountering is a java.net.SocketTimeoutException: Read timed out. This error typically arises when a specific socket timeout threshold is reached, interrupting the read operation. The default timeout value is set to 10 seconds, but this can vary depending on your infrastructure and platform. Adjusting or increasing this value might help avoiding this issue.

Additionally, it's important to note that starting from version 4.17.0, a new ConnectionRequestTimeout parameter was introduced for the DefaultConnection class. This parameter is designed to manage the system's behavior when obtaining a connection from the ConnectionPool. The default value is set to 10 seconds and can be configured through the CommunicatorConfiguration class or via the setting onlinePayments.api.connectionRequestTimeout=<time-in-millis>.

While the ConnectionRequestTimeout does not directly cause a SocketTimeoutException: Read timed out, high contention or pool exhaustion could lead to insufficient time remaining for the read operation to finish.

We recommend increasing the SocketTimeout value to provide more time for the request to complete once a connection has been obtained. This adjustment might resolve the issue you are facing.

Please let us know if this suggestion helps in your scenario and feel free to share any further feedback. Thank you once again for bringing this to our attention and we apologise for any inconvenience this issue may have caused.

Best regards, Worldline Support Team