I didn't get any error message. When calling the function from PGAdmin I get ********error**********. When I try to re-execute it, it says 'no connection to the server'. When checked the logs I found
2011-08-09 19:46:00 IST LOG: database system was interrupted; last known up at 2011-08-09 19:45:17 IST 2011-08-09 19:46:00 IST LOG: database system was not properly shut down; automatic recovery in progress 2011-08-09 19:46:00 IST FATAL: the database system is starting up 2011-08-09 19:46:00 IST LOG: consistent recovery state reached at 0/420B8C00 2011-08-09 19:46:00 IST LOG: record with zero length at 0/420B8C00 2011-08-09 19:46:00 IST LOG: redo is not required 2011-08-09 19:46:00 IST LOG: database system is ready to accept connections 2011-08-09 19:46:01 IST LOG: autovacuum launcher started Fatal Python error: PyThreadState_Get: no current thread This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. 2011-08-09 19:49:39 IST LOG: server process (PID 2596) exited with exit code 3 2011-08-09 19:49:39 IST LOG: terminating any other active server processes 2011-08-09 19:49:39 IST WARNING: terminating connection because of crash of another server process 2011-08-09 19:49:39 IST DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory. 2011-08-09 19:49:39 IST HINT: In a moment you should be able to reconnect to the database and repeat your command. 2011-08-09 19:49:39 IST LOG: all server processes terminated; reinitializing 2011-08-09 19:49:50 IST FATAL: pre-existing shared memory block is still in use 2011-08-09 19:49:50 IST HINT: Check if there are any old server processes still running, and terminate them. It only crashes when calling the first stated get_mac. If I use any other logic inside the function it works fine. May be problem occurs when using hardware related methods. When I restart the server manually, there is nothing about the problem. Chaitanya Kulkarni On Wed, Aug 10, 2011 at 12:07 PM, Craig Ringer <ring...@ringerc.id.au>wrote: > On 9/08/2011 10:54 PM, c k wrote: > > Normal python functions returning text etc. are working but when >> conatining >> >> import sys >> from uuid import getnode as get_mac >> mac = get_mac() >> return mac >> >> fails. What will be the reason? >> > > You still haven't supplied the error message you get when you run this. > > In the absence of better information, my guess would be that python's uuid > module uses ossp-uuid, same as PostgreSQL does, but a different version or > one compiled differently. The PostgreSQL `bin' dir with the postgresql > version of the DLL will be in the path before the Python one, so Python is > calling into a different version of the DLL than it expects and probably > crashing as a result. > > That would be consistent with it working from the python command line. > > To work around this, I'd either use the ossp-uuid functions via the SPI > rather than using the Python UUID module, or I'd remove the OSSP-UUID dll > from the postgresql directory. You can certainly try that to see if it > helps. > > This is one of the joys you get with Windows software not being managed by > a central packaging system. Everyone bundles their own versions of all the > dependencies, leaving messes like this where two DLLs with the same name > aren't quite compatible. Yay! > > -- > Craig Ringer >