Yaws Server and the Process Dictionary

View: New views
3 Messages — Rating Filter:   Alert me  

Yaws Server and the Process Dictionary

by Trevor Woollacott [ MTN - Innovation Centre ] :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I have setup an HTTPS server using Yaws-1.75 in Erlang R12-B5. While the clients are connected I'm seeing the following error every few seconds:
{{badmatch,undefined},[{proc_lib,exit_p,2}]}

I realise that this occurs in the following case (in R12-B5):
- A process is spawned using proc_lib:spawn_link,
- $initial_call is erased from the dictionary of that process,
- Then the process exits or crashes

When I check the dictionary of some of the Yaws Acceptors they are missing '$ancestors' and '$initial_call', as shown below (with the actual values removed by me):
dictionary: [
  {gc, ...},
  {init_db,[{gc, ...}]}]

However the other Acceptors still have $ancestors and $initial_call:
dictionary: [
  {gc, ...},
  {'$ancestors',[<5368.75.0>,yaws_server,yaws_sup,<5368.58.0>]},
  {'$initial_call',{yaws_server,acceptor0,2}},
  {init_db,[{gc, ...},
            {'$ancestors',[<5368.75.0>,yaws_server,yaws_sup,<5368.58.0>]},
            {'$initial_call',{yaws_server,acceptor0,2}]}]

So I assume that when the Yaws Acceptor exits normally, proc_lib:exit_p/2 crashes when it tries to match {m, f, a} with the value in '$initial_call'.

Has anyone seen this occur before with Yaws?

Thanks,
Trevor

NOTE: This e-mail message is subject to the MTN Group disclaimer see http://www.mtn.co.za/SUPPORT/LEGAL/Pages/EmailDisclaimer.aspx

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@...
https://lists.sourceforge.net/lists/listinfo/erlyaws-list

Re: Yaws Server and the Process Dictionary

by Claes Wikström :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Trevor Woollacott [ MTN - Innovation Centre ] wrote:
> Hi all,
>
> I have setup an HTTPS server using Yaws-1.75

1.75 is pretty old, and Yaws is using the proc dict in
fairly ugly ways. I think that you're seeing old (fixed) bugs
in how the proc dict is handled by Yaws.

Maybe

  - proc dict/proc_lib patch by Magnus F  (in 1.78)


is the fix.

/klacke

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@...
https://lists.sourceforge.net/lists/listinfo/erlyaws-list

Re: Yaws Server and the Process Dictionary

by Trevor Woollacott [ MTN - Innovation Centre ] :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> From: Claes Wikström [mailto:klacke@...]
> Sent: Wednesday, 16 September 2009 12:31 PM
> To: Trevor Woollacott [ MTN - Innovation Centre ]
> Cc: erlyaws-list@...
> Subject: Re: [Erlyaws-list] Yaws Server and the Process Dictionary
>
> Trevor Woollacott [ MTN - Innovation Centre ] wrote:
> > Hi all,
> >
> > I have setup an HTTPS server using Yaws-1.75
>
> 1.75 is pretty old, and Yaws is using the proc dict in
> fairly ugly ways. I think that you're seeing old (fixed) bugs
> in how the proc dict is handled by Yaws.
>
> Maybe
>
>   - proc dict/proc_lib patch by Magnus F  (in 1.78)
>
>
> is the fix.
>
> /klacke

Thanks Klacke.

It definitely looks like a newer version will fix our problem. Here's a copy & paste from the yaws_server:erase_transients/0 (Yaws-1.79):

    if I == undefined ->
            ok;
       list(I) ->
           %% Need to keep init_db in case we do not enter aloop (i.e. init:db)
           %% again as R12B-5 requires proc_lib keys in dict while exiting...
           put(init_db, I),
            lists:foreach(fun({K,V}) -> put(K,V) end, I)
    end.

The line containing put(init_db, I) was added, which will most likely fix our problem where the dictionary had been erased before the Acceptor exits. There are a couple other fixes which will benefit us also.

Regards,
Trevor

NOTE: This e-mail message is subject to the MTN Group disclaimer see http://www.mtn.co.za/SUPPORT/LEGAL/Pages/EmailDisclaimer.aspx

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@...
https://lists.sourceforge.net/lists/listinfo/erlyaws-list