flapdoodle-oss / de.flapdoodle.embed.mongo

...will provide a platform neutral way for running mongodb in unittests.
Apache License 2.0
910 stars 160 forks source link

Update to 4.12.3 (and 4.12.6) fails with `Could not start process: error while loading shared libraries` #515

Open froth opened 7 months ago

froth commented 7 months ago

Update to 4.12.3 (and following) suddenly failed with Caused by: java.lang.RuntimeException: Could not start process: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory.

Has anything changed in this release that could have caused this?

It uses https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian11-6.0.14.tgz on [Ubuntu 22.04.4 LTS (Jammy Jellyfish)](https://releases.ubuntu.com/jammy)

Full stacktrace:

java.lang.RuntimeException: rollback after error on transition to State(RunningMongodProcess), successful reached:
  State(ExtractedFileSet)=ExtractedFileSet{baseDir=.embedmongo/fileSets/925707ef1b60e2a16736347b4baae8dd2e7a4f008200e8cb7d8289d3dbabf20e, executable=.embedmongo/fileSets/925707ef1b60e2a16736347b4baae8dd2e7a4f008200e8cb7d8289d3dbabf20e/mongod, libraryFiles=[]},
  State(Archive)=Archive(.embedmongo/archives/https-fastdl-mongodb-org/56cb3d10404e5b9df5358ac4ee83efcb/linuxmongodb-linux-x86-64-debian11-6-0-14-tgz/b4ee6298d9213219779721f11f693502ceaaa02232493569c92babfdf6680e35/archive.tgz),
  State(Package)=Package{archiveType=TGZ, fileSet=FileSet{entries=[Entry{type=Executable, destination=mongod, uncompiledMatchingPattern=UncompiledPattern{regex=.*mongod, flags=2}}]}, url=https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian11-6.0.14.tgz},
  State(ProcessArguments)=ProcessArguments([--dbpath, /tmp/temp--2cd55f0a-6489-456d-919b-65eb03461166/mongod-database17036842948026696435, --noauth, --port, 34197, --replSet, testRepSet, --oplogSize, 5000, --syncdelay=0]),
  State(ProcessWorkingDir)=ProcessWorkingDir(/tmp/temp--2cd55f0a-6489-456d-919b-65eb03461166/workingDir17640095212965233477),
  State(Distribution)=V6_0:Platform{operatingSystem=Linux, architecture=X86_64, distribution=Debian, version=DEBIAN_12},
  State(SupportConfig)=SupportConfig{name=mongod, supportUrl=https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo/issues, messageOnException=de.flapdoodle.embed.mongo.transitions.ProcessDefaults$$Lambda/0x00007f3546dcab80@1df3935f},
  State(Name)=Name(mongod),
  State(DownloadCache)=de.flapdoodle.embed.process.store.LocalDownloadCache@1d97120a,
  State(ExtractedFileSetStore)=de.flapdoodle.embed.process.store.ContentHashExtractedFileSetStore@7c197e07,
  State(DatabaseDir)=DatabaseDir(/tmp/temp--2cd55f0a-6489-456d-919b-65eb03461166/mongod-database17036842948026696435),
  State(TempDir)=ImmutableTempDir(/tmp/temp--2cd55f0a-6489-456d-919b-65eb03461166),
  State(DistributionBaseUrl)=DistributionBaseUrl(https://fastdl.mongodb.org),
  State(Platform)=Platform{operatingSystem=Linux, architecture=X86_64, distribution=Debian, version=DEBIAN_12},
  State(ProcessConfig)=ProcessConfig{daemonProcess=false, stopTimeoutInMillis=5000},
  State(ProcessEnv)=ProcessEnv({}),
  State(ProcessOutput)=ProcessOutput{output=de.flapdoodle.embed.process.io.NamedOutputStreamProcessor@15187234, error=de.flapdoodle.embed.process.io.NamedOutputStreamProcessor@14f072a3, commands=de.flapdoodle.embed.process.io.Slf4jStreamProcessor@31522575},
  State(PersistentDir)=ImmutablePersistentDir(.embedmongo),
  State(ProgressListener)=de.flapdoodle.embed.process.io.progress.StandardConsoleProgressListener@68c8c1e,
  State(Command)=MongoD,
  State(Version)=V6_0,
  State(Net)=Net{port=34197, isIpv6=false},
  State(MongodArguments)=MongodArguments{syncDelay=0, useDefaultSyncDelay=false, isVerbose=false, verbosityLevel=1, isQuiet=false, useNoPrealloc=true, useSmallFiles=true, useNoJournal=false, enableTextSearch=false, auth=false, master=false, replication=Storage{oplogSize=5000, replSetName=testRepSet}, isConfigServer=false, isShardServer=false, params={}, args={}}
    at de.flapdoodle.reverse.TransitionWalker.initState(TransitionWalker.java:190)
    at de.flapdoodle.reverse.TransitionWalker.initState(TransitionWalker.java:69)
    at de.flapdoodle.reverse.TransitionWalker.initState(TransitionWalker.java:65)
    at com.breuninger.entdecken.ports.WeaverMongoResource$.createMongodWithLoggingAndLocalCacheDir$$anonfun$1(WeaverMongoResource.scala:62)
    at blocking @ com.breuninger.entdecken.ports.WeaverMongoResource$.createMongodWithLoggingAndLocalCacheDir(WeaverMongoResource.scala:63)
    at make @ weaver.framework.RunnerCompat.run(RunnerCompat.scala:169)
    at make @ weaver.framework.RunnerCompat.run(RunnerCompat.scala:169)
    at use @ weaver.framework.RunnerCompat.run(RunnerCompat.scala:191)
    at of$extension @ weaver.GlobalResourceF$.createMap(GlobalResourceF.scala:124)
    at map @ weaver.GlobalResourceF$.createMap(GlobalResourceF.scala:126)
    at make @ weaver.framework.RunnerCompat.run(RunnerCompat.scala:169)
    at make @ weaver.framework.RunnerCompat.run(RunnerCompat.scala:169)
Caused by: java.lang.RuntimeException: Could not start process: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
    at de.flapdoodle.embed.mongo.transitions.RunningMongoProcess.lambda$null$1(RunningMongoProcess.java:179)
    at de.flapdoodle.types.ThrowingSupplier.lambda$andFinally$1(ThrowingSupplier.java:47)
    at de.flapdoodle.types.ThrowingSupplier.lambda$andFinally$1(ThrowingSupplier.java:47)
    at de.flapdoodle.embed.mongo.transitions.RunningMongoProcess.lambda$factory$3(RunningMongoProcess.java:185)
    at de.flapdoodle.embed.process.types.RunningProcess.start(RunningProcess.java:83)
    at de.flapdoodle.embed.mongo.transitions.MongoServerStarter.result(MongoServerStarter.java:119)
    at de.flapdoodle.reverse.TransitionWalker.resolve(TransitionWalker.java:58)
    at de.flapdoodle.reverse.TransitionWalker.resolve(TransitionWalker.java:46)
    at de.flapdoodle.reverse.TransitionWalker.initState(TransitionWalker.java:180)
    at de.flapdoodle.reverse.TransitionWalker.initState(TransitionWalker.java:69)
    at de.flapdoodle.reverse.TransitionWalker.initState(TransitionWalker.java:65)
    at com.breuninger.entdecken.ports.WeaverMongoResource$.createMongodWithLoggingAndLocalCacheDir$$anonfun$1(WeaverMongoResource.scala:62)
    at cats.effect.IOFiber.runLoop(IOFiber.scala:1004)
    at cats.effect.IOFiber.execR(IOFiber.scala:1362)
    at cats.effect.IOFiber.run(IOFiber.scala:112)
    at cats.effect.unsafe.WorkerThread.run(WorkerThread.scala:634)
michaelmosmann commented 7 months ago

@froth ..hmm. the system is detected as debian12 ({operatingSystem=Linux, architecture=X86_64, distribution=Debian, version=DEBIAN_12}) .. i guess that the version for debian11 will not run on debian12 .. can you use a newer mongodb version? Is it a debian12 dist or is it something else (Ubuntu 22.04.4 LTS?) ?

froth commented 7 months ago

It is Ubuntu 22.04.4 LTS (Jammy Jellyfish).

Updating to Mongo 7.0 works fine. However 6.0 worked until flapdoodle 4.12.2. and downloaded https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-6.0.12.tgz

So I think something changed in the OS resolution?

michaelmosmann commented 7 months ago

@froth .. hmm.. i must check.. can you give me your /etc/os-release file? I am very surprised that os detection fails this way.. (if this is the bug and not something else)

froth commented 7 months ago

I am sorry is was confused yesterday and gave you incorrect information :( . The "this CI-runner Docker image has multiple base images"-maze messed with my brain.

The OS actually is Debian GNU/Linux 12 (bookworm) and as you correctly said the Debian 11 Mongo 6 seems not to work on Debian 12. However the Ubuntu 22.04.4 LTS Mongo 6 seems to work fine on Debian 12.

I am not sure if that is something that can be configured in this granularity in flapdoodle or if this would even be a good idea. I could live with upgrading to Mongo 7.

Sorry again for the wrong OS Info.

michaelmosmann commented 7 months ago

@froth .. i think i could map older versions to ubuntu instead of debian..

michaelmosmann commented 7 months ago

@froth .. i think i add an option 'strict' or a warning if there is no match desired mongodb version and platform.. so 6.0.x on debian12 would fail.. using the ubuntu version on mongodb could be achieved by overriding the platform detection ...

Or i introduce some kind of blacklisting .. It should be maintainable .. somehow:)

froth commented 7 months ago

@michaelmosmann that sounds reasonable, thanks for looking into it.

It is impressive that it works so nicely across operation systems and mongodb versions :)

You can close this issue if you want, I can live with upgrading and/or overriding.

michaelmosmann commented 7 months ago

@froth .. thanks:)

