Skip to content

Instantly share code, notes, and snippets.

Benjamin Klotz tak1n

Block or report user

Report or block tak1n

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:392a603029a8665b5ca5ff840946bbb6
rb(main):014:0> HTTParty.get(cs.fetch_criterion, logger: Logger.new(STDOUT), log_format: :curl)
I, [2017-02-17T09:19:53.322361 #11185] INFO -- : [HTTParty] [2017-02-17 09:19:53 +0100] > GET http://krugman.blogs.nytimes.com/feed
[HTTParty] [2017-02-17 09:19:53 +0100] >
[HTTParty] [2017-02-17 09:19:53 +0100] < HTTP/1.1 301
[HTTParty] [2017-02-17 09:19:53 +0100] < Server: Varnish
[HTTParty] [2017-02-17 09:19:53 +0100] < Retry-after: 0
[HTTParty] [2017-02-17 09:19:53 +0100] < Content-length: 0
[HTTParty] [2017-02-17 09:19:53 +0100] < Location: https://krugman.blogs.nytimes.com/feed
[HTTParty] [2017-02-17 09:19:53 +0100] < Accept-ranges: bytes
[HTTParty] [2017-02-17 09:19:53 +0100] < Date: Fri, 17 Feb 2017 08:18:33 GMT
View gist:18f2ef0d2b8a33fe85410553c8a785e2
(gdb) info threads
Id Target Id Frame
81 Thread 0x7f3955531700 (LWP 10) "ruby-timer-thr" 0x00007f39546efaed in poll () at ../sysdeps/unix/syscall-template.S:81
80 Thread 0x7f394b2bc700 (LWP 12) "agent_thread.r*" 0x00007f39546f1893 in select () at ../sysdeps/unix/syscall-template.S:81
79 Thread 0x7f394b0ba700 (LWP 17) "util.rb:24" pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
78 Thread 0x7f394a078700 (LWP 18) "util.rb:24" pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
77 Thread 0x7f3949e76700 (LWP 19) "monitor.rb:11" pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
76 Thread 0x7f38f3281700 (LWP 152) "ruby_thread_po*" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
75 Thread 0x7f38f3382700 (LWP 158) "ruby_thread_po*" pthread_cond_wait@
@tak1n
tak1n / TTIN log output
Created Nov 9, 2016
Stuck sidekiq workers debugging
View TTIN log output
W, [2016-11-09T10:44:06.021893 #9] WARN -- : Thread TID-osip1khvg
W, [2016-11-09T10:44:06.022035 #9] WARN -- : /usr/local/lib/ruby/2.3.0/openssl/buffering.rb:125:in `sysread'
/usr/local/lib/ruby/2.3.0/openssl/buffering.rb:125:in `readpartial'
/home/onlim/tell_it/vendor/bundle/ruby/2.3.1/gems/http-2.0.2/lib/http/timeout/null.rb:44:in `readpartial'
/home/onlim/tell_it/vendor/bundle/ruby/2.3.1/gems/http-2.0.2/lib/http/connection.rb:212:in `read_more'
/home/onlim/tell_it/vendor/bundle/ruby/2.3.1/gems/http-2.0.2/lib/http/connection.rb:87:in `readpartial'
/home/onlim/tell_it/vendor/bundle/ruby/2.3.1/gems/http-2.0.2/lib/http/response/body.rb:50:in `to_s'
/usr/local/lib/ruby/2.3.0/forwardable.rb:189:in `empty?'
/home/onlim/tell_it/vendor/bundle/ruby/2.3.1/bundler/gems/twitter-60eb2569fcaf/lib/twitter/rest/request.rb:37:in `perform'
/home/onlim/tell_it/vendor/bundle/ruby/2.3.1/bundler/gems/twitter-60eb2569fcaf/lib/twitter/rest/utils.rb:50:in `perform_request'
View gist:af2af6f8b9a3d808c1366311bb7cb000
Not all of them are blogs (some are weekly newsletters)
http://rubyweekly.com/
https://rubythursday.com/
http://rubyfacets.com/
http://blog.appsignal.com/
https://www.toptal.com/developers/blog/tags/ruby
http://www.nateberkopec.com/ (blogs about ruby and other stuff)
http://solnic.eu/ (author of ROM, dry-rb gems etc)
https://twin.github.io/
View shell
benny@benny-Lenovo-Y50-70:~$ cd dev/ [21/21]
benny@benny-Lenovo-Y50-70:~/dev$ chruby 2.3.1
benny@benny-Lenovo-Y50-70:~/dev$ gs
fatal: Not a git repository (or any of the parent directories): .git
benny@benny-Lenovo-Y50-70:~/dev$ gh .
benny@benny-Lenovo-Y50-70:~/dev$ gem install dry-validation
Fetching: concurrent-ruby-1.0.2.gem (100%)
Successfully installed concurrent-ruby-1.0.2
Fetching: dry-configurable-0.1.7.gem (100%)
Successfully installed dry-configurable-0.1.7
View Gemfile.lock
GIT
remote: git://github.com/intridea/oauth2.git
revision: 7691a2c851a14f08c6f33356a0041d015963de01
specs:
oauth2 (1.1.0)
faraday (>= 0.8, < 0.10)
jwt (~> 1.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
@tak1n
tak1n / story.md
Last active Jul 28, 2016
99 Problems but Pokemon Go ain't one (Rails request spec dependent failures, wrong SQL generated)
View story.md

The Problem

We currently face a problem when a request spec fails (typo or other exception) it affects other request specs which actually should be unaffected. The problem is we use many gems so I tried to create a minimal reproduction app (without success, https://github.com/tak1n/reproduction)

The problem in detail:

We have a request spec where we need to login a user. For user authentication we use devise and therefore we use Warden::Test::Helpers to log in users in request specs. Devise automatically updates some user related attributes when a user logs in (last_sign_in_at, last_sign_in_ip etc..).

The problem here is that when it tries to save the user for doing this changes the end result is a INSERT INTO user instead of a UPDATE user and therefore it crashes.

View spec run not affected
benny@benny-Lenovo-Y50-70:~/dev/onlim/app$ be rspec spec/requests/suggestions_spec.rb
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Randomized with seed 29762
New record: true
New record: true
New record: true
New record: true
View spec run affected
benny@benny-Lenovo-Y50-70:~/dev/onlim/app$ be rspec spec/requests/suggestions_spec.rb
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Randomized with seed 15086
New record: true
New record: true
New record: true
New record: true
View spec run
benny@benny-Lenovo-Y50-70:~/dev/onlim/app$ be rspec spec/requests/suggestions_spec.rb
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Randomized with seed 61258
FF
Failures:
You can’t perform that action at this time.