Skip to content


Workaround for morbo (MSWin + threads related) #384

wants to merge 1 commit into from

3 participants



I was investigating why morbo's autoreloading feature is crashing on MS Windows.

It turns out that there are 2 pieces used by Mojo that do not play well with threads (you probably know that fork() which is used by morbo is emulated via threads on MS Windows).

1/ Mojo::Reactor::EV seems to have troubles when used with perl's threads

2/ IO::Socket::SSL is basically thread safe providing that it is loaded in the main thread - I have created an RT for this issue

The patch in this pull request tries to deal with those 2 issues.

I know that it is a hack and that proper fix should be made in other modules outside Mojo. On the other hand providing that morbo is "only" development server I hope you will not reject it.



-1 from me, historically all Windows specific behavior has always turned out to be a total nightmare to maintain for us. This should really be fixed in EV and IO::Socket::SSL. Windows users who have those modules installed can already use the MOJO_NO_TLS=1 and MOJO_REACTOR=Mojo::Reactor::Poll environment variables as a workaround.

@kraih kraih closed this

For future reference, we've discussed this a bit further on IRC, and it turns out that only EV is currently not thread-safe. So Windows users who have EV installed and want to use Morbo, only need to set the MOJO_REACTOR=Mojo::Reactor::Poll environment variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 17, 2012
  1. @kmx
Showing with 7 additions and 0 deletions.
  1. +7 −0 script/morbo
7 script/morbo
@@ -37,6 +37,13 @@ These options are available:
working directory.
+if ($^O eq 'MSWin32') {
+ # morbo uses fork() which is on MS Windows emulated via threads
+ # however some pieces used by Mojo are not completely thread-safe
+ $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll'; # avoid using Mojo::Reactor::EV
+ $ENV{MOJO_NO_TLS} or require IO::Socket::SSL; # workaround for RT #79685
$ENV{MOJO_LISTEN} = join(',', @listen) if @listen;
require Mojo::Server::Morbo;
my $morbo = Mojo::Server::Morbo->new;
Something went wrong with that request. Please try again.