i close this if i have a good answer for that question:) until that i leave this open as an reminder ..

influence160 commented 1 month ago

Hello,

I had the same problem after upgrading java from 19 to 21 Caused by: java.lang.RuntimeException: Could not start process: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory

env : de.flapdoodle.embed.mongo.version: 4.12.2 OS: Ubuntu 22.04

Packages:

dpkg -l | grep -i openssl 
ii  libcurl4:amd64            7.81.0-1ubuntu1.16                      amd64        easy-to-use client-side URL transfer library (OpenSSL flavour)
ii  libssh-4:amd64            0.9.6-2ubuntu0.22.04.3              amd64        tiny C SSH library (OpenSSL flavor)
ii  openssl                   3.0.2-0ubuntu1.15                             amd64        Secure Sockets Layer toolkit - cryptographic utility
dpkg -l | grep libssl
ii  libssl3:amd64             3.0.2-0ubuntu1.15                       amd64        Secure Sockets Layer toolkit - shared libraries

i tryied changing de.flapdoodle.embed.mongo.version to 4.13.0 and to 4.15.0 and to 4.16.1

i also tryed RUN apt-get update && apt install -y openssl and RUN apt install libssl1.1

but everytime i had the same problem.

The problem was fixed when i changed the mongodb version from 6.0.2 to 7.0.12

de: flapdoodle: mongodb: embedded: version: 7.0.12 #6.0.2

michaelmosmann commented 1 month ago

@influence160 AFAIK does ubuntu 22.x does not provides libssl1.x anymore and newer mongodb version are using libssl3.x .. so yes. You must use a newer version of mongodb on a newer version of ubuntu.