Open d3x0r opened 7 years ago
I'm really bad at debugging from stack traces, do you know what code triggered it?
Gun.chain.map (M:\eqube\Vegas\trunk\javascript\eqube\linkedGame2\server\node_modules\gun\gun.js:2196:14)
@amark something like this causes it...
var Gun = require( "gun/gun" );
var f = require( "gun/lib/file.js" );
var a = Gun( { file:"game.json" } );
a.get("gameState").map( (val,field)=>{
console.log( "got gamestate:", field, val )
} );
but that doesn't cause it. It's when the map happens that the stack trace starts... if I remove the lib/file.js it doesn't happen
the code....
Error.stackTraceLimit = Infinity;
var Gun = require( "gun/gun" );
var f = require( "gun/lib/file.js" );
Gun.on('in', function(msg){ this.to.next(msg); } )
var a = Gun( { file:"game.json" } );
var ad = a.get( "gameState" );
var monitorQueue = [];
ad.map( (val,field)=>{
console.log( "got gamestate:", field, val )
if( field === "monitor" ) {
if( monitorQueue.length === 0 )
ad.put( { nextcall: val } );
monitorQueue.push( val );
}
} );
the data ... game.json
{
"graph": {
"gameState": {
"_": {
">": {
"nextcall": 1491512372274,
"monitor": 1491512099265.01
},
"#": "gameState"
},
"nextcall": 80,
"monitor": 74
}
}
}
I change 'nextcall' when I receive 'monitor' ONCE but that causes infinite recursion reloading from the file.
3 stack traces - the first is the last 'short' stacktrace I get; it's the last value of the file, followed by the first value in the file, with additional stack.... the third stack trace is the same 'nextCall 74' that is the second trace; except much deeper in recursion.
When my process starts now, it generates inifnite recusive loads of the file data. (although it does seem to be hearing from a client also; because the file has nextcall as 80 and not 74.
And one of the last ones
This is all of the file...