Permalink
Browse files

Update src/dutil.js

Set TRIM_DEFAULT_LENGTH to 256.
  • Loading branch information...
dhruvbird committed Jul 31, 2012
1 parent 779bfb7 commit a1c22038aa8046336325c623c0a8b4d41558ab70
Showing with 1 addition and 3 deletions.
  1. +1 −3 src/dutil.js
View
@@ -26,7 +26,7 @@
var us = require('underscore');
// The maximum number of characters that a single log line can contain
-var MAX_CHARS_IN_LOG_LINE = 4096;
+var TRIM_DEFAULT_LENGTH = 256;
var _log_level = 4;
var _log_levels = {
@@ -283,8 +283,6 @@ function replace_promise(s, victim, replacement) {
});
}
-var TRIM_DEFAULT_LENGTH = 80;
-
function trim_promise(s, len) {
return new ToStringPromise(function() {
len = len || TRIM_DEFAULT_LENGTH;

4 comments on commit a1c2203

@zandu

This comment has been minimized.

Show comment Hide comment
@zandu

zandu Aug 26, 2012

Hi,

Line 99, you're still using MAX_CHARS_IN_LOG_LINE which is causing the whole server to crash:

DUTIL::arg: WARN
DUTIL::log_it:astr.length: 4
DUTIL::log_it:Exception:
ReferenceError: MAX_CHARS_IN_LOG_LINE is not defined
at /home/zandu/node-xmpp-bosh/src/dutil.js:99:23
........

I'll try to provide a patch :)
Or is this variable initialized somewhere else?

Hi,

Line 99, you're still using MAX_CHARS_IN_LOG_LINE which is causing the whole server to crash:

DUTIL::arg: WARN
DUTIL::log_it:astr.length: 4
DUTIL::log_it:Exception:
ReferenceError: MAX_CHARS_IN_LOG_LINE is not defined
at /home/zandu/node-xmpp-bosh/src/dutil.js:99:23
........

I'll try to provide a patch :)
Or is this variable initialized somewhere else?

@dhruvbird

This comment has been minimized.

Show comment Hide comment
@dhruvbird

dhruvbird Aug 26, 2012

Owner

Nah, this was a bug -thanks for reporting it. Fixed on latest master.

Can you provide a complete stack trace so that I know where the call happened? This error is happening because sprintf() was called with an incorrect number of arguments, so it would be useful to know where that call occured.

Owner

dhruvbird replied Aug 26, 2012

Nah, this was a bug -thanks for reporting it. Fixed on latest master.

Can you provide a complete stack trace so that I know where the call happened? This error is happening because sprintf() was called with an incorrect number of arguments, so it would be useful to know where that call occured.

@zandu

This comment has been minimized.

Show comment Hide comment
@zandu

zandu Aug 26, 2012

Here you are :

[2012-08-26 18:35:43.138] [DEBUG] [websocket.js] - e3a7653d-7072-448d-bf27-754601da10f3 - Processing: <dummy><presence xmlns='jabber:client' type='unavailable'/></dummy>
[2012-08-26 18:35:43.140] [TRACE] [xmpp-proxy-connector.js] - WEBSOCKET e3a7653d-7072-448d-bf27-754601da10f3 bosh-stanza: <presence xmlns="jabber:client" type="unavailable"/>
[2012-08-26 18:35:43.141] [TRACE] [xmpp-proxy.js] - WEBSOCKET e3a7653d-7072-448d-bf27-754601da10f3 Sent: <presence xmlns="jabber:client" type="unavailable"/>
[2012-08-26 18:35:43.142] [DEBUG] [websocket.js] - e3a7653d-7072-448d-bf27-754601da10f3 - Processing: <dummy></stream:stream></dummy>
DUTIL::args: [ 'WARN',
Sun, 26 Aug 2012 16:35:43 GMT,
'_real_xml_parse::Error parsing XML:',
'<dummy></stream:stream></dummy>',
'Error: mismatched tag' ]
DUTIL::arg: WARN
DUTIL::log_it:astr.length: 4
DUTIL::log_it:Exception:
ReferenceError: MAX_CHARS_IN_LOG_LINE is not defined
at /home/zandu/node-xmpp-bosh/src/dutil.js:99:23
at Array.forEach (native)
at log_it (/home/zandu/node-xmpp-bosh/src/dutil.js:91:8)
at _real_xml_parse (/home/zandu/node-xmpp-bosh/src/dutil.js:336:3)
at Object.xml_parse (/home/zandu/node-xmpp-bosh/src/dutil.js:355:10)
at WebSocket.<anonymous> (/home/zandu/node-xmpp-bosh/src/websocket.js:189:31)
at WebSocket.emit (events.js:70:17)
at Receiver.ontext (/home/zandu/node-xmpp-bosh/node_modules/ws/lib/WebSocket.js:514:10)
at Receiver.<anonymous> (/home/zandu/node-xmpp-bosh/node_modules/ws/lib/Receiver.js:397:14)
at Receiver.expectHandler (/home/zandu/node-xmpp-bosh/node_modules/ws/lib/Receiver.js:378:33)

I'm using a modified version of StropheJS with websocket support on client-side and openfire on server-side.
Let me know if you need any other trace.

Here you are :

[2012-08-26 18:35:43.138] [DEBUG] [websocket.js] - e3a7653d-7072-448d-bf27-754601da10f3 - Processing: <dummy><presence xmlns='jabber:client' type='unavailable'/></dummy>
[2012-08-26 18:35:43.140] [TRACE] [xmpp-proxy-connector.js] - WEBSOCKET e3a7653d-7072-448d-bf27-754601da10f3 bosh-stanza: <presence xmlns="jabber:client" type="unavailable"/>
[2012-08-26 18:35:43.141] [TRACE] [xmpp-proxy.js] - WEBSOCKET e3a7653d-7072-448d-bf27-754601da10f3 Sent: <presence xmlns="jabber:client" type="unavailable"/>
[2012-08-26 18:35:43.142] [DEBUG] [websocket.js] - e3a7653d-7072-448d-bf27-754601da10f3 - Processing: <dummy></stream:stream></dummy>
DUTIL::args: [ 'WARN',
Sun, 26 Aug 2012 16:35:43 GMT,
'_real_xml_parse::Error parsing XML:',
'<dummy></stream:stream></dummy>',
'Error: mismatched tag' ]
DUTIL::arg: WARN
DUTIL::log_it:astr.length: 4
DUTIL::log_it:Exception:
ReferenceError: MAX_CHARS_IN_LOG_LINE is not defined
at /home/zandu/node-xmpp-bosh/src/dutil.js:99:23
at Array.forEach (native)
at log_it (/home/zandu/node-xmpp-bosh/src/dutil.js:91:8)
at _real_xml_parse (/home/zandu/node-xmpp-bosh/src/dutil.js:336:3)
at Object.xml_parse (/home/zandu/node-xmpp-bosh/src/dutil.js:355:10)
at WebSocket.<anonymous> (/home/zandu/node-xmpp-bosh/src/websocket.js:189:31)
at WebSocket.emit (events.js:70:17)
at Receiver.ontext (/home/zandu/node-xmpp-bosh/node_modules/ws/lib/WebSocket.js:514:10)
at Receiver.<anonymous> (/home/zandu/node-xmpp-bosh/node_modules/ws/lib/Receiver.js:397:14)
at Receiver.expectHandler (/home/zandu/node-xmpp-bosh/node_modules/ws/lib/Receiver.js:378:33)

I'm using a modified version of StropheJS with websocket support on client-side and openfire on server-side.
Let me know if you need any other trace.

@dhruvbird

This comment has been minimized.

Show comment Hide comment
@dhruvbird

dhruvbird Aug 26, 2012

Owner

@zandu Thanks for posting the trace - it is helpful. Fixes on current master.

Owner

dhruvbird replied Aug 26, 2012

@zandu Thanks for posting the trace - it is helpful. Fixes on current master.

Please sign in to comment.