Closed Linguardium closed 1 year ago
So, I will take a look today, but if you have time, can you provide a screenshot of your setup or answer to following question:
Aof6 1.7.1 for modlist. The network spanned a chunk barrier but i was standing in one of the 2 facing the other. All chunks stayed loaded. I was passing around wrapped peripherals rather than doing storing the name and using a name lookup each time. Only wired modems with the 1 computer. I did have issues when multiple inventories were connected to a full block modem and there was still one of those in the setup. The rest were panels.
Unfortunately pack just updated with breaking changes and I wiped the instance with the setup.
The storage worked fine normally but randomly gave not connected errors. Restarting the script worked fine again
More information: I seem to only run into this issue when using parallel. I built some new code on the new version and everything worked fine until I used parallel to run functions. While i dont have a minimum reproducible code, everything is looked up by peripheral name this time using global static variables and peripheral.call
.
So, you just using several (like 6 or less) inventory peripheral in paraller and this occurs time to time?
items are moved in phases, from inventory 1 to inventory 2, then pause 1 second and check if inventory 2 is done with it, if so, move to inventory 3, etc
during pauses, inventories are checked for counts and and update messages are sent to a monitor.
occasionally, when attempting to move the item, it will fail and say the peripheral is not connected (though when this happened i had some printouts specifically getting the peripheral information from the network, so it was clearly attached)
it still does happen without parallel (coroutine library in cc) but is significantly more frequent when using it. definitely feels like a race condition of some sort.
the system as a whole is only moving 1 item through it at a time, so there is never a blocking situation in any target inventory
did some more testing...
when listening to the attached and detached events, i notice that certain peripheral modems are being detached and attached (these correspond to the error occurs). I am wondering if this has to do with block entities updating states on blocks (replacing the blockstate with the new one with the new property)
I will do some more testing but with the current testing it appears that when a block entity updates a blockstate, it causes a detach and refresh event. I am not certain, but I would assume that if item movement calls are being made after the invalidation but before the refresh, it would give a "not attached" message.
I have tested this with a modem attached to a barrel and a lua script listening for detach events. when i open the barrel (and thus the state changes to show it is being looked at), it fires the detach event
So, this is common CC:T (or CC:T) behavior, because any block update around computer/model causes peripheral re-connection (like here). This behavior is by design and unfortunately, there is nothing to fix here.
The real question, I suppose, do this happens only when block state changes or there is some heisenbug in UPW that causes it to happens also ....
Yeah, i will test only CC:T and see if the problem can be replicated there alone, now that i have some test cases. thanks for bearing with me
Ok, is reproducible and is caused by UPW Test setup:
3 barrels with modems attached. 1 computer with modem attached. cables connected to all
put an item in one of the barrels write a script loop to cycle the item from barrel1 to 2, wait, then 2 to 3 then back while script is running, open a barrel a few times in succession
I tested with just CC:T, with CC:T+Peripheralium only, and with CC:T+UPW
If "Enable Generic Inventory" is enabled, you can crash the program by opening the barrel. if not, it doesnt crash.
crashlog: https://snippet.host/gzyrpg
So, I build a reproducible environment, however, I requested help about this issue, because I have literally zero idea why this happening.
It is seems that modem (?) is not connected anymore or something like this, which is very strange ... I will try to debug, but I am not sure, that I will have something
So, you can try new peripheralium and UPW, that released today, this should be fixed.
Issue is not closed, because this problem also need to be fixed in 1.19.4 and 1.20.1
Seems to be resolved. Thanks for all the effort :)
Thank you for helping solving this out!
Update for all versions, except 1.19.4 (let is just die)
[✔] peripheralium-0.4.21-1.19.2 [✔] peripheralworks-0.2.8
(AOF6 1.7.1)
Stading next to the network using wired modems, occasionally receive errors saying it could not connect to a peripheral. log shows error: