Skip to content

Instantly share code, notes, and snippets.

Avatar

Benjamin Klotz tak1n

View GitHub Profile
View POD log
[INFO] Remove old/stale PID (Hack, for better solution see: http://stackoverflow.com/a/38732187)
rm: cannot remove '/home/xxx/bms/tmp/pids/server.pid': No such file or directory
[INFO] Start Rails Puma server!
[9] Puma starting in cluster mode...
[9] * Version 4.3.5 (ruby 2.7.1-p83), codename: Mysterious Traveller
[9] * Min threads: 5, max threads: 5
[9] * Environment: production
[9] * Process workers: 5
[9] * Preloading application
I, [2020-07-28T20:44:27.944136 #9] INFO -- sentry: ** [Raven] Raven 2.13.0 ready to catch errors
View kong logs
I0728 20:44:21.668918 1 controller.go:275] Event UPDATE received - object &Endpoints{ObjectMeta:{bms-link-shortener bms /api/v1/namespaces/bms/endpoints/bms-link-shortener 06ca7d2a-00d4-11ea-9ac8-b42e99453505 108704077 0 2019-11-06 20:28:43 +0000 UTC <nil> <nil> map[] map[endpoints.kubernetes.io/last-change-trigger-time:2020-07-28T20:44:21Z] [] [] []},Subsets:[]EndpointSubset{EndpointSubset{Addresses:[]EndpointAddress{EndpointAddress{IP:10.42.0.203,TargetRef:&ObjectReference{Kind:Pod,Namespace:bms,Name:bms-api-7c76764ff5-dmd2m,UID:71a33143-6786-43be-854b-01eb62736230,APIVersion:,ResourceVersion:108704076,FieldPath:,},Hostname:,NodeName:*production1,},EndpointAddress{IP:10.42.0.216,TargetRef:&ObjectReference{Kind:Pod,Namespace:bms,Name:bms-api-86bd9c98d6-fvbds,UID:54423554-a2db-48c5-a1f3-d8bc485abce2,APIVersion:,ResourceVersion:106609306,FieldPath:,},Hostname:,NodeName:*production1,},EndpointAddress{IP:10.42.112.45,TargetRef:&ObjectReference{Kind:Pod,Namespace:bms,Name:bms-api-86bd9c98d6-bfpc2,UID:89d6
View kong logs
KONG 1
-------------------------------------------------------------------------------
Kong Ingress controller
Release: 0.9.0
Build: 0aad24a
Repository: git@github.com:kong/kubernetes-ingress-controller.git
Go: go1.14.1
-------------------------------------------------------------------------------
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.