https://toitlang.org/ logo
What is Primitive: 18:1 in 2.0.0-alpha.180?
# help
a
Got a stack and would love to know what primitive this is in this version? Perhaps I should write down how to find this out as it seems to come up a fair bit.
Copy code
Potential deadlock detected:
  Process: 3
  Program: a4ae897d-01f6-7c9d-fc35-fbe22fd3660d
  BCI: 0x3365
  Primitive: 18:1
fatal: Potential dead-lock
https://cdn.discordapp.com/attachments/1373951179188342874/1373951179419156550/message.txt?ex=682c473f&is=682af5bf&hm=4126efd35a96988791223e69d72badd507af655b8f6c0c2d239e846e9080b41e& https://cdn.discordapp.com/attachments/1373951179188342874/1373951179910025277/message.txt?ex=682c4740&is=682af5c0&hm=09bb0f07bde59b39883515487541aedabc68906b4aeaa6471797de2f1f7f790d& https://cdn.discordapp.com/attachments/1373951179188342874/1373951180253954089/message.txt?ex=682c4740&is=682af5c0&hm=1178145f4cf401366e9fa615398747cc779d4d855d8a4bc10e57bfa0593a7377& https://cdn.discordapp.com/attachments/1373951179188342874/1373951180560007199/message.txt?ex=682c4740&is=682af5c0&hm=35edc188db635e1f2d38a666ac320c100688bf88244e9befb5b685a3db6ae0bf& https://cdn.discordapp.com/attachments/1373951179188342874/1373951180954406952/message.txt?ex=682c4740&is=682af5c0&hm=53ea06e83ed6dc060e7be6192113df69d2eb35caa734f0c4275b73a4bfcd8e19& https://cdn.discordapp.com/attachments/1373951179188342874/1373951181285752862/message.txt?ex=682c4740&is=682af5c0&hm=3447a006d593da568379f1aeef2dd7e35f9c3ea64d64b17d395f4e3108d54c2b& https://cdn.discordapp.com/attachments/1373951179188342874/1373951181625360394/message.txt?ex=682c4740&is=682af5c0&hm=5a7b9bda582d22db663200febb313d467b398ad8f2f40242d8668fb69ce734b8& https://cdn.discordapp.com/attachments/1373951179188342874/1373951181935607899/message.txt?ex=682c4740&is=682af5c0&hm=d3f2ba2a779693172ea7aeacaf8d286da9610b7c5c2794cc197754d903c52d88&
f
looking
Weird... I have never seen a timeout there.
a
interesting
f
update_resource_monitor
starts with
Locker locker(mutex_)
so this could actually be a real deadlock.
How often does it hapen?
Any idea what could be causing it?
a
Not sure, but got it reported from a client, I myself havn't seen it.
The code makes use of Latches and Channels
Channels working as message inboxes / queues for processing Latches working as things to wait for responses to messages that are potentially being sent
The channels are rather high throughput
f
Still weird. But will discuss it with Kasper in our daily later today.
a
f
(side-note:
kebab-case
!!! 🙂
a
😛
The other non public codes does also...
Copy code
channel_ = Channel 20
....
  channel-send msg/protocol.Message -> none:
    if active_:
      channel_.send msg
...
  run:
    while true:
      while msg / protocol.Message? := channel_.receive --blocking=false:
...
and also have a
location-channel / Channel := ?
that is never used
f
I think the
register-monitor-notifier
is only used when a new object (that can have system events) is created, or when
sleep
is called. During a
receive
call that should have already been done.
k
@addshore Do you think we can get our hands on the snapshot for the program where this fails?
a4ae897d-01f6-7c9d-fc35-fbe22fd3660d
is the id of it, so maybe we can get the snapshot from the envelope.
a
@kasperl I expect so, I'll go and figure that out 🙂
Just the toit files won't be enough right?
f
The toit files might be enough, if we compile to the same snapshot, but the actual snapshot would be more convenient. If you compiled the pod on your machine you can try to find it in
$HOME/local/.state/toit/a4ae897d-01f6-7c9d-fc35-fbe22fd3660d.snapshot
a
aaah lovely! that might be the pointer I needed!
I'll send that over to the person that was running it to see if they can get the snapshot to me
f
The snapshot is also in the pod. So if it's not in the state directory, then you can download the pod and extract it from there.
a
Also, does it mke sense for me to plop this one on github too to track it there?
f
Good question. Probably yes. Currently it doesn't look like a 5-minute fix.
a
Ill go write it now and summarize what is here so far
k
Unsurprisingly the snapshot shows that the bytecode that we're stuck in for too long is the
invoke primitive
bytecode (0x3365 = 13157):
Copy code
13149: register-monitor-notifier_ <sdk>/core/events_.toit:73:1
  0/13153 [018] - load local 4
  1/13154 [048] - as class RpcRequestQueue_?(125 - 136)
  3/13156 [041] - pop 1
  4/13157 [089] - invoke primitive {events::register_monitor_notifier}
  8/13161 [053] - invoke static throw <sdk>/core/exceptions.toit:39:1
 11/13164 [041] - pop 1
2 Views