Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

RoleEnvironment::trackChanges throws when role state changes #580

Closed
brian-swan opened this Issue · 2 comments

4 participants

@brian-swan

When running this script in a worker role...

 <?php
 require_once 'vendor\autoload.php';
 use WindowsAzure\ServiceRuntime\RoleEnvironment;

 class MyEventProcessor {
   public static function changeCallback() {
               var_dump('hi there');
$h = fopen("output.txt", "w+");
fwrite($h, "hello there.\n");
            }
 }

 var_dump('Is available:');
 var_dump(RoleEnvironment::isAvailable());

 RoleEnvironment::addRoleEnvironmentChangingListener('MyEventProcessor::changeCallback');
 RoleEnvironment::trackChanges();

 ?>

...the script exits with the following error when the role state changes:

[17-Jul-2012 23:22:15 UTC] PHP Fatal error: Uncaught exception 'WindowsAzure\ServiceRuntime\Internal\ChannelNotAvailableException' in E:\approot\vendor\microsoft\windowsazure\WindowsAzure\ServiceRuntime\Internal\FileInputChannel.php:60
Stack trace:
#0 E:\approot\vendor\microsoft\windowsazure\WindowsAzure\ServiceRuntime\Internal\Protocol1RuntimeGoalStateClient.php(200): WindowsAzure\ServiceRuntime\Internal\FileInputChannel->getInputStream('\.\pipe\Window...')
#1 E:\approot\vendor\microsoft\windowsazure\WindowsAzure\ServiceRuntime\Internal\Protocol1RuntimeGoalStateClient.php(114): WindowsAzure\ServiceRuntime\Internal\Protocol1RuntimeGoalStateClient->_ensureGoalStateRetrieved()
#2 E:\approot\vendor\microsoft\windowsazure\WindowsAzure\ServiceRuntime\Internal\Protocol1RuntimeClient.php(72): WindowsAzure\ServiceRuntime\Internal\Protocol1RuntimeGoalStateClient->getCurrentGoalState()
#3 E:\approot\vendor\microsoft\windowsazure\WindowsAzure\ServiceRuntime\RoleEnvironment.php(212): WindowsAzure\ServiceRuntime\Internal\Protocol1RuntimeClient->getCurrentGoalState in E:\approot\vendor\microsoft\windowsazure\WindowsAzure\ServiceRuntime\Internal\FileInputChannel.php on line 60
[17-Jul-2012 23:22:45 UTC] PHP Notice: Undefined index: RoleEnvironmentPath in E:\approot\vendor\microsoft\windowsazure\WindowsAzure\ServiceRuntime\Internal\XmlGoalStateDeserializer.php on line 55
[17-Jul-2012 23:22:45 UTC] PHP Notice: Undefined index: RoleEnvironmentPath in E:\approot\vendor\microsoft\windowsazure\WindowsAzure\ServiceRuntime\Internal\XmlGoalStateDeserializer.php on line 55

The role state was being changed by another script:

 <?php

 require_once 'vendor\autoload.php';
 use WindowsAzure\ServiceRuntime\RoleEnvironment;
 use WindowsAzure\ServiceRuntime\Internal\RoleInstanceStatus;

 var_dump('Is available:');
 var_dump(RoleEnvironment::isAvailable());

 var_dump('changing to busy');

 $leaseEnd = new \DateTime();
 RoleEnvironment::setStatus(RoleInstanceStatus::BUSY, $leaseEnd);

 var_dump('Is available:');
 var_dump(RoleEnvironment::isAvailable());

 // sleep 30 seconds
 var_dump('sleeping');
 sleep(30);

 var_dump('changing to ready');
 RoleEnvironment::clearStatus();

 var_dump('Is available:');
 var_dump(RoleEnvironment::isAvailable());

 ?>
@brian-swan brian-swan was assigned
@ogail
Collaborator

Chatted with @andrerod and he think that this maybe cause from azure core itself or not. He'll investigate, reassign.

@andrerod andrerod was assigned
@matt-gibbs
Owner

Closing stale issues. Reactivate if it should be reconsidered.

@matt-gibbs matt-gibbs closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.