Camelia, the Perl 6 bug

IRC log for #mojo, 2011-03-18

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

All times shown according to UTC.

Time Nick Message
01:06 xris left #mojo
01:31 metaperl left #mojo
01:32 espent left #mojo
01:32 espent joined #mojo
01:33 metaperl joined #mojo
01:33 Kulag left #mojo
01:34 Kulag joined #mojo
01:34 tempire left #mojo
01:34 perlite_ joined #mojo
01:34 stephen1 joined #mojo
01:34 tempire joined #mojo
01:34 su-bzero joined #mojo
01:35 stephen left #mojo
01:35 su-bzero_ left #mojo
01:36 perlite left #mojo
01:36 perlite_ is now known as perlite
02:33 stephen1 left #mojo
02:49 perlrocks Twitter: "Mojolicious internal testing remains to be seen what to do" (ja) --shiba_yu36 http://twitter.com/shiba_yu​36/status/48576843560914944
03:27 stephen joined #mojo
03:50 stephen1 joined #mojo
03:51 stephen left #mojo
04:35 stephen joined #mojo
04:37 stephen left #mojo
04:37 stephen joined #mojo
04:37 stephen1 left #mojo
04:42 stephen1 joined #mojo
04:44 stephen left #mojo
04:59 stephen1 left #mojo
05:09 giwi joined #mojo
05:11 giwi left #mojo
05:33 giwi joined #mojo
05:55 kaare joined #mojo
06:05 koban` joined #mojo
06:20 ysyrota joined #mojo
06:32 Alias left #mojo
06:51 koban` left #mojo
06:58 ver joined #mojo
07:18 Foxcool joined #mojo
07:37 cosmincx joined #mojo
07:38 Christian joined #mojo
07:38 Christian morning
07:45 breaker313 joined #mojo
07:49 breaker313_ joined #mojo
07:53 breaker313 left #mojo
07:59 minimalist Morning. Weird behaviour: if I create a helper to connect to DBIx::Class, that helper gets called at almost every request creating a separate connection to MySQL. Soon MySQL crashes for too many connections.
08:01 minimalist Two things are puzzling me here: a) How come DBIC didn't cache the connection; b) How come I failed caching the connection manually my saving it in $self->{_schema}
08:01 cosmincx left #mojo
08:04 breaker313_ left #mojo
08:10 breaker313 joined #mojo
08:18 cosmincx joined #mojo
08:26 breaker313 left #mojo
08:27 giwi left #mojo
08:39 moritz minimalist: show some code pleae
08:41 minimalist left #mojo
09:03 ok22_ joined #mojo
09:08 ok22 left #mojo
09:11 koban` joined #mojo
09:19 diegok sri: any url where I can read redis author talking about that ruby quality code?
09:26 Christian left #mojo
09:29 Christian joined #mojo
09:48 su-bzero How to detect a scheme (http or https) in Mojolicious?
09:50 Christian i think so: $self->req->url->base->scheme('https')
09:51 su-bzero It returns to 'https://url'. May be $self->req->url->base->scheme(), but need to test it with nginx + fcgi.
09:51 Christian better so: if $self->req->headers->heade​r('X-Forwarded-Protocol') eq 'https'; ;)
09:51 su-bzero Hm... ok.
10:03 Foxcool left #mojo
10:19 su-bzero Doesn't work ;)
10:24 spleenjack joined #mojo
10:51 ok22_ left #mojo
10:54 fmerges joined #mojo
11:01 ok22_ joined #mojo
11:28 sri su-bzero: you need to do that yourself i suppose, the http protocol has no standard mechanism for that
11:29 sri diegok: twitter
11:32 stephan48 su-bzero: i set a header in apache2 based on the value of the HTTPS env var
11:35 diegok sri: thanks ;-)
11:42 su-bzero Thanks. I will use $self->req->env->{HTTPS} and fastcgi_param HTTPS 1; for nginx
11:45 sri oh fastcgi, then fastcgi_param HTTPS 1 is enough
11:46 sri t will get picked up automatically
11:48 breaker313 joined #mojo
12:02 yakudzo left #mojo
12:36 ok22__ joined #mojo
12:41 ok22_ left #mojo
12:42 ok22__ left #mojo
12:53 * sri yawns
12:54 ok22__ joined #mojo
13:04 ok22__ left #mojo
13:07 esskar left #mojo
13:09 breaker313_ joined #mojo
13:13 breaker313_ left #mojo
13:14 breaker313 left #mojo
13:15 ok22__ joined #mojo
13:15 breaker313 joined #mojo
13:18 ok22_ joined #mojo
13:18 GitHub120 joined #mojo
13:18 GitHub120 mojo: master Sebastian Riedel * 5ca640d (2 files in 2 dirs): changed default log level in "production" mode from "error" to "info" - http://bit.ly/eY3JEa
13:18 GitHub120 left #mojo
13:23 ok22__ left #mojo
13:23 ok22__ joined #mojo
13:24 perlrocks Twitter: "This small change should make logging with #mojolicious in production mode easier and more predictable. http://t.co/HTH590k #perl" --kraih http://twitter.com/kraih/status/48736654965485568
13:26 sri hmm
13:27 sri or maybe warn is better
13:28 ok22_ left #mojo
13:40 ok22__ left #mojo
13:51 ok22__ joined #mojo
14:05 ok22_ joined #mojo
14:07 Drossel joined #mojo
14:08 Kulag left #mojo
14:11 ok22__ left #mojo
14:41 ok22_ left #mojo
14:44 fhelmber_ left #mojo
14:52 ok22_ joined #mojo
15:02 ok22__ joined #mojo
15:07 ok22_ left #mojo
15:14 koban` left #mojo
15:15 ok22__ left #mojo
15:17 ver left #mojo
15:22 Akron joined #mojo
15:26 ok22__ joined #mojo
16:01 breaker313 left #mojo
16:13 cosmincx left #mojo
16:38 moritz sri: commit fc5894ebd26e9d770496ddc0d28618ef4d4c6e4e makes a test of mine loop
16:38 moritz it's a ->text_like(title => qr/some regex/)
16:39 sri link?
16:39 purl rumour has it link is for you to shut the fuck up
16:39 moritz sri: do you want a Data::Dumper output of the invocant on which I call it?
16:39 Christian nive weekend to you all
16:39 moritz sri: link to what?
16:40 sri the commit of course
16:40 Christian left #mojo
16:41 moritz https://github.com/kraih/mojo/commit/fc​5894ebd26e9d770496ddc0d28618ef4d4c6e4e
16:41 sri hmm
16:42 moritz sorry, need to run - will be back soonish
16:42 sri a t/mojo/dom.t test case would be more helpful
16:43 sri hard to imagine that change cause any trouble though
16:45 ok22__ left #mojo
16:48 ok22__ joined #mojo
16:50 sri moritz: or i'll at least need the responsible parts of the html file
16:51 moritz sri: working on a test case...
16:51 minimalist joined #mojo
16:51 sri even better
16:59 stephen joined #mojo
17:07 xris joined #mojo
17:20 memowe left #mojo
17:25 Akron left #mojo
17:26 ysyrota left #mojo
17:45 * sri pokes moritz
17:47 moritz sri: sorry, had to do some domestic chores :(
17:49 moritz I have a regression test now, but it's 271 lines of HTML
17:49 moritz I'll try to reduce it first
17:51 moritz reduced to 85 lines
17:53 moritz 11 lines
17:55 sri \o/
17:55 fmerges left #mojo
17:55 perlrocks Twitter: "On the Windows Start Mojolicious the development of procedures to be published in the web hosting Sakura. - Getting Started with Perl Sample Code http://bit.ly/gX0Qnt" (ja) --wPerlnews http://twitter.com/wPerlnew​s/status/48804717484191744
17:56 abra left #mojo
17:56 moritz sri: do you want a git format-patch? or a pull request?
17:57 sri both would be fine
17:58 moritz sri: http://moritz.faui2k3.org/tmp/0001-DOM-regress​ion-test-that-loops-since-commit-fc5894e.patch
17:58 moritz the added test loops currently
17:58 abra joined #mojo
17:59 moritz which means I killed after about a minute :-)
17:59 sri oh, already see what went wrong :S
18:06 abra left #mojo
18:09 ok22__ left #mojo
18:13 minimalist So, the DBIC connection via helper, I was talking about. Here is a paste of a sample code http://pastebin.com/HsEW3L4a
18:14 GitHub160 joined #mojo
18:14 GitHub160 mojo: master Sebastian Riedel * 51489ad (4 files in 4 dirs): fixed a serious Mojo::DOM bug - http://bit.ly/hLscCy
18:14 GitHub160 left #mojo
18:14 sri guess i'll make an emergency release
18:15 minimalist The 'schema' helper creates a new connection to the DB for ach request. Is that normal?
18:16 sri moritz: should be fine now
18:16 abra joined #mojo
18:18 ok22__ joined #mojo
18:21 mmmpork left #mojo
18:23 GitHub49 joined #mojo
18:23 GitHub49 mojo: master Sebastian Riedel * 5330ec5 (1 files in 1 dirs): added more tests - http://bit.ly/hJI1cD
18:23 GitHub49 left #mojo
18:24 minimalist Has anyone used DBIx::Class with Mojolicious and has any tips on how to connect to it?
18:24 sri minimalist: weekend is maybe not the best time to ask
18:24 sri minimalist: maybe the mailing list
18:25 minimalist sri: ok
18:25 sri minimalist: anyway, you do realize that the ->connect call gets executed each time you call the helper right?
18:26 sri i don't know how dbic manages connections, so i can only guess
18:26 minimalist sri: yes, but DBIC should have cached it
18:26 sri ok, then you need someone with more experience
18:26 minimalist sri: also, I cached it myself and it still didn't work
18:26 sri daemon?
18:26 purl hmmm... daemon is forever or http://www.libslack.org/daemon/
18:27 minimalist yes, daemon
18:27 sri ok, then you seem to have a problem
18:28 GitHub110 joined #mojo
18:28 GitHub110 mojo: master Sebastian Riedel * 20bc037 (1 files in 1 dirs): release preparation - http://bit.ly/i5pf9q
18:28 GitHub110 left #mojo
18:32 perlrocks Twitter: "Mojolicious 1.15 by KRAIH - http://frepan.org/~kraih/Mojolicious-1.15/" --cpan_new http://twitter.com/cpan_ne​w/status/48813963101749248
18:33 perlrocks Twitter: "Released #mojolicious 1.15 due to a serious bug in Mojo::DOM. #perl" --kraih http://twitter.com/kraih/status/48814180047929346
18:33 crab how did the bug happen?
18:33 sri side effect of a fix in 1.14
18:34 sri or more precisely, me being stupid :S
18:37 abra minimalist, I used DBIx::Simple
18:37 abra ))
18:38 minimalist abra: it's a world apart from DBIC but regardless, how do you connect to it from a Mojo app?
18:45 abra minimalist, I wrote plugin Mojolicious::Plugin::DbixSimple :)
18:46 sri we could use a list of plugins on the wiki
18:47 minimalist abra: So when connecting via a plugin, was a new connection created for each request? This is what's happening to me when I connect via a helper.
18:57 crab a new connection will be created whenever you call ->connect
18:59 minimalist crab: take a look at this http://pastebin.com/nnn657au . The connection is cached via $self->{_schema}.
19:00 minimalist One would think it'd work, but it doesn't.
19:01 minimalist Anyway, I don't want to waste everyone's Friday night with this. It seems like the only solution is to connect in startup, save the DB handle in $self->{_db} and then create a helper that uses $self->app->{_db}.
19:02 crab i certainly wouldn't think that would work
19:02 crab connecting in startup is _wrong_. it'll break when you fork.
19:03 crab minimalist: the $self you're putting your _schema in is a controller object, whose lifetime is tied to the request
19:03 crab there may be other problems, i didn't look further.
19:04 minimalist crab, what do you suggest?
19:05 abra minimalist, http://pastie.org/1687118
19:05 crab http://toroid.org/ams/etc/mojolicious-db-handles
19:06 sri abra: that looks wrong
19:06 abra sri, ?
19:06 purl rumour has it sri, is under effectively $r->bridge('/')->to(cb => sub{});
19:06 sri abra: the connection seems to be made at startup too
19:06 crab abra: you're connecting in startup again, does DBIx::Simple handle connections broken by fork?
19:07 sri unless DBIx::Simple is fork aware it will break
19:07 sri if it in fact is fork aware you don't have to worry about anything
19:07 moritz sri++ # fast bug fixes
19:08 sri http://search.cpan.org/~dwheeler/DBIx​-Connector-0.43/lib/DBIx/Connector.pm # this is a good example for a fork aware dbi connection manager
19:08 sri i thought DBIx::Class had one built in too
19:08 moritz it has
19:09 crab seems it is not fork-aware
19:09 crab DBIx::Simple, i mean
19:09 moritz and it works, as long as you don't keep other references to your $dbh around
19:09 moritz oh wait
19:09 moritz sorry, DBIx::Class is, I'm confused
19:11 sri i think multiple problems got a bit mixed up here
19:12 sri reading backlog... minimalists problem was single process, dbic reconnecting for every request
19:12 sri and Mojolicious::Plugin::DbixSimple will break with forking servers
19:12 crab right
19:13 crab but minimalist wanted to connect in startup to fix his problem, which would have moved his breakage from category 1 to category 2.
19:13 sri the plugin is trivial to fix, minimalists problem not
19:14 crab once th plugin is fixed, minimalist's problem can be fixed by using it :-)
19:14 sri right, i don't know where dbic caches connections, but i have a hunch he has to keep around the return value of ->connect
19:15 minimalist sri, that's correct
19:15 sri crab: not really
19:15 sri minimalist: but your helper is throwing away the instance
19:15 sri ok, both solved :)
19:16 minimalist crab: I don
19:16 minimalist sry
19:17 minimalist I don't see how the way you show at The Advisory Boar is any different from connecting at start
19:17 crab minimalist: because it won't connect at the start
19:17 stephan48 sri, you talked about some authentication howto in the last days... where could i find that?
19:17 crab minimalist: it'll connect the first time you call $self->app->db
19:17 minimalist crab: correction, I don't see how this is different from a helper
19:17 sri stephan48: i don't remember doing that
19:18 crab minimalist: it stores the db handle someplace with longer-than-request lifetime
19:18 sri attribute vs method
19:18 crab stephan: iirc that was "it would be good to have a ..."
19:18 sri attribute with a lazy default value to be more correct
19:19 minimalist ok, I get it now
19:19 crab attribute of the application (as opposed to the controller) with a lazy default value to be even more correct
19:19 stephan48 ah
19:19 stephan48 true
19:19 crab stephan: i think you just volunteered to write it ;-)
19:20 stephan48 mh?
19:20 purl rumour has it mh is a unix commandline-based mail user agent or at http://www.ics.uci.edu/~mh/ or Men's Health magazine or a "women's magazine" for men or Getty's way of saying hm or your way of saying hm
19:25 spleenjack left #mojo
19:36 fifo joined #mojo
19:36 abra left #mojo
19:38 sri lol, i won
19:38 sri a riak swag pack because i was the 135th person to join their irc channel
19:44 ispy_ joined #mojo
20:05 sigue left #mojo
20:05 sigue joined #mojo
20:06 crab what's in it?
20:06 purl rumour has it in it is the main Hershey factory
20:07 sri dunno
20:44 fifo left #mojo
20:54 dekimsey left #mojo
21:06 stephan48 my first mojolicious segfault
21:07 sri mojolicious wouldn't do that, must be some xs module
21:08 stephan48 });
21:08 stephan48 i had "func( abc => sub {...};"
21:08 stephan48 notice the missing ) before the M
21:08 stephan48 s/M/;/
21:10 sri is that perl5i?
21:10 stephan48 perl5i?
21:10 purl it has been said that perl5i is http://twitter.com/perl5i   http://github.com/schwern/perl5i/raw/master/img​/perl5i%20camel%20with%20a%20machine%20gun.jpg
21:11 sri oh, nevermind
21:11 stephan48 no... last time i checked it was a lenny perl5
21:26 ispy__ joined #mojo
21:28 ispy_ left #mojo
22:55 marty left #mojo
23:26 sherr left #mojo
23:38 sherr joined #mojo

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