You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Steven, hope the new year is treating you well!
I've tracked down a bug which is resulting in excel crashing suddenly with no warning. I believe it's tied to publishing numpy string arrays and when memory is freed on the python side.
Repro
Here's an example that can be run with a sheet locally. I've reproduced the crash on win10/win11, 32/64 bit, xloil 0.18.5/0.19.1 . I can provide more example cases if that would be helpful.
One additional case I need to send myself from another PC was if a global variable rather than local is published then the sheet doesn't crash. ( presumably since memory isn't freed )
importtimeimportxloilasxloimportasyncioTOPIC="BUGHUNT"_rtdServer=xlo.RtdServer()
asyncdefcrashes_1():
_rtdServer.publish(TOPIC, [["danger"]])
awaitasyncio.sleep(10)
_rtdServer.publish(TOPIC, [["safe!",1]])
asyncdefsafe_1():
_rtdServer.publish(TOPIC, [["no danger", 1]])
awaitasyncio.sleep(10)
_rtdServer.publish(TOPIC, [["safe!",1]])
asyncdefsafe_2():
_rtdServer.publish(TOPIC, [["danger"]])
_rtdServer.publish(TOPIC, [["no danger", 1]])
awaitasyncio.sleep(10)
_rtdServer.publish(TOPIC, [["safe!",1]])
asyncdefcrashes_2():
_rtdServer.publish(TOPIC, ["danger"])
asyncdefsafe_3():
_rtdServer.publish(TOPIC, "safe")
asyncdefcrashes_3():
_rtdServer.publish(TOPIC, ["danger"])
time.sleep(10)
asyncdefsafe_4():
_rtdServer.publish(TOPIC, [["safe"],[1]])
asyncdefcrashes_4():
"""Tuples aren't safe either..."""_rtdServer.publish(TOPIC, ("danger",))
asyncdefsafe_6():
"""unless they aren't 1x1"""_rtdServer.publish(TOPIC, ("safe","safe"))
TARGET_FUNC=crashes_4classExamplePublisher(xlo.RtdPublisher):
def__init__(self):
super().__init__() # You *must* call this explicitly or the python binding library will crashself._task=Nonedefconnect(self, num_subscribers):
ifself.done():
self._task=xlo.get_async_loop().create_task(TARGET_FUNC())
defdisconnect(self, num_subscribers):
ifnum_subscribers==0:
self.real_stop()
returnTrue# This publisher is no longer required: schedule it for destructiondefstop(self):
passdefreal_stop(self):
ifself._taskisnotNone:
self._task.cancel()
defdone(self):
returnself._taskisNoneorself._task.done()
deftopic(self):
returnTOPIC@xlo.func(local=False,rtd=True)defxloilRTDFunc( ):
if_rtdServer.peek(TOPIC) isNone:
publisher=ExamplePublisher()
_rtdServer.start(publisher)
return_rtdServer.subscribe(TOPIC)
@xlo.func(local=False,rtd=True)asyncdefxloilDirectRTDFunc( ):
"""Note that directly returning the values doesn't cause the same crashes"""yield"safe1"awaitasyncio.sleep(2)
yield ["safe2"]
awaitasyncio.sleep(2)
yield [["safe3"]]
awaitasyncio.sleep(2)
yield ["safe4",1]
I managed to compile xloil locally and drop breakpoints. Unfortunately it has been hard to spot exactly where the issue is here since the crash doesn't occur right away. Please let me know if there's anything I can test or check which would be helpful in narrowing this down!
The text was updated successfully, but these errors were encountered:
Hi Steven, hope the new year is treating you well!
I've tracked down a bug which is resulting in excel crashing suddenly with no warning. I believe it's tied to publishing numpy string arrays and when memory is freed on the python side.
Repro
Here's an example that can be run with a sheet locally. I've reproduced the crash on win10/win11, 32/64 bit, xloil 0.18.5/0.19.1 . I can provide more example cases if that would be helpful.
One additional case I need to send myself from another PC was if a global variable rather than local is published then the sheet doesn't crash. ( presumably since memory isn't freed )
I managed to compile xloil locally and drop breakpoints. Unfortunately it has been hard to spot exactly where the issue is here since the crash doesn't occur right away. Please let me know if there's anything I can test or check which would be helpful in narrowing this down!
The text was updated successfully, but these errors were encountered: