Skip to content

Instantly share code, notes, and snippets.

(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 November 9, 2016 09:53
Stuck sidekiq workers debugging
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'
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/
@tak1n
tak1n / shell
Created September 21, 2016 11:43
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
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 July 28, 2016 11:43
99 Problems but Pokemon Go ain't one (Rails request spec dependent failures, wrong SQL generated)

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.

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
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
@tak1n
tak1n / spec run
Created July 28, 2016 11:14
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:
@tak1n
tak1n / orf_test.rb
Last active June 14, 2016 16:20
orf feed
require 'httparty'
100.times do
response = HTTParty.get('http://rss.orf.at/news.xml')
puts 'empty response' if response.body.empty?
end