Policyd-weight issues with unclean shutdown

Today, I encountered some weird issues with a postfix/amavis mail server which was causing segfaults and memory paging errors. I was forced to bounce the server, but it wasn't able to shutdown all of it's services. That left me with the only option of calling the dedicated hosting company and requesting a hard shutdown. Shortly there after the server was up, and all services were responding.

Checking the logs, I started noticing the following warnings.

Nov 21 13:39:42 comp postfix/smtpd[6479]: warning: connect to 127.0.0.1:12525: Connection refused
Nov 21 13:39:42 comp postfix/smtpd[6479]: warning: problem talking to server 127.0.0.1:12525: Connection refused
Nov 21 13:39:42 comp postfix/smtpd[5833]: warning: connect to 127.0.0.1:12525: Connection refused
Nov 21 13:39:42 comp postfix/smtpd[5833]: warning: problem talking to server 127.0.0.1:12525: Connection refused
Nov 21 13:39:42 comp postfix/smtpd[9486]: warning: connect to 127.0.0.1:12525: Connection refused
Nov 21 13:39:42 comp postfix/smtpd[9486]: warning: problem talking to server 127.0.0.1:12525: Connection refused

So policyd-weight was not listening on that port, but the service was started. I restarted the service and noticed the following:

Nov 21 13:42:30 comp postfix/policyd-weight[10005]: warning: -k action but /var/run/.policyd-weight//polw.sock still exists, deleting it

I thought it was unusual that it didn't kill the sock on the first start, but only on the restart. The socket was left because of the hard shutdown. I thought my problems were done, but then started seeing additional warnings:

Nov 21 13:47:10 comp postfix/policyd-weight[10387]: warning: cache_query: $csock couln't be created: connect: No such file or directory, calling spawn_cache()
Nov 21 13:47:38 comp postfix/policyd-weight[10435]: warning: cache_query: $csock couln't be created: connect: No such file or directory, calling spawn_cache()
Nov 21 13:47:39 comp postfix/policyd-weight[10435]: warning: cache_query: $csock couln't be created: connect: No such file or directory, calling spawn_cache()

To resolve this, I had to shutdown policyd-weight again and delete all the files in /var/run/.policyd-weight. After restart, everything was back to normal. I wanted to post this at uno-code.com in case I run into this again.