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

IRC log for #mojo, 2017-06-30

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

All times shown according to UTC.

Time Nick Message
00:22 schelcj joined #mojo
01:58 bit_shifter How can I use a helper (with a parameter) as a coderef for IOLoop's next_tick?  Trying to wrap my head around how to formulate that syntax.
02:00 bit_shifter ie, instead of "Mojo::IOLoop->next_tick(sub { ... });", "Mojo::IOLoop->next_tick($c->helper_sub($param));"
02:00 bit_shifter Obviously that passes in the returned value from helper_sub as the parameter to next_tick...
02:06 bit_shifter Seems like there would be a better way than "next_tick(sub { $c->helper_sub($param( })" but maybe not.
02:06 bit_shifter Just pretend I got that 2nd to last paren facing the right direction
02:19 noganex_ joined #mojo
02:40 Grinnz you can use curry, but it's basically doing a wrapper sub like that under the hood anyway
02:46 bit_shifter Ah, ok.  Just making sure I'm not being a complete idiot.
03:16 mcsnolte joined #mojo
06:04 inokenty-w joined #mojo
06:25 dod joined #mojo
06:31 dod joined #mojo
06:48 AndrewIsh joined #mojo
06:56 prg joined #mojo
07:04 karjala_ joined #mojo
07:25 cosimo joined #mojo
07:29 trone joined #mojo
08:00 sri anyone know if this actually works? https://github.com/kraih/mojo/wiki/logrotate
08:02 sri i suspect not, since coolo just reported to me that it doesn't
08:35 nic https://paste.ubuntu.com/24987600/ is what I use
08:36 nic coolo: That might be useful, tho the 'reload' step you'd change
08:38 sri that depends on hypnotoad
08:39 coolo perhaps I want to switch to it
08:40 sri it shouldn't be necessary though
08:40 coolo but that does not help because the one that broke is the websocket service, which is not prefork
08:41 rshadow joined #mojo
08:59 sri fwiw, i can replicate the problem by editing the log file and removing lines, it just stops logging
09:04 karjala_ batman + Grinnz, DBD::mysql reverted to its buggy past self, with respect to unicode handling in BLOBs
09:04 karjala_ does this mean that Mojo::mysql needs to be updated again
09:04 karjala_ ?
09:06 karjala_ I'll check
09:12 batman karjala_: https://github.com/jhthorsen/mojo-mysql/compare/1.03...master#diff-e06f03e15d5fd50a7f3927cd435d6e03R340
09:14 sri with proper truncate i can't replicate the issue
09:14 sri "truncate -s 0 log/development.log" on a running system works just fine
09:22 karjala_ batman, I wasn't refering to utf8mb4... but to BLOBs behaving weirdly. Anyway I'm testing, and in 3 minutes I'll report my findings.
09:23 karjala_ My report is that nothing needs to be changed on DBD::mysql - now all scripts work (with todays release of DBD::mysql) - both new & old
09:23 karjala_ with BLOBs and all
09:25 haarg DBD::mysql will be changing again to include better utf8 handling, but via a different option
09:25 haarg at least, i believe that's the plan
09:25 karjala_ Sorry
09:25 karjala_ I meant: Nothing needs to be changed on Mojo::mysql
09:25 karjala_ Not on DBD::mysql
09:26 karjala_ ok
09:28 karjala_ So Mojo::mysql could enable that option by default. Good.
09:39 sri coolo: i'm assuming logrotate is borked or configured wrong, because a real truncate should be fine
09:39 batman Not going to enable something that doesn't work with the "old" MySQL databases. But it's ok if it only requires a new version of DBD::mysql
09:56 coolo sri: as it does not happen everytime, there must be an additional factor involved
10:12 rshadow joined #mojo
11:37 sri can't imagine what that might be
11:54 zakame joined #mojo
12:16 sri i suppose something like this would allow the logger to recover from all sorts of errors https://gist.github.com/anonymous/5cca91a0f7c73751cde610b644aeae19
12:16 sri (not really a proposal)
12:16 sri just throwing it out there
12:18 sri in our case it might be that the logger ran out of disk space, and didn't recover after logrotate freed up some space again
12:18 sri honestly, i have no clue what the correct behavior for a logger would be in a case like that
12:25 gizmomathboy joined #mojo
12:38 sri is there a common idiom for recovering from disk full with an append handle?
12:39 sri clearing the handle is kinda shitty in cases where people set the handle manually from the app
13:06 zakame joined #mojo
13:14 zakame joined #mojo
13:19 gryphon joined #mojo
13:31 Pyritic joined #mojo
13:33 Janos joined #mojo
13:35 mcsnolte joined #mojo
13:40 sri looking through other logger implementations... it does not look like there are idioms to steal :(
13:43 sri some loggers just open and close the log file for every write
14:14 spicyjack sri: : > /path/to/file?
14:14 spicyjack sri: in shell, ":" is a noop, and can be used to truncate files
14:16 spicyjack not sure how that can be translated into Perl without a system call
14:17 sri spicyjack: how does that help with the problem?
14:18 spicyjack sri: truncate the file to get enough space back to write logs again?
14:18 spicyjack or to get enough space back period
14:18 sri that's not the problem at all
14:18 michael joined #mojo
14:18 sri perl has a truncate() function, it's trivial
14:19 jabberwok use Tardis::Space::Inside;
14:19 stryx` joined #mojo
14:19 sri the problem is to recover after the disk full problem has been resolved
14:21 sri right now Mojo::Log does not work after space is available again
14:21 spicyjack sri: and you don't want to use signals to trigger closing/reopening of files, since signals aren't portable
14:22 sri signals are not really a solution either
14:22 spicyjack they're a solution that has been used, but not desired in this use case
14:22 sri they are just another way to do log rotation
14:23 sri and they don't work for the case where the app server and minion share a log file
14:49 bwf joined #mojo
15:05 zivester joined #mojo
15:40 dod joined #mojo
15:42 ptolemarch joined #mojo
15:52 stryx` joined #mojo
15:59 PryMar56 joined #mojo
15:59 sri sometimes i wonder if we should just log to STDERR/STDOUT and let plugins handle everything else ;p
16:05 gregf_ hello
16:06 purl que tal, gregf_.
16:06 gregf_ a dumb question
16:06 preaction we won't judge you
16:07 gregf_ im sending json in the body, but for some reason in the controller action, $self->request->json is undef :/
16:07 gregf_ now, do i need to provide any additional headers ?
16:09 preaction does $self->req->body show the right json? did you send a Content-Type: application/json with your request? is it a POST or PUT request?
16:09 gregf_ http://mojolicious.org/perldoc/Mojo/Message/#json <= the docs dont tell me much
16:09 gregf_ yeah, the json in the body is right
16:09 gregf_ POST, and ive set the content type to 'application/json'
16:09 Grinnz if ->json returns undef then the json probably didn't validate
16:10 gregf_ hmm, let me try and validate it from the command prompt :) #hang on a sec
16:10 Grinnz you can use decode_json($self->req->body) instead, it will throw an exception that might help
16:10 Grinnz (use Mojo::JSON 'decode_json')
16:10 gregf_ ah - sure :), let me give that a whirl as well
16:11 sri coolo brought up systemd for logging earlier, and how it pretty much just works except for double timestamps
16:12 sri is there an env var one can use to detect systemd?
16:12 Grinnz hmm
16:13 Grinnz i don't think so, you have to do a syscall
16:13 sri i wouldn't mind having systemd specific log output, it's the preferred deployment method in the docs already
16:13 sri bummer
16:18 marcus sri: Would love to see support for systemd logging too
16:19 marcus sri: I think a command line flag would be fine if it can't be detected.
16:20 sri testing atm.
16:20 sri i only see two extra env vars "INVOCATION_ID"and "JOURNAL_STREAM"
16:21 marcus sri: what about checking parent pid?
16:22 preaction does Sys::Syslog go to systemd's log?
16:22 sri JOURNAL_STREAM seems like it's made for this
16:23 sri "systemd will now set the $JOURNAL_STREAM environment variable for all services whose stdout/stderr are connected to the Journal (which effectively means by default: all services)"
16:23 marcus yeah, that seems correct
16:23 sri i mean, we just make it an attribute
16:24 sri has with_timestamps => sub { !$ENV{JOURNAL_STREAM} };
16:25 sri oh
16:25 sri and i guess ->path shouldn't be set
16:26 preaction i like that. it'll also work well with pushing mojo logs through other logging systems (like syslog)
16:26 sri has with_timestamps => sub { !!$self->path || !$ENV{JOURNAL_STREAM} };
16:26 sri s/$self/shift/
16:28 cosimo joined #mojo
16:29 arcanez someone is used to subroutine signatures :)
16:29 sri i wish
16:30 arcanez is there any (noticable) difference between using shift vs $_[0]?
16:30 disputin joined #mojo
16:34 dod joined #mojo
16:36 Grinnz $_[0] doesn't modify the array
16:36 Grinnz shift looks nicer
16:36 sri easier to type
16:37 sri technically, i think shift was slower a long long time ago
16:49 arcanez ^^ is what I really meant, sorry
16:52 gregf_ hmmm, back
16:54 good_news_everyon joined #mojo
16:54 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vQBXj
16:54 good_news_everyon mojo/master 6841633 Sebastian Riedel: print log messages without timestamps to STDERR when deployed with systemd
16:54 good_news_everyon left #mojo
16:54 gregf_ preaction: Grinnz my, the json was invalid :/ .. damn, i never knew everything in JSON required quotes.. #save numbers
16:54 Grinnz numbers, null, true, false
16:55 Grinnz everything else that isnt structural is a string
16:55 pink_mist even some numbers
16:55 pink_mist if they're too floaty
16:56 Grinnz for the most part number formats between perl and json are the same so thats nice
16:56 gregf_ for a moment i felt i was working in ruby :/
16:56 gregf_ yeah...
16:56 purl totally dude!
16:57 gregf_ preaction: Grinnz cheers guys :)
16:57 gregf_ or rather, Thanks very much! :)
17:00 sri allright, how to phrase "...defaults to auto-detection based on the presence of a L</"path"> and the C<JOURNAL_STREAM> environment variable." better?
17:03 good_news_everyon joined #mojo
17:03 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vQBME
17:03 good_news_everyon mojo/master 91f1b56 Sebastian Riedel: && already casts to boolean
17:03 good_news_everyon left #mojo
17:03 Pyritic joined #mojo
17:35 trwww joined #mojo
17:41 dod joined #mojo
18:05 miller joined #mojo
18:42 disputin joined #mojo
18:43 dod joined #mojo
19:22 FROGGS joined #mojo
19:32 disputin joined #mojo
19:55 brunoramos joined #mojo
20:06 rshadow joined #mojo
20:20 noganex joined #mojo
20:26 sh14 joined #mojo
20:30 rshadow joined #mojo
21:34 stryx` joined #mojo
23:37 Kundun joined #mojo

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