Skip to content

Instantly share code, notes, and snippets.

@mpe
Last active May 3, 2016 04:27
Show Gist options
  • Save mpe/6c7c8e3b6422a93b722604166c9b1fc3 to your computer and use it in GitHub Desktop.
Save mpe/6c7c8e3b6422a93b722604166c9b1fc3 to your computer and use it in GitHub Desktop.
nsq v0.3.7 not saving topics on SIGTERM
$ ./nsqd
[nsqd] 2016/05/03 14:22:09.888393 nsqd v0.3.6 (built w/go1.5.1)
[nsqd] 2016/05/03 14:22:09.888621 ID: 790
[nsqd] 2016/05/03 14:22:09.888782 TOPIC(test-mpe): created
[nsqd] 2016/05/03 14:22:09.888849 NSQ: persisting topic/channel metadata to nsqd.790.dat
[nsqd] 2016/05/03 14:22:09.888954 DISKQUEUE(test-mpe): readOne() opened test-mpe.diskqueue.000000.dat
[nsqd] 2016/05/03 14:22:09.894471 TCP: listening on [::]:4150
[nsqd] 2016/05/03 14:22:09.894541 HTTP: listening on [::]:4151
[nsqd] 2016/05/03 14:22:13.606642 200 GET /stats (10.61.2.158:49674) 163.585µs
<SIGTERM sent here>
[nsqd] 2016/05/03 14:22:23.249783 NSQ: persisting topic/channel metadata to nsqd.790.dat
[nsqd] 2016/05/03 14:22:23.249972 TCP: closing [::]:4150
[nsqd] 2016/05/03 14:22:23.250122 HTTP: closing [::]:4151
[nsqd] 2016/05/03 14:22:23.255097 NSQ: closing topics
[nsqd] 2016/05/03 14:22:23.255119 TOPIC(test-mpe): closing
[nsqd] 2016/05/03 14:22:23.255148 TOPIC(test-mpe): closing ... messagePump
[nsqd] 2016/05/03 14:22:23.255160 DISKQUEUE(test-mpe): closing
[nsqd] 2016/05/03 14:22:23.255168 DISKQUEUE(test-mpe): closing ... ioLoop
[nsqd] 2016/05/03 14:22:23.260954 QUEUESCAN: closing
[nsqd] 2016/05/03 14:22:23.260970 LOOKUP: closing
[nsqd] 2016/05/03 14:22:23.260995 ID: closing
$ ls -1 *.dat
nsqd.790.dat
test-mpe.diskqueue.meta.dat
Topics have been persisted correctly.
$ ./nsqd
[nsqd] 2016/05/03 14:23:21.952780 nsqd v0.3.7 (built w/go1.6)
[nsqd] 2016/05/03 14:23:21.952886 ID: 790
[nsqd] 2016/05/03 14:23:21.953071 TOPIC(test-mpe): created
[nsqd] 2016/05/03 14:23:21.953202 NSQ: persisting topic/channel metadata to nsqd.790.dat
[nsqd] 2016/05/03 14:23:21.958944 TCP: listening on [::]:4150
[nsqd] 2016/05/03 14:23:21.958982 HTTP: listening on [::]:4151
[nsqd] 2016/05/03 14:23:27.964512 200 GET /stats (10.61.2.158:49686) 110.6µs
<SIGTERM sent here>
Terminated
$ ls -1 *.dat
nsqd.790.dat
Topic never hit the disk.
It works correctly if I use SIGINT:
$ ./nsqd
[nsqd] 2016/05/03 14:26:14.689744 nsqd v0.3.7 (built w/go1.6)
[nsqd] 2016/05/03 14:26:14.689866 ID: 790
[nsqd] 2016/05/03 14:26:14.689977 TOPIC(test-mpe): created
[nsqd] 2016/05/03 14:26:14.690124 NSQ: persisting topic/channel metadata to nsqd.790.dat
[nsqd] 2016/05/03 14:26:14.695583 TCP: listening on [::]:4150
[nsqd] 2016/05/03 14:26:14.695708 HTTP: listening on [::]:4151
[nsqd] 2016/05/03 14:26:16.447111 200 GET /stats (10.61.2.158:49710) 124.318µs
[nsqd] 2016/05/03 14:26:21.111269 200 GET /stats (10.61.2.158:49720) 86.06µs
<SIGINT sent here>
[nsqd] 2016/05/03 14:26:24.424098 NSQ: persisting topic/channel metadata to nsqd.790.dat
[nsqd] 2016/05/03 14:26:24.424246 TCP: closing [::]:4150
[nsqd] 2016/05/03 14:26:24.424366 HTTP: closing [::]:4151
[nsqd] 2016/05/03 14:26:24.429387 NSQ: closing topics
[nsqd] 2016/05/03 14:26:24.429412 TOPIC(test-mpe): closing
[nsqd] 2016/05/03 14:26:24.429443 TOPIC(test-mpe): closing ... messagePump
[nsqd] 2016/05/03 14:26:24.429468 TOPIC(test-mpe): flushing 4 memory messages to backend
[nsqd] 2016/05/03 14:26:24.429552 DISKQUEUE(test-mpe): writeOne() opened test-mpe.diskqueue.000000.dat
[nsqd] 2016/05/03 14:26:24.429650 DISKQUEUE(test-mpe): readOne() opened test-mpe.diskqueue.000000.dat
[nsqd] 2016/05/03 14:26:24.429704 DISKQUEUE(test-mpe): closing
[nsqd] 2016/05/03 14:26:24.429709 DISKQUEUE(test-mpe): closing ... ioLoop
[nsqd] 2016/05/03 14:26:24.435242 QUEUESCAN: closing
[nsqd] 2016/05/03 14:26:24.435247 LOOKUP: closing
[nsqd] 2016/05/03 14:26:24.435259 ID: closing
$ ls -1 *.dat
nsqd.790.dat
test-mpe.diskqueue.000000.dat
test-mpe.diskqueue.meta.dat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment