Bug Tracker item #2842529, was opened at 2009-08-22 12:53 Message generated for change (Comment added) made by sbajic You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126467&aid=2842529&group_id=250683
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: daemon Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Julien Valroff (valroff) Assigned to: Nobody/Anonymous (nobody) Summary: PID file not re-created on SIGHUP Initial Comment: When sending a SIGHUP to dspam daemon, the PID file is not re-created if the ServerPID configuration option is set in dspam.conf. When running dspam daemon as non-privileged user, dspam log shows an error when creating the PID file: Aug 18 16:51:53 nix dspam[5652]: Reloading configuration Aug 18 16:51:53 nix dspam[5652]: received signal. waiting for processing threads to exit. Aug 18 16:51:53 nix dspam[5652]: daemon is down. Aug 18 16:51:53 nix dspam[5652]: reloading configuration Aug 18 16:51:53 nix dspam[5652]: Unable to open file for writing: �"#006#010#010##006#...@##006#010: Permission denied The file is most of the time different and it *seems* these are random portions of the dspam.conf file. I have been able to identify where the error comes from, it is in dspam.c, around line 3981: if (pidfile) { FILE *file; file = fopen(pidfile, "w"); if (file == NULL) { LOG(LOG_ERR, ERR_IO_FILE_WRITE, pidfile, strerror(errno)); } else { fprintf(file, "%ld\n", (long) getpid()); fclose(file); } } Changing the value of ServerPID to something different than the default leads to the same behaviour, but when not using the ServerPID configuration option, everything works as expected. I can reproduce it easily in virtual box running Debian lenny, using the latest git code with a very basic configuration. Cheers, Julien ---------------------------------------------------------------------- >Comment By: Stevan Bajic (sbajic) Date: 2009-09-25 20:43 Message: Something strange is going on: -------------- nyx ~ # grep -i "^Sep.*dspam.*Unable to open file for writing" /var/log/vmail.log Sep 25 18:48:26 nyx dspam[6617]: Unable to open file for writing: /run/dspam/dspam.pid: No such file or directory Sep 25 20:23:54 nyx dspam[12252]: Unable to open file for writing: /run/dspam/dspam.pid: No such file or directory nyx ~ # grep ^ServerPID /etc/dspam/dspam.conf ServerPID /var/run/dspam/dspam.pid nyx ~ # dspam --version DSPAM Anti-Spam Suite GIT (agent/library) Copyright (c) 2002-2009 DSPAM Project http://dspam.sourceforge.net. DSPAM may be copied only under the terms of the GNU General Public License, a copy of which can be found with the DSPAM distribution kit. Configuration parameters: '--prefix=/usr' '--build=i686-pc-linux-gnu' '--host=i686-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--with-storage-driver=hash_drv,mysql_drv' '--with-dspam-home=/var/spool/dspam' '--sysconfdir=/etc/mail/dspam' '--enable-daemon' '--disable-external-lookup' '--disable-clamav' '--enable-large-scale' '--disable-domain-scale' '--enable-syslog' '--disable-debug' '--disable-bnr-debug' '--disable-verbose-debug' '--enable-long-usernames' '--with-dspam-group=dspam' '--with-dspam-home-group=dspam' '--with-dspam-mode=2511' '--with-logdir=/var/log/dspam' '--enable-virtual-users' '--enable-preferences-extension' '--disable-homedir' '--with-mysql-includes=/usr/include/mysql' '--with-mysql-libraries=/usr/lib/mysql' 'build_alias=i686-pc-linux-gnu' 'host_alias=i686-pc-linux-gnu' 'CC=i686-pc-linux-gnu-gcc' 'CFLAGS=-march=native -O2 -pipe -fweb -frename-registers -ftree-vectorize -floop-interchange -floop-strip-mine -floop-block -ftree-loop-optimize -freorder-blocks-and-partition -fgcse-sm -fgcse-las -maccumulate-outgoing-args -funswitch-loops -ftracer -fprefetch-loop-arrays -fno-ident -fno-strict-overflow -mfpmath=sse -mmmx -msse -msse2' 'LDFLAGS=-Wl,-O1 -Wl,--add-needed -Wl,--as-needed -Wl,--hash-style=both -Wl,--sort-common' nyx ~ # -------------- I have configured /var/run/dspam/dspam.pid and NOT /run/dspam/dspam.pid! Something is ultra fishy here. ---------------------------------------------------------------------- Comment By: Julien Valroff (valroff) Date: 2009-09-25 19:09 Message: Sorry, I do not think I had tried SIGHUP before... Cheers, Julien ---------------------------------------------------------------------- Comment By: Stevan Bajic (sbajic) Date: 2009-09-25 18:52 Message: Really? How do you then explain this here: ---- Aug 18 16:51:53 nix dspam[5652]: Unable to open file for writing: �"#006#010#010##006#...@##006#010: Permission denied ---- Either _ds_read_attribute is not working right and get's some garbage when executing this here: ---- pidfile = _ds_read_attribute(agent_config, "ServerPID"); ---- Or _ds_read_attribute can't read the dspam.conf. Or something is not okay with your dspam.conf. Okay... let me try that on my setup. OUCH! You are right. The pidfile get's deleted but the process is still running with the old process id and no new pidfile get's created. Hmm... I need to look into that. Did that worked in DSPAM olde then 3.9.0? Kind Regards from Switzerland Stevan Bajic ---------------------------------------------------------------------- Comment By: Julien Valroff (valroff) Date: 2009-09-25 17:47 Message: The default one ;) /var/run/dspam/dspam.pid Cheers, Julien ---------------------------------------------------------------------- Comment By: Stevan Bajic (sbajic) Date: 2009-09-25 13:46 Message: And what value do you have for ServerPID in your configuration? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126467&aid=2842529&group_id=250683 ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Dspam-devel mailing list Dspam-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dspam-devel