[SERVER-7859] printStackTrace() not work on Linux Created: 06/Dec/12  Updated: 15/Dec/12  Resolved: 06/Dec/12

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 2.2.2
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Vadim Voitsiakh Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux 3.5.0-19-generic #30-Ubuntu SMP x86_64


Operating System: Linux
Steps To Reproduce:

Open mongo shell. Type: printStackTrace()

Participants:

 Description   

MongoDB shell version: 2.2.2
connecting to: test
> printStackTrace()
Error("Printing Stack Trace")@:0
()@src/mongo/shell/utils.js:37
@(shell):1
 
> 

And latest version has the same issue:

MongoDB shell version: 2.3.2-pre-
connecting to: test
> printStackTrace()
Error: Printing Stack Trace
    at printStackTrace (src/mongo/shell/utils.js:37:7)
    at (shell):1:1
> 



 Comments   
Comment by Eric Milkie [ 06/Dec/12 ]

Your expectation is correct.

>  bar()
in bar()
in foo()
Error: Printing Stack Trace
    at printStackTrace (src/mongo/shell/utils.js:37:7)
    at foo ((shell):1:37)
    at bar ((shell):1:37)
    at (shell):1:1

I'm resolving this as works-as-designed.

Comment by Vadim Voitsiakh [ 06/Dec/12 ]

Ok, I never saw how this function works later but in the following example:

> function foo() { print('in foo()'); printStackTrace() }
> function bar() { print('in bar()'); foo(); }
> bar()

I expect printing list of executed javascript functions: foo() than bar()

Comment by Eric Milkie [ 06/Dec/12 ]

Please describe your expected behavior for the function.
From your output in the description, it appears to be working correctly. It prints the current JavaScript callstack, and since you are calling it interactively, there is very little callstack to print.

Generated at Thu Feb 08 03:15:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.