"Subscription has unsubscribed" after attempting to Start a Projection on Windows Azure running Linux (I don't get that message in Windows)

Hello,

I’m trying to run EventStore on Windows Azure and I’ve gotten pretty far just by following this advice:

  1. https://github.com/EventStore/EventStore/wiki/Setup-EventStore-on-Windows-Azure

  2. Using daemonize to turn the process into a daemon

  3. Remembering to export the LD_LIBRARY_PATH to avoid complete failure of the projects

But, now I am at the point where a projection is not really starting after I click “Start”. I know this was working under Windows on my local machine because I wrote and tested it several months ago during a training class from Greg when he was in Atlanta.

Here’s what happens:

When I click the “Start” button for the projection, I get this console message:

[09900,11,17:26:23.604] Enabling ‘QuestionAnswerCounts3’ projection

[09900,11,17:26:23.713] ‘QuestionAnswerCounts3’ projection source has been written

[09900,12,17:26:23.716] Creating an event distribution point at ‘answers: -1’

[09900,12,17:26:23.716] The ‘c9290922-f39e-4972-9f34-b16653e77ad5’ projection subscribed to the ‘c64188dc-c179-4e24-9ee7-c280f4df3728’ distribution point

[09900,12,17:26:23.719] The ‘c9290922-f39e-4972-9f34-b16653e77ad5’ subscription has joined the heading distribution point at ‘10402467’

[09900,12,17:26:23.719] The ‘c9290922-f39e-4972-9f34-b16653e77ad5’ projection subscribed to the ‘04e084af-3129-471c-ac80-fbb25c917de8’ heading distribution point

[09900,12,17:26:23.719] The ‘c9290922-f39e-4972-9f34-b16653e77ad5’ is subscribing to the heading distribution point with TF-EOF marker event at '10402467’

[09900,12,17:26:23.721] The ‘c9290922-f39e-4972-9f34-b16653e77ad5’ subscription has unsubscribed from the ‘04e084af-3129-471c-ac80-fbb25c917de8’ heading distribution point

[09900,12,17:26:23.721] Creating an event distribution point at 'answers: 44’

[09900,12,17:26:23.721] The ‘c9290922-f39e-4972-9f34-b16653e77ad5’ subscription has unsubscribed (reader: dcd2d80e-bb75-42c2-b0c0-f6864133390d)

By contrast, locally on Windows 7 when I enable the same projection I see:

[03328,14,17:40:01.288] ‘QuestionAnswerCoutns2’ projection source has been written

[03328,15,17:40:01.288] The ‘855bb98e-5d2a-4c8e-be8e-7d7c0f72ea32’ subscription has unsubscribed (reader: 8b9abdd7-7f95-4b40-8134-85a3bc15edcc)

[03328,15,17:40:01.288] Creating an event distribution point at ‘answers: 284’

[03328,15,17:40:01.288] The ‘d05b1b40-bbc8-4ad7-8f04-db9f23d2bcb2’ projection subscribed to the ‘0acd5ceb-e82b-4845-ab4e-7bd528f8e1ed’ distribution point

[03328,15,17:40:01.288] The ‘d05b1b40-bbc8-4ad7-8f04-db9f23d2bcb2’ subscription has joined the heading distribution point at ‘348353230’

[03328,15,17:40:01.295] The ‘d05b1b40-bbc8-4ad7-8f04-db9f23d2bcb2’ projection subscribed to the ‘1d459a77-949a-4fdb-969b-ee824baae081’ heading distribution point

[03328,15,17:40:01.295] The ‘d05b1b40-bbc8-4ad7-8f04-db9f23d2bcb2’ is subscribing to the heading distribution point with TF-EOF marker event at '348353230’

[03328,30,17:40:15.676] Error while collecting stats The Counter layout for the Category specified is invalid, a counter of the type:

AverageCount64, AverageTimer32, CounterMultiTimer, CounterMultiTimerInverse, C

ounterMultiTimer100Ns, CounterMultiTimer100NsInverse, RawFraction, or SampleFrac

tion has to be immediately followed by any of the base counter types: AverageBas

e, CounterMultiBase, RawBase or SampleBase.

Even though there is that error at the bottom, it still seems to work fine, and I never get the unsubscribed notice.

In the UI in Chrome’s network tab I see some failed requests:

  1. Request URL:

http://v1csevents.cloudapp.net:2113/projection/QuestionAnswerCounts3/result

  1. Request Headers CAUTION: Provisional headers are shown.
  2. Accept:

application/json

  1. Referer:

http://v1csevents.cloudapp.net:2113/web/view-projection.htm

  1. User-Agent:

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36

  1. X-Requested-With:

XMLHttpRequest

  1. Request URL:

http://v1csevents.cloudapp.net:2113/projection/QuestionAnswerCounts3/state

  1. Request Headers CAUTION: Provisional headers are shown.
  2. Accept:

application/json

  1. Referer:

http://v1csevents.cloudapp.net:2113/web/view-projection.htm

  1. User-Agent:

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36

  1. X-Requested-With:

XMLHttpRequest

However, after that, the requests for state are no longer cancelled, but just return nothing, when it starts polling – which of course also results in the state panel being empty in the UI for the Projection.

SIDE NOTE: When I do “Debug Projection” – I can build up the state and see it created as I expect.

Here’s the console messaging for that:

  1. Load the Debug Projection page, console:

[09900,12,17:38:30.275] Creating an event distribution point at ‘answers: -1’

[09900,12,17:38:30.275] The ‘6837d6a9-6b79-4b42-bd19-9d2e5295b5e3’ projection su

bscribed to the ‘97bc471d-4ecb-47ae-bc37-f0eb6f564486’ distribution point

[09900,12,17:38:30.276] The ‘6837d6a9-6b79-4b42-bd19-9d2e5295b5e3’ subscription

has unsubscribed (reader: 97bc471d-4ecb-47ae-bc37-f0eb6f564486)

Press run button:

[09900,12,17:40:38.982] Creating an event distribution point at ‘answers: 0’

[09900,12,17:40:38.982] The ‘c07f8156-70f1-40b0-9d0e-7dc3a4a6581e’ projection su

bscribed to the ‘e704d88e-018a-4f1f-bfa0-236875851a54’ distribution point

[09900,12,17:40:38.983] The ‘c07f8156-70f1-40b0-9d0e-7dc3a4a6581e’ subscription

has unsubscribed (reader: e704d88e-018a-4f1f-bfa0-236875851a54)

State result:

{“questions”:{“1”:{“choices”:{“You should use constructor injection always”:1}}}}

Press again:

[09900,12,17:41:45.484] Creating an event distribution point at ‘answers: 1’

[09900,12,17:41:45.484] The ‘ad1d90cb-96aa-47cb-aaee-7fa23436348f’ projection su

bscribed to the ‘b0ad1f07-bce2-4f2b-93af-ad66ecc94e31’ distribution point

[09900,12,17:41:45.485] The ‘ad1d90cb-96aa-47cb-aaee-7fa23436348f’ subscription

has unsubscribed (reader: b0ad1f07-bce2-4f2b-93af-ad66ecc94e31)

State result:

{“questions”:{“1”:{“choices”:{“You should use constructor injection always”:1}},“2”:{“choices”:{“Magic-oriented programming”:1}}}}

I notice that this is what happens when I Run, the URL http://v1csevents.cloudapp.net:2113/projections/read-events is read, and returns this data

… is the projection being processed on the client side here?

{

“correlationId”: “5b6bc178-e6a4-480f-92ee-be8c789b598a”,

“readerPosition”: {"$s":{“answers”:12}},

“events”: [

{

“eventStreamId”: “answers”,

“eventNumber”: 3,

“eventType”: “Answer”,

“data”: {

“user”: {

“value”: “Guest47779”

},

“answer”: {

“questionId”: 4,

“choice”: “Extract interface”,

“correct”: false

}

},

“isJson”: true,

“readerPosition”: {"$s":{“answers”:3}}

},

{

“eventStreamId”: “answers”,

“eventNumber”: 4,

“eventType”: “Answer”,

“data”: {

“user”: {

“value”: “Guest47779”

},

“answer”: {

“questionId”: 5,

“choice”: “C#QRS”,

“correct”: false

}

},

“isJson”: true,

“readerPosition”: {"$s":{“answers”:4}}

},

{

“eventStreamId”: “answers”,

“eventNumber”: 5,

“eventType”: “Answer”,

“data”: {

“user”: {

“value”: “Guest47779”

},

“answer”: {

“questionId”: 6,

“choice”: “When building a large-scale searchable index”,

“correct”: true

}

},

“isJson”: true,

“readerPosition”: {"$s":{“answers”:5}}

},

{

“eventStreamId”: “answers”,

“eventNumber”: 6,

“eventType”: “Answer”,

“data”: {

“user”: {

“value”: “Guest47779”

},

“answer”: {

“questionId”: 7,

“choice”: “Make systems that are able to recover from every failure”,

“correct”: false

}

},

“isJson”: true,

“readerPosition”: {"$s":{“answers”:6}}

},

{

“eventStreamId”: “answers”,

“eventNumber”: 7,

“eventType”: “Answer”,

“data”: {

“user”: {

“value”: “Guest47779”

},

“answer”: {

“questionId”: 8,

“choice”: “When you make a sale in the sales system, your data will be eventually consistent in the billing system”,

“correct”: false

}

},

“isJson”: true,

“readerPosition”: {"$s":{“answers”:7}}

},

{

“eventStreamId”: “answers”,

“eventNumber”: 8,

“eventType”: “Answer”,

“data”: {

“user”: {

“value”: “Guest47779”

},

“answer”: {

“questionId”: 9,

“choice”: “Redirect the user back to the screen to read the data they just updated immediately”,

“correct”: false

}

},

“isJson”: true,

“readerPosition”: {"$s":{“answers”:8}}

},

{

“eventStreamId”: “answers”,

“eventNumber”: 9,

“eventType”: “Answer”,

“data”: {

“user”: {

“value”: “Guest50217”

},

“answer”: {

“questionId”: 1,

“choice”: “Consider using a functional style that passes your depdendencies via a closure”,

“correct”: true

}

},

“isJson”: true,

“readerPosition”: {"$s":{“answers”:9}}

},

{

“eventStreamId”: “answers”,

“eventNumber”: 10,

“eventType”: “Answer”,

“data”: {

“user”: {

“value”: “Guest50217”

},

“answer”: {

“questionId”: 2,

“choice”: “Magic-oriented programming”,

“correct”: false

}

},

“isJson”: true,

“readerPosition”: {"$s":{“answers”:10}}

},

{

“eventStreamId”: “answers”,

“eventNumber”: 11,

“eventType”: “Answer”,

“data”: {

“user”: {

“value”: “Guest50217”

},

“answer”: {

“questionId”: 3,

“choice”: “Because a class gets created at run-time that derives from your class to stand in its place”,

“correct”: true

}

},

“isJson”: true,

“readerPosition”: {"$s":{“answers”:11}}

},

{

“eventStreamId”: “answers”,

“eventNumber”: 12,

“eventType”: “Answer”,

“data”: {

“user”: {

“value”: “Guest50217”

},

“answer”: {

“questionId”: 4

}

},

“isJson”: true,

“readerPosition”: {"$s":{“answers”:12}}

}

]

}

Finally, for what it’s worth this is my projection:

fromStream(‘answers’).

when({

$init: function() {

return { questions: {} };

},

‘Answer’: function(s, e) {

try

{

var key = e.data.answer.questionId;

if (key === undefined)

return;

if (!s.questions[key]) {

s.questions[key] = { choices: {} };

}

var question = s.questions[key];

if (question === undefined)

return;

var choice = e.data.answer.choice;

if (choice === undefined)

return;

if (!question.choices[choice]) {

question.choices[choice] = 0;

}

question.choices[choice]++;

} catch (ex) {

}

}

});

The original app that fills the answers stream is this:

https://github.com/JogoShugh/AngularEventStoreQuiz

I run it using the node nws package after compiling the coffeescript to JS.

I modified it to point the server root to http://v1csevents.cloudapp.net:2113 and that part worked just fine. It allows me to submit answers into the stream and all that.

Do you have --run-projections=all as part of your command line?

Yep

I also tried --run-projections all

Here’s what I have:

azureuser@V1CSEvents:~$ cat runEventStore.sh

. /home/azureuser/download/EventStore/mono.sh

. /home/azureuser/eventstore-2.0.1/binaries/eventStore.sh

daemonize /opt/mono/bin/mono-sgen /home/azureuser/eventstore-2.0.1/binaries/Even

tStore.SingleNode.exe --enable-projections=all

where mono.sh is:

export PATH=/opt/mono/bin:$PATH

and eventStore.sh is:

export LD_LIBRARY_PATH=/home/azureuser/eventstore-2.0.1/binaries/

Does that look normal?

Thanks!

Josh

Heh…wait a second! enable-projections!!! let me try with run-

Yes!!! dunno why I had enable-projections instead of run-projections, as I had run-projections in my local instance, but now it works!
Thanks James!