bfg / mojox-run

MojoX::Run - asynchronous external command execution for Mojo
5 stars 3 forks source link

new mojo and etc #2

Open sugar84 opened 12 years ago

sugar84 commented 12 years ago

Hello.

MojoX::Run is very useful, thanks.

This script hangs up on my machine (tested with 1.11 amd 1.41 Mojo), it's very simple, but doesn't work.

And MojoX:Run does not work totaly with latest Mojo. I suggest since 1.65, there was many incompatible changes around Mojo::IOLoop. Are you going to fix it?

sugar84 commented 12 years ago

oh sorry... i did a typo, there shold be 'exit_cb' isntead of 'exec_cb'. It was night and i wanted to sleep =)

But second question is still opened/

bfg commented 12 years ago

Hmm... You're right it doesn't work anymore, crap!

I'm getting the following with mojolicious 1.98:

1.98
hello
[Wed Sep 21 11:31:11 2011] [debug] 6.000 seconds]
[Wed Sep 21 11:31:11 2011] [debug] Subprocess spawned as pid 10014.
[Wed Sep 21 11:31:11 2011] [debug] [process 10014]: Setting execution timeout to 6.000 seconds.
[Wed Sep 21 11:31:11 2011] [debug] [process 10014]: handles: stdin=8d49a6c, stdout=8d2a5a4, stderr=8d2ae34
[Wed Sep 21 11:31:11 2011] [debug] [process 10014]: stdio stream timeout set to 7 seconds.
[Wed Sep 21 11:31:11 2011] [debug] [process 10014]: (handle: 8d2a5a4) Appending 30 bytes to STDOUT buffer.
[Wed Sep 21 11:31:11 2011] [debug] [process 10014]: Error on handle 8d49a6c: Bad file descriptor
[Wed Sep 21 11:31:11 2011] [debug] [process 10014]: STDIN closed.
Write failed: Can't call method "_connecting" on an undefined value at /usr/lib/perl5/site_perl/5.12.3/Mojo/IOLoop/Client.pm line 129.

I'm going to take a look into it and try to fix it... Geee, i just hate Mojo::IOLoop; @kraih should just use AnyEvent...

kraih commented 12 years ago

We already have native AnyEvent support in Mojolicious through EV.

bfg commented 12 years ago

kraih, EV support is great, i really appreciate it, but is not native AnyEvent support; AnyEvent modules work just becouse AnyEvent tries to use EV by default.

I created MojoX::Run before Mojo::IOLoop supported EV; Mojo::IOLoop interface changed quite a bit since beginning of the year, AnyEvent interface didn't change in at least two years - that's why i love it :)

My opinion is that Mojolicious should add a single dependency - AnyEvent and that Mojo::UserAgentl, morbo and Mojo::Server::Daemon should be reimplemented using AnyEvent. But you (kraih) set clear goals for Mojolicious (no dependencies) and this just doesn't make so much sense in my opinion... However, it's your project, we all love it :)

And i'll have to deal with api change... and this is what really sucks.

No hard feelings, we don't need to agree :)

Brane

bfg commented 12 years ago

Damn, i just hate comment & close button :)

kraih commented 12 years ago

It's not about dependencies, i just don't like AnyEvent (unlike EV, which i like a lot). ;)

sugar84 commented 12 years ago

I hate this button too =))

But what is the total your decision? Don't adopt MojoX::Run to Mojo::IOLoop, right?

bfg commented 12 years ago

I will FIX MojoX::Run to work natively with latest Mojo::IOLoop :)

sugar84 commented 12 years ago

cool, thanks =)

bfg commented 12 years ago

Do you use EV backend? It seems that Mojolicious 1.65 broke non-socket fh support in IOLoop...

I'm getting:

Write failed: Can't call method "_connecting" on an undefined value at /usr/lib/perl5/site_perl/5.12.3/Mojo/IOLoop/Client.pm line 129.

I'm asking this because i'm thinking about implementing MojoX::Run on top of EV, which has stable interface... What do you think about depending MojoX::Run to EV?

sugar84 commented 12 years ago

Yes, it was broken in 1.66. But i had some bugs in 1.11. EV? I think is good decision, because IOLoop has unstable public interface, and sri means IOLoop as internal module.

Now i'm trying to implement my own similar asyncronous system on top of AnyEvent, but if you will port MojoX::Run to EV, it will be better than dependency to AnyEvent. And i will switch to helping you with testing new MojoX::Run.

regards

bfg commented 12 years ago

Hi!

I'm very busy these days, sorry for delay. Does commit a1fdd1a5e0846b7 fix your problems?

After debugging i came up with the following conclusion:

bfg commented 12 years ago

@kraih, you don't like AnyEvent, but you like EV?!?!

Funny, both modules were made by the same author, EV gives you just pure, but blazingly fast event loop, AnyEvent gives you async DNS, working IPv6 and TLS, powered by EV... And AE interface is almost the same as EV interface...

So, if you're such fan of EV, you should reimplement Mojo::Server::Daemon and Mojo::Client using EV and obsolete IOLoop. World really doesn't need another eventloop implemented on top of other eventloop :)

sugar84 commented 12 years ago

This commit allows to run mojox-run with new Mojo::* Thanks a lot

But it's not solve this bug, i sent pull request to fix it

sugar84 commented 12 years ago

... and on another machine with last commit to mojoxrun has those nice tests error mojolicious is last (1.99)

bfg commented 12 years ago

Can you please set environment variable MOJO_IOWATCHER="Mojo::IOWatcher" before running tests again? I'm getting different errors with EV and pure perl implementations.

This is just not fun anymore. Kraih says that ioloop was never ment to things such as mojox-run and that this functionality is completely unsupported. It looks like writing to process stdin is completely broken in pure-perl ioloop implementation, but it could be fixed under EV implementation by implementing IO directly using EV api...

Hm, i'm not sure if this has any sense... Have you tried AnyEvent::Util::run_cmd, Anyevent::SubProcess or AnyEvent::Run? They should work with EV ioloop implementation...

sugar84 commented 12 years ago

Yes with MOJO_IOWATCHER="Mojo::IOWatcher" tests worked

AnyEvent::Util::run_cmd - it's only for "cmd" AnyEvent::Run - not good Anyevent::SubProcess - good, depends on Moose =(

sugar84 commented 12 years ago

Mb throw out IOLoop? =)