Azusfin / lavacoffee

A fast and rich-featured lavalink wrapper for node.js
https://Azusfin.github.io/lavacoffee/index.html
BSD 3-Clause "New" or "Revised" License
7 stars 3 forks source link

Maximum call stack size exceeded #7

Closed rilysh closed 2 years ago

rilysh commented 2 years ago

For myself, it occurred on playerMove event when I'm trying to destroy a current player instance when user manually disconnect the bot from voice channel. When sending data to lavalink somehow seems like node can't able to clean up previous stack Error message

Exception in PromiseRejectCallback:                                          
/home/luha/Desktop/Erna/node_modules/lavacoffee/dist/structures/CoffeeNode.js:178                                                                         
        return new Promise((resolve, reject) => {                            
               ^                                                                                                      
RangeError: Maximum call stack size exceeded                                 
Exception in PromiseRejectCallback:                                          
/home/luha/Desktop/Erna/node_modules/lavacoffee/dist/structures/CoffeeNode.js:178                                                                         
        return new Promise((resolve, reject) => {                            
               ^                                                                                                          
RangeError: Maximum call stack size exceeded                                 
Exception in PromiseRejectCallback:                                          
/home/luha/Desktop/Erna/node_modules/lavacoffee/dist/structures/CoffeeNode.js:178                                                                         
        return new Promise((resolve, reject) => {                            
               ^                                                                                                              
RangeError: Maximum call stack size exceeded                                 
/home/luha/Desktop/Erna/node_modules/lavacoffee/dist/structures/CoffeePlayer.js:86                                                                        
        const node = this.lava.nodes.get(this.options.node);                 
                                     ^                                                                            
RangeError: Maximum call stack size exceeded

Implementation

export default async (client, player, oldChannel, newChannel) => {
    if (!newChannel) {
        setTimeout(() => {
            player.queue.clear();
            if (player) player.destroy();
        }, 2000);
    }
};
rilysh commented 2 years ago

nvm, I was just being dumb and interrupt <Player>.destroy() in two separate events.