« Back to channel list

#ruby - 09 August 2017

« Back 1 day Forward 1 day »
[00:00:38] jrabe: has joined #ruby
[00:00:39] Psy-Q: has joined #ruby
[00:01:11] cschneid_: has joined #ruby
[00:02:23] eckhardt: has joined #ruby
[00:03:40] SeepingN: has joined #ruby
[00:09:25] eelster: has joined #ruby
[00:10:08] Bilge: has joined #ruby
[00:11:56] cschneid_: has joined #ruby
[00:12:30] eelster: has joined #ruby
[00:13:45] chouhoul_: has joined #ruby
[00:16:50] edwardly: has joined #ruby
[00:16:51] edwardly: has joined #ruby
[00:17:20] Rodya_: has joined #ruby
[00:18:20] bronson: has joined #ruby
[00:18:21] jphase: has joined #ruby
[00:19:06] bruno-: has joined #ruby
[00:21:40] hkdsun: has joined #ruby
[00:25:44] marxarelli: has joined #ruby
[00:25:52] ascarter: has joined #ruby
[00:26:51] cschneid_: has joined #ruby
[00:44:28] cadillac_: has joined #ruby
[00:52:43] HoloIRCUser: has joined #ruby
[00:55:36] hahuang65: has joined #ruby
[00:59:11] m4rCsi: has joined #ruby
[00:59:16] ged: has joined #ruby
[00:59:51] sumobob: has joined #ruby
[00:59:56] marcellus: has joined #ruby
[01:00:28] vifino: has joined #ruby
[01:01:06] Neptu: has joined #ruby
[01:02:19] snowcrshd: has joined #ruby
[01:06:26] MrSparkle: has joined #ruby
[01:10:31] funburn: has joined #ruby
[01:18:19] olivier__: has joined #ruby
[01:21:24] cschneid_: has joined #ruby
[01:22:03] funburn: has joined #ruby
[01:23:46] jphase: has joined #ruby
[01:24:28] runescape07rsps: has joined #ruby
[01:25:56] gizmore|2: has joined #ruby
[01:26:46] jphase: has joined #ruby
[01:28:15] ecuanaso: has joined #ruby
[01:28:27] cagomez: has joined #ruby
[01:29:20] edwardly: has joined #ruby
[01:29:20] edwardly: has joined #ruby
[01:35:16] ascarter: has joined #ruby
[01:36:11] Kitty-: has joined #ruby
[01:37:52] ramfjord: has joined #ruby
[01:46:23] guardianx: has joined #ruby
[01:49:10] jphase: has joined #ruby
[01:51:07] HoloIRCUser1: has joined #ruby
[01:52:41] uZiel: has joined #ruby
[01:53:49] cdg: has joined #ruby
[01:59:35] cagomez: has joined #ruby
[01:59:48] aurelien`: has joined #ruby
[02:08:19] astrobunny: has joined #ruby
[02:12:21] Jameser: has joined #ruby
[02:14:24] dcunit3d: has joined #ruby
[02:15:25] cagomez: has joined #ruby
[02:16:57] snowcrshd: has joined #ruby
[02:24:13] _whitelogger: has joined #ruby
[02:32:12] ecuanaso: has joined #ruby
[02:35:02] Kitty-: has joined #ruby
[02:35:34] digitalnomad: has joined #ruby
[02:42:12] ascarter: has joined #ruby
[02:47:35] gusrub: has joined #ruby
[02:49:46] kies: has joined #ruby
[02:54:23] electrostat: has joined #ruby
[02:55:06] guardianx: has joined #ruby
[02:56:02] RahulT: has joined #ruby
[02:56:37] hahuang65: has joined #ruby
[03:02:17] elev___: has joined #ruby
[03:05:50] jtd: has joined #ruby
[03:07:12] Jameser: has joined #ruby
[03:07:43] Elevanto: has joined #ruby
[03:11:08] sspreitz: has joined #ruby
[03:20:25] kies: has joined #ruby
[03:20:45] elcontrastador: has joined #ruby
[03:26:43] Jameser: has joined #ruby
[03:26:49] Rodya_: has joined #ruby
[03:34:38] jenrzzz: has joined #ruby
[03:34:39] jenrzzz: has joined #ruby
[03:38:10] gusrub: has joined #ruby
[03:42:35] cschneid_: has joined #ruby
[03:42:49] gix: has joined #ruby
[03:43:22] Moosashi: has joined #ruby
[03:49:54] ascarter: has joined #ruby
[03:51:13] edwardly: has joined #ruby
[03:51:13] edwardly: has joined #ruby
[03:53:08] Emmanuel_Chanel: has joined #ruby
[03:55:42] mooser: has joined #ruby
[03:55:56] bambanx: has joined #ruby
[03:56:47] cschneid_: has joined #ruby
[04:01:19] kies: has joined #ruby
[04:02:56] Moosashi: has joined #ruby
[04:06:13] RahulT: has joined #ruby
[04:08:31] banisterfiend: has joined #ruby
[04:11:06] brendan-: has joined #ruby
[04:11:27] anaeem1: has joined #ruby
[04:13:18] anaeem1__: has joined #ruby
[04:20:02] bronson: has joined #ruby
[04:22:34] ascarter: has joined #ruby
[04:25:09] cam27: has joined #ruby
[04:25:41] BTRE: has joined #ruby
[04:29:16] Rodya_: has joined #ruby
[04:29:36] digitalnomad: has joined #ruby
[04:33:58] naprimer2: has joined #ruby
[04:40:36] jenrzzz: has joined #ruby
[04:43:38] dennisvennink: has joined #ruby
[04:44:26] sarbs: has joined #ruby
[04:47:51] jenrzzz: has joined #ruby
[04:47:51] jenrzzz: has joined #ruby
[04:50:10] Moosashi: has joined #ruby
[04:51:05] jamesaxl: has joined #ruby
[04:54:52] meinside: has joined #ruby
[04:55:57] ascarter: has joined #ruby
[04:57:12] govg: has joined #ruby
[04:57:29] hahuang65: has joined #ruby
[05:09:56] SeepingN: has joined #ruby
[05:14:13] patrontechnosoft: has joined #ruby
[05:17:17] ascarter: has joined #ruby
[05:20:30] Bock: has joined #ruby
[05:21:55] bronson: has joined #ruby
[05:24:04] uZiel: has joined #ruby
[05:30:12] Rodya_: has joined #ruby
[05:45:07] jackjackdripper1: has joined #ruby
[05:49:21] nadir: has joined #ruby
[05:50:32] anisha: has joined #ruby
[05:51:46] cam27: has left #ruby: ()
[05:58:02] lexruee: has joined #ruby
[05:59:58] RahulT: has joined #ruby
[06:00:19] Moosashi: has joined #ruby
[06:00:25] Bhootrk_: has joined #ruby
[06:00:50] Bhootrk_: has joined #ruby
[06:01:48] rabajaj: has joined #ruby
[06:03:10] ascarter_: has joined #ruby
[06:03:24] KeyJoo: has joined #ruby
[06:04:55] ur5us: has joined #ruby
[06:09:29] jphase_: has joined #ruby
[06:14:35] djbkd: has joined #ruby
[06:16:46] Inoperable: has joined #ruby
[06:22:52] bronson: has joined #ruby
[06:23:15] dionysus69: has joined #ruby
[06:31:06] Rodya_: has joined #ruby
[06:31:58] cschneid_: has joined #ruby
[06:34:30] FWTIKPNWBSRSHYOM: has joined #ruby
[06:36:22] Dimik: has joined #ruby
[06:49:40] ramfjord: has joined #ruby
[06:56:10] nofxxx: has joined #ruby
[06:58:22] hahuang65: has joined #ruby
[07:01:09] conta: has joined #ruby
[07:10:00] ascarter_: has joined #ruby
[07:10:16] TomyWork: has joined #ruby
[07:10:21] ramfjord: has joined #ruby
[07:17:22] high_fiver: has joined #ruby
[07:23:37] bronson: has joined #ruby
[07:24:25] mark_66: has joined #ruby
[07:28:34] vondruch: has joined #ruby
[07:28:35] KeyJoo: has joined #ruby
[07:31:42] Rodya_: has joined #ruby
[07:31:45] tAn: has joined #ruby
[07:33:11] jamesaxl: has joined #ruby
[07:37:36] ascarter_: has joined #ruby
[07:43:36] dennisvennink: has joined #ruby
[07:43:53] Silthias: has joined #ruby
[07:44:36] leandrobighetti: has joined #ruby
[07:44:47] leandrobighetti: has left #ruby: ()
[07:46:25] ramfjord: has joined #ruby
[07:47:23] anaeem1: has joined #ruby
[07:48:12] X-tonic: has joined #ruby
[07:49:34] X-tonic: has joined #ruby
[07:51:07] dennisvennink: has joined #ruby
[07:54:07] antgel: has joined #ruby
[07:57:55] ur5us: has joined #ruby
[08:01:46] burgestrand: has joined #ruby
[08:04:46] HoloIRCUser2: has joined #ruby
[08:05:54] 17SABNWE0: has joined #ruby
[08:08:04] ams__: has joined #ruby
[08:08:20] sysvalve: has joined #ruby
[08:08:27] vondruch: has joined #ruby
[08:13:40] Immune: has joined #ruby
[08:14:33] wnd: has joined #ruby
[08:19:42] funkycrunchy: has joined #ruby
[08:20:16] funkycrunchy: has left #ruby: ()
[08:21:25] jenrzzz: has joined #ruby
[08:21:25] jenrzzz: has joined #ruby
[08:22:14] Silthias1: has joined #ruby
[08:22:29] ramfjord: has joined #ruby
[08:25:11] bronson: has joined #ruby
[08:25:15] jaruga: has joined #ruby
[08:30:30] anisha: has joined #ruby
[08:32:45] Rodya_: has joined #ruby
[08:35:56] Bhootrk_: has joined #ruby
[08:36:19] Beams: has joined #ruby
[08:38:06] ramfjord: has joined #ruby
[08:40:59] ascarter_: has joined #ruby
[08:43:27] marr: has joined #ruby
[08:43:36] gix: has joined #ruby
[08:44:06] jinie_: has joined #ruby
[08:45:46] DTZUZO: has joined #ruby
[08:48:14] DoubleMalt: has joined #ruby
[08:51:14] jinie_: has joined #ruby
[08:51:45] aupadhye: has joined #ruby
[08:52:05] Psy-Q: has joined #ruby
[08:52:41] mtkd: has joined #ruby
[08:52:44] unsymbol: has joined #ruby
[08:54:17] sonne: has joined #ruby
[08:56:11] mooser: has joined #ruby
[08:56:15] j416: has joined #ruby
[08:59:28] hahuang65: has joined #ruby
[09:01:17] gix: has joined #ruby
[09:02:41] dennisvennink: has joined #ruby
[09:03:02] charliesome: has joined #ruby
[09:04:38] ur5us: has joined #ruby
[09:12:31] vuoto: has joined #ruby
[09:13:20] cagomez: has joined #ruby
[09:13:24] ramfjord: has joined #ruby
[09:20:44] mustaffa: has joined #ruby
[09:22:20] careta: has joined #ruby
[09:26:04] bronson: has joined #ruby
[09:26:45] jaruga: has joined #ruby
[09:29:27] DTZUZO: has joined #ruby
[09:31:09] chrisarcand: has joined #ruby
[09:31:10] jericon: has joined #ruby
[09:31:12] ryotarai: has joined #ruby
[09:31:14] erlend: has joined #ruby
[09:31:16] dysfigured: has joined #ruby
[09:31:16] zachary12: has joined #ruby
[09:31:16] veloutin: has joined #ruby
[09:31:16] webhat: has joined #ruby
[09:31:16] marcellus: has joined #ruby
[09:31:16] Dry_Lips: has joined #ruby
[09:31:16] ericnw: has joined #ruby
[09:31:16] thoraxe: has joined #ruby
[09:31:16] Dry_Lips: has joined #ruby
[09:31:20] dcluna: has joined #ruby
[09:31:20] jhass: has joined #ruby
[09:31:20] belmoussaoui: has joined #ruby
[09:31:21] Archrover: has joined #ruby
[09:31:22] scottschecter: has joined #ruby
[09:31:23] brucebag: has joined #ruby
[09:31:24] brucebag: has joined #ruby
[09:31:25] planigan: has joined #ruby
[09:31:25] SHyx0rmZ: has joined #ruby
[09:31:26] BTRE: has joined #ruby
[09:31:27] brainslug: has joined #ruby
[09:31:27] kaspergrubbe: has joined #ruby
[09:31:28] ByronJohnson: has joined #ruby
[09:31:29] evie_hammond: has joined #ruby
[09:31:30] inukshuk: has joined #ruby
[09:31:30] tabakhase: has joined #ruby
[09:31:32] cydrobolt: has joined #ruby
[09:31:32] priodev: has joined #ruby
[09:31:32] cydrobolt: has joined #ruby
[09:31:33] clemens3: has joined #ruby
[09:31:39] Aloy: has joined #ruby
[09:31:40] Drakevr: has joined #ruby
[09:31:44] rapha: has joined #ruby
[09:31:45] Tatey: has joined #ruby
[09:31:48] ged: has joined #ruby
[09:31:51] danman: has joined #ruby
[09:31:53] tAn: has joined #ruby
[09:31:56] ikopico: has joined #ruby
[09:31:58] HoloIRCUser3: has joined #ruby
[09:32:03] mjuhl: has joined #ruby
[09:32:05] roger_rabbit: has joined #ruby
[09:32:13] brw: has joined #ruby
[09:32:15] hkdsun: has joined #ruby
[09:32:25] bier: has joined #ruby
[09:32:47] Azure: has joined #ruby
[09:32:51] linduxed: has joined #ruby
[09:32:52] jyaworski: has joined #ruby
[09:33:28] Rodya_: has joined #ruby
[09:33:39] perry: has joined #ruby
[09:33:39] perry: has joined #ruby
[09:33:46] zululee: has joined #ruby
[09:34:15] gnarf: has joined #ruby
[09:34:48] charliesome_: has joined #ruby
[09:35:40] bodie_: has joined #ruby
[09:36:14] bokayio: has joined #ruby
[09:36:18] michael_mbp: has joined #ruby
[09:37:15] Cork: has joined #ruby
[09:37:18] bauruine: has joined #ruby
[09:37:41] timmow: has joined #ruby
[09:37:48] heinrich5991: has joined #ruby
[09:39:13] Serpent7776: has joined #ruby
[09:44:01] InfinityFye: has joined #ruby
[09:44:24] cagomez: has joined #ruby
[09:48:11] ascarter: has joined #ruby
[09:49:27] ramfjord: has joined #ruby
[09:50:26] darix: does trunk really need ruby to build itself?
[09:51:01] dalpo: has joined #ruby
[09:53:45] nekomune: has joined #ruby
[09:56:35] darix: hmm seems only when doing autoreconf. snapshot tarball works
[10:00:12] yuciyuar: has joined #ruby
[10:00:18] cagomez: has joined #ruby
[10:03:17] jenrzzz: has joined #ruby
[10:03:17] jenrzzz: has joined #ruby
[10:05:05] ramfjord: has joined #ruby
[10:06:55] dminuoso: darix: It uses miniruby (which it bootstraps itself)
[10:07:13] darix: dminuoso: autoreconf -fi && ./configure
[10:07:17] darix: and it was trying to find ruby
[10:07:25] darix: using snapshot.tar.gz it works
[10:09:42] snowcrshd: has joined #ruby
[10:11:14] rgtk: has joined #ruby
[10:24:37] catphish: has joined #ruby
[10:25:20] DrCode: has joined #ruby
[10:26:54] bronson: has joined #ruby
[10:27:57] tomphp: has joined #ruby
[10:29:15] rgtk: has joined #ruby
[10:31:00] catphish: my infinite sched_yield loop is still occurring: https://paste.ubuntu.com/25276100/
[10:32:19] harryk: has joined #ruby
[10:36:54] catphish: unfortunately i have no idea how to go about reproducing it in a controlled environment
[10:44:54] matthewd: catphish: Other threads?
[10:49:45] vuoto: has joined #ruby
[10:50:31] belmoussaoui: has joined #ruby
[10:54:09] belmoussaoui: has joined #ruby
[10:56:21] ascarter: has joined #ruby
[10:57:53] sepp2k: has joined #ruby
[10:58:04] mikecmpbll: has joined #ruby
[11:00:18] hahuang65: has joined #ruby
[11:05:02] nickjj: has joined #ruby
[11:05:29] tomphp: has joined #ruby
[11:20:39] xall: has joined #ruby
[11:21:50] dminuoso: catphish: Can you describe the loop?
[11:22:03] tomphp: has joined #ruby
[11:24:37] tomphp: has joined #ruby
[11:27:29] bronson: has joined #ruby
[11:28:11] dminuoso: Oh there was some gdb stuff at the bottom, I see.
[11:33:28] ahrs: has joined #ruby
[11:35:00] catphish: dminuoso: i hope the step describes the loop, all i know for sure is that it repeatedly calls sched_yield()
[11:35:12] lexruee: has joined #ruby
[11:36:49] dminuoso: catphish: Yeah, I'm digging into the Ruby code. It looks like some unaccounted for race condition.
[11:37:04] ldnunes: has joined #ruby
[11:37:18] dminuoso: catphish: What OS are you on?
[11:37:39] catphish: Linux 3.16.0-62-generic x86_64
[11:38:03] catphish: ubuntu 14.04
[11:38:22] lele: has joined #ruby
[11:39:30] dminuoso: catphish: You're on a plain x86 architecture, right?
[11:40:00] dminuoso: I mean.. I know its implied in that kernel string, but I just wanna know whether that's a safe assumption to make.
[11:40:05] catphish: yes, just a regular install of ubuntu on a E5-2609 v2 @ 2.50GHz
[11:41:13] A124: has joined #ruby
[11:41:26] catphish: and ruby 2.3.4 built from source with everything default (you will find the line numbers are offset due to https://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_2_3/thread.c?r1=58289&r2=58288&pathrev=58289&view=patch
[11:42:23] dminuoso: catphish: Yeah Im using the git mirror
[11:42:51] dminuoso: catphish: So let's start with one thing. That particular loop is normal.
[11:43:25] catphish: that surprises me, i understood that kernel call was quite expensive
[11:44:29] dminuoso: catphish: Essentially it's just a spinlock.
[11:44:45] dminuoso: But it shouldn't spin indefinitely.
[11:44:59] dminuoso: (It's a spinlock around a semaphore)
[11:45:18] dminuoso: Kind of I guess.
[11:47:58] dminuoso: catphish: Does the problem trigger reliably on exit?
[11:48:52] catphish: dminuoso: no, only randomly :(
[11:50:19] dminuoso: The code comments are mindnumbing..
[11:50:24] dminuoso: * send a signal to intent that a target thread return from blocking syscall.
[11:50:57] catphish: i have a job worker that fetches a job to be performed, forks, allows the job (which usually has many threads) to run in the fork, then when the child dies, it moves onto the next job
[11:51:19] catphish: this bug happens randomly across my whole app, but i usually see it on these worker children because they exit often
[11:55:12] beilabs: has joined #ruby
[11:57:46] ldnunes: has joined #ruby
[11:58:17] ch3: has joined #ruby
[11:58:34] dminuoso: matthewd: The timer thread is just the thread that preempts non-cooperative thats that don't release/gil and yield right?
[11:58:41] dminuoso: *non-cooperative threads
[11:59:16] dminuoso: catphish: I would be very interested in what other threads are still running and where.
[11:59:50] catphish: i'll see if i can pull any more information
[11:59:57] catphish: about running threads specifically
[12:00:34] synthroid: has joined #ruby
[12:00:53] ascarter: has joined #ruby
[12:03:15] matthewd: dminuoso: I don't actually know what it does beyond "nothing particularly notable", tbh
[12:03:39] BSAlb: has joined #ruby
[12:04:39] dminuoso: matthewd: Mmm. The code is really tough to read and has "japanese" written all over it. :|
[12:04:59] BSAlb: has joined #ruby
[12:05:17] ramfjord: has joined #ruby
[12:06:07] kev1n: has joined #ruby
[12:06:27] BSAlb: has joined #ruby
[12:06:31] catphish: i'm just looking at a tangent mystery where one of the hung processes is a child created by open4 that shouldn't have been running ruby at all
[12:07:48] BSAlb: has joined #ruby
[12:09:36] dminuoso: The way I see it, the only way this could get stuck, is if this condition was constantly hit by another thread: https://github.com/ruby/ruby/blob/v2_3_3/thread_pthread.c#L1295
[12:09:58] dminuoso: Because it would have to get stuck inside one of these two: https://github.com/ruby/ruby/blob/v2_3_3/thread_pthread.c#L1312-L1327
[12:10:28] catphish: https://paste.ubuntu.com/25276522/
[12:10:42] catphish: this one has just the one thread, the timer thread isn't running
[12:11:51] dennisvennink: has joined #ruby
[12:12:05] catphish: i say "this one" because here's another that has both: https://paste.ubuntu.com/25276537/
[12:14:34] dminuoso: catphish: I can't fathom as to how that situation could end up.
[12:15:01] dminuoso: catphish: Reason being: https://github.com/ruby/ruby/blob/v2_3_3/thread_pthread.c#L1312-L1327
[12:15:08] dminuoso: catphish: This is the only spot those ... wait
[12:15:52] dminuoso: catphish: Please use gdb to tell me what timer_thread_pipe.writing actually is
[12:15:55] catphish: nb. your understanding of this far exceeds mine, so apologies if i'm just nodding and hoping you will find something
[12:16:33] catphish: dminuoso: gladly, how do i ask it?
[12:20:01] catphish: (gdb) whatis timer_thread_pipe.writing
[12:20:01] catphish: type = rb_atomic_t
[12:20:11] catphish: i assume that's not terribly useful information?
[12:21:25] dminuoso: catphish: just use print :)
[12:21:39] catphish: (gdb) print timer_thread_pipe.writing
[12:21:54] dminuoso: Yeah and I dont see how that could be with no threads left.
[12:22:05] dminuoso: Unless the ATOMIC_INC/ATOMIC_DEC was buggy
[12:22:08] dminuoso: file a bug report.
[12:22:34] dminuoso: That is unless you have a native extension that fucks around with the timer directly
[12:23:21] catphish: this is in the process with
[12:23:51] catphish: Id Target Id Frame
[12:23:52] catphish: * 1 Thread 0x7f79872e8740 (LWP 15176) "ruby" 0x00007f7985f8c1d7 in sched_yield () at ../sysdeps/unix/syscall-template.S:81
[12:23:52] catphish: (gdb) print timer_thread_pipe.writing
[12:24:11] catphish: so, in the process with only one thread, that still occurs
[12:26:18] aufi: has joined #ruby
[12:26:52] dminuoso: catphish: File a bug report.
[12:27:26] catphish: it certainly could be a native extension making a mess, this app has a lot of dependencies
[12:27:40] dminuoso: catphish: Essentially there is a counter that is treated like this: atomic_inc_counter; do_stuff; atomic_dec_counter - that is the only place where that counter ever gets modified.
[12:27:56] dminuoso: catphish: It starts out with 0. If it ends up with anything but 0, there's something strangely fucked up.
[12:28:16] dminuoso: catphish: valgrind it perhaps
[12:28:17] catphish: is it possible that a thread increments it, then we fork, leaving it incremented
[12:28:19] bronson: has joined #ruby
[12:29:26] sysvalve: has joined #ruby
[12:29:52] catphish: can i see at a glance which gems i'm running have native code?
[12:30:08] catphish: i'd like to see if anything is obviously in common with this report: https://github.com/resque/resque/issues/578
[12:30:55] catphish: seemingly i'm not the first to have this bug, but it was never really resolved
[12:31:17] Ainieco: has joined #ruby
[12:31:33] Ainieco: hello, seems like modulo is broken in ruby
[12:31:40] matthewd: catphish: Check .so files in $" ?
[12:31:44] catphish: that's quite the accusation :)
[12:31:55] Ainieco: (-2) % 8 == 6 but in reality it's -2
[12:32:56] catphish: i'd be very unhappy if modulo returned a negative number
[12:33:22] catphish: i rather rely on it returning a repeating patters of 0 to n where n is a positive integer
[12:33:39] catphish: and i'd expect that to continue into negative number space
[12:34:11] beilabs: has joined #ruby
[12:35:33] catphish: ainieco: what makes you expect the result to be negative?
[12:36:00] herwin: ainieco: see https://en.wikipedia.org/wiki/Modulo_operation "Result has the same sign as"
[12:36:33] jaruga: has joined #ruby
[12:36:47] t-recx: has joined #ruby
[12:36:47] catphish: looks like ruby supports both!
[12:37:12] catphish: i had no idea it was so controversial :)
[12:37:34] Ainieco: catphish: yeah, was confused by other languages
[12:37:53] catphish: yeah, makes sense, certainly looks like they vary
[12:39:25] ldnunes: has joined #ruby
[12:43:09] catphish: dminuoso: do you know off-hand what code is being run inside the block that increments that counter, if i can make it increment, then fork, i might have a chance of making a test case
[12:46:37] dminuoso: catphish: https://github.com/ruby/ruby/blob/v2_3_3/thread_pthread.c#L1282-L1310 this
[12:47:24] conta: has joined #ruby
[12:48:34] catphish: /* must be safe inside sighandler, so no mutex */
[12:51:37] conta: has joined #ruby
[12:51:57] dminuoso: catphish: For the purpose of the timer itself, it doesn't matter whether its mutex protected or not.
[12:52:18] catphish: i just found this https://github.com/ruby/ruby/commit/f224fecc0fec5e73570137ab258af679fd9d3cfd
[12:52:40] jphase: has joined #ruby
[12:52:45] dminuoso: catphish: Yup that's the commit that introduced the code.
[12:52:58] catphish: oh, my mistake
[12:54:06] catphish: i was misunderstanding something there
[12:54:46] catphish: am i right in my interpretation that a fork during that execution would lead to this situation?
[12:57:35] dminuoso: catphish: Explain why
[12:59:31] catphish: dminuoso: if this code ran in a thread other than the main thread (which i assume is a possibility if someone has written code to spin and wait for it to unlock), then would a fork not cause the thread that incremented the value to be left behind (threads are not copied on fork) but the value would still remain incremented in the child
[13:01:04] hahuang65: has joined #ruby
[13:02:10] dminuoso: catphish: Agreed. You could trivially provoke this situation in fact.
[13:02:24] charliesome: has joined #ruby
[13:03:29] dminuoso: catphish: It does sound like a reasonable hypothesis. Test it. ;p
[13:04:19] catphish: any idea how i might do this?
[13:04:54] belmoussaoui: has joined #ruby
[13:07:43] cpruitt: has joined #ruby
[13:09:07] belmoussaoui: has joined #ruby
[13:09:44] dminuoso: catphish: Well here's what has to happen:
[13:10:37] ascarter: has joined #ruby
[13:10:42] beilabs: has joined #ruby
[13:11:31] dminuoso: catphish: There's 2 ways this wakeup call is triggered. a) whenever the gvl lock is acquired, and b) whenever a signal handler is called
[13:11:36] rgtk: has joined #ruby
[13:15:34] catphish: ah i understand the loop now: while (ATOMIC_CAS(timer_thread_pipe.writing, (rb_atomic_t)0, 0)) native_thread_yield();
[13:16:31] catphish: so it's unquestionable that timer_thread_pipe.writing is being incremented and not decremented
[13:16:43] funburn: has joined #ruby
[13:20:41] beilabs: has joined #ruby
[13:20:46] funburn: has joined #ruby
[13:21:21] uncle-bob: has joined #ruby
[13:22:58] aurelien: has joined #ruby
[13:25:47] _aeris_: has joined #ruby
[13:26:13] funburn: has joined #ruby
[13:28:12] DLSteve: has joined #ruby
[13:28:29] funburn: has joined #ruby
[13:29:16] bronson: has joined #ruby
[13:30:16] _aeris_: has joined #ruby
[13:30:25] Bhootrk_: has joined #ruby
[13:33:47] funburn: has joined #ruby
[13:35:05] konsolebox: has joined #ruby
[13:35:47] naprimer2: has joined #ruby
[13:37:20] jamesaxl: has joined #ruby
[13:37:39] tvw: has joined #ruby
[13:38:53] Jameser: has joined #ruby
[13:39:58] Bhootrk_: has joined #ruby
[13:45:01] guardianx: has joined #ruby
[13:47:12] BSaboia: has joined #ruby
[13:49:38] mim1k: has joined #ruby
[13:50:32] TheBrayn: I have an if call that I want to change: „if foo.bar? && baz = somefunction“ when will the second part fail?
[13:51:45] matthewd: TheBrayn: When it's false (or nil)?
[13:51:56] TheBrayn: but this is an anti-pattern, right?
[13:53:42] matthewd: I'd say it's worth some caution (because people may misread it), but I personally don't avoid it too hard. (Assuming we're talking about the use of an assignment in the conditional.)
[13:56:42] mooser: has joined #ruby
[13:56:48] Dump_not: has joined #ruby
[13:57:14] TheBrayn: ok I'll just wrap the second statement in parentheses
[13:57:27] catphish: IMO assigning in an if and ignoring the result is unnecessary and hence a bad idea for readability
[13:57:44] catphish: in this case, the second condition is *always* true, so there's no point having it in the conditional
[13:58:46] catphish: if(baz=true) << pointless if(baz=check_something()) << ok (in my opinion)
[13:58:55] dminuoso: catphish: and that ATOMIC_CAS must have been a brainfart.
[13:58:57] matthewd: catphish: Do you know something about `somefunction` that I don't?
[13:59:15] TheBrayn: yeah the result is used
[13:59:33] dark_popara: has joined #ruby
[13:59:34] catphish: matthewd: oh, totally misread, i saw the closing quote and thought somefunction was a string
[14:00:23] catphish: dminuoso: sorry, i don't follow
[14:02:31] chouhoulis: has joined #ruby
[14:03:04] catphish: it does seem like while(!timer_thread_pipe.writing) would achieve the same thing
[14:03:11] dminuoso: catphish: No.
[14:03:16] chouhoulis: has joined #ruby
[14:03:20] dminuoso: catphish: The load could be teared.
[14:03:50] catphish: i'm afraid once again i don't understand
[14:04:04] rgtk: has joined #ruby
[14:04:18] dminuoso: catphish: Though considering what the code does, it probably really doesnt matter anyway. It's quite racey.
[14:04:44] catphish: oh, compare-and-swap is a safety for pointers
[14:04:55] dminuoso: catphish: Well while(!timer_thread_pipe.writing) is a load right? It loads some say 32 bit data. It's not guaranteed it does so in a single instruction.
[14:05:13] catphish: yeah, i think i understand
[14:05:29] catphish: so, i still need to work out why it's non-zero :(
[14:05:31] mikecmpb_: has joined #ruby
[14:05:31] truenito: has joined #ruby
[14:06:51] catphish: i must admit i avoid shared memory between threads in c at all cost, so this is all quite new to me
[14:06:57] __Yiota: has joined #ruby
[14:08:09] dminuoso: catphish: the fork theory sounds reasonable.
[14:08:44] dminuoso: catphish: Well shared mutable state is the bane of all multithreading bugs :-)
[14:08:54] beilabs: has joined #ruby
[14:09:20] Rodya_: has joined #ruby
[14:10:12] Rapture: has joined #ruby
[14:13:01] dminuoso: catphish: Turns out Ruby folks knew about this, and ensure the timer thread is stopped before fork...
[14:13:23] catphish: i was just looking for the before/aster fork code to check
[14:13:23] chouhoul_: has joined #ruby
[14:13:44] truenito: has joined #ruby
[14:13:51] catphish: does stopping the timer thread actually prevent that code running though?
[14:14:51] dminuoso: catphish: Yes.
[14:15:07] ascarter: has joined #ruby
[14:15:15] dminuoso: From what I can tell
[14:16:05] ResidentBiscuit: has joined #ruby
[14:16:22] Stan: has joined #ruby
[14:17:48] catphish: sighandler() blindly calls rb_thread_wakeup_timer_thread() which blindly calls ATOMIC_INC(timer_thread_pipe.writing);
[14:18:05] catphish: i see no code to check if the timer thread exists
[14:18:35] dminuoso: catphish: In fact the timer stop code is empty for thread_pthread...
[14:20:02] catphish: i'm still not comprehending how this could be triggered in real life
[14:21:02] nOwz: has joined #ruby
[14:21:31] thuryn: dang. i missed the answer to my regexp question yesterday, and my client isn't logging.
[14:21:34] dminuoso: catphish: Each time the gvl lock is reacquired.
[14:21:45] catphish: oh, the call from ubf_select()
[14:22:52] dminuoso: catphish: no that one is irrelevant
[14:23:00] GodFather: has joined #ruby
[14:23:19] dminuoso: it calls the same function mmm
[14:23:23] catphish: i couldn't find any other calls to it
[14:24:50] dminuoso: catphish: there's a call to rb_thread_wakeup_timer_thread_low from gvl_acquire_common
[14:24:53] catphish: oh gvl_acquire_common calls rb_thread_wakeup_timer_thread_low
[14:25:35] dminuoso: catphish: And that one in a multi-threaded environment is likely to be called whenever an effective context switch happens
[14:25:43] apparition47: has joined #ruby
[14:26:12] catphish: i didn't believe my application was creating any threads pre-fork, but it's certainly seeming likely this is the cause
[14:26:57] antgel: has joined #ruby
[14:26:59] thuryn: does (^|\/) mean to match if the value of #{some_var} appears after the last / OR at the beginning of foo?
[14:27:11] cam27: has joined #ruby
[14:27:15] thuryn: foo =~ /(^|\/)#{some_var}$/ <--- regarding this
[14:27:34] Jameser: has joined #ruby
[14:28:27] catphish: thuryn: ^ means the beginning of a line, $ means end of a line
[14:29:14] catphish: thuryn: so, it matches if some_var occurs at the end of a line following / or is both at the beginning and the end of a line
[14:29:19] mikecmpbll: has joined #ruby
[14:29:49] catphish: [beginning of line or /]some_var[end of line]
[14:30:25] bronson: has joined #ruby
[14:30:44] dminuoso: catphish: Well if there's any signal communication that could be a another
[14:30:48] cam27: has left #ruby: ()
[14:31:09] hays: has joined #ruby
[14:31:09] hays: has joined #ruby
[14:31:18] dminuoso: catphish: Im curious what ubf_select is about
[14:31:30] catphish: dminuoso: i wondered that, but signals don't make a thread do they? so the code would complete before a fork happened
[14:31:50] dminuoso: ubf means unblocking function supposedly
[14:31:55] hays: if i want to reuse code (like a class for example) without going all in on a gem is there a way to do this? require_relative maybe?
[14:32:11] dminuoso: catphish: technically signal handlers run outside normal thread flow but inside its process space
[14:32:19] hays: usecase: I have a directory of ruby scripts that all work together and share common aspects, and they are in my $PATH
[14:32:35] banisterfiend: has joined #ruby
[14:32:44] thuryn: catphish, okay, that's how i was reading it. thanks.
[14:32:46] dminuoso: catphish: assume a signal handler to behave like an injectd setjmp/longjmp/longjmp
[14:33:37] hightower2: has joined #ruby
[14:34:11] hightower2: Hey, what's some good Ruby library for parsing a directory tree and finding files? (Some Find library/module, but not the one from standard lib)
[14:34:19] catphish: a line of code in native_reset_timer_thread() would probably fix this, but it might be hacky at best
[14:34:29] dminuoso: catphish: though. you are right.
[14:34:37] dminuoso: without creating a thread pre-fork its impossible to race.
[14:35:04] catphish: dminuoso: that's what i was thinking, however maybe i have a thread i'm not aware of, a stray timeout or similar
[14:35:12] dminuoso: because the only thread is blocked from executoin until the signal handler is executed
[14:35:27] catphish: dminuoso: that was my assessment
[14:35:53] dminuoso: catphish: well you can check if there's a thread if you just set a breakpoint into the appropriate c function and just run until fork :P
[14:36:13] dminuoso: catphish: But that thread would have to run basically during forking.
[14:37:05] dminuoso: catphish: considering it's the main thread that has the signal handlers, I don't think its signals we have to worry about
[14:37:17] dminuoso: its either the gvl_common_acquire or ubf_select
[14:37:23] hays: anyone have any insight to my question? really just trying to put together some quick commandline utilities and I hate having to copypaste my classes everywhere
[14:37:38] cschneid_: has joined #ruby
[14:37:46] bruno-: has joined #ruby
[14:37:57] dminuoso: hays: require_relative is a thing :-)
[14:38:05] catphish: pthread's native_reset_timer_thread() does nothing right now, but it could tidy up this mess if it wanted to
[14:38:08] Silthias1: hays: cant comment on if its good practise or not, but i use require_relative for what your decribing
[14:38:51] catphish: hays: put them in files, require them
[14:38:53] hays: and the relative part is relative to the script location not the current working directory right
[14:39:00] catphish: hays: correct
[14:39:03] dminuoso: catphish: I found something else...
[14:39:11] catphish: dminuoso: :)
[14:39:21] dminuoso: catphish: https://github.com/ruby/ruby/blob/v2_3_3/thread_pthread.c#L1655-L1656
[14:39:25] belmoussaoui: has joined #ruby
[14:39:47] dminuoso: Look at that... if only that had an effect. ;-)
[14:40:41] catphish: dminuoso: well it does stop the wakeups :)
[14:40:52] dminuoso: catphish: Everything here smells that it needs pthread_cond_wait
[14:41:13] belmoussaoui: has joined #ruby
[14:41:58] cadillac_: has joined #ruby
[14:42:00] dminuoso: catphish: The problem is not the wakeup itself.
[14:42:07] dminuoso: It's the pieces of execution that trigger it.
[14:42:57] gr33n7007h: has joined #ruby
[14:43:13] dminuoso: catphish: fork needs to block rb_thread_wakeup_timer_thread and rb_thread_wakeup_timer_thread_low from having a side-effect
[14:43:48] catphish: one option is simply to set writing=0 in native_reset_timer_thread()
[14:44:05] catphish: since this runs after fork, its purpose is to clean up the timer thread, currently it does nothing
[14:44:09] dminuoso: catphish: Great idea! While another thread is in the middle of rb_thread_wakeup_timer_thread
[14:44:26] dminuoso: catphish: then you end up with a non-0 counter again
[14:44:33] catphish: if that's possible, yes
[14:44:58] dminuoso: catphish: The thing is, rb_thread_wakeup_timer_thread is a critical section.
[14:45:40] Polysics: has joined #ruby
[14:45:45] dminuoso: catphish: lack of mutex makes it hard to do anything sensible
[14:45:48] polishdub: has joined #ruby
[14:46:27] catphish: rb_thread_reset_timer_thread is only called by after_exec()
[14:46:47] catphish: so, as a hack, i suspect it's safe, but it's not clear to me what the correct solution is
[14:47:54] dminuoso: catphish: So you agree that we can't just introduce a mutex into rb_thread_wakeup_timer_thread, because since it's executed from signal handlers. Right?
[14:49:07] catphish: if you put a mutex around it 1) it would potentially deadlock in signal handlers 2) it still wouldn't stop another thread forking
[14:49:49] catphish: should i go ahead and write this up as a bug somewhere?
[14:50:57] dminuoso: catphish: What you could do, is put a spinlock in rb_thread_wakeup_timer_thread
[14:51:49] dminuoso: Though.. no. That thing makes syscalls.
[14:52:26] oleo: has joined #ruby
[14:52:57] dminuoso: catphish: What if fork simply reset the writer count?
[14:53:13] catphish: dminuoso: see 5 minutes ago ;)
[14:53:43] dminuoso: catphish: missed it, but had the same thought and reasoning :)
[14:54:24] catphish: rb_fork_ruby -> fork(); after_fork_ruby() -> after_exec() -> after_exec_non_async_signal_safe() -> rb_thread_reset_timer_thread()
[14:54:38] dminuoso: catphish: By the way, that stray label (it's removed in 2.4) is quite funny: https://github.com/ruby/ruby/blob/v2_3_3/thread_pthread.c#L1291
[14:54:43] catphish: it's like someone wrote a stub ready for this bug
[14:54:56] sleepee: has joined #ruby
[14:55:30] catphish: dminuoso: i was just laughing at this comment: https://github.com/ruby/ruby/blob/1e84c8343f38aab16299ddfb7cb20d3e9dabba6f/process.c#L1187
[14:55:44] dminuoso: catphish: Oh indeed. There's quite a few stubs in there.
[14:55:57] dminuoso: catphish: Haha, let me blame this
[14:56:41] catphish: dminuoso: so basically the very first thing that gets run after a fork is rb_thread_reset_timer_thread() - this does nothing but is perfectly poised to reset everything related to the timer thread (ie the writing counter)
[14:56:51] dminuoso: catphish: Considering the size of that execution path, it should pretty darn hard to trigger this bug. So it's actually surprising that you got this bug repeatedly.
[14:57:25] catphish: dminuoso: i'd agree, but i'm apparantly not the only one
[14:57:41] catphish: there must be a particular pattern that makes this likely
[14:57:53] dminuoso: catphish: Wow, this was not just a second author adding a funny remark.
[14:57:59] dminuoso: catphish: This was actually a single change: https://github.com/ruby/ruby/commit/d074d0df9503b8df51c0ec5e5137c4729f511b17
[14:58:15] _main_: has joined #ruby
[14:59:23] _main_: has joined #ruby
[15:00:48] catphish: the question for me now is whether i test my timer_thread_pipe.writing = 0 fix on a production application server
[15:00:55] catphish: since i have no other way to reproduce this
[15:02:57] hahuang65: has joined #ruby
[15:03:34] camonz: has joined #ruby
[15:04:20] Rodya_: has joined #ruby
[15:04:41] catphish: i'll raise this as a bug with my proposed solution
[15:08:37] chouhoulis: has joined #ruby
[15:11:31] __Yiota: has joined #ruby
[15:12:10] Jameser: has joined #ruby
[15:14:12] d10n-work: has joined #ruby
[15:21:15] catphish: dminuoso: https://bugs.ruby-lang.org/issues/13794
[15:21:41] dminuoso: catphish: I wonder... does fork not lock the gvl?
[15:21:48] HoloIRCUser: has joined #ruby
[15:22:19] dminuoso: catphish: I mean in my mind, Im trying to sketch a scenario
[15:22:23] matthewd: s/not lock/release/
[15:22:59] ascarter: has joined #ruby
[15:23:15] catphish: dminuoso: i don't think it would matter, because rb_thread_wakeup_timer_thread_fd returns immediately before running any other code
[15:23:24] jackjackdripper: has joined #ruby
[15:23:34] catphish: even if it was run immediately before a fork, it would still return and decrement first
[15:25:34] catphish: Eric Wong would be the man to ask about this
[15:25:52] digitalnomad: has joined #ruby
[15:26:03] cagomez: has joined #ruby
[15:26:19] synthroid: has joined #ruby
[15:26:25] cagomez: has joined #ruby
[15:27:48] synthroid: has joined #ruby
[15:28:13] catphish: well i hope someone sees my bug :)
[15:29:04] uZiel: has joined #ruby
[15:30:12] HoloIRCUser: has joined #ruby
[15:31:15] bronson: has joined #ruby
[15:31:34] wickedbloodfart: has joined #ruby
[15:31:35] brw: has joined #ruby
[15:32:01] synthroid: has joined #ruby
[15:33:33] Jameser: has joined #ruby
[15:35:01] dionysus69: has joined #ruby
[15:38:47] digitalnomad: has joined #ruby
[15:38:54] catphish: dminuoso: thanks for all the help, time to go now, but i'll keep an eye on my bug report, and try to test my proposed fix, i'm sure someone will come up with a better fix
[15:41:05] __Yiota: has joined #ruby
[15:43:18] brent__: has joined #ruby
[15:43:38] brent__: has joined #ruby
[15:43:47] rikmen: has joined #ruby
[15:43:52] rikmen: has left #ruby: ()
[15:45:29] ahrs: has joined #ruby
[15:45:56] brent__: has joined #ruby
[15:46:18] mim1k: has joined #ruby
[15:49:02] TomyLobo: has joined #ruby
[15:50:00] dminuoso: matthewd: Mmm at what point though?
[15:50:36] Jameser: has joined #ruby
[15:52:09] matthewd: At all, I guess. My point was just that the lock will be held at the time the function is invoked, and it'd have to go out of its way to release it.
[15:52:40] dminuoso: matthewd: Well if the gvl was released after the forked process was prepared it wouldn't have an impact
[15:53:03] dminuoso: Oh well. I guess the critical point is when the actual process is syscall forked
[15:54:46] [Butch]: has joined #ruby
[15:56:09] alnewkirk: has joined #ruby
[15:56:48] DoubleMalt: has joined #ruby
[15:57:08] Ishido: has joined #ruby
[15:57:16] npgm: has joined #ruby
[15:57:18] BSAlb: has joined #ruby
[15:57:26] jackjackdripper: has joined #ruby
[15:58:17] mim1k: has joined #ruby
[15:59:38] cdg: has joined #ruby
[15:59:49] PaulCape_: has joined #ruby
[16:01:26] cdg_: has joined #ruby
[16:02:37] __Yiota: has joined #ruby
[16:04:45] jphase: has joined #ruby
[16:05:13] Rodya_: has joined #ruby
[16:05:56] gusrub: has joined #ruby
[16:09:10] __Yiota: has joined #ruby
[16:24:41] Sylario: has joined #ruby
[16:25:45] t-recx: has joined #ruby
[16:27:07] beilabs: has joined #ruby
[16:27:34] canton7: has joined #ruby
[16:30:12] ascarter: has joined #ruby
[16:32:07] bronson: has joined #ruby
[16:34:46] BSab: has joined #ruby
[16:36:14] BSab: has joined #ruby
[16:36:59] S1kx: has joined #ruby
[16:37:33] BSab: has joined #ruby
[16:38:08] dionysus69: has joined #ruby
[16:38:58] BSab: has joined #ruby
[16:39:56] rubylearner121: has joined #ruby
[16:40:19] BSab: has joined #ruby
[16:43:55] eldebrim1: has joined #ruby
[16:50:15] goyox86: has joined #ruby
[16:50:35] yehowyada: has joined #ruby
[16:54:23] rgtk: has joined #ruby
[16:55:20] HoloIRCUser2: has joined #ruby
[16:55:24] alfie_: has joined #ruby
[16:58:51] __Yiota: has joined #ruby
[16:59:00] conta: has joined #ruby
[16:59:08] tAn: has joined #ruby
[17:03:48] hahuang65: has joined #ruby
[17:04:46] alfiemax: hey everyone... :)
[17:05:03] alfiemax: i'm facing an issue where nokogiri isn't able to get all the a tags
[17:05:16] alfiemax: this is what is tried :
[17:05:17] alfiemax: doc = Nokogiri::HTML(open('http://www.cluelessapp.com')) ; links = doc.css('a')
[17:05:50] alfiemax: it returns 6 links, but i'm sure there are more, since the obvious facebook/twitter links are not returned
[17:06:02] Rodya_: has joined #ruby
[17:06:15] eckhardt: has joined #ruby
[17:06:24] Papierkorb: alfiemax: more links (and what not) may actually be loaded later through javascript on the page
[17:07:01] alfiemax: but i do see it in the source of the page, so i doubt it's added via JS
[17:09:31] Papierkorb: Oh my god, that's super broken HTML
[17:09:38] Papierkorb: > <style=text-align: center><label> Your Name<br />
[17:09:38] cagomez: has joined #ruby
[17:09:48] Papierkorb: No, I didn't forget to copy the quotes. There are none.
[17:13:27] alfiemax: yea, you are right
[17:13:28] cagomez: has joined #ruby
[17:13:33] alfiemax: so how did yo find it ?
[17:13:52] Papierkorb: Looking at the source
[17:14:22] Papierkorb: Or rather, being confused that my editor suddenly stopped doing proper highlighting of the document
[17:15:29] jack298: has joined #ruby
[17:16:22] jack298: Hi! I'm trying to do some authentication with the Sinatra::Warden module, but I'm always getting NoMethod error for authenticated?. Here is my app.rb file: https://gist.github.com/anonymous/8c79d5d0bc123304845ba3004d9e7290 . Can somebody help me?
[17:17:39] rippa: has joined #ruby
[17:17:47] uZiel: has joined #ruby
[17:18:40] dviola: has joined #ruby
[17:22:28] goyox86: has joined #ruby
[17:26:07] mooser: has joined #ruby
[17:26:34] jphase: has joined #ruby
[17:26:53] alfiemax: @Papierkorb thanks :)
[17:27:11] kies: has joined #ruby
[17:31:46] ascarter: has joined #ruby
[17:31:46] agent_white: has joined #ruby
[17:32:50] bronson: has joined #ruby
[17:34:11] Polysics_: has joined #ruby
[17:34:21] mikecmpbll: has joined #ruby
[17:36:17] DoubleMalt: has joined #ruby
[17:37:31] beilabs: has joined #ruby
[17:37:33] ascarter: has joined #ruby
[17:39:04] Polysics: has joined #ruby
[17:39:11] sneakerhax: has joined #ruby
[17:45:48] ur5us: has joined #ruby
[17:53:42] Polysics: has joined #ruby
[17:54:54] ascarter: has joined #ruby
[17:56:37] TimAndLyle: has joined #ruby
[17:56:48] TimAndLyle: has left #ruby: ()
[17:56:52] kies: has joined #ruby
[17:59:04] Ryzokuken: has joined #ruby
[17:59:43] Frem: has joined #ruby
[18:00:24] Guest24408: has joined #ruby
[18:02:27] cdg: has joined #ruby
[18:06:31] preyalone: has joined #ruby
[18:07:09] mooser: has joined #ruby
[18:07:48] HelloCode: has joined #ruby
[18:09:54] Rodya_: has joined #ruby
[18:11:13] sumobob: has joined #ruby
[18:15:07] ramfjord: has joined #ruby
[18:16:35] bronson: has joined #ruby
[18:16:48] uZiel: has joined #ruby
[18:17:13] anisha: has joined #ruby
[18:19:46] synthroid: has joined #ruby
[18:20:02] dcluna: has joined #ruby
[18:20:46] zmo: is there a ruby function like python's all() that will return true if all values of the list are true ?
[18:21:38] SeepingN: has joined #ruby
[18:22:33] ramfjord: has joined #ruby
[18:22:55] zmo: or, if not, to avoid the typical X-Y problem question: how, given an array of hashes that have a key => `[{'name':.., ...}, {'name':..,..}...]` how can I check in a one liner that a given name exists?
[18:25:10] zmo: still having a hard time to check the `?`
[18:28:25] rippa: has joined #ruby
[18:30:10] agent_white: has joined #ruby
[18:30:34] chouhoul_: has joined #ruby
[18:31:09] ramfjord: has joined #ruby
[18:31:29] lxsameer: has joined #ruby
[18:31:34] nadir: has joined #ruby
[18:31:47] chouhoul_: has joined #ruby
[18:32:00] __Yiota: has joined #ruby
[18:32:25] Polysics: has joined #ruby
[18:32:56] ldnunes: has joined #ruby
[18:35:33] conta: has joined #ruby
[18:39:25] cjk101010: has joined #ruby
[18:40:42] Rodya_: has joined #ruby
[18:40:47] jackjackdripper: has joined #ruby
[18:40:55] eightlimbed: has joined #ruby
[18:40:56] vuoto: has joined #ruby
[18:44:29] alfie_: has joined #ruby
[18:45:35] alfiemax: has joined #ruby
[18:46:03] alfiemax: a followup of the previous issue... using nokogiri
[18:47:12] AxelAlex: has joined #ruby
[18:47:25] alfiemax: doc = Nokogiri::XML(open('http://www.cluelessapp.com')) ; links = doc.css('a')
[18:47:49] alfiemax: this ignores the html issues it has and returns all the links on the page
[18:48:39] alfiemax: as compared to Nokogiri::HTML which doesn't because it's an invalid html, so how's HTML & XML parsing different?
[18:50:50] postmodern: has joined #ruby
[18:51:14] jenrzzz: has joined #ruby
[18:51:36] ldnunes: has joined #ruby
[18:56:48] conta: has joined #ruby
[18:57:30] uZiel: has joined #ruby
[18:57:51] Immune: has joined #ruby
[18:59:58] ascarter: has joined #ruby
[19:00:18] Rapture: has joined #ruby
[19:01:56] marr: has joined #ruby
[19:02:09] runescape07rsps: has joined #ruby
[19:02:36] uZiel: has joined #ruby
[19:04:50] hahuang65: has joined #ruby
[19:05:10] cjk101010: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[19:05:39] chouhoulis: has joined #ruby
[19:07:53] alfiemax: no one?? :(
[19:07:59] high_fiver: has joined #ruby
[19:09:27] micah: has joined #ruby
[19:10:09] micah: if I say: unless scope[v].nil? and scope[v].false? -- does that mean "do the following, unless scope[v] is not nil, and scope[v] is not false?
[19:11:35] chouhoulis: has joined #ruby
[19:12:02] MarkBilk: has joined #ruby
[19:12:19] havenwood: micah: Ruby doesn't have a #false? out of the box. You'd have to add one.
[19:12:44] havenwood: micah: You can do just `if scope[v]` and `unless scope[v]`.
[19:13:07] havenwood: micah: Only `false` and `nil` are falsey. Everything else is truthy.
[19:13:52] micah: havenwood: you mean put both 'if scope[v]' along with 'unless scope[v]' or are you saying I can use either one
[19:14:13] havenwood: micah: Either one, they're inverse of each other.
[19:14:43] havenwood: alfiemax: Maybe give it a try with Oga.
[19:14:55] micah: havenwood: well, if the value of scope[v] is false, I dont want to do the following thing
[19:15:21] havenwood: alfiemax: We could help you debug it better if you can give a working example. I see 10 elements with the code you gave. How many are expected? Which are missing?
[19:15:45] havenwood: micah: do_things if scope[v]
[19:16:04] alfiemax: doc = Nokogiri::HTML(open('http://www.cluelessapp.com')) ; links = doc.css('a')
[19:16:08] alfiemax: this gives 6
[19:16:18] alfiemax: doc = Nokogiri::XML(open('http://www.cluelessapp.com')) ; links = doc.css('a')
[19:16:21] alfiemax: this gives 10
[19:16:26] nacsurte: has joined #ruby
[19:16:39] alfiemax: missing one's are the social links, facebook, twitter, etc
[19:17:14] havenwood: alfiemax: Are the missing ones <a href=> tags?
[19:17:26] burgestrand: has joined #ruby
[19:17:27] havenwood: That's why they're missing.
[19:17:32] micah: havenwood: so if scope[v] is not defined, it wont fail?
[19:17:50] alfiemax: tags are not missing, the problem is that :
[19:18:03] havenwood: micah: it would be nil if undefined, which would be a no-op
[19:18:12] alfiemax: on line 281, 292 there are html violations
[19:18:18] havenwood: micah: if nil
[19:18:27] micah: i'm confused now
[19:20:45] micah: has left #ruby: ()
[19:20:57] ldnunes: has joined #ruby
[19:21:32] alfiemax: but why the diff between XML vs HTML parsing?
[19:21:42] alfiemax: what does XML parsing skip?
[19:22:58] planigan: has joined #ruby
[19:24:25] havenwood: >> 42 if nil # micah
[19:24:26] ruby[bot]: havenwood: # => nil (https://eval.in/843618)
[19:24:53] eckhardt: has joined #ruby
[19:24:53] havenwood: afisher: XML is stricter.
[19:24:59] havenwood: alfiemax: ^
[19:25:04] havenwood: afisher: sorry for the ping, misstell
[19:25:23] eelster: has joined #ruby
[19:25:53] alfiemax: seems like the other way round, since using XML it ignored those HTML violations
[19:27:22] afisher: havenwood: no worries
[19:31:50] swills: has joined #ruby
[19:31:50] swills: has joined #ruby
[19:33:07] jpterry: has joined #ruby
[19:33:07] guacamole: has joined #ruby
[19:33:35] mnemon: alfiemax: html parser doesn't like newlines inside the tags? :)
[19:37:59] cagomez: has joined #ruby
[19:38:33] jordanm: has joined #ruby
[19:41:07] nacsurte: has joined #ruby
[19:43:49] theRoUS`: has left #ruby: ("Off to another part of the maze of twisty little passages")
[19:45:55] eelster: has joined #ruby
[19:48:10] mim1k: has joined #ruby
[19:50:20] mostlybadfly: has joined #ruby
[19:50:25] burgestrand: has joined #ruby
[19:50:59] wilbert: has joined #ruby
[19:52:23] jphase: has joined #ruby
[19:52:48] jenrzzz: has joined #ruby
[19:52:48] jenrzzz: has joined #ruby
[19:54:48] digitalnomad: has joined #ruby
[19:55:56] alfiemax: has joined #ruby
[19:59:02] dennisvennink: has joined #ruby
[19:59:59] eelster: has joined #ruby
[20:01:35] FastJack: has joined #ruby
[20:02:27] NeverTired: has joined #ruby
[20:03:51] tomphp: has joined #ruby
[20:04:16] ramfjord: has joined #ruby
[20:05:27] ascarter: has joined #ruby
[20:06:17] Dimik: has joined #ruby
[20:06:42] FastJack: has joined #ruby
[20:06:47] vondruch: has joined #ruby
[20:10:07] jenrzzz: has joined #ruby
[20:10:07] jenrzzz: has joined #ruby
[20:11:21] vondruch: has joined #ruby
[20:12:26] tomphp: has joined #ruby
[20:12:33] law: has joined #ruby
[20:12:52] law: hey all, is there a way to tell rest-client to ONLY use ipv4? I'm dealing with a broken IPv6 config, and rest-client is preferring v6 addresses
[20:13:28] Rodya_: has joined #ruby
[20:15:22] konsolebox: what does Ruby use to produce its API documentation?
[20:16:02] tirej: has joined #ruby
[20:16:33] tirej: has joined #ruby
[20:16:52] tirej: has joined #ruby
[20:16:53] tirej: has joined #ruby
[20:17:05] konsolebox: anyone can tell how to produce the html files with the extracted ruby source?
[20:17:14] tomphp: has joined #ruby
[20:21:28] ramfjord: has joined #ruby
[20:22:46] sumobob: has joined #ruby
[20:24:56] clemens3: konsolebox: you mean docs for ruby itself, or for your own code? personally i downloaded the ruby docs from the web locally, but rvm can create the docs, just dunno where to find it then..: https://rvm.io/rubies/docs
[20:26:21] konsolebox: clemens3: i already knew how to produce them. rdoc --op rdoc. i do use a local copy instead if i need a reference, but this is for knowing how ruby does it, because i'll also create a documentation for my own code.
[20:26:46] clemens3: konsolebox: seems rvm docs open is worth a try after docs creation... personally coming from java with javadoc, i am underwheelmed with ruby doc, thought they have some..
[20:27:05] clemens3: konsolebox: wait a second then
[20:28:44] armando: has joined #ruby
[20:28:48] clemens3: konsolebox: for example: cd myproject; rdoc --output nonexistentdocdir bin/myprog.rb lib/mylib.rb; open nonexistentdocdir/index.html
[20:29:46] konsolebox: clemens3: oh, that part is a bit obvious already ,but thanks
[20:30:14] konsolebox: clemens3: now i'm done generating the files, but i kind of don't like the html's theme
[20:31:49] konsolebox: gotta try 0.36.0
[20:32:33] clemens3: konsolebox: oki, but don't know how to use your own templates..
[20:32:48] reber: has joined #ruby
[20:33:21] jphase: has joined #ruby
[20:35:37] hahuang65: has joined #ruby
[20:36:25] Mrgoose2: How can I use a protobuf binary in ruby?
[20:37:00] eckhardt: has joined #ruby
[20:38:06] ramfjord: has joined #ruby
[20:38:11] MarkBilk_: has joined #ruby
[20:39:30] jokke: has joined #ruby
[20:40:45] tao_: has joined #ruby
[20:41:04] mjuszczak: has joined #ruby
[20:44:43] zenspider: has joined #ruby
[20:45:20] swills: has joined #ruby
[20:46:37] zenspider: clemens3: what part(s) of the doco do you object to?
[20:49:01] _sfiguser: has joined #ruby
[20:52:10] eightlimbed: has joined #ruby
[20:59:39] ur5us: has joined #ruby
[21:02:13] __Yiota: has joined #ruby
[21:05:38] saintcajetan: has joined #ruby
[21:06:20] dennisvennink: has joined #ruby
[21:07:23] nopoliti1: has joined #ruby
[21:08:16] KeyJoo: has joined #ruby
[21:10:53] law: hey all, I'm trying to re-index a hash given to me from an API, and I'm having a heck of a time getting my iterator right
[21:10:59] law: basically, this - https://paste.fedoraproject.org/paste/H1deIqmxKzvhfxn5I22U2Q
[21:12:06] adaedra: what do you have so far?
[21:12:15] ascarter: has joined #ruby
[21:14:06] law: https://paste.fedoraproject.org/paste/1Qt~x7~~ceuD-~jj3qJdVg
[21:14:13] law: that. it gives me a newhash.length of 0
[21:15:13] adaedra: Hash#merge returns a new hash, it does not modify the current one
[21:16:06] adaedra: For changing just one key, just do `hash[key] = value`
[21:16:29] law: example?
[21:17:15] law: oh wait, here we go. Hash.merge! does what i want
[21:17:24] law: thanks for the tip, I forgot that Hash.merge was non-destructive
[21:17:57] law: is there a way to iterate over this so the structure of the source hash can be arbitrary?
[21:18:28] adaedra: you just want to have the value in `unique_string_id` as key?
[21:18:33] law: correct
[21:18:39] adaedra: Just use `group_by`
[21:19:02] adaedra: Coupled with `delete` if you don't want the key in sub-hashes
[21:19:10] law: is that part of Hash, or something else?
[21:19:26] adaedra: I think it's from Enumerable
[21:19:32] adaedra: &ri Hash#group_by
[21:19:32] `derpy: http://ruby-doc.org/core-2.4.1/Enumerable.html#method-i-group_by
[21:19:42] zenspider: law: Enumerable... read the doco for that whole module and you'll be happier
[21:19:53] law: hell yes. thank you!
[21:20:22] cpruitt: has joined #ruby
[21:20:43] Rodya_: has joined #ruby
[21:21:26] konsolebox: second law: keep a local copy of the documentation, and bookmark the important classes/modules in a folder in bookmarks toolbar
[21:21:31] SP|Scream: has joined #ruby
[21:22:26] ecuanaso: has joined #ruby
[21:22:52] adaedra: Or just use ri
[21:23:12] digitalnomad: has joined #ruby
[21:23:17] adaedra: Why make a copy of the documentation you already have?
[21:24:44] law: hrm. how do I want to structure this iterator? I must admit, I'm pretty light on this stuff
[21:27:07] cpruitt: has joined #ruby
[21:29:05] alfiemax: has joined #ruby
[21:31:21] GodFather: has joined #ruby
[21:32:37] rgr: has joined #ruby
[21:33:41] hahuang65: has joined #ruby
[21:36:47] havenwood: law: array.map { |hash| key = hash[:unique_string_id]; value = hash.reject { |k, _| k == :unique_string_id }; [key, value] }.to_h
[21:36:55] havenwood: law: array.each_with_object({}) { |hash, result| result[hash[:unique_string_id]] = hash.reject { |k, _| k == :unique_string_id } }
[21:37:07] GodFather: has joined #ruby
[21:37:08] havenwood: law: ^ those are two ways, there are plenty more
[21:38:04] konsolebox: adaedra: what do you mean "why make a copy"?
[21:38:30] careta: has joined #ruby
[21:38:55] adaedra: You were the one speaking of making a copy.
[21:39:15] konsolebox: adaedra: please be explicit about what i was speaking of
[21:39:35] adaedra: > konsolebox second law: keep a local copy of the documentation, and bookmark the important classes/modules in a folder in bookmarks toolbar
[21:39:56] konsolebox: adaedra: it depends on the system. i don't have it by default.
[21:40:11] GodFather: has joined #ruby
[21:40:33] konsolebox: `$ ri Class` -> Nothing known about Class
[21:41:08] brent__: has joined #ruby
[21:41:44] havenwood: law: don't name your variables `array` and `hash` for real - be more descriptive of what's in the collections
[21:42:58] zenspider: konsolebox: rvm? there's a command to generate the ri info. I wish they didn't turn it off by default
[21:43:28] _sfiguser: has joined #ruby
[21:43:48] konsolebox: nah. i just enabled the "doc" flag and it's already generating. but i doubt the html template would be same as the one i liked.
[21:44:26] zenspider: konsolebox: ri doesn't have an html template... which is why it is nice. :)
[21:44:40] zenspider: but if you have one you like, you can fire off rdoc w/ a flag to point at it
[21:46:48] law: havenwood: but of course, I'm just genericizing them
[21:46:49] anisha: has joined #ruby
[21:46:56] konsolebox: zenspider: i'm talking with respect to why a local copy of rdoc would be necessary. not really about ri.
[21:47:09] konsolebox: zenspider: do you have the html files of the rdoc as well?
[21:47:43] zenspider: konsolebox: probably not? I strictly use ri
[21:47:52] zenspider: (but maybe?)
[21:47:59] konsolebox: adaedra: well there's the difference ^
[21:48:22] adaedra: What? To have HTML docs?
[21:48:45] zenspider: apparently not.... just html generated for my core gems (because I want ri generated for them)
[21:48:45] mim1k: has joined #ruby
[21:48:46] konsolebox: yes. it's what i suggested. you asked "why a copy is necessary".
[21:49:09] adaedra: It's... still docs
[21:49:26] konsolebox: and it's much better imo.
[21:49:35] konsolebox: ri is good for immediate reference, but not for browsing.
[21:49:44] jenrzzz_: has joined #ruby
[21:49:54] konsolebox: try using it some time.
[21:50:32] adaedra: Wow, you seem to know my usage of docs way better than I do
[21:51:30] GodFather: has joined #ruby
[21:51:36] konsolebox: well you seem to not, to be honest
[21:51:41] zenspider: konsolebox & adaedra : one notch down on the snark
[21:54:16] cdg: has joined #ruby
[21:56:29] jack298: has joined #ruby
[21:57:09] workmad3: has joined #ruby
[21:59:38] jphase: has joined #ruby
[22:00:30] catphish: has joined #ruby
[22:01:02] guacamole: has joined #ruby
[22:12:56] GodFather: has joined #ruby
[22:17:51] ascarter: has joined #ruby
[22:18:06] segy_: has joined #ruby
[22:18:20] alfiemax: has joined #ruby
[22:30:18] digitalnomad: has joined #ruby
[22:31:40] chouhoul_: has joined #ruby
[22:34:45] jenrzzz: has joined #ruby
[22:35:38] law: what am I missing when trying to pass a hash to a function here? https://paste.fedoraproject.org/paste/rOjvWUy0O4zYlvUnyb7xVQ
[22:37:26] law: nvm, sorted it. hashes need to be treated like hashes, not arrays. derp.
[22:47:12] segy_: has joined #ruby
[22:53:24] jphase: has joined #ruby
[22:57:45] TomyLobo: has joined #ruby
[22:59:22] jack298: has joined #ruby
[23:01:33] cschneid_: has joined #ruby
[23:03:38] jphase: has joined #ruby
[23:04:45] Moosashi: has joined #ruby
[23:05:03] graft: has joined #ruby
[23:19:46] BSaboia: has joined #ruby
[23:20:07] code_zombie: has joined #ruby
[23:23:00] ecuanaso: has joined #ruby
[23:24:04] ascarter: has joined #ruby
[23:25:27] RahulT: has joined #ruby
[23:35:38] conta1: has joined #ruby
[23:35:41] Moosashi: has joined #ruby
[23:38:10] jenrzzz: has joined #ruby
[23:38:10] jenrzzz: has joined #ruby
[23:42:09] cdg_: has joined #ruby
[23:42:13] konsolebox: documentation has always been more difficult than writing code.
[23:42:43] SeepingN: and "business logic"
[23:43:06] SeepingN: "I'll get the hard coding part done while you guys iron out the business logic"
[23:46:29] jack298: has joined #ruby
[23:49:15] mim1k: has joined #ruby
[23:54:44] jenrzzz: has joined #ruby
[23:54:44] jenrzzz: has joined #ruby
[23:58:51] ecuanaso: has joined #ruby
[23:59:26] pb122: has joined #ruby
[23:59:48] digitalnomad: has joined #ruby