Closed GeekyDeaks closed 7 years ago
As I have mentioned in our previous conversations, I looked seriously at PM2, but have since moved away from implementing it. It very well may be (given that I have not had a chance to take a look at this, I could have no idea what the hades I am talking about, but...) you might could move away from PM2 if everything works ok without it.
Yeah - I think you are absolutely right, but I am a pedantic ass and it's bugging me :) - mostly because I don't actually think it's a PM2 problem per se.
I tried replicating it on a little RPi, but for some reason it's not failing. I think I'm going to have to create a debug environment on intel to dig further.
ok - I can get it to hang without pm2 in node v6.6.0. I occurs immediately after running the !advisor
command.
You know I posted something in your chat the other day about having some issues and if I remember correctly, the advisor cmd was what I wanted to checkout.
yeah - I forgot about that - too much stuff going on :)
Figured it out. It's a bug in the fancy (i.e. unnecessarily complex) message building code. It does not handle blank messages correctly, so when the trials part returns nothing it causes it to go into an infinite loop.
Odd problem - migrated to discord.js v9 and everything was looking good on my dev box (OSX). Moved it to the staging environment (linux / pm2) and it repeated hangs after a few commands. Unfortunately it does not just crash, so pm2 leaves the process in a brain dead state. I can also replicate this on my OSX machine by running the bot under pm2 and sending a few commands.
Fun facts:
I attached
lldb
to the process once it had hung and it seems to be spinning on a lock. When taking a look undertruss
I noticed that all the V8 worker threads were waiting for the same semaphore. Here is the state of all the threads fromlldb
:Looks suspiciously like a classic deadlock.
I am not familiar with the OSX data structures, so I am going to replicate the environment on a linux machine I can use
gdb
to figure out which thread had the lock and hopefully how it got there.