0
votes

I have been trying to create a worker role using powershell, Azure Emulator and the azure node.js sdk however I have been running into problems when I try to start adding modules to by worker process.

These are the steps I have taken:

1) Run Powershell 2) Create a new azure node.js project

new-azureserviceproject

3) Add a webrole

add-azurenodewebrole

4) Add a worker role

add-azurenodeworkerrole

If I run the project at this stage

start-azureemulator -launch

The site runs fine and without any IIS errors. But when I start installing new modules into the worker role and try running it again I get windows IIS errors such as "Windows Azure Web Role Entry Point Has Stopped Working" without any more information as to why it stopped. Is anybody else encountered these errors and more importantly does anybody have any examples on how to create a worker role to run a cron job and talk to my windows azure table storage? All I want to do is run a cron job every 5 seconds to check table storage for any new updates and do something.

Any ideas?

Details of the error:

Problem Event Name: APPCRASH
Application Name:   iisexpress.exe
Application Version:    8.0.8298.0
Application Timestamp:  4f620349
Fault Module Name:  iiscore.dll
Fault Module Version:   8.0.8298.0
Fault Module Timestamp: 4f63b65c
Exception Code: c0000005
Exception Offset:   00021767
OS Version: 6.1.7601.2.1.0.256.28
Locale ID:  1033
Additional Information 1:   f66d
Additional Information 2:   f66d807b515d6b2dc6f28f66db769a01
Additional Information 3:   7b2f
Additional Information 4:   7b2f6797d07ebc2c23f2b227e779722e

Update, if I lower the instance count to 1 for both webrole and worker role then it doesn't crash, perhaps it's a problem with the azure emulator ?

2

2 Answers

0
votes

There are several questions here, so let's start with the first. A decent sample for using a worker role that adds modules (socket.io) can be found here: https://www.windowsazure.com/en-us/develop/nodejs/tutorials/app-using-socketio/

Next up is of course the conversation about modules on Windows. Some modules with binary dependencies don't run on Windows. That has gotten to be a pretty small number, but it is still a possibility. You should see if you can run your worker role code outside of the emulator to validate this.

Next up we should consider this process. You would typically push changes that require action into a Storage Queue from your web role and pull from the at queue in your worker role. If you have a "cron module" then pull the top item from the queue when the timer event is fired. You can always do sleeps here, but that kind of blocking is frowned on in the node world.

0
votes

This may not be related but I thought I should mention it. I ran into issues because the default version of NodeJS seemed to be too old to work with the modules I was using. You may need to change the version of NodeJS. To see the list of available versions:

Get-AzureServiceProjectRoleRuntime

Then, apply a specific version (example):

Set-AzureServiceProjectRole [Role_Name] Node 0.10.21