Help with: java.io.IOException fixed content-length: X, bytes received: Y

I have dug around and am not finding any examples of this on the forums,

However I have an HttpClient making a get request to a flask server, and that flask servers response comes back 95% of the time. However every once in a while I am getting an IOException that my return isn't as large as it should be.

Here is the code being called:

httpClient.get(url, params=params, data=data)

Exception:

EXCEPTION: IOException(<module:API.Flask>, LINE 82 ""): 
java.io.IOException: Unable to GET endpoint/route/connections?node_a=D2012-C404&node_b=CLLR-C404, 
MESSAGE: Error getting request, 
CAUSE: fixed content-length: 41069, bytes received: 11970

Stacktrace:

This is actually a cloned stack trace off of Throwable().setStackTrace(exception.getCause().getStackTrace()) so I could print it into my logs)

Stacktrace
java.lang.Throwable: Error getting request
at java.net.http/jdk.internal.net.http.HttpClientImpl.send(Unknown Source)
at java.net.http/jdk.internal.net.http.HttpClientFacade.send(Unknown Source)
at com.inductiveautomation.ignition.common.script.builtin.http.JythonHttpClient.send(JythonHttpClient.java:101)
at com.inductiveautomation.ignition.common.script.builtin.http.JythonHttpClient.get(JythonHttpClient.java:306)
at jdk.internal.reflect.GeneratedMethodAccessor37.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:190)
at org.python.core.PyObject.__call__(PyObject.java:422)
at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:237)
at org.python.core.PyMethod.__call__(PyMethod.java:228)
at org.python.pycode._pyx1756._send_request$11(:119)
at org.python.pycode._pyx1756.call_function()
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyBaseCode.call(PyBaseCode.java:306)
at org.python.core.PyFunction.function___call__(PyFunction.java:474)
at org.python.core.PyFunction.__call__(PyFunction.java:469)
at org.python.core.PyFunction.__call__(PyFunction.java:464)
at org.python.core.PyObject._callextra(PyObject.java:589)
at org.python.pycode._pyx1759.wrapper$2(:25)
at org.python.pycode._pyx1759.call_function()
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyBaseCode.call(PyBaseCode.java:306)
at org.python.core.PyBaseCode.call(PyBaseCode.java:197)
at org.python.core.PyFunction.__call__(PyFunction.java:485)
at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:237)
at org.python.core.PyMethod.__call__(PyMethod.java:228)
at org.python.pycode._pyx1756._call_endpoint$9(:50)
at org.python.pycode._pyx1756.call_function()
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyBaseCode.call(PyBaseCode.java:306)
at org.python.core.PyBaseCode.call(PyBaseCode.java:197)
at org.python.core.PyFunction.__call__(PyFunction.java:485)
at org.python.core.PyMethod.__call__(PyMethod.java:187)
at org.python.pycode._pyx1756.get$4(:19)
at org.python.pycode._pyx1756.call_function()
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyBaseCode.call(PyBaseCode.java:306)
at org.python.core.PyBaseCode.call(PyBaseCode.java:197)
at org.python.core.PyFunction.__call__(PyFunction.java:485)
at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:237)
at org.python.core.PyMethod.__call__(PyMethod.java:228)
at org.python.pycode._pyx1751.get_manual_jumps$3(:56)
at org.python.pycode._pyx1751.call_function()
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyBaseCode.call(PyBaseCode.java:150)
at org.python.core.PyFunction.__call__(PyFunction.java:426)
at org.python.pycode._pyx1714.transform$1(:9)
at org.python.pycode._pyx1714.call_function()
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyBaseCode.call(PyBaseCode.java:306)
at org.python.core.PyFunction.function___call__(PyFunction.java:474)
at org.python.core.PyFunction.__call__(PyFunction.java:469)
at org.python.core.PyFunction.__call__(PyFunction.java:464)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:846)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:828)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$TrackingProjectScriptManager.runFunction(ProjectScriptLifecycle.java:832)
at com.inductiveautomation.perspective.gateway.binding.transforms.script.ScriptTransform.runFunction(ScriptTransform.java:116)
at com.inductiveautomation.perspective.gateway.binding.transforms.script.ScriptTransform.synchronousTransformInternal(ScriptTransform.java:162)
at com.inductiveautomation.perspective.gateway.binding.transforms.AbstractSynchronousTransform.transform(AbstractSynchronousTransform.java:30)
at com.inductiveautomation.perspective.gateway.model.AbstractBindingHarness$TransformSequencer.transform(AbstractBindingHarness.java:295)
at com.inductiveautomation.perspective.gateway.model.AbstractBindingHarness$TransformSequencer.run(AbstractBindingHarness.java:308)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at com.inductiveautomation.perspective.gateway.threading.BlockingWork$BlockingWorkRunnable.run(BlockingWork.java:58)

Any ideas on what could be causing this? The answers I got from ChatGPT start to send me down some very complicated rabbit holes...

I would think you've triggered some firewall along the path and it substituted an error page after the headers were delivered.

I'll concur with Phil. Can you set up a persistent trace/Wireshark/whatever ( assuming the traffic isn't TLS)?

IOException fixed content-length: X byes received: y

Kieth, did your title get garbled?

1 Like

Hmmm.... So we are talking about two VMs on the same subnet, one of them being a linux install of Ignition, the other being a linux server running two podman based containers (one for Flask and one for a Graph db)

Per asking the person that setup the infrastructure, it doesnt seem there are any firewalls between the two unless something native with RHEL or Podman could be standing in the way...

Through some rough searches through documentation, it seems like it may be a podman firewall that isn't happy when we send a lot of requests through it, guess there is more searching to do there.

1 Like

To close the loop on this issue:

The root cause of this issue is due to the implementation of the httpClient calls coming from within a function where the data default value is set to None. This causes intermittent issues with the response.

def _send_request(self, req_type, endpoint, params=None, data=None):
    ... <other code>
    response = self.client.get(url, params=params, data=data)
1 Like