[Asterisk-bsd] FreeBSD hang up when exiting **BUG FIX**

Andy Brook andy at lynksys.net
Mon Feb 14 09:36:27 CST 2005


I've submitted a PR to freebsd which can be found here http://www.freebsd.org/cgi/query-pr.cgi?pr=77515 

Anyone wanting to fix this locally can just replace the file /usr/ports/misc/zaptel/files/patch-zaptel::zaptel.c with the attached patch.txt which is a diff containing the changes detailed below, I've done this on my machine and it's now working a treat and I don't have to go into the server room to hard power off it any more WOO HOO!!!

Andy

-----Original Message-----
From: Charles A.Newcomer [mailto:charles at iapc.net] 
Sent: 04 February 2005 00:59
To: Asterisk on BSD discussion
Subject: Re: [Asterisk-bsd] FreeBSD hang up when exiting **BUG FIX**

Let me post this again.
I think this will solve all of the hard lockups.

Greetings:

It looks like there is a bug in the zaptel driver from 
zaptel-freebsd-0.8.

It manifest itself when the zt_chan_read call is interrupted. (To 
reproduce
run zttest and hit ^C).  I first noticed it when doing a STOP NOW.

Changing the schluffen routine as follows fixes the problem:

> static int schluffen(void *q)
> {
>    int rc;
>
>         switch (rc=tsleep(q, PZERO | PCATCH, "schluffen", 0)) {
>            case    EINTR:
>            case ERESTART: return(rc);
>         }
>         return(0);
> }
>


This allows the for (;;) loop to exit after an interrupt.


Thanks,
/can


On Feb 3, 2005, at 3:45 PM, Jerry Bednyak wrote:

> I'm having the same problem. I did notice, however,
> that disabling all the musiconhold classes via
> musiconhold.conf will allow a clean shutdown without
> hanging the computer. Maybe that will spawn some ideas
> as to the problem. Using FreeBSD 5.3 w/ Zaptel,
> Asterisk 1.0.3
>
> Jerry
>
> ----- Original Message -----
> From: "Vahan Yerkanian" <vahan at arminco.com>
> To: "Asterisk on BSD discussion" <asterisk-bsd at
> lists.digium.com>
> Sent: Sunday, January 16, 2005 3:18 AM
> Subject: Re: [Asterisk-bsd] FreeBSD hang up when
> exiting *
>
>
>> Same thing here,
>>
>> Try to unload zaptel drivers and you'll see the
> problem go. We need
>> newer drivers in ports for sure.
>>
>> Kavit Munshi wrote:
>>> I am getting a very strange error on FreeBSD 5.3
> STABLE. I am using
>>> asterisk 1.0.3 and the zaptel-bsd drivers from the
> svn trunk. Asterisk
>>> performs just fine. No issues whatsoever. The
> problem arises when I try
>>> to exit asterisk in any fashion, stop now, stop
> when convenient, hitting
>>> CTRL-C, using kill -9 or kill all; it freezes the
> entire operating
>>> system over. Its like getting the blue screen of
> death on windows. No
>>> keys work and I have to reset the machine manually.
>>>
>>> Now the instresting bit is, after rebooting i
> examine the log files and
>>> i get no log messages pertaining to a crash or any
> kernel messages which
>>> give a clue.
>>>
>>> This is really weird as asterisk performs very
> nicely and doesnt give
>>> any issues with memory load or interrupts. It only
> has problems when you
>>> try to exit it.
>>>
>>> I will appreciate any help.
>>>
>>> regards
>>>
>>> Kavit
>>> _______________________________________________
>>> Asterisk-BSD mailing list
>>> Asterisk-BSD at lists.digium.com
>>>
> http://lists.digium.com/mailman/listinfo/asterisk-bsd
>>>
>>
>
> _______________________________________________
> Asterisk-BSD mailing list
> Asterisk-BSD at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-bsd
>

_______________________________________________
Asterisk-BSD mailing list
Asterisk-BSD at lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-bsd
-------------- next part --------------
--- zaptel/zaptel.c
+++ zaptel/zaptel.c
@@ -156,12 +156,17 @@
 #endif
 
 static struct cdevsw zt_devsw = {
-#if __FreeBSD_version >= 502103
+#if __FreeBSD_version < 502103
+#ifdef MAJOR_AUTO
+		.d_maj = MAJOR_AUTO,
+#else
+		.d_maj = ZT_MAJOR,
+#endif
+#else
 		.d_version = D_VERSION,
 #endif
 		.d_open			= ztopen,
-		.d_name			= "zaptel",
-		.d_maj			= ZT_MAJOR
+		.d_name			= "zaptel"
 };
 
 
@@ -664,8 +669,13 @@
 
 static int schluffen(void *q)
 {
-	tsleep(q, PZERO | PCATCH, "schluffen", 0);
-	return(0);
+    int rc;
+
+         switch (rc=tsleep(q, PZERO | PCATCH, "schluffen", 0)) {
+            case    EINTR:
+            case ERESTART: return(rc);
+         }
+         return(0);
 }
 
 static __inline void calc_fcs(struct zt_chan *ss)


More information about the Asterisk-BSD mailing list