Cannot create a query / projection.

I’m investigating using ES for a couple of projects I’m working on. However I can’t seem to create even the simplest projection / query.

And I don’t seem to get much output.

Web Interface:

test_projection- Faulted(0.0%)

**Mode: **OneTime
js1

Console:

[31646,12,02:27:09.153] The ‘test_projection’ projection faulted due to 'Cannot create a projection state handler.

Handler type: JS

Query:

// NOTE: this sample projection immediately stops in one-time mode unless you have

// either event_type1 or event_type1 events in the store

options({

            // reorderEvents: false,          // enables event reordering in a multi-stream projection

                                              // event reordering attempts to feed the projection with events in a

                                              // their natural order

            // processingLag: 0,              // processing lag in ms allowing event reordering to happen

});

fromAll()

// fromStream('streamId') | fromStreams(['sream1', 'stream2']) | fromCategory('category')

   //NOTE: fromCategory requires $by_category standard projection to be enabled

// .foreachStream() | .partitionBy(function(e) { return e.body.useId; })

.when({

    $init: function () {

        return { count1: 0, count2: 0, }; // initial state

    },

    event_type1: function(s, e) {

        //  emit('streamId', 'eventType', {/* event body */} [, {/* optional event metadata */}]);

        //  linkTo('streamId', e [, {/* optional link-to-event metadata */}]);

        //  copyTo('streamId', e);

        s.count1 += 1;

        return s;

    },

    event_type2: function(s, e) {

        s.count2 += 1;

        return s;

    },

    /* $any: function (s, e) ... // NOTE: $any is exclusive and cannot be used in combination with

                                 // other event filters

    */

})

// .filterBy(f)/transformBy(f)

// .outputTo(name[, namePattern]) // defines a name for the output stream

//NOTE: filterBy(), transformBy(), emit(), linkTo(), copyTo() require "emit enabled" (see checkbox below)

Message:

js1’

js1

[31646,11,02:27:09.154] The ‘test_projection’ projection faulted due to ‘js1’

[31646,11,02:27:09.155] ‘test_projection’ projection source has been written

I’ve just downloaded the 2.0.1 and am running from the extracted dir.

ls

EventStore.BufferManagement.dll EventStore.Web.Playground.exe.config

EventStore.BufferManagement.dll.mdb EventStore.Web.Playground.exe.mdb

EventStore.ClientAPI.dll EventStore.Web.dll

EventStore.ClientAPI.dll.mdb EventStore.Web.dll.mdb

EventStore.Common.dll NLog.config

EventStore.Common.dll.mdb NLog.dll

EventStore.Core.Tests.dll Newtonsoft.Json.dll

EventStore.Core.dll Prelude

EventStore.Core.dll.mdb Users

EventStore.Projections.Core.dll config.json

EventStore.Projections.Core.dll.mdb es-common-web

EventStore.SingleNode.Web.dll libjs1.so

EventStore.SingleNode.Web.dll.mdb libv8.so

EventStore.SingleNode.exe nunit.framework.dll

EventStore.TestClient.exe padmin.esconfig

EventStore.Transport.Http.dll padmin.exe

EventStore.Transport.Http.dll.mdb padmin.exe.mdb

EventStore.Transport.Tcp.dll protobuf-net.dll

EventStore.Transport.Tcp.dll.mdb singlenode-web

EventStore.Web.Playground.exe web-resources

I’m on OS X 10.8.4, with Mono:

