Mojolicious morbo constantly crashing on Windows

Today I’ve shown Mojolicious to some of my colleaques in a social coding workshop. They don’t have any experiences with the new kind of web frameworks and Mojolicious provides a nice way to get into the post CGI.pm times. The use case for the demo was a Mercurial management web interface. The setup was very simple, ActiveState Perl 5.16.1, VIM for Windows and the recent version of Mojolicious. I used morbo as the development webserver and everytime I saved the file in VIM morbo crashed instantly.

Not morbo itself but the Perl interpreter. It turned out to be a known issue in the Mojolicious issue tracking system at github. The reason for the crashes is not inside Mojolicious but inside the Windows parts of Perl, especially in the thread parts. This causes crashes inside of IO::Socket::SSL and EV and therefore crashes for morbo.

There is a simple solution for that. You can set certain environment variables to turn off the usage of EV (and TLS if you want to). As I am not using TLS in my morbo environments it was sufficient for me to set the environment variable MOJO_REACTOR to Mojo::Reactor::Poll and avoid the usage of libev.

C:\> set MOJO_REACTOR=Mojo::Reactor::Poll

Voila, enjoy a working morbo on Windows. Btw, the workshop was great, it’s nice to see people having interest in Perl again.

 

Update: There seem to be a fix, however it was not working as it just fell back to Mojo::Reactor::Poll instead of using EV.

If you are a frequent Windows user and would like to make this environment permanent to your user you can use the setx command to save this environment to your users registry. This will save it and the next morbo session from a different terminal will work without flaws. Here is the command:

C:\>setx MOJO_REACTOR Mojo::Reactor::Poll

ERFOLGREICH: Angegebener Wert wurde gespeichert.

Please note, I am using a German windows version. The message just says, that this value has been stored successfully. It’s now part of the reigistry of my user and will stay even after a reboot. With the /M switch to the setx command this can be made global for all users on the system.