[SERVER-24914] Cannot start mongod from cwd > 1000 bytes long Created: 06/Jul/16 Updated: 02/Sep/16 Resolved: 16/Aug/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | 3.3.12 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Kevin Pulo | Assignee: | Kevin Pulo |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Operating System: | ALL | ||||||||||||||||
| Steps To Reproduce: |
|
||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
The expectation is that the server should start successfully from any working directory that the OS considers valid. This is especially true when only absolute paths have been specified for dbpath and logpath, and if --fork is used (whereupon the server will chdir to /). See also Success case:
Failure case:
https://github.com/mongodb/mongo/blob/r3.3.9/src/mongo/db/server_options_helpers.cpp#L458-L468
A quick and easy (though partial) fix is to just change the hardcoded 1024 and 1000 to PATH_MAX ( It turns out that POSIX requires PATH_MAX >= 256 (or >= 1024 for XSI). Darwin/OSX and Solaris are 1024, but Linux is 10k or more. A fuller (but more involved) fix would be to dynamically allocate and grow the buffer as necessary. |
| Comments |
| Comment by Githook User [ 16/Aug/16 ] |
|
Author: {u'username': u'devkev', u'name': u'Kevin Pulo', u'email': u'kevin.pulo@mongodb.com'}Message: |
| Comment by Andy Schwerin [ 08/Jul/16 ] |
|
Great, Kevin. Go ahead and put up a patch to use current_path() as you described. |
| Comment by Kevin Pulo [ 07/Jul/16 ] |
|
boost::filesystem::current_path() can be used to do this the Right Way (doubling out the buffer size, etc), and is easy to use. |