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: v3.9.0 >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Julien Valroff (valroff) Assigned to: Stevan Bajic (sbajic) 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: 2010-08-21 10:46 Message: Thanks for reporting this issue. It's fixed in GIT. ---------------------------------------------------------------------- Comment By: Andreas (gladiac) Date: 2009-12-26 11:54 Message: This sounds and looks like a buffer overflow killing a pointer or the value of the pointer. Have you checked with valgrind? ---------------------------------------------------------------------- Comment By: Julien Valroff (valroff) Date: 2009-12-24 15:13 Message: HI, I have tested with --verbose-debug and I confirm everything seems to work as expected: Dec 24 14:51:11 nix dspam[3737]: Reloading configuration Dec 24 14:51:11 nix dspam[3737]: received signal. waiting for processing threads to exit. Dec 24 14:51:11 nix dspam[3737]: daemon is down. Dec 24 14:51:11 nix dspam[3737]: reloading configuration r...@nix:~# cat /var/run/dspam/dspam.pid 3737 However, I have just made a new test without verbose-debug, and it has also worked (and then failed...) Cheers, Julien ---------------------------------------------------------------------- Comment By: Julien Valroff (valroff) Date: 2009-12-23 20:52 Message: Hi, I have tried setting the ServerPid as the first option in my dspam.conf but still have the same issue (using RC2). I already have debug compiled in (not active though). I will rebuild it tomorrow with verbose debug and check whether it works or not. Here are the configuration parameters in case it helps you find something: '--build' 'i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--disable-dependency-tracking' '--includedir=/usr/include' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-split-configuration' '--enable-static' '--enable-external-lookup' '--enable-syslog' '--with-logdir=/var/log/dspam/' '--localstatedir=/var' '--libexecdir=/usr/lib/dspam' '--srcdir=./' '--with-dspam-home=/var/spool/dspam' '--sysconfdir=/etc/dspam' '--enable-domain-scale' '--enable-signature-headers' '--with-delivery-agent=/usr/bin/procmail' '--enable-daemon' '--with-mysql-includes=/usr/include/mysql' '--with-pgsql-includes=/usr/include/postgresql' '--with-storage-driver=mysql_drv,pgsql_drv,sqlite3_drv,hash_drv' '--enable-debug' '--enable-virtual-users' '--enable-preferences-extension' '--enable-clamav' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-g -O2 -O2' 'LDFLAGS=' 'CPPFLAGS=' 'CXXFLAGS=-g -O2' 'FFLAGS=-g -O2' Cheers, Julien ---------------------------------------------------------------------- Comment By: Stevan Bajic (sbajic) Date: 2009-12-22 13:23 Message: Wicked! Without debug and verbose-debug it's not working: -------- nyx nginx # /etc/init.d/dspam restart * Stopping DSPAM... [ ok ] * Starting DSPAM... [ ok ] nyx nginx # cat /var/run/dspam/dspam.pid 29482 nyx nginx # kill -1 29482 nyx nginx # cat /var/run/dspam/dspam.pid cat: /var/run/dspam/dspam.pid: No such file or directory nyx nginx # -------- Could be an issue with the compile optimizing some stuff. I need to look at it more deeper. Could you try on your setup and turn on debug and debug-verbose and look if sending HUP to the DSPAM process is working on your setup? ---------------------------------------------------------------------- Comment By: Stevan Bajic (sbajic) Date: 2009-12-22 13:12 Message: Now this is strange. I added a bunch of verbose output statements to read_config.c in order to debug what is going on and now sending HUP to DSPAM binary works. Let me compile DSPAM without debug and debug-verbose and see if it is still working. ---------------------------------------------------------------------- Comment By: Stevan Bajic (sbajic) Date: 2009-12-22 08:36 Message: Do you want to hear something funny? Can you try to move that ServerPID entry in your dspam.conf to be one of the first configuration options and then restart DSPAM and then try again to send HUP to the daemon? Does it then work on your setup? ---------------------------------------------------------------------- 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 ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Dspam-devel mailing list Dspam-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dspam-devel