Question Authors' Forum

Memory issues on Jobe server (mongosh)

Memory issues on Jobe server (mongosh)

by Mark Stern -
Number of replies: 2

I am trying to create a question type for MongoDB (queries only using mongosh connecting to a static database). When I try to connect, I get the following error:

***Run error***
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Traceback (most recent call last):
  File "__tester__.python3", line 40, in <module>
    output = subprocess.check_output(['mongosh', "commands.js"],
  File "/usr/lib/python3.10/subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['mongosh', 'commands.js']' died with <Signals.SIGABRT: 6>.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "__tester__.python3", line 45, in <module>
    raise Exception("mongodb error: " + str(e))
Exception: mongodb error: Command '['mongosh', 'commands.js']' died with <Signals.SIGABRT: 6>.
This might mean I do not have enough memory on my Jobe server (it has 1GByte), but I can run mongosh on the jobe server and connect to the database without any problem.

Any other thoughts?

Thanks,

Mark Stern


In reply to Mark Stern

Re: Memory issues on Jobe server (mongosh)

by Richard Lobb -
You probably just have to increase the memory limit that's used on the Jobe server. You do that in the question. Or you can do it in the question type if you've made a special type for mongosh questions. See this thread for instructions: https://coderunner.org.nz/mod/forum/discuss.php?d=141. You could first try setting the memory limit to 0 (which disables memory limit checking) then expore a bit to find a realistic value. 1000 perhaps?
In reply to Richard Lobb

Re: Memory issues on Jobe server (mongosh)

by Mark Stern -
Thanks, that worked. 1000 was not enough, but 1500 did the trick.