Skip to content
This repository has been archived by the owner. It is now read-only.

CalendarServer doesn't delete stray sockets on startup #135

Closed
macosforgebot opened this issue Apr 19, 2007 · 11 comments
Closed

CalendarServer doesn't delete stray sockets on startup #135

macosforgebot opened this issue Apr 19, 2007 · 11 comments

Comments

@macosforgebot
Copy link

@macosforgebot macosforgebot commented Apr 19, 2007

@wsanchez originally submitted this as ticket:161


4/13/07 1:52 PM Nick:

(NOTE: This is the CalendarServer r1484.)

When CalendarServer starts up, it attempts to make some Unix socket files. But if the sockets already exist (in my case it was due to a kernel panic that occurred while CalendarServer was running), CalendarServer won't start up.

Steps to Reproduce:

  1. Place a dead socket file in CalendarServer/logs/caldavd.sock
  2. Run CalendarServer

Expected Results:

  • CalendarServer is expected to start up as normal.

Actual Results:

  • An exception occurs and CalendarServer quits:
2007-04-13 14:11:04-0600 [-] twistedcaldav.logging.AMPLoggingFactory starting on "'logs/caldavd.sock'"
2007-04-13 14:11:04-0600 [-] Traceback (most recent call last):
2007-04-13 14:11:04-0600 [-]   File "/Users/nickzman/Twisted/bin/twistd", line 21, in <module>
2007-04-13 14:11:04-0600 [-]     run()
2007-04-13 14:11:04-0600 [-]   File "/Users/nickzman/Twisted/twisted/scripts/twistd.py", line 27, in run
2007-04-13 14:11:04-0600 [-]     app.run(runApp, ServerOptions)
2007-04-13 14:11:04-0600 [-]   File "/Users/nickzman/Twisted/twisted/application/app.py", line 379, in run
2007-04-13 14:11:05-0600 [-]     runApp(config)
2007-04-13 14:11:05-0600 [-]   File "/Users/nickzman/Twisted/twisted/scripts/twistd.py", line 23, in runApp
2007-04-13 14:11:05-0600 [-]     _SomeApplicationRunner(config).run()
2007-04-13 14:11:05-0600 [-]   File "/Users/nickzman/Twisted/twisted/application/app.py", line 158, in run
2007-04-13 14:11:05-0600 [-]     self.postApplication()
2007-04-13 14:11:05-0600 [-]   File "/Users/nickzman/Twisted/twisted/scripts/_twistd_unix.py", line 213, in postApplication
2007-04-13 14:11:05-0600 [-]     startApplication(self.config, self.application)
2007-04-13 14:11:05-0600 [-]   File "/Users/nickzman/Twisted/twisted/scripts/_twistd_unix.py", line 174, in startApplication
2007-04-13 14:11:05-0600 [-]     service.IService(application).privilegedStartService()
2007-04-13 14:11:05-0600 [-]   File "/Users/nickzman/Twisted/twisted/application/service.py", line 228, in privilegedStartService
2007-04-13 14:11:05-0600 [-]     service.privilegedStartService()
2007-04-13 14:11:05-0600 [-]   File "/Users/nickzman/Twisted/twisted/application/service.py", line 228, in privilegedStartService
2007-04-13 14:11:05-0600 [-]     service.privilegedStartService()
2007-04-13 14:11:05-0600 [-]   File "/Users/nickzman/Twisted/twisted/application/internet.py", line 68, in privilegedStartService
2007-04-13 14:11:05-0600 [-]     self._port = self._getPort()
2007-04-13 14:11:05-0600 [-]   File "/Users/nickzman/Twisted/twisted/application/internet.py", line 86, in _getPort
2007-04-13 14:11:05-0600 [-]     return getattr(reactor, 'listen'+self.method)(*self.args, **self.kwargs)
2007-04-13 14:11:05-0600 [-]   File "/Users/nickzman/Twisted/twisted/internet/posixbase.py", line 432, in listenUNIX
2007-04-13 14:11:05-0600 [-]     p.startListening()
2007-04-13 14:11:05-0600 [-]   File "/Users/nickzman/Twisted/twisted/internet/unix.py", line 89, in startListening
2007-04-13 14:11:05-0600 [-]     raise CannotListenError, (None, self.port, le)
2007-04-13 14:11:05-0600 [-] twisted.internet.error.CannotListenError: Couldn't listen on any:logs/caldavd.sock: (48, 'Address already in use').

