The web in a box - a next generation web framework for the Perl programming language

IRC log for #mojo, 2017-04-13

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:20 stryx` joined #mojo
00:47 Lee joined #mojo
01:32 omega joined #mojo
01:36 tchaves joined #mojo
02:23 noganex_ joined #mojo
04:04 dboehmer_ joined #mojo
04:24 arcanez purl: jberger?
04:24 purl somebody said jberger was http://i.imgur.com/UPfFmXF.jpg or Foreman
05:29 SwellJoe joined #mojo
05:47 dod joined #mojo
05:48 mishanti1 Dark Oath is pretty decent if you want somewhat melodic soft metal. Portugese it seems, though the vocals are english.
05:53 dod joined #mojo
05:56 inokenty-w joined #mojo
06:11 SwellJoe_ joined #mojo
06:27 dod joined #mojo
06:36 Vandal joined #mojo
07:05 trone joined #mojo
07:08 rshadow joined #mojo
07:25 AndrewIsh joined #mojo
08:49 rshadow joined #mojo
08:56 HtbaaPi hello all, I'm running into some issues with Hypnotoad :(
08:56 HtbaaPi I've moved this application from an nginx server to apache and have been having problems since
08:57 HtbaaPi inside my action I'm executing a number of HTTP requests to its own API and more often than not I get a 'Worker has no hearbeat, restarting'
08:57 HtbaaPi resulting in a Proxy Error for the upload. I've already upped the heartbeat_timeout to 300 secs, inactivity_timeout to 120 secs. Have 16 workers
08:58 HtbaaPi Apache is configures as: ProxyPass / http://127.0.0.1:5000/ retry=1 acquire=3000 timeout=600 keepalive=On
08:58 HtbaaPi any pointers what else I can do?
09:02 HtbaaPi the action executing these requests and the one receiving the requests also call inactivity_timeout(600) to make sure there's enough time
09:05 trone joined #mojo
09:13 HtbaaPi my Apache error log is giving me a lot of: 'error reading status line from remote server 127.0.0.1:5000' errors as well
09:22 mishanti1 HtbaaPi: FYI there is little activity on this channel at this time (due to timezones being a thing). Please hang around and I'm sure someone will be able to help out.
09:23 HtbaaPi mishanti1: I always have irssi open. So I can always watch back. Thanks
09:23 mishanti1 HtbaaPi: Btw, are these requests executed non-blocking so you give the worker time to ack eg. heartbeats?
09:24 nic HtbaaPi: It's many years since I fought with Apache, but have you checked the Guides and wiki notes?  (I'm guessing 'yes' but just want to check.)
09:25 HtbaaPi nic: Yes I have. Could take another look at the Wiki but last time that didn't have what I needed though :(
09:25 mishanti1 HtbaaPi: Can I ask why you went from nginx to apache? I usually hear people going the other way these days.
09:25 HtbaaPi mishanti1: as far as I know it's non-blocking. I followed the guide to do the http request non-blocking
09:26 HtbaaPi e.g. call render_later, then call $self->ua->post() and pass it an anonymous subroutine
09:26 HtbaaPi inside that subroutine I call several ua->posts() the same way that are doing the actual uploads
09:27 HtbaaPi mishanti1: reason the transfer was made to Apache was because of how that server has been configured
09:27 karjala_ joined #mojo
09:27 HtbaaPi the tooling that exists there to create website accounts etc. is based around Apache
09:29 karjala_ When running "hypnotoad scripts/app.pl" while hypnotoad is already running, in order to update itself with the latest files, should I prepend the hypnotoad command with the necessary ENV varibales again? Such as MOJO_REVERSE_PROXY=1 etc?
09:29 HtbaaPi in this case I'm pretty sure the blame is with Apache. These errors never ocurred with nginx
09:30 HtbaaPi but for this particular server I could get rid of Apache. Would probably be a better solution
09:47 HtbaaPi Apache manual is talking about the proxy-initial-not-pooled setting which supposedly avoids that error message. Hopefuly that's the solution then
10:01 pink_mist HtbaaPi: is there any reason you haveto do http requests to yourself rather than just calling helper functions?
10:04 HtbaaPi pink_mist: it mainly has to do with preventing (some) code duplication. Everything is handled by models so it could be done
10:04 pink_mist then I *REALLY* and *STRONGLY* suggest you change so you can just call helper functions instead of having to do http requests to your own app.
10:04 HtbaaPi but there's at least one case where it really needs to call itself
10:05 HtbaaPi I'm aware
10:05 HtbaaPi it's just not always that simple to just change stuff
10:05 pink_mist of course, I understand. but it really is the thing to do.
10:05 HtbaaPi and under nginx it has never been an issue
10:07 pink_mist karjala_: yes, you should give it the same env vars again
10:12 karjala_ thx
10:34 HtbaaPi refactoring to only use method calls and not doing http requests was easier than expected. Still have one left but this is a lot better
10:36 stryx` joined #mojo
10:36 pink_mist heh, great :P HtbaaPi++
11:16 rshadow joined #mojo
11:23 stryx` joined #mojo
11:29 janl joined #mojo
11:32 Sebbe joined #mojo
11:51 dotan_convos joined #mojo
12:08 marcus joined #mojo
12:08 batman joined #mojo
12:10 maschine I couldn't get the reverse proxies to work at all with Apache and Hypnotoad - I set it up exactly like the guides said and always got 500 internal error.  I removed Apache2 and installed nginx (first time ever) and it worked immediately.
12:29 janl nginx is easy to configure
12:29 janl apache is hellish
12:31 HtbaaPi janl: oh I know, especially when you need to reverseproxy, but also fastcgi stuff. And what not really :)
12:32 HtbaaPi but, with the newer proxy_http module it's become a lot easier to use reverse proxy with Apache
12:42 sri hmm, i guess it would be kinda neat if Mojo::File docs mentioned which methods interact with the file system and which don't
13:21 kes joined #mojo
13:22 kes strange, When I write: ->status_is( 234 ) I got next warning:
13:22 kes You named your test '234 '.  You shouldn't use numbers for your test names
13:23 sri oh, phantomjs just died
13:24 sri maintainer stepped down after chrome announced headless chrome support out of the box
13:24 Pyritic joined #mojo
13:25 gizmomathboy joined #mojo
13:26 dod joined #mojo
13:26 * sri pokes jberger
13:45 sri guess microsoft will buy ubuntu soon
13:45 sri that would explain all the drastic changes recently
13:45 ribasushi sri: too late https://fossbytes.com/microsoft-buys-canonical-kills-ubuntu-linux-forever/
13:46 sri i'm not a fan of april fools, and that's not even a good one
13:47 ribasushi :)
13:49 sri would make total sense for microsoft to want in on the enterprise linux business, and at the same time they would get the distro for WSL on the desktop
13:50 gryphon joined #mojo
13:54 sri Grinnz: re cpan modules, minion also got a few new features since your last sqlite backend release *nudge nudge*
13:55 dod joined #mojo
14:10 karjala_ joined #mojo
14:22 jberger sri: hmmmm, maybe that's a good thing
14:22 jberger phantomjs has always felt frustratingly incomplete
14:22 jberger if you do something in the page context asynchronously there is basically no way to check what the page state is later
14:23 jberger the way people do it is to attach a console log event listener use that as a conduit for communication
14:23 jberger which is just crazy
14:24 jberger and the documentation is half empty, for even some basic methods/events
14:26 vicash jberger: any opinions on slimerjs ?
14:26 jberger haven't used it
14:27 jberger "and is not yet truly headless"
14:27 jberger that sounds like a bad sign
14:30 jberger I am curious if headless chrome is going to have the same sandboxing concepts that phantomjs does/did
14:33 zivester joined #mojo
14:35 sri looks like all browsers are adding headless modes
14:35 sri even microsoft edge
14:36 sri guess sooner or later we'll have a standard protocol for controlling them all
14:39 jabberwok joined #mojo
14:46 jberger is this a joke? it seems like the documentation for headless chrome is a collection of google docs
14:46 maschine jberger, I've been trying to use your Email::Sender::Simple example https://tinyurl.com/hxk4q6a
14:46 maschine I have verified that Email::Sender is working (using the example code from cpan, it works great) and the minion job says it's finished but I never get any email
14:47 jberger all my demo did was use the print output, to actually send something you'd need to configure an SMTP backend for Email::Sender
14:48 jberger does the print backend work for you?
14:48 maschine yeah I've done that part
14:48 rshadow joined #mojo
14:51 maschine I didn't try it - or at least, I couldn't get the "EMAIL_SENDER_TRANSPORT=Print ./app.pl minion worker" command to work
14:52 jberger ok well we need to figure out why that doesn't work first
14:53 jberger I don't want to spend time trying to configure SMTP when there's a bug in the code someplae
14:53 maschine I think it doesn't recognize the command.
14:53 jberger and back on the other subject, it does indeed seem as if this is the real headless chrome documentation: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
14:54 jberger doesn't recognize what command?
14:54 maschine EMAIL_SENDER_TRANSPORT
14:54 jberger that's not a command, its an environment variable
14:54 jberger what platform are you on
14:54 jberger ?
14:54 maschine Ubuntu 16.04
14:55 maschine yeah, I'm a linux neophyte, but I've struggled through most of it. :p
14:56 maschine I get "-bash: ./myapp.pl: Permission denied"
14:56 preaction chmod +x myapp.pl; or perl myapp.pl
14:57 maschine well naturally I just figured it out
14:57 jberger haha
14:57 jberger yeah, that's a problem
14:58 maschine normally I would have to add "perl" to the front, ie instead of $ ./myapp.pl minion worker, I have to write $ perl ./myapp.pl minion worker
14:58 jberger ah
14:58 jberger yeah, either works
14:58 maschine I tried $ perl EMAIL_SENDER_TRANSPORT=Print which doesn't work
14:58 maschine but $ EMAIL_SENDER_TRANSPORT=Print perl ./app.pl minion worker does
14:59 jberger you can set environment variables by using the 'export' command too
14:59 jberger but then it lasts for the rest of the session
14:59 jberger doing it as part of the command invocation it only lasts for the length of that process
15:00 maschine so the print output does work
15:01 jabberwok $ VAR=value command ---- is a common bit of shell (see 'sh' or 'bash' manpages), one of those Unix-isms that pervade the minds of Perl5 coders
15:01 jberger maschine: how are you configuring SMTP?
15:01 jberger now that print works
15:02 maschine I'm pretty sure my SMTP works because I used this example on CPAN https://tinyurl.com/m5mjopq
15:02 maschine and it sends immediately
15:03 maschine I jumped through a lot of hoops to get it working, even going to spamhaus to remove my IP from their block list.. lol
15:04 jberger ok, so did you do the same thing for the minion example?
15:04 maschine yeah I copied and pasted the same code into minion..  no email
15:05 jberger and you ran the worker?
15:05 jberger what was the job result?
15:05 chansen joined #mojo
15:08 maschine "finished  default  email_task"
15:08 maschine no errors
15:08 purl You mean no error *messages*
15:10 jberger can you paste (to a paste site) your code?
15:10 maschine yeah
15:10 genio Please remember to redact sensitive info
15:10 maschine actually it's pretty much your example verbatim, but I'll paste the one with the sendmail CPAN example (which also isn't working)
15:14 maschine http://pasted.co/ac9474bb your demo code
15:15 maschine http://pasted.co/f45133f2 this code works for sure
15:17 jberger there is literally no difference
15:18 maschine yeah I didn't think so either
15:19 jberger does the eval example work (from my article)?
15:20 maschine I ran your demo exactly as it was and it "works" but no, I don't get any emails
15:20 maschine and the minion job says it finished
15:20 jberger perl app.pl eval 'app->send_email(q[me@spam.org], "Care for some SPAM?", "Well how about it?")'
15:20 jberger with your email address of course
15:21 genio doesn't sendmail() die on error? that should likely be trapped
15:22 maschine jberger that does work
15:22 jberger minion would show the job failed if it dies
15:22 sri what does the minion task look like?
15:23 jberger its a tiny wrapper around the helper
15:23 sri then show it
15:24 jberger ?
15:24 sri actually... ignore me... i'll just get upset by the partial pastes
15:24 jberger the code being shown is http://pasted.co/ac9474bb
15:25 jberger maschine: do the minion job arguments look correct?
15:25 jberger perl app.pl minion job <id>
15:27 sri ah, the paste site is borked in my broweser and i can't see parts of it
15:27 sri s/e//
15:27 jberger its basically the same as my perltricks article here: http://perltricks.com/article/193/2015/9/18/How-to-send-verification-emails-using-Mojolicious/
15:28 disputin joined #mojo
15:28 maschine here's the results, using the exact code from your example http://pasted.co/e428920b
15:28 maschine I should try a different paste site, that one uses flash.. probably why it's broken
15:28 sri we like gist around here
15:32 jberger I really don't know what's wrong. If the helper works, and the job is enqueued with the correct arguments, and the job runs and reports finished successfully ... it is doing exactly the same as the helper.
15:33 maschine yeah I don't know.   It doesn't make sense to me.
15:35 jberger and the entire minion process works when you override the transport to Print?
15:36 jberger the generated email looks correct?
15:37 maschine yeah it looks fine
15:38 jberger the only possible thing I can imagine is that the minion worker process exits a little too quickly perhaps?
15:38 sh14 joined #mojo
15:38 jberger maschine: can you alter the task definition like this:
15:39 maschine https://gist.github.com/anonymous/2c6fff6f6e6b62af1bd6720ea34577c5
15:39 jberger my $job = shift; $job->app->send_email(@_); $job->finish('done');
15:42 maschine same result
15:42 maschine print output works, the job shows it's finished, but no email gets sent
15:43 sri try initializing all the email stuff inside the minion task
15:43 sri without the helpers
15:47 maschine like in the task definition right?  I still need the helper that creates the minion queue?
15:48 jberger yes
15:48 jberger (though I'm not sure what sri suspects here)
15:48 maschine well, same result..
15:49 jberger what transport are you using?
15:49 sri jberger: dependence on destructors or something like that
15:49 rshadow joined #mojo
15:50 jberger ok
15:50 sri minion does POSIX::_exit
15:51 sri suppose you could test it with a subprocess too
15:52 jberger sri: that was my fear, which is why I had it explicitly finish in the task definition, give it time to finish writing
15:52 maschine Postfix
15:52 pink_mist I thought ::Subprocess did POSIX::_exit too
15:55 jberger maschine: actually, try adding 'exit()' at the end of the task
15:55 jberger see if you can force it to flush buffers that way
15:56 PryMar56 joined #mojo
15:56 jberger (though reading the sendmail backend it looks like it closes the pipe)
15:57 Grinnz sri: retry for active jobs and sharing worker status? looks easy enough
15:57 stryx` joined #mojo
15:57 Grinnz what's the worker status sharing used for, i'm curious?
15:58 maschine jberger: no change
15:58 jberger any chance you can try to explicitly use the SMTP transport?
15:59 jberger and we might be getting to the point of summoning rjbs
15:59 maschine what do you mean?
15:59 maschine not using Email::Sender?
16:00 jberger no, Email::Sender has many transport types
16:00 jberger of which Print is on
16:00 jberger e
16:01 jberger I guess since you  don't seem to know, we are only assuming it is using the Sendmail backend to talk to postfix, but we don't really know do we
16:01 maschine ah, so like running $ EMAIL_SENDER_TRANSPORT=Print perl ./app.pl minion worker but with a different variable
16:01 jberger or like this: https://metacpan.org/pod/Email::Sender::Manual::QuickStart#passing-in-your-own-transport
16:02 maschine it does work if I run it on it's own
16:02 jberger maschine: yes we understand that
16:02 jberger the question is why should minion make any difference
16:02 jberger and really the only thing I can think of is that the fork
16:02 jberger so I want to try another backend that would actually send
16:03 jberger to definitively point to the Sendmail backend
16:03 jberger as the problem
16:03 maschine I see.. so maybe it's not using the right transport when using minion for some reason
16:04 jberger or maybe somehow the Sendmail backend has a fork problem
16:04 jberger I'm grasping at straws
16:04 jberger if the Print backend works, then from my perspective everything is working and the problem is in Email::Sender
16:04 jberger but that doesn't help you
16:07 maschine so I explicitly defined the transport in both the Email::Sender working example and in yours.   Same results
16:09 maschine wait, I did it wrong.  Let me try again
16:09 jberger you are trying Sendmail or SMTP?
16:11 vicash maschine: maybe you need to try sending an email in a separate script without Minion or Mojo and see if Email::Sender works by itself. you can troubleshoot the email sending much faster this way. are you using Sendmail, exim, postfix, dovecot etc ?
16:11 jberger vicash we've already established that maschine can send email via the helper that is defined
16:12 jberger but when the helper is used in a thin wrapper minion task, then it doesn't
16:12 vicash jberger: ah ok. i missed that in the earlier messages.
16:12 jberger (and actually it does when it uses the Print backend)
16:13 vicash maschine: shouldn't there be logging in /var/log somewhere that an email was sent or not sent regardless of whether you're using minion or not
16:15 Grinnz /var/log/maillog is generally used by sendmail and other implementations of sendmail
16:15 Grinnz as well as postfix, etc
16:22 Pyritic joined #mojo
16:23 jabberwok left #mojo
16:25 maschine yeah there are some differences in the logs
16:25 maschine I think I'm going to look more closely at my SMTP configuration
17:04 gryphon joined #mojo
17:05 gryphon_ joined #mojo
17:14 dod joined #mojo
17:18 stryx` joined #mojo
17:26 khfeng joined #mojo
17:26 sh14|2 joined #mojo
17:47 stryx` joined #mojo
18:05 dantti_laptop joined #mojo
18:09 csson joined #mojo
18:16 khfeng joined #mojo
19:32 marty_ joined #mojo
19:51 gizmomathboy joined #mojo
20:05 gizmomathboy joined #mojo
20:09 sri Grinnz: for whatever data you want to share
20:09 sri look how it's used in the worker command, you could make remote control commands to change all those settings at runtime
20:10 sri expose them in an admin ui
20:11 sri it was the last missing puzzle piece for full remote control support in an admin ui
20:12 sri you can now show how many jobs any worker can process in parallel and allow changing the value
20:12 sri remotely, on the ui
20:12 Grinnz ah, ok
20:13 Bloke joined #mojo
20:31 gizmomathboy joined #mojo
22:24 PopeF Any suggestions for doing non-blocking file I/O with Mojo::IOLoop ?
22:25 PopeF The project I'm working on uses Mojo for asynchronous Amazon S3 I/O, and I'd like to maintain consistency with that for file I/O.
22:28 pink_mist you want Mojo::IOLoop::Stream objects
22:28 PopeF pink_mist, thanks, I'll read up on that
22:33 sri non-blocking file i/o is mostly pointless unless you use something like IO::AIO
22:34 sri and if you do the overhead might end up making things slower
22:35 marty joined #mojo
22:36 sri using Mojo::IOLoop::Stream for file i/o is always wrong
22:36 pink_mist oh
22:36 PopeF oh
22:37 PopeF What's the right way, then?
22:37 sri IO::AIO if you really need it
22:37 sri otherwise there is none
22:37 sri you do it blocking
22:37 PopeF Well, I need it for completeness' sake, if nothing else.
22:38 sri with files on a file system there is no waiting for things to become readable or writable
22:38 sri they always are
22:38 PopeF good point.
22:38 purl nice and sharp
22:38 sri then just fake it, like Mojo::SQLite
22:39 PopeF Yeah, that would work. Under the hood, I guess, I would need separate execution threads to be able to do long-running file I/O asynchronously.
22:43 dikim joined #mojo
23:35 maschine so maybe I'm crazy, but it seemed like Minion was sort of made to do stuff like that?  Long, blocking operations could be offloaded onto a Minion queue?
23:35 maschine I have a couple specific features on the app I'm developing that are perfect for a Minion job I think - a binary generation tool (with checksum corrections and RSA signatures) and a binary search tool.
23:36 maschine Even though I haven't gotten Jberger's demo to work yet, it has actually helped me understand how Minion functions.. so not a total loss. :)
23:40 stryx` joined #mojo
23:53 sri just like the description says http://mojolicious.org/perldoc/Minion#DESCRIPTION

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary