[Mailman-Users] socket.gethostname()
Richard Barrett
r.barrett at openinfo.co.uk
Thu Nov 6 18:59:28 CET 2003
On Thursday, November 6, 2003, at 06:17 pm, John Poltorak wrote:
> On Thu, Nov 06, 2003 at 04:57:12PM +0000, Richard Barrett wrote:
>>
>> On Thursday, November 6, 2003, at 05:43 pm, John Poltorak wrote:
>>
>>>
>>>
>>> I'm getting an error in LockFile.py at this point (line 180) :-
>>>
>>> self.__tmpfname = '%s.%s.%d' % (
>>> lockfile, socket.gethostname(), os.getpid())
>>>
>>> It looks as though the function socket.gethostname() is causing this
>>> error.
>>>
>>> How can I display the value returned by this funtion and where should
>>> it
>>> be retrieved from? ie should it be using $HOSTNAME ?
>>>
>>
>> socket is a standard Python module. Its gethostname() function should
>> return the same as the hostname shell command. From the command line
>> you should be able to run python and get something like this:
>
> Many thanks for this.
>
>
>> mailman at mailman2:~> hostname
>> mailman2
>> mailman at mailman2:~> python
>> Python 2.2.2 (#3, Feb 11 2003, 16:57:53)
>> [GCC 2.95.3 20010315 (SuSE)] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> import socket
>>>>> socket.gethostname()
>> 'mailman2'
>
> Where does value originate and should it match anything within
> Mailman's
> configuration?
>
It originates within the system kernel. Read the man page for hostname.
Like hostname, socket.gethostname() is calling a system C library
function to get the information, which is quite independent of Mailman.
> Is there any way to dump the value of self.__tmpfname to the logfile
> from
> the lines above ?
>
No because you would not running Mailman, just the Python interpreter
from the command line.
> This is what currently appears in the error log:-
>
>
> admin(648): File "../Mailman/MailList.py", line 817, in __save
> admin(648): fname_tmp = fname + '.tmp.%s.%d' %
> (socket.gethostname(), os.getpid())
> admin(648): error: (14, 'Bad address')
>
>
This is a system error code, EFAULT, which means "Bad address",
whatever that means. It is certainly abnormal and I suspect not a
problem in MM per se. It could indicate an incipient memory problem or
corrupt libraries or kernel or ...
After discussion with a colleague we decided we couldn't identify any
simple, obvious cause or course of action to take but it sounded like
something was broken in the system.
Is this a persistent or occasional problem?
My first instincts are to reboot the system, maybe run a few
diagnostics on memory and disk, and a full fsck and see if that clears
it. With my knowledge of things this is SWAG territory.
> I'm assuming that socket.gethostname() is the culprit.
>
If you called socket.gethostname() from the Python command line as I
suggested in my previous message and got a sensible result, you are
probably wrong in this assumption.
>
> --
> John
>
-----------------------------------------------------------------------
Richard Barrett http://www.openinfo.co.uk
More information about the Mailman-Users
mailing list