Notes: If all of the stray socket files in the logs directory are deleted, then and only then does CalendarServer start up correctly.

@macosforgebot
Copy link
Author

@macosforgebot macosforgebot commented Apr 19, 2007

@wsanchez originally submitted this as comment:1:⁠ticket:161

  • Severity changed from Other to Crash/data loss
@macosforgebot
Copy link
Author

@macosforgebot macosforgebot commented Jul 30, 2007

@wsanchez originally submitted this as comment:2:⁠ticket:161

  • Milestone changed from 1.0 to 1.1
@macosforgebot
Copy link
Author

@macosforgebot macosforgebot commented Dec 15, 2007

@wsanchez originally submitted this as comment:3:⁠ticket:161

  • Milestone changed from 1.1 to 1.2
@macosforgebot
Copy link
Author

@macosforgebot macosforgebot commented Jan 23, 2008

@wsanchez originally submitted this as comment:4:⁠ticket:161

  • Milestone changed from 1.2 to 2.x
@macosforgebot
Copy link
Author

@macosforgebot macosforgebot commented Aug 1, 2008

aaron.grattafiori@… originally submitted this as comment:5:⁠ticket:161


"If all of the stray socket files in the logs directory are deleted, then and only then does CalendarServer start up correctly."

Why are the sockets in the logs directory?

Why hasn't this been fixed a long time ago?

@macosforgebot
Copy link
Author

@macosforgebot macosforgebot commented Aug 3, 2008

@wsanchez originally submitted this as comment:6:⁠ticket:161


"Why are the sockets in the logs directory?"

No good reason there; should be in /var/run.

"Why hasn't this been fixed a long time ago?"

Might be because you haven't submitted a patch fixing this yet.

@macosforgebot
Copy link
Author

@macosforgebot macosforgebot commented Aug 4, 2008

aaron.grattafiori@… originally submitted this as comment:7:⁠ticket:161


Replying to wsanchez@apple.com:

"Why are the sockets in the logs directory?"

No good reason there; should be in /var/run.

Changing the default path in the config file fixed the pid and sockets being in the wrong place. (They are now in /var/run/caldavd)
I fail to see why the "logs" directory was chosen for anything other than logs or remains the default

"Why hasn't this been fixed a long time ago?"

Might be because you haven't submitted a patch fixing this yet.

Is this a problem with Twisted or CalendarServer? Seems like they are cleaning up sockets here: http://twistedmatrix.com/trac/browser/trunk/twisted/internet/unix.py?rev=24089#L75
Has the year been spent waiting for someone to submit a patch? My email address doesn't end in apple.com

@macosforgebot
Copy link
Author

@macosforgebot macosforgebot commented Aug 5, 2008

@wsanchez originally submitted this as comment:8:⁠ticket:161


As I said, no good reason for the logs dir; we should fix that.

You don't need an apple.com email address to submit patches.

We all have our priorities; if this is important to you, the best thing you can do to make progress on it is to submit a patch.

@macosforgebot
Copy link
Author

@macosforgebot macosforgebot commented Oct 28, 2008

@wsanchez originally submitted this as comment:9:⁠ticket:161

  • Status changed from new to assigned

Is there an easy way to know that a socket file has no listener attached to it? That would be a reliable way to detect a stray socket.

@macosforgebot
Copy link
Author

@macosforgebot macosforgebot commented Oct 28, 2008

@wsanchez originally submitted this as comment:10:⁠ticket:161


Default location for ControlSocket is /var/run/caldavd-pydir.sock, which is not the logs dir, so that problem should be cleared up. Note that in caldavd-test.plist, it is logs/caldavd.sock because we don't want to create a bunch of runtime directories for development/testing. (You should not be deploying a server using the test config, use by using the run script; though I know some distros are incorrectly doing so.)

@macosforgebot
Copy link
Author

@macosforgebot macosforgebot commented Jun 19, 2009

@wsanchez originally submitted this as comment:11:⁠ticket:161

  • Status changed from assigned to closed
  • Milestone changed from CalendarServer-2.x to CalendarServer-2.2
  • Resolution changed from to Software changed

This was fixed in 2.2 by checking whether the socket is still valid.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.