Codecademy / EventHub

An open source event analytics platform
http://tinyurl.com/eventhub
1.33k stars 139 forks source link

Map failed #9

Closed luizpvas closed 10 years ago

luizpvas commented 10 years ago

Hey guys, sorry to bother, but I can't seem to find why EventHub is failing to add an event. Everything compiles, passes the test units and initialize the server. (Linux Mint 17, 32 bit) The CURL command was the same in the readme

curl -X POST http://localhost:8080/events/track --data "event_type=signup&external_user_id=foobar&event_property_1=1"

Full error message:

luiz@laptop ~/DOS/EventHub $ java -jar web/target/web-1.0-SNAPSHOT.jar 
2014-08-13 23:56:27.467:INFO:oejs.Server:main: jetty-9.1.z-SNAPSHOT
2014-08-13 23:56:27.503:INFO:oejs.ServerConnector:main: Started ServerConnector@1ec0a94{HTTP/1.1}{0.0.0.0:8080}
2014-08-13 23:56:47.930:WARN:oejs.HttpChannel:qtp33168999-21: /events/track
com.google.common.util.concurrent.UncheckedExecutionException: java.lang.RuntimeException: java.io.IOException: Map failed
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2199)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3932)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3936)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4806)
    at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4812)
    at com.codecademy.eventhub.list.DmaList.update(DmaList.java:55)
    at com.codecademy.eventhub.index.UserEventIndex.addEvent(UserEventIndex.java:126)
    at com.codecademy.eventhub.EventHub.addEvent(EventHub.java:176)
    at com.codecademy.eventhub.web.commands.TrackEvent.execute(TrackEvent.java:35)
    at com.codecademy.eventhub.web.EventHubHandler.handle(EventHubHandler.java:71)
    at com.codecademy.eventhub.web.JsonpCallbackHandler.handle(JsonpCallbackHandler.java:55)
    at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:459)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:280)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:229)
    at org.eclipse.jetty.io.AbstractConnection$1.run(AbstractConnection.java:505)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
    at java.lang.Thread.run(Thread.java:744)
Caused by: 
java.lang.RuntimeException: java.io.IOException: Map failed
    at com.codecademy.eventhub.base.ByteBufferUtil.createNewBuffer(ByteBufferUtil.java:14)
    at com.codecademy.eventhub.list.DmaList$1.load(DmaList.java:118)
    at com.codecademy.eventhub.list.DmaList$1.load(DmaList.java:115)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3522)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2315)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2278)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2193)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3932)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3936)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4806)
    at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4812)
    at com.codecademy.eventhub.list.DmaList.update(DmaList.java:55)
    at com.codecademy.eventhub.index.UserEventIndex.addEvent(UserEventIndex.java:126)
    at com.codecademy.eventhub.EventHub.addEvent(EventHub.java:176)
    at com.codecademy.eventhub.web.commands.TrackEvent.execute(TrackEvent.java:35)
    at com.codecademy.eventhub.web.EventHubHandler.handle(EventHubHandler.java:71)
    at com.codecademy.eventhub.web.JsonpCallbackHandler.handle(JsonpCallbackHandler.java:55)
    at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:459)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:280)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:229)
    at org.eclipse.jetty.io.AbstractConnection$1.run(AbstractConnection.java:505)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
    at java.lang.Thread.run(Thread.java:744)
Caused by: 
java.io.IOException: Map failed
    at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:888)
    at com.codecademy.eventhub.base.ByteBufferUtil.createNewBuffer(ByteBufferUtil.java:12)
    at com.codecademy.eventhub.list.DmaList$1.load(DmaList.java:118)
    at com.codecademy.eventhub.list.DmaList$1.load(DmaList.java:115)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3522)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2315)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2278)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2193)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3932)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3936)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4806)
    at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4812)
    at com.codecademy.eventhub.list.DmaList.update(DmaList.java:55)
    at com.codecademy.eventhub.index.UserEventIndex.addEvent(UserEventIndex.java:126)
    at com.codecademy.eventhub.EventHub.addEvent(EventHub.java:176)
    at com.codecademy.eventhub.web.commands.TrackEvent.execute(TrackEvent.java:35)
    at com.codecademy.eventhub.web.EventHubHandler.handle(EventHubHandler.java:71)
    at com.codecademy.eventhub.web.JsonpCallbackHandler.handle(JsonpCallbackHandler.java:55)
    at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:459)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:280)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:229)
    at org.eclipse.jetty.io.AbstractConnection$1.run(AbstractConnection.java:505)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
    at java.lang.Thread.run(Thread.java:744)
Caused by: 
java.lang.OutOfMemoryError: Map failed
    at sun.nio.ch.FileChannelImpl.map0(Native Method)
    at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:885)
    at com.codecademy.eventhub.base.ByteBufferUtil.createNewBuffer(ByteBufferUtil.java:12)
    at com.codecademy.eventhub.list.DmaList$1.load(DmaList.java:118)
    at com.codecademy.eventhub.list.DmaList$1.load(DmaList.java:115)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3522)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2315)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2278)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2193)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3932)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3936)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4806)
    at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4812)
    at com.codecademy.eventhub.list.DmaList.update(DmaList.java:55)
    at com.codecademy.eventhub.index.UserEventIndex.addEvent(UserEventIndex.java:126)
    at com.codecademy.eventhub.EventHub.addEvent(EventHub.java:176)
    at com.codecademy.eventhub.web.commands.TrackEvent.execute(TrackEvent.java:35)
    at com.codecademy.eventhub.web.EventHubHandler.handle(EventHubHandler.java:71)
    at com.codecademy.eventhub.web.JsonpCallbackHandler.handle(JsonpCallbackHandler.java:55)
    at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:459)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:280)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:229)
    at org.eclipse.jetty.io.AbstractConnection$1.run(AbstractConnection.java:505)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
    at java.lang.Thread.run(Thread.java:744)
chengtao commented 10 years ago

from the stacktrace, it seems like you are running out of memory (indicated by java.lang.OutOfMemoryError: Map failed)

luizpvas commented 10 years ago

Is there a minimum amount of memory needed to run EventHub? Shouldn't it grow as more events are added? This error occurs when I try to add the first one.

chengtao commented 10 years ago

I should have made it clearer. EventHub doesn't use that much memory but instead it is using memory mapped file to write data to disk. Though I haven't got a chance to really trace the code, I believe the error message is trying to say that based on the current configuration, the system is trying to allocate a memory mapped file that's larger than 4G and since the file is larger than 4G, it cannot be memory mapped.

luizpvas commented 10 years ago

Hum... I see. Thanks for the answer! I was able to run EventHub just fine on a 64-bit Windows 7 and in a 64-bit Linux VM. I'm guessing it's an issue with 32bit OS then.