Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eventhub and Docker #14

Closed
dmr opened this issue Oct 16, 2014 · 7 comments
Closed

Eventhub and Docker #14

dmr opened this issue Oct 16, 2014 · 7 comments

Comments

@dmr
Copy link

dmr commented Oct 16, 2014

Hi,

I built a small Dockerfile to run eventhub and it seems to work fine. But when I mount an external volume (because I want the database to be consistent) it fails and I don't understand why.
Here is the error

Exception in thread "main" com.google.inject.ProvisionException: Guice provision errors:

1) Error in custom provider, org.fusesource.leveldbjni.internal.NativeDB$DBException: IO error: /tmp/event_hub/dated_event_index.db/MANIFEST-000001: Invalid argument
  at com.codecademy.eventhub.index.DatedEventIndexModule.getDatedEventIndex(DatedEventIndexModule.java:27)
  while locating com.codecademy.eventhub.index.DatedEventIndex
  at com.codecademy.eventhub.web.Module.getEventHub(Module.java:59)
  at com.codecademy.eventhub.web.Module.getEventHub(Module.java:59)
  while locating com.codecademy.eventhub.EventHub
  at com.codecademy.eventhub.web.Module.getEventHubHandler(Module.java:34)
  while locating com.codecademy.eventhub.web.EventHubHandler

1 error
    at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1014)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1040)
    at com.codecademy.eventhub.web.EventHubHandler.main(EventHubHandler.java:100)
Caused by: org.fusesource.leveldbjni.internal.NativeDB$DBException: IO error: /tmp/event_hub/dated_event_index.db/MANIFEST-000001: Invalid argument
    at org.fusesource.leveldbjni.internal.NativeDB.checkStatus(NativeDB.java:200)
    at org.fusesource.leveldbjni.internal.NativeDB.open(NativeDB.java:218)
    at org.fusesource.leveldbjni.JniDBFactory.open(JniDBFactory.java:168)
    at com.codecademy.eventhub.index.DatedEventIndexModule.getDatedEventIndex(DatedEventIndexModule.java:29)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:105)
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:55)
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:66)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47)
    at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1005)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
    at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1001)
    at com.google.inject.spi.ProviderLookup$1.get(ProviderLookup.java:90)
    at com.google.inject.spi.ProviderLookup$1.get(ProviderLookup.java:90)
    at com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:99)
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:55)
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:66)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
    at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1005)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
    at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1001)
    at com.google.inject.spi.ProviderLookup$1.get(ProviderLookup.java:90)
    at com.google.inject.spi.ProviderLookup$1.get(ProviderLookup.java:90)
    at com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:99)
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:55)
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:66)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47)
    at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1005)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1051)
    at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1001)
    ... 2 more

Any idea what the problem is?

To reproduce:

  1. Install docker
  2. build a docker image with this Dockerfile
FROM alexeiled/java7-maven-git
MAINTAINER Daniel M. Rech, dr@netsyno.com
ENV DEBIAN_FRONTEND noninteractive
RUN mkdir /eventhub
WORKDIR /eventhub
RUN git clone --depth=1 https://github.com/Codecademy/EventHub.git .
RUN EVENT_HUB_DIR=`pwd` mvn -am -e -pl web clean package
CMD ["java", "-jar", "/eventhub/web/target/web-1.0-SNAPSHOT.jar"]
VOLUME ["/tmp/event_hub"]
EXPOSE 8080

i.e. by executing

docker build -t eventhub:1.0 .
  1. Run the container and expose a port
docker run -ti -p 8080:8080 eventhub:1.0
  1. Accessing with a web browser works: http://192.168.59.103:8080/
  2. Now start with a volume mount:
docker run -ti -p 8080:8080 -v /home/abc/local:/tmp/event_hub eventhub:1.0

and the error occurs.

@chengtao
Copy link
Contributor

I'm not familiar with how docker works, but i suspect that some interaction among jni, docker fs mount and memory mapped file is wrong.....
p.s. JNI bridged LevelDB is the one throwing exception and LevelDB is using memory mapped file

@dmr
Copy link
Author

dmr commented Oct 17, 2014

Thank you for the quick reply. I also think this is more of a docker or interaction problem but I thought maybe you had any experience with that.

@bonswouar
Copy link

I actually pushed my EventHub Docker Image yesterday, and I have no problem with data volumes (but I am on Debian).

@chengtao
Copy link
Contributor

given that the problem is likely from OSX + JNI + memory mapped file, close to issue for now.

@dmr
Copy link
Author

dmr commented Oct 21, 2014

Is it possible to have Eventhub store data in a not memory mapped file?

@dmr
Copy link
Author

dmr commented Oct 21, 2014

But in general I agree: This is not an Eventhub issue

@chengtao
Copy link
Contributor

Unfortunately, LevelDB is pretty tightly integrated into the system and it is using memory mapped file for performance reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants