Closed Toumal closed 12 years ago
Unable to duplicate on latest (8e6b451459). Is the problem present if you use the API directly through a browser? Does it happen with any value, and not just the return value of SF::uid()
?
I tried other values instead of 13, and also random strings, email addresses....
I also tried createGroup() - same problem. Reinstalled nodeJS, nothing. Also tried with an older 0.6.6 of nodeJS, same behavior...
Try running node --trace server.js
and see what the backtrace looks like on the error.
...(this=0x1700cd000061, Content-Type, <undefined>) {
5483: ...(this=0x1700cd000061, Content-Type) {
5484: ...toLowerCase(this=Content-Type) {
5484: ...} -> content-type
5483: ...} -> application/json; charset=utf-8
5482: ...} -> application/json; charset=utf-8
5482: ...(this=0x1700cd000061, Content-Length,
Ends with this: (well aside from the graceful shutdown messages)
20: (this=0x1700cc02ad61, 0x1700cc02ac91) {
20: } ->
I really appreciate your time and help!
Any idea what's the cause? Is there any other part of the log that I should post to help shed more light on it?
Looking at the log entry you posted, it almost looks like eplite returns the JSON response and then crashes. Is that the case or not?
Also, does this still happen on the latest revision? If so, please specify the revision you're referring to, since "latest" is a moving target.
I'm a git newbie, forgive my lack of specific revision... For what it's worth, I made an update today, same result.
And yeah, It does seem to generate the API - RESPONSE correctly and then crash.
Is there anything node.js related that I should reinstall or wipe or something? This is on ubuntu linux btw.
node 0.6.10 is pretty recent, I think. Can't imagine that a reinstall would help. But it's easy, couldn't hurt.
You say it correctly generates the response, which makes me wonder if it's a problem outside of eplite. Sure you have the latest dependencies installed with bin/installDeps.sh
? (I'm grasping at straws here)
Yeah. Is there maybe a way I could erase all the dependencies and have them redownloaded? (Sorry, quite new to node.js too)
In the root of your eplite dir, remove the node_modules directory. Then just run bin/installDeps.sh
.
Ok, did that, also did a clean checkout and reinstalled node.js
My config is default, with mysql (same effect with the dirty db) and that seems to work because it retrieves the mapper2group bit from the db successfully.
Same effect.
PHP reports this:
fopen(http://blablabla.com:9001/api/1/createGroupIfNotExistsFor) [function.fopen]: failed to open stream: HTTP request failed!
This is what I get in the logs:
[2012-02-21 15:14:38.785] [INFO] console - Your Etherpad Lite git version is 10cbb48 [2012-02-21 15:14:38.788] [INFO] console - Report bugs at https://github.com/Pita/etherpad-lite/issues [2012-02-21 15:14:38.986] [INFO] console - Server is listening at 0.0.0.0:9001 [2012-02-21 15:14:38.987] [INFO] console - info - 'socket.io started' [2012-02-21 15:14:43.081] [INFO] API - REQUEST, createGroupIfNotExistsFor, {"groupMapper":"13","apikey":"rFqIF49IlsRy5frbAi1gzitSA8bKZVPD"} [2012-02-21 15:14:43.087] [DEBUG] ueberDB - GET - mapper2group:13 - "g.srx6RjSTUxHFWfrw" - from database [2012-02-21 15:14:43.087] [INFO] API - RESPONSE, createGroupIfNotExistsFor, {"code":0,"message":"ok","data":{"groupID":"g.srx6RjSTUxHFWfrw"}} [2012-02-21 15:14:43.110] [ERROR] console - [RangeError: Maximum call stack size exceeded] [2012-02-21 15:14:43.113] [INFO] console - graceful shutdown... [2012-02-21 15:14:43.113] [INFO] console - db sucessfully closed.
This is what I get:
[2012-02-21 15:09:47.102] [INFO] console - Your Etherpad Lite git version is 10cbb48 [2012-02-21 15:09:47.112] [INFO] console - Report bugs at https://github.com/Pita/etherpad-lite/issues [2012-02-21 15:09:47.650] [INFO] console - Server is listening at 0.0.0.0:9001 [2012-02-21 15:09:47.651] [INFO] console - info - 'socket.io started' [2012-02-21 15:09:57.991] [INFO] API - REQUEST, createGroupIfNotExistsFor, {"groupMapper":"13","apikey":"rFqIF49IlsRy5frbAi1gzitSA8bKZVPD"} [2012-02-21 15:09:57.994] [DEBUG] ueberDB - GET - mapper2group:13 - "g.srx6RjSTUxHFWfrw" - from database [2012-02-21 15:09:58.001] [INFO] API - RESPONSE, createGroupIfNotExistsFor, {"code":0,"message":"ok","data":{"groupID":"g.srx6RjSTUxHFWfrw"}} [2012-02-21 15:09:58.019] [ERROR] console - [RangeError: Maximum call stack size exceeded] [2012-02-21 15:09:58.022] [INFO] console - graceful shutdown... [2012-02-21 15:09:58.064] [INFO] console - db sucessfully closed.
This is the part of the trace log where things go haywire. It starts doing the log output and building the http response, and then it just loops:
23: (this=0x190ae78b54a1, .[32m[2012-02-21 15:22:00.594] [INFO] API - .[39mRESPONSE, createGroupIfNotExistsFor, {"code":0,"message":"ok","data":{"groupID":"g.srx6RjSTUxHFWfrw"}}) {
24: replace(this=.[32m[2012-02-21 15:22:00.594] [INFO] API - .[39mRESPONSE, createGroupIfNotExistsFor, {"code":0,"message":"ok","data":{"groupID":"g.srx6RjSTUxHFWfrw"}}, 0x1c5bf38e9281, 0x296d95049371) {
25: StringReplaceGlobalRegExpWithFunction(this=
Sure wish I could duplicate this. Here are some thoughts:
exports.createGroupIfNotExistsFor
function. Put in some debug prints (or use a debugger) and see what's what when things go to pot. If that function seems okay (and it looks like it is), then find the caller, and debug the callback it's passing.Just FYI, I found that when I clear my database I can fetch the list, but as soon as I try to insert a new pad via the API I get the error again. This is the content of my db:
mysql> select * from store; +------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | key | value | +------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | MYSQL_MIGRATION_LEVEL | 1 | | author2sessions:a.9lnU4M9wVGDSiRBQ | {"sessionIDs":{"s.4IWBtEDuKBGUK5YP":1,"s.zKPYDNCuvPvyGeQd":1,"s.A5VaazC0mgz2cpwR":1,"s.jzLVgf74gkY0pM7l":1,"s.9nubsHiFVp4nnUH2":1,"s.FLU6Q9olZu9vEv0O":1,"s.l8MHIiKRsHuHf6l4":1,"s.UgCfeb7TCeC3FRe9":1,"s.78FquMjpH8QJxZYm":1,"s.if17FFpgQBG5ho4U":1,"s.TYTtWUeWdbuGZeax":1,"s.Cizi37JnqXOHBQHD":1,"s.kHSOEjOM8gTrtAYf":1}} | | globalAuthor:a.9lnU4M9wVGDSiRBQ | {"colorId":30,"name":"13","timestamp":1331491359546} | | group2sessions:g.9H16WKS4g7eSId0Q | {"sessionIDs":{"s.4IWBtEDuKBGUK5YP":1,"s.zKPYDNCuvPvyGeQd":1,"s.A5VaazC0mgz2cpwR":1,"s.jzLVgf74gkY0pM7l":1,"s.9nubsHiFVp4nnUH2":1,"s.FLU6Q9olZu9vEv0O":1,"s.l8MHIiKRsHuHf6l4":1,"s.UgCfeb7TCeC3FRe9":1,"s.78FquMjpH8QJxZYm":1,"s.if17FFpgQBG5ho4U":1,"s.TYTtWUeWdbuGZeax":1,"s.Cizi37JnqXOHBQHD":1,"s.kHSOEjOM8gTrtAYf":1}} | | group:g.9H16WKS4g7eSId0Q | {"pads":{}} | | mapper2author:Toumal | "a.9lnU4M9wVGDSiRBQ" | | mapper2group:13 | "g.9H16WKS4g7eSId0Q" | | session:s.4IWBtEDuKBGUK5YP | {"groupID":"g.9H16WKS4g7eSId0Q","authorID":"a.9lnU4M9wVGDSiRBQ","validUntil":1331506800} | | session:s.78FquMjpH8QJxZYm | {"groupID":"g.9H16WKS4g7eSId0Q","authorID":"a.9lnU4M9wVGDSiRBQ","validUntil":1331506800} | | session:s.9nubsHiFVp4nnUH2 | {"groupID":"g.9H16WKS4g7eSId0Q","authorID":"a.9lnU4M9wVGDSiRBQ","validUntil":1331506800} | | session:s.A5VaazC0mgz2cpwR | {"groupID":"g.9H16WKS4g7eSId0Q","authorID":"a.9lnU4M9wVGDSiRBQ","validUntil":1331506800} | | session:s.Cizi37JnqXOHBQHD | {"groupID":"g.9H16WKS4g7eSId0Q","authorID":"a.9lnU4M9wVGDSiRBQ","validUntil":1331506800} | | session:s.FLU6Q9olZu9vEv0O | {"groupID":"g.9H16WKS4g7eSId0Q","authorID":"a.9lnU4M9wVGDSiRBQ","validUntil":1331506800} | | session:s.TYTtWUeWdbuGZeax | {"groupID":"g.9H16WKS4g7eSId0Q","authorID":"a.9lnU4M9wVGDSiRBQ","validUntil":1331506800} | | session:s.UgCfeb7TCeC3FRe9 | {"groupID":"g.9H16WKS4g7eSId0Q","authorID":"a.9lnU4M9wVGDSiRBQ","validUntil":1331506800} | | session:s.if17FFpgQBG5ho4U | {"groupID":"g.9H16WKS4g7eSId0Q","authorID":"a.9lnU4M9wVGDSiRBQ","validUntil":1331506800} | | session:s.jzLVgf74gkY0pM7l | {"groupID":"g.9H16WKS4g7eSId0Q","authorID":"a.9lnU4M9wVGDSiRBQ","validUntil":1331506800} | | session:s.kHSOEjOM8gTrtAYf | {"groupID":"g.9H16WKS4g7eSId0Q","authorID":"a.9lnU4M9wVGDSiRBQ","validUntil":1331506800} | | session:s.l8MHIiKRsHuHf6l4 | {"groupID":"g.9H16WKS4g7eSId0Q","authorID":"a.9lnU4M9wVGDSiRBQ","validUntil":1331506800} | | session:s.zKPYDNCuvPvyGeQd | {"groupID":"g.9H16WKS4g7eSId0Q","authorID":"a.9lnU4M9wVGDSiRBQ","validUntil":1331506800} | +------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
I did some debugging and the CreateGroupIfNotExistsFor function seems fine.
It crashes in server.js right at the res._send(response) line:
//This is for making an api call, collecting all post information and passing it to the apiHandler
var apiCaller = function(req, res, fields)
{
apiLogger.info("API CALL");
res.header("Content-Type", "application/json; charset=utf-8");
apiLogger.info("REQUEST, " + req.params.func + ", " + JSON.stringify(fields));
//wrap the send function so we can log the response
res._send = res.send;
res.send = function(response)
{
apiLogger.info("Before stringify");
response = JSON.stringify(response);
apiLogger.info("RESPONSE, " + req.params.func + ", " + response);
//is this a jsonp call, if yes, add the function call
apiLogger.info("Before jsonp");
if(req.query.jsonp)
response = req.query.jsonp + "(" + response + ")";
apiLogger.info("Before send");
--------------------------This is the last seen log output ---------------------------------------
res._send(response);
}
//call the api handler
apiLogger.info("Before handle call");
apiHandler.handle(req.params.func, fields, req, res);
apiLogger.info("After handle call");
}
Console output:
[2012-03-11 14:01:19.703] [INFO] API - API POST CALL [2012-03-11 14:01:19.705] [INFO] API - API CALL [2012-03-11 14:01:19.705] [INFO] API - REQUEST, createGroupIfNotExistsFor, {"groupMapper":"13","apikey":"rFqIF49IlsRy5frbAi1gzitSA8bKZVPD"} [2012-03-11 14:01:19.705] [INFO] API - Before handle call [2012-03-11 14:01:19.707] [INFO] API - After handle call [2012-03-11 14:01:19.711] [DEBUG] ueberDB - GET - mapper2group:13 - null - from database [2012-03-11 14:01:19.712] [DEBUG] ueberDB - SET - group:g.loAuZDZyATt3pXP9 - {"pads":{}} - to buffer [2012-03-11 14:01:19.712] [INFO] API - Before stringify [2012-03-11 14:01:19.713] [INFO] API - RESPONSE, createGroupIfNotExistsFor, {"code":0,"message":"ok","data":{"groupID":"g.loAuZDZyATt3pXP9"}} [2012-03-11 14:01:19.713] [INFO] API - Before jsonp [2012-03-11 14:01:19.713] [INFO] API - Before send [2012-03-11 14:01:19.749] [ERROR] console - [RangeError: Maximum call stack size exceeded] [2012-03-11 14:01:19.752] [INFO] console - graceful shutdown... [2012-03-11 14:01:19.768] [INFO] ueberDB - Flushed 1 values
I'm sorry I'm not well versed with node.js, any hints on how I can debug the response handling? It's rather opaque to me at the moment...
At the risk of being a nuisance, I'd very much like to find the reason behind this error and I'd appreciate any pointers.
No, you're definitely not being a nuisance. Sorry it's taken me so long to look into this. I've just started a new job and haven't had much time for open source lately.
It looks like an infinite recursive loop, but I'm not totally sure how it's happening. You'll have to be my eyes and ears since I still can't duplicate this. I've put a branch up at https://github.com/jhollinger/etherpad-lite/tree/bad. Check it out (either literally or just copy my changes) and see if it has any effect.
@Toumal, can you confirm that the above patch fixes this?
Yes! Awesome, thanks a lot!
This is on the latest revision, node 0.6.10:
Calling any group related API function results in a "RangeError: Maximum call stack size exceeded":
I'm using the php etherpad lite client, doing the following:
Etherpad works fine via the web frontend, no issues creating pads and editing them...
Anyone have any clues for me what I'm doing wrong?