question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

unrecognised option '--noprealloc' during start of MongoDB

See original GitHub issue

Hi,

I’m trying to use Embedded MongoDB 4.41 on a SUSE Enterprise 12 server.

With the default configuration, an invalid download URL is generated (https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.4.1.tgz). For MongoDB 4.4.1, there doesn’t seem to be a generic linux version any more - only distribution-specific versions. So I changed the version: starter.prepare(config, Distribution.of(() -> "suse12-4.4.1", Platform.Linux, BitSize.detect()))

Now MongoDB is being successfully downloaded (from https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-suse12-4.4.1.tgz), but starting fails with the following error:

Download com.bmw.qwin.supplierdata.boundary.SupplierDataResourceTest$$Lambda$408/0x0000000100309040@7ecca48:Linux:B64 START
Download com.bmw.qwin.supplierdata.boundary.SupplierDataResourceTest$$Lambda$408/0x0000000100309040@7ecca48:Linux:B64 DownloadSize: 71250531
Download com.bmw.qwin.supplierdata.boundary.SupplierDataResourceTest$$Lambda$408/0x0000000100309040@7ecca48:Linux:B64 0% 1% 2% 3% 4% 5% 6% 7% 8% 9% 10% 11% 12% 13% 14% 15% 16% 17% 18% 19% 20% 21% 22% 23% 24% 25% 26% 27% 28% 29% 30% 31% 32% 33% 34% 35% 36% 37% 38% 39% 40% 41% 42% 43% 44% 45% 46% 47% 48% 49% 50% 51% 52% 53% 54% 55% 56% 57% 58% 59% 60% 61% 62% 63% 64% 65% 66% 67% 68% 69% 70% 71% 72% 73% 74% 75% 76% 77% 78% 79% 80% 81% 82% 83% 84% 85% 86% 87% 88% 89% 90% 91% 92% 93% 94% 95% 96% 97% 98% 99% 100% Download com.bmw.qwin.supplierdata.boundary.SupplierDataResourceTest$$Lambda$408/0x0000000100309040@7ecca48:Linux:B64 downloaded with 34790kb/s
Download com.bmw.qwin.supplierdata.boundary.SupplierDataResourceTest$$Lambda$408/0x0000000100309040@7ecca48:Linux:B64 DONE
Extract /home/qwin/.embedmongo/linux/mongodb-linux-x86_64-suse12-4.4.1.tgz START
Extract /home/qwin/.embedmongo/linux/mongodb-linux-x86_64-suse12-4.4.1.tgz extract mongodb-linux-x86_64-suse12-4.4.1/bin/mongod
Extract /home/qwin/.embedmongo/linux/mongodb-linux-x86_64-suse12-4.4.1.tgz nothing left
Extract /home/qwin/.embedmongo/linux/mongodb-linux-x86_64-suse12-4.4.1.tgz DONE
[mongod error]Error parsing command line: unrecognised option '--noprealloc'
[mongod error] try '/tmp/extract-6a3d4b31-a14e-4523-8d2f-9e699ddf02e5extractmongod --help' for more information

This command line option has apparently been removed (see https://docs.mongodb.com/manual/reference/configuration-options/#removed-mmapv1-options)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
robin850commented, Nov 27, 2020

If it can be helpful, here’s a code that overrides successMessage() (great catch by the way @shahr) and makes the server start but I guess the library is hard to use anyway in any project at the moment given the issues and the backward-incompatible changes:

class CustomMongodProcess extends MongodProcess {
    public CustomMongodProcess(Distribution distribution,
                               MongodConfig config,
                               RuntimeConfig runtimeConfig,
                               MongodExecutable mongodExecutable) throws IOException {
        super(distribution, config, runtimeConfig, mongodExecutable);
    }

    @Override
    protected String successMessage() {
        return "Waiting for connections";
    }
}

class CustomMongodExecutable extends MongodExecutable {
    public CustomMongodExecutable(Distribution distribution,
                                  MongodConfig mongodConfig,
                                  RuntimeConfig runtimeConfig,
                                  ExtractedFileSet files) {
        super(distribution, mongodConfig, runtimeConfig, files);
    }

    @Override
    protected MongodProcess start(Distribution distribution, MongodConfig config, RuntimeConfig runtime)
            throws IOException {
        return new CustomMongodProcess(distribution, config, runtime, this);
    }
}


MongodConfig config = /* ... */;
RuntimeConfig runtimeConfig = /* ... */;

Distribution distribution = Distribution.detectFor(config.version());

Optional<ExtractedFileSet> files = runtimeConfig.artifactStore()
        .extractFileSet(distribution);

new CustomMongodExecutable(distribution, config, runtimeConfig, files.get());

And then do whatever you want with the executable.

2reactions
shahrcommented, Nov 25, 2020

@trailoff @martintheault I think there are 2 issues here (at least in my case):

  1. The download of the mongo 4.4.x fails (as per @woswoasdeni original comment on the issue). I managed to fix that by providing customized download configuration as documented

  2. After disabling the --noprealloc option, the MongodExecutable#start() does not return/blocks (despite the server appearing to have started correctly from the logs). This can solved by overriding the line I mentioned above (https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo/blob/master/src/main/java/de/flapdoodle/embed/mongo/AbstractMongoProcess.java#L88) because, from what I can tell through digging into the code, the server’s log output is read and checked for that particular string to determine if the process has started correctly. Since mongo has changed the log format and messages in 4.4.x onwards, we need to override the successMessage() method so that it finds the correct log entry text.

Hope that helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

unrecognised option '--noprealloc' during start of MongoDB
I'm trying to use Embedded MongoDB 4.41 on a SUSE Enterprise 12 server. With the default configuration, an invalid download URL is generated...
Read more >
error parsing command line: unrecognised option '--noprealloc'
Try to start the mongodb service using "net start mongodb" normally and is working fine. (Not as a service) The service is not...
Read more >
kubernetes - shows unrecognized option '--smallfiles'
Error when creating a mongodb replicaset - shows unrecognized option '--smallfiles' ... I am creating the below mongodb statefulset which creates ...
Read more >
Unrecognized option: --SSL - M001: MongoDB Basics
I'm using MongoDB Enterprise on Windows 10 Home. This is what happens when I type mongo --version MongoDB shell version v4.0.3 git version: ......
Read more >
Configuration File Options — MongoDB Manual
The following page describes the configuration options available in MongoDB ... Specifying an unrecognized protocol will prevent the server from starting.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found