# writeBlocking function issue

**URL:** <https://forum.inductiveautomation.com/t/writeblocking-function-issue/70954>\
**Category:** Ignition\
**Created:** [March 13, 2023, 8:53am UTC](https://forum.inductiveautomation.com/t/writeblocking-function-issue/70954 "2023-03-13T08:53:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![grzegorz.kaczmarczyk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/grzegorz.kaczmarczyk/32/24167_2.png) [@grzegorz.kaczmarczyk](https://forum.inductiveautomation.com/u/grzegorz.kaczmarczyk)\
**Post date:** [March 13, 2023, 8:53am UTC](https://forum.inductiveautomation.com/t/writeblocking-function-issue/70954/1 "2023-03-13T08:53:46Z")

</div>

Hi,

so normally writeBlocking function works pretty well, but I found in our archive history, that once writeBlocking took about 30 seconds to write a value to the tag, where normally it's about 200 ms. What could cause the issue and is there any solution to prevent it.

---

<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:** [March 13, 2023, 9:25am UTC](https://forum.inductiveautomation.com/t/writeblocking-function-issue/70954/2 "2023-03-13T09:25:21Z")

</div>

> [@grzegorz.kaczmarczyk](#):
>
> where normally it's about 200 ms

That's really long for "normal". It suggests that your PLC communications are heavily loaded, and occasionally overloaded. Fix that.

The whole point of `writeBlocking()` is to wait for the write to finish, or yield an error. Writes to memory tags should take a fraction of a millisecond. Writes to OPC tags with typical loading should take a few tens of milliseconds or less.

---

<div class="post-metadata">

**Author:** ![grzegorz.kaczmarczyk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/grzegorz.kaczmarczyk/32/24167_2.png) [@grzegorz.kaczmarczyk](https://forum.inductiveautomation.com/u/grzegorz.kaczmarczyk)\
**Post date:** [March 13, 2023, 9:39am UTC](https://forum.inductiveautomation.com/t/writeblocking-function-issue/70954/3 "2023-03-13T09:39:00Z")

</div>

Hmm, we have a OPC server between PLC and Ignition. Do you think, that this could make some delays?

---

<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:** [March 13, 2023, 9:39am UTC](https://forum.inductiveautomation.com/t/writeblocking-function-issue/70954/4 "2023-03-13T09:39:46Z")

</div>

Not typically. But that OPC server could be heavily loaded or overloaded.

---

<div class="post-metadata">

**Author:** ![grzegorz.kaczmarczyk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/grzegorz.kaczmarczyk/32/24167_2.png) [@grzegorz.kaczmarczyk](https://forum.inductiveautomation.com/u/grzegorz.kaczmarczyk)\
**Post date:** [March 13, 2023, 9:41am UTC](https://forum.inductiveautomation.com/t/writeblocking-function-issue/70954/5 "2023-03-13T09:41:39Z")

</div>

Aaa, I forgot to mention, that there is a script before writeBlocking, so this could take some time.

But there is still question about those 30 seconds response. What could cause it?

---

<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:** [March 13, 2023, 9:43am UTC](https://forum.inductiveautomation.com/t/writeblocking-function-issue/70954/6 "2023-03-13T09:43:47Z")

</div>

An overloaded OPC connection or PLC connection is the only obvious reason, within `writeBlocking`. You should use `java.lang.System.nanoTime()` before and after that call to verify the delay is really at that spot.

---

<div class="post-metadata">

**Author:** ![grzegorz.kaczmarczyk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/grzegorz.kaczmarczyk/32/24167_2.png) [@grzegorz.kaczmarczyk](https://forum.inductiveautomation.com/u/grzegorz.kaczmarczyk)\
**Post date:** [March 13, 2023, 10:19am UTC](https://forum.inductiveautomation.com/t/writeblocking-function-issue/70954/7 "2023-03-13T10:19:02Z")

</div>

Thanks for your response. I found in archive, that there are missing heartbeat signals (1 s) exactly in the moment, where writeBlocking responded after 30 seconds. We will monitor PLC and OPC connection.
