[asterisk-dev] Trying to vfree() nonexistent vm area

Chris B. bencokakao at gmail.com
Mon Oct 16 01:50:06 MST 2006


Hello!

Yesterday(Of course sunday), one of my production servers went
down, no service running anymore, machine totally unresponsive. The last
logentry (which was the only reasonable at the crash time) was a
kernel log:

Oct 15 12:00:02 [kernel] Trying to vfree() nonexistent vm area
(f8c96000)

As it happened two seconds after 12:00 and the machine was running fine
for 150 days i suspect cronjobs i installed a few days ago. 

The cronjob starts a python script which retrieves settings from the
voicemail-table in a postgres-db, writes it to voicemail.conf and
finally does "asterisk -Rx 'reload app_voicemail.so'" (i need this
workaround as 1.2 doesn't have the pgsql-module)

it was scheduled every 20min and was running stable since 2 weeks.
however, i mistakenly installed the cronjob a second time on 13.Oct to
run every minute, so the script was started every minute and every 20
minutes since then, so it was running twice at the same time every
20min. This went fine for 2 days, till yesterday.

Do you think that the reload of the voicemail-module in a race
condition was the reason for this crash? Should i report this as a
bug?

I've attached the py-script for the sake of completeness...

Thanks
Christian

-------------- next part --------------
#!/usr/bin/python
import pg
import commands


def write_header(basedir):
	vmconfigfile=basedir + 'voicemail.conf'
	vmconfig=open(vmconfigfile,'w')		#open for writing with no compression
	vmconfig.write('[general]' + '\n')
	vmconfig.write('\n')
	vmconfig.write('format=wav49|wav' + '\n')
	vmconfig.write('serveremail=voicemail at orga.org' + '\n')
	vmconfig.write('attach=yes' + '\n')
	vmconfig.write('maxmsg=120' + '\n')
	vmconfig.write('maxmessage=320' + '\n')
	vmconfig.write('skipms=3000' + '\n')
	vmconfig.write('maxsilence=10' + '\n')
	vmconfig.write('silencethreshold=128' + '\n')
	vmconfig.write('maxlogins=3' + '\n')
	vmconfig.write('fromstring=Orga Voicemail' + '\n')
	vmconfig.write('pagerfromstring=Orga Voicemail' + '\n')
	vmconfig.write('emailsubject=[ORGA VM]: New message ${VM_MSGNUM} in mailbox ${VM_MAILBOX}' + '\n')
	vmconfig.write('emailbody=Dear ${VM_NAME}:\\n\\nYou have received a new message in your mailbox ${VM_MAILBOX}.\\n\\nMessage Length: ${VM_DUR} \\nMessage Number: ${VM_MSGNUM} \\nFrom:${VM_CALLERID} \\nDate: ${VM_DATE} \\n\\nDepending on your configuration, you can listen to the message by \\nopening the attached voicefile or by calling 900 from your \\nOrga-Account\\n\\nBest regards\\nOrga Voicemail-Service' + '\n')
	vmconfig.write('emaildateformat=%A, %d %B %Y at %H:%M:%S' + '\n')
	vmconfig.write('externnotify=/usr/bin/mwi/mwi-immediate' + '\n')
	vmconfig.write('\n')
	vmconfig.write('\n')
	vmconfig.write('[zonemessages]' + '\n')
	vmconfig.write('\n')
	vmconfig.write('\n')
	vmconfig.write('[default]' + '\n')
	vmconfig.write('\n')
	vmconfig.close()




def write_context_header(context):
	vmconfigfile=basedir + 'voicemail.conf'
	print vmconfigfile
	vmconfig=open(vmconfigfile,'a')		#open for appending to file with no compression
        vmconfig.write('\n')
        vmconfig.write('\n')
	vmconfig.write('[' + context + ']')
        vmconfig.write('\n')

def write_voicemail_file(context,mailboxno,mbxpassword,fullname,email,attach,delete,timezone,saycid,review,context_repeat):
	vmconfigfile=basedir + 'voicemail.conf'
	print vmconfigfile
	vmconfig=open(vmconfigfile,'a')		#open for appending to file with no compression
       	vmconfig.write(mailboxno + ' => ' + mbxpassword + ',' + fullname + ',' + email + ',')
        vmconfig.write('attach=' + attach + ',delete=' + delete + ',tz=' + timezone + ',saycid=' + saycid + ',review=' + review + '\n')
	vmconfig.close()


#conn = pg.connect("Orga2","2XX.XXX.XXX.106",5432,None,None,"db2user","secretpassword2")
conn = pg.connect("Orga","2XX.XXX.XXX.98",5432,None,None,"dbuser","secretpassword")
count_qry = "select * FROM voicemail;"
data_qry = "select * FROM voicemail order by context;"
voicemailrecord=conn.query(data_qry).dictresult()
basedir= "/etc/asterisk/"
i=0
context_repeat = voicemailrecord[0]['context']
write_header(basedir)


print context_repeat
for voicemailrecord in conn.query(data_qry).dictresult():
	print i
	context = voicemailrecord['context']
	mailboxno = voicemailrecord['mailbox']
	mbxpassword = voicemailrecord['password']
	fullname = voicemailrecord['fullname']
	email = voicemailrecord['email']
	attach = voicemailrecord['attach']
	delete = voicemailrecord['delete']
	timezone = voicemailrecord['tz']
	saycid = voicemailrecord['saycid']
	review = voicemailrecord['review']
	print context
	if context==context_repeat and i>0:
		write_voicemail_file(context,mailboxno,mbxpassword,fullname,email,attach,delete,timezone,saycid,review, context_repeat)
	else:
		write_context_header(context)
		write_voicemail_file(context,mailboxno,mbxpassword,fullname,email,attach,delete,timezone,saycid,review, context_repeat)
	context_repeat=context
	print 'context_repeat=' + context_repeat
	i=i+1

commands.getoutput('chown root:asterisk /etc/asterisk/voicemail.conf')
commands.getoutput('asterisk -Rx \'reload app_voicemail.so\'')



More information about the asterisk-dev mailing list