i2pd icon indicating copy to clipboard operation
i2pd copied to clipboard

LogPrint's logger starts after the pidfile is initialized for some reason

Open yangfl opened this issue 7 years ago • 2 comments

First, I'd like to thank you for fixing #1047.

However, I met the exact the same problem today. i2pd do exit with a non-zero return code, but still no other information is given. This makes debugging considerably a pain.

Please consider add some more error message to indicate what's going wrong.

yangfl avatar Mar 31 '18 06:03 yangfl

It seems LogPrint() in UnixDaemon.cpp sometimes doesn't work. Try this (add syslog() call just near LogPrint() call)

                                pidFH = open(pidfile.c_str(), O_RDWR | O_CREAT, 0600);
                                if (pidFH < 0)
                                {
                                        syslog (LOG_USER|LOG_NOTICE, "%s %s %s %s %d\n", "Could not create PIDfile", pidfile.c_str(), strerror(errno), "pidFH:", pidFH);
                                        LogPrint(eLogError, "Daemon: could not create pid file ", pidfile, ": ", strerror(errno));
                                        return false;
                                }

See also https://github.com/PurpleI2P/i2pd/issues/345#issuecomment-345523045

LLE8 avatar Mar 31 '18 10:03 LLE8

yeah LogPrint's logger starts after the pidfile is initialized for some reason.

On Sat, Mar 31, 2018 at 10:05:15AM +0000, LLE8 wrote:

It seems LogPrint() in UnixDaemon.cpp sometimes doesn't work.

Try this (add syslog() call just near LogPrint() call)

                                pidFH = open(pidfile.c_str(), O_RDWR | O_CREAT, 0600);
                                if (pidFH < 0)
                                {
                                        syslog (LOG_USER|LOG_NOTICE, "%s %s %s %s %d\n", "Could not create PIDfile", pidfile.c_str(), strerror(errno), "pidFH:", pidFH);
                                        LogPrint(eLogError, "Daemon: could not create pid file ", pidfile, ": ", strerror(errno));
                                        return false;
                                }

See also https://github.com/PurpleI2P/i2pd/issues/345#issuecomment-345523045

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/PurpleI2P/i2pd/issues/1153#issuecomment-377681865

majestrate avatar Mar 31 '18 10:03 majestrate