# Write to client memory tag fails in tag event, yet succeeds in client timer event

**URL:** <https://forum.inductiveautomation.com/t/write-to-client-memory-tag-fails-in-tag-event-yet-succeeds-in-client-timer-event/16048>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [November 19, 2017, 3:57am UTC](https://forum.inductiveautomation.com/t/write-to-client-memory-tag-fails-in-tag-event-yet-succeeds-in-client-timer-event/16048 "2017-11-19T03:57:54Z")\
**Posts on this page:** 1\
**Showing post:** 9

<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 16, 2023, 8:36pm UTC](https://forum.inductiveautomation.com/t/write-to-client-memory-tag-fails-in-tag-event-yet-succeeds-in-client-timer-event/16048/9 "2023-06-16T20:36:06Z")

</div>

Sounds like you need to write a driver.

Mainly because you need locking. But jython-based locking in Ignition is extremely difficult to implement correctly, because the jython life cycle for Ignition is based on projects--project saves due to designer edits throw away your code and any locks and sockets you might have created. But if you have threads running with those existing code modules and objects, they'll continue living in parallel until the thread exits.

See this recent topic and all its linked discussions:

> [@Gateway Script Error: super(type, obj): obj must be an instance or subtype of type](https://forum.inductiveautomation.com/t/gateway-script-error-super-type-obj-obj-must-be-an-instance-or-subtype-of-type/51042/9):
>
> Yes. A project save does not kill off any running threads, and does not replace the code within them. The memory of the entire old interpreter, with old objects, is stuck in process memory until the thread finishes. If you are using system.util.getGlobals() and friends, or attaching jython classes to SDK APIs, old and new objects can mix. (And old objects can get stuck.)

TL/DR: Don't use sockets in anything but gateway (not Perspective) scope, and just open/write/read/close in a single operation unless you follow all the "rules" for long-lived threads and objects.

---

_[View the full topic](https://forum.inductiveautomation.com/t/write-to-client-memory-tag-fails-in-tag-event-yet-succeeds-in-client-timer-event/16048)._
