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

IRC log for #mojo, 2016-04-20

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

All times shown according to UTC.

Time Nick Message
00:00 sri_ hypnotoad for testing is just wrong
00:00 basic6_ well i *was* testing with morbo. but the error doesnt happen in morbo
00:00 basic6_ so i'm reproducing it in hypnotoad. that's the only reason why i'm testing with hypnotoad
00:01 sri_ then i'm misunderstanding the whole situation
00:01 disputin joined #mojo
00:02 basic6_ i've probably explained it poorly. i'll try again
00:04 basic6_ js on the webpage is uploading data chunks, one specific controller action is triggered. that controller logs that it has received data chunk #... and then starts storing it in a remote location. this usually means SFTP.
00:04 basic6_ ideally, after the chunk has been saved in that location, it returns http 200 and the javascript code sends the next chunk and so on... works nicely in morbo
00:06 basic6_ in hypnotoad, what happens a lot (but ranomly) is that a chunk is suddenly received twice. what i mean by that is that for example chunks 1 to 9 are being received, logged, everything fine...
00:06 mattp_ is there an elegant way to turn off/on prettify/canonical json encoding?
00:07 mattp_ i was thinking of just adding a json_pretty format ontop of the default xs json i replaced
00:07 basic6_ then chunk #10 is received, stored. for some reason, maybe coincidence, i often see a "Stopped worker" tight at that point but that might be unrelated, not sure. then another worker logs that it also received chunk 10 and tries to store it again
00:08 basic6_ chunks are sent via post requests. that's why i said the post request #10 is apparently received or handled twice. this chunk is sent to the remote location twice
00:10 basic6_ there's more going on but i think the other parts are irrelevant. removing all of the SFTP foo and instead writing the same data to a local file *seems* to, the error has not happened yet, so maybe the sftp part is relevant but i couldnt see how this could have anything to do with hypnotoad
00:11 basic6_ sri sorry that was a lot of text. my main point is that i'm seeing a chunk (#10) being received by the controller twice when it's sent once (by the browser).
00:13 sri_ the only real difference between morbo and hypnotoad there is that hypnotoad can handle multiple requests that do blocking stuff at the same time
00:13 sri_ your problem will be there
00:18 basic6_ yeah i think so too, it's just that the client is sending the chunks that belong together one after another, so i'll have to find out where the chunk is being duplicated or whatever is going on
00:21 basic6_ it kind of looks like this (reduced): http://paste.debian.net/439623/
00:22 basic6_ anyway i'll take a break and continue debugging another time. thank you sri_ for your help
00:22 good_news_everyon joined #mojo
00:22 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vwGrG
00:22 good_news_everyon mojo/master 8936972 Sebastian Riedel: log when the manager process has been stopped
00:22 good_news_everyon left #mojo
00:26 cpan_mojo Minion-5.04 by SRI https://metacpan.org/release/SRI/Minion-5.04
00:52 disputin joined #mojo
01:09 mcsnolte joined #mojo
01:24 trwww joined #mojo
01:30 tchaves joined #mojo
01:31 tchaves joined #mojo
02:34 noganex_ joined #mojo
03:55 ivi joined #mojo
04:51 jberger Fwiw, even though basic6_ has left, we have confirmed that some reverse proxies retry failed post requests
04:51 jberger Keep that in mind
04:51 bpmedley That's odd
04:51 jberger It really is
04:52 jberger https://news.ycombinator.com/item?id=11217477
05:46 inokenty-w joined #mojo
06:34 sri_ ohoh, mojo now has 1,666 stars on github
06:49 dod joined #mojo
06:54 dod joined #mojo
07:03 salva joined #mojo
07:11 AndrewIsh joined #mojo
07:36 basic6_ joined #mojo
07:39 trone joined #mojo
07:47 dod joined #mojo
07:48 jberger zomg I'm gonna need some sleep
07:51 jberger I'm not sure who to blame for this
07:52 jberger So I think I'm gonna blame copernicus and the wright brothers
08:13 Vandal joined #mojo
08:37 osfabibisi joined #mojo
08:39 melo joined #mojo
08:49 tyldis sri_: Was the solution proposed by CHYC for minion stats performant enough? (< CHYC> sri: https://gist.github.com/chy-causer/86b08c6d658b9db6595b8df96cbfe18b)
08:57 sri_ tyldis: oh, i totally missed that
08:57 sri_ CHYC++
08:58 sri_ i see a lot of interesting ideas there
09:06 sri_ gonna test it when i have some time to turn it into a query without stored procedure
09:12 sri_ my instincts tell me all those subselects will be very expensive though
09:13 jberger maybe build a CTE first?
09:15 jberger thinking about it is bending my brain a little bit, but then again that could be the lack of sleep
09:16 sri_ you at a qa hackathon?
09:18 jberger yep
09:18 jberger first one to arrive
09:18 jberger just how the flights worked out
09:18 sri_ sleep deprivation and a qa hackathon, what could possibly go wrong? :)
09:18 jberger there goes the perl interpreter!
09:23 meshl joined #mojo
09:31 sri_ actually wasn't too hard to change https://gist.github.com/anonymous/08ce391d514740e05d8d99f53aa43ade
09:32 sri_ and as far as performance goes, it is pretty slow
09:33 sri_ 38/s
09:33 sri_ current stats can be done with 210/s
09:41 sri_ also interesting, counting states with a subquery alone totally destroys performance
09:41 jberger I have another try
09:42 jberger this could be completely crap but it works in (very) limited testing: https://gist.github.com/jberger/350cde8b608466c142c39364c9306257
09:42 jberger I was trying to get it out as one json object, but nested aggregates was not working
09:42 jberger I suspect building another CTE would have worked
09:42 jberger but I wanted to show you
09:43 sri_ counting jobs in the queue is not such an interesting metric
09:44 jberger oh, maybe I missed the point entirely
09:44 jberger what are we trying to do? :-P
09:44 sri_ https://gist.github.com/chy-causer/86b08c6d658b9db6595b8df96cbfe18b#file-result-pl
09:44 sri_ hehe, that was the intended result
09:44 jberger ah
09:44 jberger whoopps
09:45 sri_ the big question is if such a complicated structure can be built without destroying performance
09:46 basic6___ joined #mojo
09:46 sri_ so far all evidence suggests that it can't
09:46 sri_ but sometimes all it takes is a clever index
09:58 basic6___ jberger: "Fwiw, even though basic6_ has left, we have confirmed that some reverse proxies retry failed post requests" thank you, also for the link to the nginx discussion! i will keep it in mind
10:00 pierrick joined #mojo
10:01 jberger sri_: https://gist.github.com/jberger/350cde8b608466c142c39364c9306257
10:01 jberger basic6___: I'm glad you read the log (I'm assuming that's what you did)
10:01 jberger that's why I still talk into the ether :-P
10:05 basic6___ yes i did and thanks for talking into the ether, i appreciate it :)
10:07 jberger sri: does my update work?
10:07 jberger ish
10:08 jberger I'm not exactly sure how to pack that into a json object directly but the output seems close
10:16 sri_ that gets us to 56/s
10:25 CHYC sri: I get 336/s on original code, 279/s using my code and 53/s using the CTE you uploaded.
10:26 sri_ CHYC: oh, interesting
10:26 sri_ didn't expect stored procedures to make such a difference
10:29 CHYC If my knowledge on psql is up to scratch, the example CTE is effectively creating two temporary tables, queues and states, performing a cross join, then filtering on that.
10:42 Kripton joined #mojo
10:43 kaare joined #mojo
11:04 jberger CHYC: that's my understanding too
11:29 CHYC Also, with respect to the counting states being slow, that's most likely because state::text = states.state is doing a cast to text, which means it isn't using the index on minion_jobs.
11:29 CHYC Much faster to do state = states.state::minion_state.
11:34 CHYC Or, unnest(array['active', 'failed', 'finished', 'inactive']::minion_state[])
11:52 sri_ CHYC: that makes it go up to 67/s
11:54 sri_ did this for testing https://gist.github.com/anonymous/16192bebc13bcdc93e51758007de4042
11:54 sri_ running "perl -Ilib examples/minion_bench.pl" for a rough benchmark
11:56 sri_ and a one-liner like this to test stuff ad-hoc
11:56 sri_ perl -Ilib -Mojo -E 'plugin minion => {Pg => "postgresql://tester:testing@/test"}; app->minion->add_task(foo => sub { sleep 5 and app->log->debug("FOO!") }); app->start' minion job -s
12:01 sri_ btw. cte's don't appear to affect results
12:02 sri_ this one also gives me 67/s https://gist.github.com/anonymous/a9feac7241badf8edeb415e331289707
12:03 meshl joined #mojo
12:16 dod joined #mojo
12:18 dod joined #mojo
12:31 asarch joined #mojo
12:47 Kripton joined #mojo
12:58 ramortegui joined #mojo
13:20 meshl joined #mojo
13:54 dod joined #mojo
14:18 kaare joined #mojo
14:28 Atog joined #mojo
14:49 good_news_everyon joined #mojo
14:49 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vwnY5
14:49 good_news_everyon mojo/master 7c471a4 Sebastian Riedel: the <slot> element has been added to HTML
14:49 good_news_everyon left #mojo
14:49 PopeFelix How do I successfully write code with a cat who insists upon sitting on my lap and keyboard?
14:49 gizmomathboy joined #mojo
14:54 Lee teach the cat to write code
14:55 PopeFelix Lee, the cat has no thumbs.
14:55 Lee meh, just means no whitespace
14:55 PopeFelix I'd need a paw-sized keyboard.
14:55 jberger it can hit spacebar with its nose
14:55 PopeFelix Plus I don't know how to communicate abstract concepts to the cat.
14:55 Lee then you need a decoy keyboard :D
14:56 PopeFelix lol
14:56 jberger Lee++
14:56 PopeFelix He has a heating pad he can lay on right next to me. But he wants to sit on my lap.
14:58 gizmomathboy where does mojo get the 'has' keyword from? This is more for my edification since I don't see it as a keyword in Perl and looking through the github repo I don't see it defined there (sorry that my search fu is weak)
14:59 sri_ http://mojolicious.org/perldoc/Mojo/Base#has
14:59 bpmedley gizmomathboy: mojo::base
15:00 gizmomathboy huh, I thought I looked there. thanks
15:03 gizmomathboy bpmedley, I don't see it in Mojo::Base.pm (although I do see it in the docs)
15:05 Grinnz https://metacpan.org/source/SRI/Mojolicious-6.58/lib/Mojo/Base.pm#L85
15:06 bpmedley 18:53 <bpmedley> http://bmedley.org/mojo.pdf <-- Comments are welcome and desired.. a Photo app chapter was added.  I believe I need to add websockets, IOLoop, helpers, and database use..
15:06 gizmomathboy Grinnz, thanks mucho. like I said. my search fu is off today
15:07 Grinnz it's easy to miss. as for the concept of has(), it's the same keyword Moose and Moo et al use to declare attributes
15:10 gizmomathboy Grinnz, yeah I was originally thinking "I didn't think mojo used moose and such" and started looking (and not finding it because...I guess not enough caffeine?)
15:11 PopeFelix gizmomathboy, I don't know how you were searching, but if you look at the code, it's declared via monkey_patch, rather than "sub has"
15:11 PopeFelix Which one could easily miss if one didn't know what to look for.
15:12 gizmomathboy PopeFelix, I was doing a search on 'has ' I think of instead of just 'has'...plus I was in a meeting and a bit distracted I guess.
15:13 gizmomathboy it was more idle curiosity on my part because I understood what it was doing just wonder where it was coming from in the code. So, idle thought taken care of
15:13 PopeFelix gizmomathboy, I often find that whatever I'm doing to keep me occupied during a meeting gets more of my attention than the actual meeting itself. ;)
15:13 PopeFelix coolies
15:13 * PopeFelix should take up crochet or something. Less chance of getting absorbed and missing something important.
15:14 PopeFelix I work remote, so all my meetings are phone meetings.
15:14 gizmomathboy PopeFelix, yeah, I was doing some more noodling with mojo to get how mojo does things. Also, it was a mostly useless meeting so the time with mojo was a better use of my time...even though it has nothing to do with my job as a sysadmin
15:14 gizmomathboy and with that...it's burrito time
15:14 PopeFelix gizmomathboy, it's good to be well rounded.
15:19 kaare joined #mojo
15:21 Atog joined #mojo
15:35 jberger is someone the reactor_ev.t test failing for anyone else?
15:36 jberger oh and these too
15:36 jberger https://travis-ci.org/kraih/mojo/jobs/124495317
15:46 sri_ yes, looks like IO::Socket::SSL changed
15:47 sri_ don't think i have time to look at it today
15:50 jberger just weird because I was going to use Mojolicious as a test suite for Test::Builder on Test2
15:51 jberger so if I downgrade IO::Socket::SSL to 2.025 I get those tests passing
15:52 jberger but I still get fails on t/mojo/reactor_ev.t  and t/mojo/user_agent_online.t
16:01 jberger for me https://github.com/kraih/mojo/commit/8936972fb6971a0aac35d2a4d8d88095b148d48c breaks t/mojo/reactor_ev.t
16:04 jberger this is the test that fails https://github.com/kraih/mojo/blob/master/t/mojo/reactor_ev.t#L138
16:12 HtbaaPi joined #mojo
16:12 jberger nevermind, not that commit
16:12 jberger bisecting lied to me :s
16:23 orev joined #mojo
16:29 HtbaaPi joined #mojo
16:40 kaare_ joined #mojo
16:42 mspo joined #mojo
16:42 mspo what's the modern way to distribute perl apps?
16:42 mspo I used to be a big fan of PP but.. you know
16:43 mspo fatpacker?
16:45 perlpilot "distribute perl apps"?  CPAN.
16:45 mspo deploy perl apps
16:45 mspo how's that
16:49 bpmedley mspo: are you asking about how to deploy a mojo app?
16:50 cfedde we do it with docker.
16:56 gizmomathboy PopeFelix, yes, I am definitely getting rounder as a result of these burritos ;-)
16:57 osfabibisi joined #mojo
17:16 tchaves joined #mojo
17:17 dod joined #mojo
17:19 PryMar56 joined #mojo
17:32 disputin joined #mojo
17:45 sri_ jberger: actually looks like IO::Socket::SSL might be broken
17:45 sri_ i can't seem to get it to negotiate a custom cipher list at all
17:46 Grinnz_ the latest update disabled RC4 for clients according to the changelog
17:47 sri_ tried using DHE-RSA-AES256-SHA256 instead, doesn't work either
17:47 sri_ instead it keeps negotiating the first cipher in the default list
17:48 Grinnz_ matrix is spotty http://matrix.cpantesters.org/?dist=IO-Socket-SSL%202.026
17:49 sri_ IO::Socket::SSL turns into one of the more frustrating deps
17:52 genio sri_: Do others like ECDHE-RSA-AES128-GCM-SHA256 work properly?
17:52 sri_ i can use one i see in the IO::Socket::SSL diff though
17:53 sri_ don't have time to look into it, but it seems sketchy that a good cipher that my openssl version supports cannot be negotiated
17:53 genio https://gist.github.com/genio/ba1b60b4f74f72896d2c#file-httpd-conf-L15  ordering to get A+ ratings on SSL test labs
17:54 genio DHE-RSA-AES256-SHA256 is pretty far down in that list *shrugs*
17:56 good_news_everyon joined #mojo
17:56 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vwndL
17:56 good_news_everyon mojo/master 8aa8fed Sebastian Riedel: use AES256-SHA for testing
17:56 good_news_everyon left #mojo
18:13 gryphon joined #mojo
18:58 mspo bpmedley: as an example, yes
18:59 mspo bpmedley: but mostly a mojo::useragent app
19:07 zz_Foxcool joined #mojo
19:09 melo joined #mojo
19:10 bpmedley mspo: what are the requirements for the app's environment?
19:14 kaare_ joined #mojo
19:43 kaare joined #mojo
19:58 gizmomathboy I'm calling a render thusly:  $self->render(msg => 'UPP generation'); however when I go to the page I get "Global symbol "$msg" requires explicit package name".
19:59 gizmomathboy the template line is <h2><%= $msg %></h2>
20:00 gizmomathboy I have an identical template for a different route but that route doesn't get the error
20:00 gizmomathboy wtf am I missing?
20:00 user_5458 joined #mojo
20:01 disputin joined #mojo
20:02 user_5458 my $ua = Mojo::UserAgent->new;
20:02 user_5458 Doing non blocking get() and putting this in the same function will result into premature connection close
20:03 user_5458 using it as global def will work fine.
20:03 user_5458 why?
20:03 Grinnz_ user_5458: because the $ua goes out of scope
20:03 gizmomathboy gist of snippets of my code: https://gist.github.com/gizmomathboy/45f7491e48a68a452fbe0b71298d143f
20:04 Grinnz_ you have to make sure the $ua sticks around until you're done with it, the transaction won't keep a hard reference to it
20:04 Grinnz_ you can do this either by storing the $ua globally, in an object, or just putting "undef $ua" in the callback so it closes over the object
20:04 user_5458 Ah, ok
20:04 user_5458 I declare my $ua = Mojo::UserAgent->new; global
20:05 user_5458 should do the job then
20:05 jberger gizmomathboy: try either stashing msg or explicitly rendering the template
20:06 jberger I'm assuming that the problem is that the render aha are localized into the stash but you don't actually render because the template key isn't set
20:06 jberger s/aha/args/
20:07 jberger So that when the default render comes at the end of the action (when nothing was actually rendered) it auto renders
20:07 jberger But without msg
20:14 gizmomathboy jberger, thanks. what's weird is that it will render for the '/' route though
20:14 user_5458 let's say i make a couple of objects inside a non blocking mojolicious function. Do they clean themself up or do I have to call for each local object undef <obj>; at the end?
20:15 jberger gizmomathboy: is have to see what you mean
20:15 jberger I'd
20:15 Grinnz_ if you assign them to lexical variables and don't reference them from elsewhere, they'll go out of scope once the callback is cleaned up
20:15 pink_mist user_5458: perl cleans things up when they go out of scope
20:15 jberger I've been up for like 40 hours
20:16 user_5458 ok, i just ask because i'm from c++, there it's not the case and i have to destroy it.
20:16 Grinnz_ that's only true in perl if you create circular references
20:16 bpmedley jberger: Get sleep!!
20:16 gizmomathboy jberger, I'll poke around with the stash and such (and maybe throw it up on github to make it easier to see what I'm doing wrong)
20:16 gizmomathboy jberger, what bpmedley said
20:17 gryphon joined #mojo
20:17 jberger user_5458: The undef $var things you see some places are actually to create a strong reference
20:17 jberger Will do
20:17 jberger It is finally evening here in England
20:18 jberger Flying east you lose a night cycle
20:18 pink_mist user_5458: perl is reference counted; the only time you'll need to think about this in perl is when there's a reference cycle
20:19 jberger pink_mist: again not totally true
20:19 jberger Sometimes you craft a strong reference intentionally
20:19 jberger Where then all you do is destruct it
20:19 pink_mist that's what reference counting is for
20:20 jberger Say like $c->on(finish => sub { undef $tx })
20:20 pink_mist that's just closing over it
20:20 jberger What you are actually doing is keeping a reference to the tx
20:20 pink_mist the fact that you're calling undef is pretty irrelevant
20:20 jberger Yep
20:21 jberger But that's in the code in places, even in examples
20:21 jberger And it is what user_5458 posted
20:22 jberger http://irclog.perlgeek.de/mojo/2016-04-20#i_12369057
20:23 pink_mist right, but then I'd rather say that "if you don't understand that perl is reference counted in the first place, those examples are misleading"
20:23 pink_mist user_5458: it's not the "undef" bit of that that's important. it's the using $tx or $uabit in there that's important.
20:23 pink_mist *$ua bit
20:29 kaare joined #mojo
20:53 melo joined #mojo
20:55 cpan_mojo Mojo-UserAgent-Mockable-1.24 by POPEFELIX https://metacpan.org/release/POPEFELIX/Mojo-UserAgent-Mockable-1.24
21:04 PopeFelix Which release was entirely motivated by a messed up dist.ini. :\
21:17 user_5458 i have to call my own post restful function. $ua->get('127.0.0.1:3000/function'). Is that the right  way to do it  ?
21:18 user_5458 $ua->post* i meant
21:18 user_5458 but 127.0.0.1:3000/func is right?
21:18 Grinnz_ you should not call yourself from http
21:19 user_5458 what would be the right way to call /function from another function?
21:19 Grinnz_ the usual solution is to just call the method if it's in the same controller, or create a common function for both routes to call
21:19 Grinnz_ or a helper method
21:21 user_5458 ok, then i have to make a normal function for that part.
21:21 PopeFelix Yeah, I'd recommend making a normal function (i.e. helper method)
22:01 disputin joined #mojo
22:17 tchaves joined #mojo
22:39 meshl joined #mojo
22:58 pink_mist do note: it's perfectly *possible* to call yourself via http if you use nonblocking ... but it's really not a good idea
23:02 Grinnz_ madness lies along that pathway
23:03 pink_mist I've done it ... but just to prove that I could; I'd never do that in production :P
23:07 genio but _what_ did you call yourself?
23:07 tchaves joined #mojo
23:07 Grinnz_ a handsome fellow, of course
23:33 disputin joined #mojo
23:37 NwBhy_ joined #mojo

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