[SERVER-40693] Mongo shell should surface errors from open() syscall Created: 17/Apr/19  Updated: 11/Jul/19  Resolved: 11/Jul/19

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

Type: Improvement Priority: Minor - P4
Reporter: Nic Cottrell Assignee: Kevin Pulo
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-41047 errnoWithDescription always returns "... Closed
duplicates SERVER-31077 do not attempt to save history to a b... Closed
is duplicated by TOOLS-2263 Mongo shell should surface errors fro... Closed
Participants:
Case:

 Description   

A customer received the following error after running a very long aggregation call:

2019-04-16T17:22:08.856+0200 E - [main] Error saving history file: FileOpenFailed: Unable to open() file : Unknown error
2019-04-16T17:22:08.856+0200 I CONTROL [main] shutting down with code:0

This seems to be from src/mongo/shell/dbshell.cpp

The shell seems to be unable to open the file it uses to save the command history. Can we change the logic to surface the underlying error code the open() syscall is throwing?



 Comments   
Comment by Kevin Pulo [ 11/Jul/19 ]

Closing as a duplicate of SERVER-31077 and SERVER-41047.

Comment by Kevin Pulo [ 18/Apr/19 ]

It does. The error is generated at https://github.com/mongodb/mongo/blob/r4.0.9/src/mongo/shell/linenoise.cpp#L2771

ss << "Unable to " << what << " file " << filename << ": " << mongo::errnoWithDescription();

So the reason in this case is "Unknown error". But there is another clue — the filename appears to be the empty string "". So this appears to be SERVER-31077. Can you confirm that the aggregation in this case was run via mongo --eval? In which case, the error is harmless and safe to ignore.

Generated at Thu Feb 08 04:55:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.