Monitoring for long_message_queue
is out in OTP 27.
The messages sent to the monitoring process when the threshold is exceeded look like {monitor, Pid, long_message_queue, true}
. The pid is the process whose mailbox is backed up, but without more context, a pid isn’t very informative.
What information can you get about a process without putting more messages into its mailbox? Registered name? Process label? Initial call? Anything else?
process_info(Pid, dictionary)
will give you a hint of what it is. We put(name, i_am_a_cache_cleaner)
into dictionary, it helps a lot.
process_info(Pid, binary)
will help to find leakage. process_info(Pid,memory)
will help with heap usage.
process_info(Pid, [current_function,current_stacktrace,status,message_queue_len,dictionary,total_heap_size])
is a must to call on such bad processes to get idea of what is happening.
Sending messages is useless, it is already blocked.
Nice. I wasn’t sure if those process_info
checks would be mailbox messages. 
You can also do process_info(Pid, {dictionary, specific_key})
as of OTP 26.2.
1 Like
@maxlapshin BTW if you use the new proc_lib:set_label/1
, it will store that under $process_label
in the process dictionary, like your i_am_a_cache_cleaner
trick except that :observer
and logs may display it too.
1 Like
yes, it is a great idea. One of those dozens that we have done, but were too lazy to push to upstream =(