none
Restart WaWorkerHost safely RRS feed

  • Question

  • Hi,
    I'm trying to troubelshoot some issues in our application after deployment to Azure (in emulator it runs well). The problem seems to be in worker role, so I added some more tracing into the code and now I would like to replace the assembly at worker role instance. I connected using Remote Desktop and copy the assembly to the host instance.

    I'm not able to replace the assembly as it is used by the worker role process. So I would need to stop it for time of replacing and then start it again. What is the best way how to do it?

    Thanks

    eXavier


    eXavier
    Wednesday, August 24, 2011 9:46 AM

Answers

  • InUse uses the same mechanism as installers and Windows Update. When these programs find a file that cannot be replaced because it's locked, they create a new entry in a list of pending file operations. The next time the operating system restarts, it replaces each file in this list. This occurs early during the boot process to ensure that the programs that use these files haven't started yet.

    But if you kill the process, it should release the lock on the assembly so presumably you won't need InUse in that case. 

    • Marked as answer by eXavier_777 Thursday, August 25, 2011 12:43 PM
    Thursday, August 25, 2011 11:32 AM

All replies

  • You might be able to mark the assembly for replacement with the InUse utility (see http://support.microsoft.com/kb/228930). Once you've done that, you can log into the portal, select the correct instance and choose reboot. I suppose that rebooting the instance from the remote desktop session will also work but by doing it at the portal, you are letting the fabric know what's happening. The assembly should be replaced once the instance is rebooted.

    Also, if it dies, the worker role process should be automatically restarted. So another option would be to kill the process and replace the DLL before the process starts again. But you said "safely", so the first method seems to fit this category a little better.

    I assume this is only for troubleshooting purposes. If you have multiple role instances, you will need to repeat the procedure with each instance. Also, if an instance is reimaged for any reason, all your changes will be lost.

     

     

     

     

    Wednesday, August 24, 2011 2:21 PM
  • Sounds good. Does InUse work with just killing the process? If so that would be exactly what I was looking for.

    Thanks!


    eXavier
    Thursday, August 25, 2011 9:19 AM
  • InUse uses the same mechanism as installers and Windows Update. When these programs find a file that cannot be replaced because it's locked, they create a new entry in a list of pending file operations. The next time the operating system restarts, it replaces each file in this list. This occurs early during the boot process to ensure that the programs that use these files haven't started yet.

    But if you kill the process, it should release the lock on the assembly so presumably you won't need InUse in that case. 

    • Marked as answer by eXavier_777 Thursday, August 25, 2011 12:43 PM
    Thursday, August 25, 2011 11:32 AM