Projection host troubles: Multiple projections emitting to the same stream detected?

Hi All,

I have some ongoing trouble with my projection (which just repartitions streams). Here’s the story

  1. I had an extremely simple projection before, it was running happily for a long time:

fromAll().whenAny(function(s, e) {

if (e.metadata) 

    if (e.metadata.component)

      linkTo(e.metadata.component, e); 

return null; 

});

  1. Eventually this projection silently crashed with some weird errors (they all tend to do that eventually for some reason), got stuck in faulted state and refused to start.

The ‘component’ projection faulted due to ‘Cannot create a projection state handler…Failed to compile script. Terminated?’

  1. I gave up on trying to fix the projection, managed to delete it and created another projection to continue from where it stopped (obviously, I’m skipping all events that were already linked). Yet, EventStore is trying to protect me:

Multiple projections emitting to the same stream detected. Stream: ‘hub3-consumption’. Last event projection: ‘6’. Emitting projection: ‘9’

I know that there are multiple projections and that’s the reason why I killed and deleted projection ‘6’.

How can I ignore this “multiple projections” message with “yes, I know” and continue?

Best regards,

Rinat

Follow-up,

Apparently (from looking at the source code) there was no way to disable this check. Problem solved by removing it from source of 2.0.1 (which I’m currently running) and redeploying.

Best,

Rinat

Rinat,

You might be better upgrading to a newer build - projections has changed a lot since 2.0.1 (we specifically released it with the expectation that it would change in the future as it stabilised, which it’s close to being now).

It’s important to stop any projections in the old build before moving to a new one, which ensures that any outstanding checkpoints are written and should prevent duplicate processing.

Cheers,

James

Hi James,

Which build you would recommend as stable enough for production? I saw only 2.0.1 as the latest stable build on the download page.

Best,

Rinat

We haven’t released any newer binaries yet (coming likely this week with clustering support), but I can go through and find you a stable commit to base a new build from. Want to ping me on Skype?

Any build has the caveat that projections still aren’t guaranteed to be perfect yet!

James

Rinat,

The only reason for the “The ‘component’ projection faulted due to ‘Cannot create a projection state handler…Failed to compile script. Terminated?’” message is that JS execution took more than 1 second and it was terminated. What could make compilation (execution of projection JS definition) take so much time? Too busy CPU?

Projections detect conflicts by reading the last event in a stream before writing anything to the stream. Just append any event without metadata to that stream. The new projection will no longer see this stream as output from another projection.

br

Yuriy

James, that would be terrific. What’s your skype handle? Mine is rinat.abdullin

Yuriy, thank you for the tips. Yes, busy CPU was probably the cause (running this Event Store in virtualised environment on Azure - things are slower than bare bone hardware there).

Thanks again.

Best,

Rinat

1 second to process an event is still a huge amount.

@yuriy we might want to make this tunable