Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#3889 closed Bug (fixed)

logfile isn't flushed to disk frequently enough

Reported by: oh_noes Owned by: jordan
Priority: Normal Milestone: 2.20
Component: Daemon Version: 2.10
Severity: Normal Keywords: backport-2.1x backport-2.0x
Cc:

Description

Parameters:

[SERVER:/export/home/torrent][torrent]# pargs `pgrep trans`
25276:  /usr/local/transmission/bin/transmission-daemon --config-dir /data/info --logfi
argv[0]: /usr/local/transmission/bin/transmission-daemon
argv[1]: --config-dir
argv[2]: /data/info
argv[3]: --logfile
argv[4]: /data/log/transmission-daemon.log
argv[5]: --no-portmap
argv[6]: --no-lpd
[SERVER:/export/home/torrent][torrent]# ps -ef | grep [2]5276
 torrent 25276     1   0 21:24:17 ?           0:17 /usr/local/transmission/bin/transmission-daemon --config-dir /data/info --logfi

Bug:

[SERVER:/export/home/torrent][torrent]# rm /data/log/transmission-daemon.log
[SERVER:/export/home/torrent][torrent]# ls -lh / | grep data
drwxr-xr-x   9 torrent  torrent      10 Jan 11 19:16 data
[SERVER:/export/home/torrent][torrent]# ls -lh /data | grep log
drwxr-xr-x   2 torrent  torrent       4 Jan 11 21:21 log
[SERVER:/export/home/torrent][torrent]# ls -lh /data/log/transmission-daemon.log
/data/log/transmission-daemon.log: No such file or directory
[SERVER:/export/home/torrent][torrent]# echo "testing" >> /data/log/transmission-daemon.log
[SERVER:/export/home/torrent][torrent]# ls -lh /data/log/transmission-daemon.log
-rw-r--r--   1 torrent  torrent       8 Jan 11 21:22 /data/log/transmission-daemon.log
[SERVER:/export/home/torrent][torrent]# 

[SERVER:/export/home/torrent][torrent]# sudo svcadm enable svc:/application/transmission-daemon:default && tail -f /data/log/transmission-daemon.log
testing
[21:24:20.487] Blocklist "level1.bin" updated with 224914 entries (blocklist.c:373)
[21:24:20.488] Blocklist "level1.bin" contains 224914 entries (blocklist.c:114)
[21:24:20.488] Transmission 2.13+ (11666) started (session.c:661)
[21:24:20.488] RPC Server Adding address to whitelist: 127.0.0.1 (rpc-server.c:807)
[21:24:20.488] RPC Server Adding address to whitelist: 172.16.50.* (rpc-server.c:807)
[21:24:20.488] RPC Server Serving RPC and Web requests on port 127.0.0.1:9091/transmission/ (rpc-server.c:985)
[21:24:20.488] RPC Server Whitelist enabled (rpc-server.c:989)
[21:24:20.488] Port Forwarding Stopped (port-forwarding.c:183)
[21:24:20.488] Using settings from "/data/info" (daemon.c:483)
[21:24:20.488] Saved "/data/info/settings.json" (bencode.c:1720)
[21:24:20.488] Blocklist "level1.bin" contains 224914 entries (blocklist.c:114)
[21:24:20.488] Blocklist "blocklist.bin" contains 224908 entries (blocklist.c:114)
[21:24:20.488] Loaded 38 torrents (session.c:1857)
[21:27:02.490] Saved "/data/info/torrents/ubu########ntu-10.10-alternate-amd64.iso.d18fa3595643fb7b.torrent" (bencode.c:1720)
[21:27:02.490] ubuntu-10.10-alternate-amd64.iso Pausing (torrent.c:1705)
[21:27:02.490] Saved "/data/info/resume/ubuntu-10.10-alternate-amd64.iso.d18fa3595643fb7b.resume" (bencode.c:1720)
[21:27:02.490] ubuntu-10.10-alternate-amd64.iso Queued for verification (verify.c:257)
[21:27:02.490] ubuntu-10.10-alternate-amd64.iso Verifying torrent (verify.c:215)
[21:30:18.493] Saved "/data/info/resume/ubuntu-10.10-server-i386.iso.c946a3d########576e347df.resume" (bencode.c:1720)
[21:30:18.493] Saved "/data/info/resume/TORRENT1.a262cf514d408861.resume" (bencode.c:1720)
[21:30:18.493] Saved "/data/info/resume/ubuntu-10.10-alternate-amd64.iso.d18fa3595643fb7b.resume" (bencode.c:1720)
[21:30:18.493] Saved "/data/info/stats.json" (bencode.c:1720)
[21:36:18.499] Saved "/data/info/resume/TORRENT2.c946a3d576e347df.resume" (bencode.c:1720)
[21:36:18.499] Save########

This is with message-level = 2.

As you can see in the above it's not properly writing log files yet it has full access to the dir/log file.

The ########'s show a period of inactivity where *nothing* is written. As you can see, it constantly stops half-way through the line.

It's not buffering the writes of debug output is it?

--log-debug --foreground

This works without a problem. Running the process manually outside of SMF exhibits the same behavior.

transmission-daemon 2.13+ (11666)

Change History (5)

comment:1 Changed 11 years ago by jordan

hi oh_noes,

Does this fix the issue?

Index: daemon/daemon.c
===================================================================
--- daemon/daemon.c	(revision 11666)
+++ daemon/daemon.c	(working copy)
@@ -323,6 +323,9 @@
     for( l=list; l!=NULL; l=l->next )
         printMessage( logfile, l->level, l->name, l->message, l->file, l->line );
 
+    if( logfile != NULL )
+        fflush( logfile );
+
     tr_freeMessageList( list );
 }

comment:2 Changed 11 years ago by jordan

  • Component changed from Transmission to Daemon
  • Milestone changed from None Set to 2.20
  • Owner set to jordan
  • Status changed from new to assigned
  • Version changed from 2.13+ to 2.10

comment:3 Changed 11 years ago by jordan

  • Resolution set to fixed
  • Status changed from assigned to closed

The patch above WFM... :)

Fixed in trunk by r11682

comment:4 Changed 11 years ago by jordan

  • Keywords backport-2.1x backport-2.0x added

comment:5 Changed 11 years ago by jordan

  • Summary changed from --logfile is unreliable on Solaris 10 to logfile isn't flushed to disk frequently enough
Note: See TracTickets for help on using tickets.