de.flapdoodle.embed.mongo: NoSuchFileException because path duplicates directory path

Seeing behavior similar to https://github.com/flapdoodle-oss/de.flapdoodle.embed.process/issues/122 during our build process in OpenShift 3.7 on both RHEL7 and RHEL8 base images.

https://catalog.redhat.com/software/containers/redhat-openjdk-18/openjdk18-openshift/58ada5701fbe981673cd6b10?container-tabs=overview

The behavior does not occur during local development on OS X 12.x and 13.0.

We’re using de.flapdoodle.embed.process as part of de.flapdoodle.embed.mongo

We have just migrated our application to Spring Boot 2.7.5 which uses de.flapdoodle.embed.mongo:3.4.11 and de.flapdoodle.embed.process:3.1.15

I’ve included the relevant portion of the stack trace below

Caused by:
--
  | org.springframework.beans.BeanInstantiationException: Failed to instantiate [de.flapdoodle.embed.mongo.MongodExecutable]: Factory method 'embeddedMongoServer' threw exception; nested exception is de.flapdoodle.embed.process.exceptions.DistributionException: java.nio.file.NoSuchFileException: ?/.embedmongo/extracted/Linux-B64--redhat_8---4.2.22/?/.embedmongo/extracted/Linux-B64--redhat_8---4.2.22/extractmongod
  | at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
  | at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
  | ... 138 more
  |  
  | Caused by:
  | de.flapdoodle.embed.process.exceptions.DistributionException: java.nio.file.NoSuchFileException: ?/.embedmongo/extracted/Linux-B64--redhat_8---4.2.22/?/.embedmongo/extracted/Linux-B64--redhat_8---4.2.22/extractmongod
  | at de.flapdoodle.embed.process.runtime.Starter.prepare(Starter.java:71)
  | at de.flapdoodle.embed.process.runtime.Starter.prepare(Starter.java:52)
  | at de.flapdoodle.embed.mongo.spring.autoconfigure.EmbeddedMongoAutoConfiguration.embeddedMongoServer(EmbeddedMongoAutoConfiguration.java:104)
  | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  | at java.lang.reflect.Method.invoke(Method.java:498)
  | at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
  | ... 139 more
  |  
  | Caused by:
  | java.nio.file.NoSuchFileException: ?/.embedmongo/extracted/Linux-B64--redhat_8---4.2.22/?/.embedmongo/extracted/Linux-B64--redhat_8---4.2.22/extractmongod
  | at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
  | at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
  | at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
  | at sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:526)
  | at sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:253)
  | at java.nio.file.Files.copy(Files.java:1274)
  | at de.flapdoodle.embed.process.extract.ExtractedFileSets.copy(ExtractedFileSets.java:57)
  | at de.flapdoodle.embed.process.store.ExtractedArtifactStore.extractFileSet(ExtractedArtifactStore.java:110)
  | at de.flapdoodle.embed.process.runtime.Starter.prepare(Starter.java:59)
  | ... 146 more

This only occurs in one test execution (the first) and subsequent test executions start / use the embedded mongo database appropriately. We can see all the other tests pass and the logs for the database shutting down

2022-11-21 18:32:42.407  INFO [,,] 246 --- [      Thread-59] d.f.e.m.s.autoconfigure.EmbeddedMongo    : 2022-11-21T18:32:42.407+0000 I  NETWORK  [conn2] end connection 127.0.0.1:35626 (1 connection now open)

Similar to flapdoodle-oss/de.flapdoodle.embed.process#122 , this appears to be because the path duplicates the target artifact directory ?/.embedmongo/extracted/Linux-B64--redhat_8---4.2.22 twice (as ?/.embedmongo/extracted/Linux-B64--redhat_8---4.2.22/?/.embedmongo/extracted/Linux-B64--redhat_8---4.2.22/extractmongod).

I’ve exhausted most of my resources trying to resolve this, including using de.flapdoodle.embed.mongo.spring and trying to set artifactStorePath using DownloadConfigBuilderCustomizer (which “works” but doesn’t change the behavior)

Working on further reproducibility, and I’ve checked other similar issues and haven’t found a working solution.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments