Skip to content

Instantly share code, notes, and snippets.

Avatar
🤗

Naotoshi Seo sonots

🤗
View GitHub Profile
View sigdump_on_httpclient
Sigdump at 2014-02-03 17:07:09 +0900 process 23569 (/usr/lib64/fluent/ruby/bin/fluentd)
Thread #<Thread:0x00000000990fe8> status=run priority=0
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:38:in `dump_backtrace'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:24:in `block in dump_all_thread_backtrace'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:23:in `each'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:23:in `dump_all_thread_backtrace'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:16:in `block in dump'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:107:in `open'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:107:in `_open_dump_path'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:14:in `dump'
View sigdump2
Sigdump at 2014-02-04 12:10:51 +0900 process 30784 (/usr/lib64/fluent/ruby/bin/fluentd)
Thread #<Thread:0x00000001eeb000> status=run priority=0
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:38:in `dump_backtrace'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:24:in `block in dump_all_thread_backtrace'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:23:in `each'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:23:in `dump_all_thread_backtrace'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:16:in `block in dump'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:107:in `open'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:107:in `_open_dump_path'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:14:in `dump'
@sonots
sonots / sigdump3
Created Feb 5, 2014
shutdown is stuck by out_forward. But, again, the line is calling pack_sockaddr_in. `@usock.send "\0", 0, Socket.pack_sockaddr_in(n.port, n.resolved_host)`
View sigdump3
Sigdump at 2014-02-06 02:40:58 +0900 process 47527 (/usr/lib64/fluent/ruby/bin/fluentd)
Thread #<Thread:0x00000000ff7ff8> status=run priority=0
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:38:in `dump_backtrace'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:24:in `block in dump_all_thread_backtrace'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:23:in `each'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:23:in `dump_all_thread_backtrace'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:16:in `block in dump'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:107:in `open'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:107:in `_open_dump_path'
/usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/sigdump-0.2.2/lib/sigdump.rb:14:in `dump'
View fluent-top.sh
#!/bin/sh
# PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
PORT=$1
source /etc/bashrc
export TERM=vt100
file="/tmp/fluent-top.$(date '+%Y%m%d')"
date=$(date '+%Y%m%d %H:%M:%S')
pid=$(ps -ef | grep ruby | grep fluentd | grep 28000 | awk '$4 != 0' | awk '{print $2}')
# MEMO: top -c's COMMAND is shortened with nohup or cron, so I greped for ps -ef.
top=$(echo -n $(top -b -n 1 -c -d 0 | awk "\$1 == $pid"))
@sonots
sonots / fluent-lsof.sh
Last active Aug 29, 2015
sudo fluent-lsof.sh
View fluent-lsof.sh
#!/bin/sh
PORT=$1
source /etc/bashrc
file="/tmp/fluent-lsof.$(date '+%Y%m%d')"
date=$(date '+%Y%m%d %H:%M:%S')
system_file_num=$(/usr/sbin/lsof | wc -l)
system_socket_num=$(/usr/sbin/lsof | /bin/egrep 'TCP|UDP' | wc -l)
process_socket__num=$(/usr/sbin/lsof -i:$PORT | wc -l)
close_wait_num=$(/usr/sbin/lsof -i:$PORT | grep CLOSE_WAIT | wc -l)
echo "$date $system_file_num $system_socket_num $process_socket_num $close_wait_num" >> $file
View gist:8910571
# ruby のビルドはおわっているものとする
git clone git@github.com:fluent/fluentd.git
git checkout -b v11 origin/v11
bundle # ないとダメ><
bin/fluentd -h
# see http://magazine.rubyist.net/?0044-FluentdV11NewFeatures
bin/fluentd -c fluentd.conf --gemfile MyGemfile
@sonots
sonots / gist:8921291
Last active Aug 29, 2015
net/http error
View gist:8921291
2014-02-11 03:13:02 +0900 [warn]: out_yohoushi: IOError closed stream development/fluentd/flowcounter/watcher/count_max
/usr/lib/fluent/ruby/lib/ruby/1.9.1/net/protocol.rb:143:in `select'
/usr/lib/fluent/ruby/lib/ruby/1.9.1/net/protocol.rb:143:in `rescue in rbuf_fill'
/usr/lib/fluent/ruby/lib/ruby/1.9.1/net/protocol.rb:140:in `rbuf_fill'
/usr/lib/fluent/ruby/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
/usr/lib/fluent/ruby/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
/usr/lib/fluent/ruby/lib/ruby/1.9.1/net/http.rb:2563:in `read_status_line'
/usr/lib/fluent/ruby/lib/ruby/1.9.1/net/http.rb:2552:in `read_new'
/usr/lib/fluent/ruby/lib/ruby/1.9.1/net/http.rb:1320:in `block in transport_request'
/usr/lib/fluent/ruby/lib/ruby/1.9.1/net/http.rb:1317:in `catch'
View gist:9036094
Installing atomic (1.1.14)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/seo.naotoshi/.rbenv/versions/2.0.0-p247/bin/ruby extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
@sonots
sonots / gist:9047653
Last active Aug 29, 2015
Fluentd process is stuck at `Socket.pack_sockaddr_in` on shutdown.
View gist:9047653

Fluentd does not die sometimes (stuck on shutdown).

I dumped the ruby backtrace using sigdump. The result is attached at gistfile2.txt. Below is a part of it.

  Thread #<Thread:0x00000001df50d8> status=sleep priority=0
      /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.43/lib/fluent/plugin/out_forward.rb:118:in `shutdown'
      /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-keep-forward-0.1.2/lib/fluent/plugin/out_keep_forward.rb:34:in `shutdown'
      /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.43/lib/fluent/plugin/out_copy.rb:56:in `block in shutdown'
View gist:9065060
* Mon Nov 04 2013 Carlos O'Donell <carlos@redhat.com> - 2.12-1.132
- Revert the addition of gettimeofday vDSO function for ppc and ppc64 until
OPD VDSO function call issues are resolved (#1026533).
* Wed Oct 23 2013 Siddhesh Poyarekar <siddhesh@redhat.com> - 2.12-1.131
- Call gethostbyname4_r only for PF_UNSPEC (#1022022).
* Mon Sep 23 2013 Patsy Franklin <pfrankli@redhat.com> - 2.12-1.130
- Fix integer overflows in *valloc and memalign. (#1008310).
You can’t perform that action at this time.