Mono JIT compiler version 3.2.1 ((no/f3f789e Tue Jul 30 00:31:23 EDT 2013)

Copyright © 2002-2012 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com

TLS: normal

SIGSEGV: altstack

Notification: kqueue

Architecture: x86

Disabled: none

Misc: softdebug

LLVM: yes(3.3svn-mono)

GC: sgen

The command I’m using to start ES is:

sudo mono-sgen EventStore.SingleNode.exe -h 3000 -t 3001 --db .db

Any Ideas?

  • Courtney

Hi,

Two things you need to do there:

  1. –run-projections=all if you want your own projections rather than just system ones to run (system is the default)

  2. ensure that LD_LIBRARY_PATH is exported and pointing to the directory containing libv8.so and libjs1.so.

If this doesn’t work, please post the log that ES outputs during startup as this might contain some useful debugging information. Are you using the released binaries or custom built?

We haven’t tested extensively on OSX, though I don’t see any reason (except for a lack of procfs which prevents statistics collection from working properly) it shouldn’t work for development. As far as I’m aware, mono 3.2.1 does NOT contain our patches,
and consequently is not suitable for production use with the Event Store. However, the patches have been merged into trunk so should be in a future mono release.

Thanks,

James

Hi,

unfortunately we provide a bad error message here. It means that the system cannot find or load libjs1.so. Typically you just need to add it to the LD_LIBRARY_PATH.

br

yuriy

Thanks guys however still no luck. I am using the release binaries.

echo $LD_LIBRARY_PATH

/Users/clautour/Downloads/eventstore-mono-2.0.1/

ls $LD_LIBRARY_PATH

EventStore.BufferManagement.dll EventStore.Web.Playground.exe.config

EventStore.BufferManagement.dll.mdb EventStore.Web.Playground.exe.mdb

EventStore.ClientAPI.dll EventStore.Web.dll

EventStore.ClientAPI.dll.mdb EventStore.Web.dll.mdb

EventStore.Common.dll NLog.config

EventStore.Common.dll.mdb NLog.dll

EventStore.Core.Tests.dll Newtonsoft.Json.dll

EventStore.Core.dll Prelude

EventStore.Core.dll.mdb Users

EventStore.Projections.Core.dll config.json

EventStore.Projections.Core.dll.mdb es-common-web

EventStore.SingleNode.Web.dll libjs1.so

EventStore.SingleNode.Web.dll.mdb libv8.so

EventStore.SingleNode.exe nunit.framework.dll

EventStore.TestClient.exe padmin.esconfig

EventStore.Transport.Http.dll padmin.exe

EventStore.Transport.Http.dll.mdb padmin.exe.mdb

EventStore.Transport.Tcp.dll protobuf-net.dll

EventStore.Transport.Tcp.dll.mdb singlenode-web

EventStore.Web.Playground.exe web-resources

mono-sgen EventStore.SingleNode.exe -h 3000 -t 3001 --db .db2 --run-projections=all

[37778,01,00:45:50.033]

ES VERSION: 2.0.1.0 (master/549d96219418572625b2f68d46ec809d9e86f7df, Thu, 1 Aug 2013 18:26:54 +0100)

OS: Unknown (Unix 12.4.0.0)

RUNTIME: 3.2.1 ((no/f3f789e Tue Jul 30 00:31:23 EDT 2013) (32-bit)

GC: 2 GENERATIONS

LOGS: /Users/clautour/Downloads/eventstore-mono-2.0.1/.db2-logs

SHOW HELP: False ()

SHOW VERSION: False ()

LOGS DIR: ()

CONFIGS: ()

DEFINES: ()

IP: 127.0.0.1 ()

TCP PORT: 3001 (–tcp-port from command line)

SECURE TCP PORT: 0 ()

HTTP PORT: 3000 (–http-port from command line)

STATS PERIOD SEC: 30 ()

CACHED CHUNKS: -1 ()

CHUNKS CACHE SIZE: 536871424 ()

MIN FLUSH DELAY MS: 2 ()

DB PATH: .db2 (–db from command line)

SKIP DB VERIFY: False ()

RUN PROJECTIONS: All (–run-projections from command line)

PROJECTION THREADS: 3 ()

WORKER THREADS: 5 ()

HTTP PREFIXES: ()

ENABLE TRUSTED AUTH: False ()

CERTIFICATE STORE: ()

CERTIFICATE NAME: ()

CERTIFICATE FILE: ()

CERTIFICATE PASSWORD: ()

PREPARE TIMEOUT MS: 2000 ()

COMMIT TIMEOUT MS: 2000 ()

FORCE: False ()

[37778,01,00:45:50.060]

DATABASE: /Users/clautour/Downloads/eventstore-mono-2.0.1/.db2

WRITER CHECKPOINT: 93228 (0x16C2C)

CHASER CHECKPOINT: 93228 (0x16C2C)

EPOCH CHECKPOINT: 92875 (0x16ACB)

TRUNCATE CHECKPOINT: -1 (0xFFFFFFFFFFFFFFFF)

[37778,01,00:45:50.193] MessageHierarchy initialization took 00:00:00.0916501.

[37778,01,00:45:50.268] CACHED TFChunk #0-0 (chunk-000000.000000) in 00:00:00.0018705.

[37778,01,00:45:50.450] Starting MiniWeb for /web/es/js/projections ==> /Users/clautour/Downloads/eventstore-mono-2.0.1/singlenode-web/js/projections

[37778,01,00:45:50.450] Starting MiniWeb for /web/es/js/projections/v8/Prelude ==> /Users/clautour/Downloads/eventstore-mono-2.0.1/Prelude

[37778,01,00:45:50.450] Starting MiniWeb for /web/es/js/projections/resources ==> /Users/clautour/Downloads/eventstore-mono-2.0.1/web-resources/js

[37778,01,00:45:50.451] Binding MiniWeb to /web/es/js/projections/{*remaining_path}

[37778,01,00:45:50.451] Binding MiniWeb to /web/es/js/projections/v8/Prelude/{*remaining_path}

[37778,01,00:45:50.452] Binding MiniWeb to /web/es/js/projections/resources/{*remaining_path}

[37778,01,00:45:50.454] Starting MiniWeb for /web ==> /Users/clautour/Downloads/eventstore-mono-2.0.1/singlenode-web

[37778,01,00:45:50.454] Starting MiniWeb for /web/es ==> /Users/clautour/Downloads/eventstore-mono-2.0.1/es-common-web

[37778,01,00:45:50.454] Binding MiniWeb to /web/{*remaining_path}

[37778,01,00:45:50.454] Binding MiniWeb to /web/es/{*remaining_path}

[37778,01,00:45:50.455] Starting MiniWeb for /web/users ==> /Users/clautour/Downloads/eventstore-mono-2.0.1/Users/web

[37778,01,00:45:50.455] Binding MiniWeb to /web/users/{*remaining_path}

[37778,09,00:45:50.480] ========== [127.0.0.1:3000] SYSTEM INIT…

[37778,09,00:45:50.506] Starting Normal TCP listening on TCP endpoint: 127.0.0.1:3001.

[37778,07,00:45:50.530] TableIndex initialization…

[37778,07,00:45:50.539] ReadIndex building…

[37778,07,00:45:50.557] ReadIndex Rebuilding Done: total processed 57 records, time elapsed: 00:00:00.0180940.

[37778,09,00:45:50.560] Starting HTTP server on [http://127.0.0.1:3000/]…

[37778,09,00:45:50.563] HTTP server is up and listening on [http://127.0.0.1:3000/]

[37778,09,00:45:50.587] SLOW BUS MSG [MainBus]: SystemInit - 54ms. Handler: HttpService.

[37778,09,00:45:50.617] SLOW QUEUE MSG [MainQueue]: SystemInit - 131ms. Q: 0/27.

[37778,09,00:45:50.619] ========== [127.0.0.1:3000] SYSTEM START…

[37778,09,00:45:50.625] ========== [127.0.0.1:3000] PRE-MASTER STATE, WAITING FOR CHASER TO CATCH UP…

[37778,09,00:45:50.627] ========== [127.0.0.1:3000] IS WORKING!!! SPARTA!!!

[37778,07,00:45:50.742] === Writing E6@93228:{1d1dd6a8-6161-4cc1-bd2c-b3a41a56c802} (previous epoch at 92875).

[37778,07,00:45:50.748] === Update Last Epoch E6@93228:{1d1dd6a8-6161-4cc1-bd2c-b3a41a56c802} (previous epoch at 92875).

[37778,13,00:45:50.787] SLOW BUS MSG [bus]: CreatePrepared - 54ms. Handler: ProjectionCoreService.

[37778,13,00:45:50.787] SLOW QUEUE MSG [Projection Core #1]: CreatePrepared - 54ms. Q: 0/2.

[37778,12,00:45:50.788] SLOW BUS MSG [bus]: CreateAndPrepare - 52ms. Handler: ProjectionCoreService.

[37778,14,00:45:50.788] SLOW BUS MSG [bus]: CreatePrepared - 55ms. Handler: ProjectionCoreService.

[37778,12,00:45:50.788] SLOW QUEUE MSG [Projection Core #0]: CreateAndPrepare - 53ms. Q: 0/0.

[37778,14,00:45:50.788] SLOW QUEUE MSG [Projection Core #2]: CreatePrepared - 55ms. Q: 0/2.

[37778,10,00:45:50.820] Created stats stream ‘$stats-127.0.0.1:3000’, code = WrongExpectedVersion

[37778,12,00:45:50.857] Creating an event distribution point at 'C:0/P:-1; $UserCreated: -1; ’

[37778,14,00:45:50.857] Creating an event distribution point at ‘C:0/P:-1’

[37778,13,00:45:50.857] Creating an event distribution point at ‘C:0/P:-1’

[37778,14,00:45:50.882] The ‘84d6edc9-4c25-4679-abae-7469945fcc2f’ projection subscribed to the ‘b10f541a-4cf6-4cec-b0d5-02f48e67b97e’ distribution point

[37778,13,00:45:50.882] The ‘40b7d721-64e0-47d3-9912-11512df10ba1’ projection subscribed to the ‘545a7848-00d7-4895-9b92-8eca79160fff’ distribution point

[37778,12,00:45:50.882] The ‘979fb5d2-a847-498e-8bba-af1327515deb’ projection subscribed to the ‘98c2721b-5ef3-49a6-b751-a7e422e22f91’ distribution point

[37778,14,00:45:50.885] SLOW BUS MSG [bus]: Subscribe - 57ms. Handler: EventReaderCoreService.

[37778,14,00:45:50.885] SLOW QUEUE MSG [Projection Core #2]: Subscribe - 58ms. Q: 4/6.

[37778,14,00:45:50.885] Creating an event distribution point at ‘C:0/P:-1’

[37778,13,00:45:50.885] SLOW BUS MSG [bus]: Subscribe - 58ms. Handler: EventReaderCoreService.

[37778,14,00:45:50.885] The ‘597dd070-583c-4a4e-9ffa-8bcc00301dfc’ projection subscribed to the ‘643174f6-51bb-4124-b508-e4ad1b96d19e’ distribution point

[37778,13,00:45:50.885] SLOW QUEUE MSG [Projection Core #1]: Subscribe - 58ms. Q: 4/6.

[37778,13,00:45:50.885] Creating an event distribution point at ‘C:0/P:-1’

[37778,13,00:45:50.885] The ‘c2725a6c-2261-4945-a5ca-47ee45dabc1d’ projection subscribed to the ‘92d08442-1dae-415d-bd89-287b15d4bef5’ distribution point

[37778,12,00:45:50.887] SLOW BUS MSG [bus]: Subscribe - 60ms. Handler: EventReaderCoreService.

[37778,12,00:45:50.887] SLOW QUEUE MSG [Projection Core #0]: Subscribe - 61ms. Q: 2/6.

[37778,14,00:45:50.919] The ‘84d6edc9-4c25-4679-abae-7469945fcc2f’ subscription has unsubscribed (reader: b10f541a-4cf6-4cec-b0d5-02f48e67b97e)

[37778,13,00:45:50.919] The ‘40b7d721-64e0-47d3-9912-11512df10ba1’ subscription has unsubscribed (reader: 545a7848-00d7-4895-9b92-8eca79160fff)

[37778,13,00:45:50.921] The ‘c2725a6c-2261-4945-a5ca-47ee45dabc1d’ subscription has unsubscribed (reader: 92d08442-1dae-415d-bd89-287b15d4bef5)

[37778,14,00:45:50.921] The ‘597dd070-583c-4a4e-9ffa-8bcc00301dfc’ subscription has unsubscribed (reader: 643174f6-51bb-4124-b508-e4ad1b96d19e)

Looks like you are running a mismatched 64bit vs 32 bit. Mono there is 32 bit but binaries downloaded are 64 bit. I will discuss with others getting 32 bit binaries up otherwise as of now you would need to build from source.

Is there a reason why you would want to be running 32 bit?

Greg

After some discussion internally we at this point are going to leave 32 builds as source base builds. The main reason for this being we do not see many people running in such an environment. We are however open to discussion to this if people have good reasons for wanting to run 32 bit versions that we may be missing.

Greg

Hi Courtney,

One more point - even if you switch it’s possible that libv8.so and libjs1.so will not work correctly under Mac OS X, as it tends to look for *.dylib files instead. I can confirm that building from source works though. We’ll update the downloads page to
be more specific. I’m not sure we’re in a position to be providing Mac builds at the moment (I don’t have any hardware spare to throw up as a build server at the moment), but I’ll investigate it for the future.

Cheers,

James

Thanks guys that makes sense. I have also used the Mono release binaries, and upon further investigation they don’t distribute 64bit binaries for Mac. From http://www.mono-project.com/Mono:OSX:

The 64 bit support has a few limitations today which is why we have not entirely switched to it:

  • Our Windows.Forms implementation uses Carbon, and as such, it would not work with a 64-bit Mono.
  • MonoDevelop uses Carbon for its menu integration so it would not run on a 64-bit VM.
  • MonoMac bindings have not been ported to 64 bits.

This may provide justification to do 32bit builds. In any case, I will build ES myself. Failing that I’ll just run it from a VM.

Hi all!

Just wanted to pitch in that the problem still persists. Although I do see the problem it gets a bit strange to me. Running a Mac myself and trying to get an EventStore dev machine going.

I installed mono (getting forced to get the 32bit version, at least as far as I know). Then i installed the precompiled EventStore binary (getting forced to get the 64bit version, at least as far as I know). EventStore runs, as outlined above, but projections won’t work.

Since Mono on OsX always seems to be 32bit - what is the use case for the 64bit OsX binary? It seems to me that everyone downloading it will run into this problem? Or have I missed anything?

Anyway - after having some issues with installing in parallels as well I will soon be up and running on Ubuntu in Azure, so the problem for me personally is minor (although my dev machine will still not have EventStore running locally).

/Victor

Mono on OSX isn’t 32 bit only but they don’t release binaries for 64 bit (apparently it’s work in progress). You can build it from source fairly trivially.

The next release will be statically linked with mono so won’t require the runtime to be installed separately.

“The next release will be statically linked with mono so won’t require the runtime to be installed separately.”

That’s the way to do it!

I see, prefect then!
/Victor