# Read timed out but only when using Vision

**URL:** <https://forum.inductiveautomation.com/t/read-timed-out-but-only-when-using-vision/91343>\
**Category:** Ignition\
**Tags:** scripting, vision, perspective\
**Created:** [June 4, 2024, 1:55pm UTC](https://forum.inductiveautomation.com/t/read-timed-out-but-only-when-using-vision/91343 "2024-06-04T13:55:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cal](https://avatars.discourse-cdn.com/v4/letter/c/f1d935/32.png) [@Cal](https://forum.inductiveautomation.com/u/Cal)\
**Post date:** [June 4, 2024, 1:55pm UTC](https://forum.inductiveautomation.com/t/read-timed-out-but-only-when-using-vision/91343/1 "2024-06-04T13:55:14Z")

</div>

Currently, I am able to run the following in Perspective using a change script of a label that is updated by a PLC tag:

`collect = system.db.runNamedQuery("Collect",{"CollectId": collectId})`

When I attempt to run the same thing in a propertyChange Script Editor of a label in Vision I receive the following error and I'm not sure what I need to do differently; does anyone have any tips on what may be the issue?

```python
Traceback (most recent call last):
  File "<event:propertyChange>", line 23, in <module>
com.inductiveautomation.ignition.client.gateway_interface.GatewayException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Read timed out

	caused by GatewayException: Read timed out
	caused by SocketTimeoutException: Read timed out

Ignition v8.1.32 
Java: Azul Systems, Inc. 11.0.18

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 4, 2024, 1:56pm UTC](https://forum.inductiveautomation.com/t/read-timed-out-but-only-when-using-vision/91343/2 "2024-06-04T13:56:51Z")

</div>

Vision has a hard 60-second time limit on remote procedure calls to the gateway. Any query that takes longer will fail.

(That is an astonishingly slow query to run from a user interface.)

---

<div class="post-metadata">

**Author:** ![Cal](https://avatars.discourse-cdn.com/v4/letter/c/f1d935/32.png) [@Cal](https://forum.inductiveautomation.com/u/Cal)\
**Post date:** [June 4, 2024, 1:57pm UTC](https://forum.inductiveautomation.com/t/read-timed-out-but-only-when-using-vision/91343/3 "2024-06-04T13:57:56Z")

</div>

What do you recommend as an alternative?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 4, 2024, 2:05pm UTC](https://forum.inductiveautomation.com/t/read-timed-out-but-only-when-using-vision/91343/4 "2024-06-04T14:05:24Z")

</div>

If you absolutely have to tolerate unusually long queries, a workable (_not_ **simple** ) approach would be:

- Use `system.util.sendRequest()` to ask a gateway message handler to start the query in an asynchronous task. Have it immediately return a unique token for the task.

- In the asynchronous task, when complete, use `system.util.sendMessage()` to deliver the query result to the origin client ID, with the token in the payload, too.

- In the client, place the token and some followup task information in a library script top-level dictionary. Perhaps with a timeout value.

- Define a client message handler to receive completed queries, popping the tokens from the dictionary, and performing the follow-up task.

- Define a client timer event to occasionally loop through the dictionary, checking and handling timeouts.

I recommend figuring out how to make that query reliably return results in a couple seconds.

---

<div class="post-metadata">

**Author:** ![Cal](https://avatars.discourse-cdn.com/v4/letter/c/f1d935/32.png) [@Cal](https://forum.inductiveautomation.com/u/Cal)\
**Post date:** [June 4, 2024, 2:07pm UTC](https://forum.inductiveautomation.com/t/read-timed-out-but-only-when-using-vision/91343/5 "2024-06-04T14:07:51Z")

</div>

Thank you. I will look into what you suggested.
