From francesco@REDACTED Sat Jan 1 16:01:10 2005 From: francesco@REDACTED (Francesco Cesarini (Erlang Consulting)) Date: Sat, 01 Jan 2005 15:01:10 +0000 Subject: Erlang Statistics / Usage Message-ID: <41D6BB36.5080607@erlang-consulting.com> Hi All, I finally managed to put on line the presentation on Erlang Usage in the World given at the Snowbird Workshop in late September last year. It contains statistics from the Erlang mailing list (Top posters / domains / posts on a monthly basis), statistics from the erlang.org site, alongside EUC data. Unfortunately, the data form the 4th quarter and the 10th EUC is missing, (Curves have since continued pointing upwards), but regardless, it is interesting and should give you all an idea over where Erlang is heading. Slides/pdf are at http://www.erlang-consulting.com/erlangworkshop04/ Happy New Year! Francesco -- http://www.erlang-consulting.com From vances@REDACTED Sun Jan 2 03:42:33 2005 From: vances@REDACTED (Vance Shipley) Date: Sat, 1 Jan 2005 21:42:33 -0500 Subject: LAPD protocol implementation available Message-ID: <20050102024233.GP42962@frogman.motivity.ca> Folks, In a project last year I found I needed a LAPD protocol implementation which provided an API to the Unacknowledged Information (UI) frame service. I wasn't able to find an existing implementation which exposed the UI service to the user. So to complete the project I implemented my own version of the Link Access Procedures on the D-channel (LAPD) as documented in ITU-T Q.921. I did this to create an emulation environment for GSM Abis interfaces. This was work done simply in order to have a testing environment for another commercial product we developed. I am making this Erlang application available under a BSD opensource license. I'm not sure how likely it is that anyone will have a use for this but I might as well share. If nothing else the design documented in the User Guide might might be interesting for those building such communicating state machine applications. -Vance http://www.motivity.ca/lapd/index.html http://www.motivity.ca/lapd-1.1.tar.gz From rprice@REDACTED Sun Jan 2 11:26:35 2005 From: rprice@REDACTED (Roger Price) Date: Sun, 2 Jan 2005 11:26:35 +0100 (CET) Subject: Erlang Statistics / Usage In-Reply-To: <41D6BB36.5080607@erlang-consulting.com> Message-ID: On Sat, 1 Jan 2005, Francesco Cesarini (Erlang Consulting) wrote: > Slides/pdf are at http://www.erlang-consulting.com/erlangworkshop04/ Is there an alternative address for those, like me, who have scripting turned off as a security measure? A "no-frame" alternative would also be very helpful. Best Regards, Roger From raimo@REDACTED Sun Jan 2 20:01:12 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 02 Jan 2005 20:01:12 +0100 Subject: unknown_catch_try_state under R10B-2 References: <41D07515.8000306@loxysoft.se>, <41D0870F.9040600@loxysoft.se> Message-ID: It seems to be a bug in the beam_validator module (compiler internal). It is a new post-processing pass that checks the generated code to see if the compiler messed up some optimization and produced unsafe code. It has been tested on most code we had available, but obviously not all code in the world. We will have a look at this problem after the christmas vacations. Thank you for reducing the bug for us. To find exactly what went wrong you will have to compile with the -S switch to get a .beam assembly listing, then read and understand it. If you have to get forward sooner you can probably work around the bug with a slight rewrite of the code. The validator seems to have problems with a catch statement. It might be the parenthesis around "catch begin ... end", or the "begin ... end" in a catch. That is the only thing that looks a bit odd. OK, the "case ok of _ -> ... end" also looks a bit odd so it might be the catch in such a statement... Nevertheless we will locate this bug sooner or later. bjorn@REDACTED (Bj?rn Bylander) writes: > I've reduced the incorrect code to this: > > -module(foomod). > -export([handle_info/2]). > -record(state, { foo = undefined }). > > handle_info({_}, State) -> > foo(), > State#state{foo = bar}, > case ok of > _ -> > case catch foo() of > ok -> > {stop, State} > end > end; > > handle_info(_, State) -> > (catch begin > foo(), > State#state{foo = bar} > end), > case ok of > _ -> > case catch foo() of > ok -> > {stop, State} > end > end. > > foo() -> ok. > > On 2004-12-27 21:48, Bj?rn Bylander wrote: > > I get the following output from make:all([load]) with R10B-2 under > > Windows. The module (admctrl_srv.erl) compiles fine under R9C-2, > > R9C-1 > > and R9C-0. I haven't tried other R10 releases. > > Recompile: admctrl_srv > > admctrl_srv: function handle_info/2+2032: > > Internal consistency check failed - please report this bug. > > Instruction: {'%live',1} > > Error: unknown_catch_try_state: > > ./Admctrl_srv.erl:103: Warning: variable 'From' is unused > > Apart from the obvious bug I find the first warning message odd in > > that the 'a' in the module file name is an upper case 'a' and not a > > lower case 'a' as it actually is and also is written in the warnings > > following it... > > Is there any info in the error message about the row on which this > > occurs or do I have to try locate the row some other way? > > /Bj?rn Bylander > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From mfs@REDACTED Sun Jan 2 23:55:02 2005 From: mfs@REDACTED (Mark Scandariato) Date: Sun, 2 Jan 2005 17:55:02 -0500 (GMT-05:00) Subject: unknown_catch_try_state under R10B-2 Message-ID: <7207126.1104706502374.JavaMail.root@wamui10.slb.atl.earthlink.net> This works: catch begin foo() end, and so does this: catch begin State#state{foo = bar} end, but this crashes in beam_validator: catch begin foo(), State#state{foo = bar} end, Mark. -----Original Message----- From: Raimo Niskanen Sent: Jan 2, 2005 2:01 PM To: erlang-questions@REDACTED Subject: Re: unknown_catch_try_state under R10B-2 It seems to be a bug in the beam_validator module (compiler internal). It is a new post-processing pass that checks the generated code to see if the compiler messed up some optimization and produced unsafe code. It has been tested on most code we had available, but obviously not all code in the world. We will have a look at this problem after the christmas vacations. Thank you for reducing the bug for us. To find exactly what went wrong you will have to compile with the -S switch to get a .beam assembly listing, then read and understand it. If you have to get forward sooner you can probably work around the bug with a slight rewrite of the code. The validator seems to have problems with a catch statement. It might be the parenthesis around "catch begin ... end", or the "begin ... end" in a catch. That is the only thing that looks a bit odd. OK, the "case ok of _ -> ... end" also looks a bit odd so it might be the catch in such a statement... Nevertheless we will locate this bug sooner or later. bjorn@REDACTED (Bj?rn Bylander) writes: > I've reduced the incorrect code to this: > > -module(foomod). > -export([handle_info/2]). > -record(state, { foo = undefined }). > > handle_info({_}, State) -> > foo(), > State#state{foo = bar}, > case ok of > _ -> > case catch foo() of > ok -> > {stop, State} > end > end; > > handle_info(_, State) -> > (catch begin > foo(), > State#state{foo = bar} > end), > case ok of > _ -> > case catch foo() of > ok -> > {stop, State} > end > end. > > foo() -> ok. > > On 2004-12-27 21:48, Bj?rn Bylander wrote: > > I get the following output from make:all([load]) with R10B-2 under > > Windows. The module (admctrl_srv.erl) compiles fine under R9C-2, > > R9C-1 > > and R9C-0. I haven't tried other R10 releases. > > Recompile: admctrl_srv > > admctrl_srv: function handle_info/2+2032: > > Internal consistency check failed - please report this bug. > > Instruction: {'%live',1} > > Error: unknown_catch_try_state: > > ./Admctrl_srv.erl:103: Warning: variable 'From' is unused > > Apart from the obvious bug I find the first warning message odd in > > that the 'a' in the module file name is an upper case 'a' and not a > > lower case 'a' as it actually is and also is written in the warnings > > following it... > > Is there any info in the error message about the row on which this > > occurs or do I have to try locate the row some other way? > > /Bj?rn Bylander > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From casper2000a@REDACTED Mon Jan 3 08:31:48 2005 From: casper2000a@REDACTED (Casper) Date: Mon, 3 Jan 2005 13:31:48 +0600 Subject: Mnesia and Memory question In-Reply-To: <7207126.1104706502374.JavaMail.root@wamui10.slb.atl.earthlink.net> Message-ID: Hi All, Wish all of you a Happy and Tsunami Free New year!!! I'm currently studying Erlang Mnesia database. Could any of you please advice me regarding below questions? 1. When I created disc_copies table, the full table resides in the memory as well. Due to this, if I load about millions of records, the memory utilization is far too great (few Giga bytes). For a HLR, SMSC kind of system, is this a good practice? 2. Is there anyway to limit the usage of memory and let the rest keep in the Disk? For example the latest loaded pages worth 600MB in memory only. 3. For the above (1) kind of application, is Mnesia good? Any advice you can give to make it efficient? 4. To maintain CDRs, can I use disc_only tables of Mnedia? Thanks in advance! Cheers, Eranga From rvg@REDACTED Mon Jan 3 09:03:51 2005 From: rvg@REDACTED (Rudolph van Graan) Date: Mon, 3 Jan 2005 10:03:51 +0200 (SAST) Subject: Mnesia and Memory question In-Reply-To: References: Message-ID: Hi Casper, some suggestions below > I'm currently studying Erlang Mnesia database. Could any of you please > advice me regarding below questions? > > 1. When I created disc_copies table, the full table resides in the memory as > well. Due to this, if I load about millions of records, the memory > utilization is far too great (few Giga bytes). For a HLR, SMSC kind of > system, is this a good practice? As you've pointed out, use disc_only tables for this. > 4. To maintain CDRs, can I use disc_only tables of Mnedia? In my experience, it is best to keep this type of data externally (In a standard SQL database). The reason for this is that most queries (as in mnemosyne or select in mnesia) result in a table scan that usually reads every record. It *is* possible to define indices, but they are rarely as efficient as a dedicated databases. We have experimented with the logging of CDR's in mnesia, postgresql and mysql. Of these, we've had the best results with mysql, requiring almost no maintenance and highest uptime. We've used the erlang ODBC application as interface, running Gentoo linux. Hope that this helps :) Regards, Rudolph van Graan Pattern Matched Technologies http://www.patternmatched.com From mickael.remond@REDACTED Mon Jan 3 18:25:22 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Mon, 03 Jan 2005 18:25:22 +0100 Subject: Funny discovery in the Java world Message-ID: <41D98002.1060200@erlang-fr.org> Hello, I thought that you might like to read this article: Unbreakable Java: A Java Server That Never Goes Down Which is covered on Slashdot: http://developers.slashdot.org/article.pl?sid=05/01/03/1434213&tid=108&tid=156&tid=218 Here is a little teaser from the article: "The key to understanding robust Java is isolation, isolation, and isolation. Robust applications, especially robust application servers, require a high level of isolation between users. It's not acceptable that an error occurring while processing one user's request may affect all users connected to the system. The complexity of software systems makes it impossible to develop software that is completely free of errors, so errors will always happen. Only isolation can provide real robustness by limiting the impact of errors." Looks a lot like if they are going to discover Erlang very soon. Happy new year ! -- Micka?l R?mond http://www.erlang-projects.org/ From mats.cronqvist@REDACTED Mon Jan 3 19:16:42 2005 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Mon, 03 Jan 2005 19:16:42 +0100 Subject: Funny discovery in the Java world In-Reply-To: <41D98002.1060200@erlang-fr.org> References: <41D98002.1060200@erlang-fr.org> Message-ID: <41D98C0A.8030902@ericsson.com> Mickael Remond wrote: >[...] > > Looks a lot like if they are going to discover Erlang very soon. > methinks you should substitute "reinvent" for "discover"... From valentin@REDACTED Mon Jan 3 19:59:32 2005 From: valentin@REDACTED (Valentin Micic) Date: Mon, 3 Jan 2005 20:59:32 +0200 Subject: Mnesia and Memory question References: Message-ID: <003701c4f1c6$5caf7dc0$0100a8c0@MONEYMAKER2> > > 1. When I created disc_copies table, the full table resides in the memory as > well. Due to this, if I load about millions of records, the memory > utilization is far too great (few Giga bytes). For a HLR, SMSC kind of > system, is this a good practice? > HLR "kind of application" does not operate on huge sets of data, but consist of series of specific lookups. In my experience a disk_only_copy may be a reasonably good fit as well. > 2. Is there anyway to limit the usage of memory and let the rest keep in the > Disk? For example the latest loaded pages worth 600MB in memory only. > Not out of the box... at one stage I've been developing an ETS-based table cache, that relied on key collision and hashing to limit the size of ets table (i.e. use size of the table as the RANGE argument in erlang:phash/2). I had reasonably good results, but then after disconvering that disc_only_copy was fast enough, I gave up -- there were few chalenges, i.e. how to provide simple replication and synchronisation between remote table copies and local cache. > > 4. To maintain CDRs, can I use disc_only tables of Mnedia? > That depends on what do you mean by maintenance... if you think of CDR logging, I'd say, use disk_log instead. We're doing it and we're quite happy with it. If you wan CDRs for analysys, then collect them into a disk_log, and periodically move into MNESIA (or some relational database, if you must ;-). Valentin. From casper2000a@REDACTED Tue Jan 4 04:57:26 2005 From: casper2000a@REDACTED (Casper) Date: Tue, 4 Jan 2005 09:57:26 +0600 Subject: Mnesia and Memory question In-Reply-To: <003701c4f1c6$5caf7dc0$0100a8c0@MONEYMAKER2> Message-ID: Hi all, Thanks for your replies. Those help me a lot. Cheers, Eranga -----Original Message----- From: Valentin Micic [mailto:valentin@REDACTED] Sent: Tuesday, January 04, 2005 1:00 AM To: Casper; erlang-questions@REDACTED Subject: Re: Mnesia and Memory question > > 1. When I created disc_copies table, the full table resides in the memory as > well. Due to this, if I load about millions of records, the memory > utilization is far too great (few Giga bytes). For a HLR, SMSC kind of > system, is this a good practice? > HLR "kind of application" does not operate on huge sets of data, but consist of series of specific lookups. In my experience a disk_only_copy may be a reasonably good fit as well. > 2. Is there anyway to limit the usage of memory and let the rest keep in the > Disk? For example the latest loaded pages worth 600MB in memory only. > Not out of the box... at one stage I've been developing an ETS-based table cache, that relied on key collision and hashing to limit the size of ets table (i.e. use size of the table as the RANGE argument in erlang:phash/2). I had reasonably good results, but then after disconvering that disc_only_copy was fast enough, I gave up -- there were few chalenges, i.e. how to provide simple replication and synchronisation between remote table copies and local cache. > > 4. To maintain CDRs, can I use disc_only tables of Mnedia? > That depends on what do you mean by maintenance... if you think of CDR logging, I'd say, use disk_log instead. We're doing it and we're quite happy with it. If you wan CDRs for analysys, then collect them into a disk_log, and periodically move into MNESIA (or some relational database, if you must ;-). Valentin. From casper2000a@REDACTED Tue Jan 4 05:58:45 2005 From: casper2000a@REDACTED (Casper) Date: Tue, 4 Jan 2005 10:58:45 +0600 Subject: Gen_server and Gen_fsm questions In-Reply-To: Message-ID: Hi All, It's me again with a list of questions. Gen_server: 1) Does gen_server execute code synchronously? 2) Even though gen_server Cast is a asynchronous request, in terms of Gen_server, it's synchronous code execution, right? 3) So if I need to process things in parallel in the server side, how can I do it? 4) Then what happens to the Gen_server State, if parallel execution can happen? Gen_Fsm: 1) As I can see Gen_fsm starts its own process for each state machine. 2) Because of that if I use Gen_fsm to maintain Call (Telecom switch or PBX kind of system) handling, for each Call a new process starts. 3) Is this a good method? 4) Or rather should I use an Erlang Dict to have Call Circuit State machines and update each machine in every call event? All of above are not questions, some are statements. If you can advice me in terms of Best Erlang Practice, I really appreciate. Also I wonder if any of you out there, who has done Telecom platforms in Erlang, is willing to provide consultation to me. Thanks in advance! Eranga From vances@REDACTED Tue Jan 4 08:27:07 2005 From: vances@REDACTED (Vance Shipley) Date: Tue, 4 Jan 2005 02:27:07 -0500 Subject: Gen_server and Gen_fsm questions In-Reply-To: References: Message-ID: <20050104072707.GA67691@frogman.motivity.ca> On Tue, Jan 04, 2005 at 10:58:45AM +0600, Casper wrote: } } Gen_server: } 1) Does gen_server execute code synchronously? It processes a request until the handler returns. In a simple case the handler returns {reply, Reply, State} and then the client's call to gen_server:call/2 returns Reply. It can have multiple requests outstanding however by returning {noreply, State} in which case the vlient's call to gen_server:call/2 doesn't return. At some point later the gen_server process calls gen_server:reply/2 to cause the clients call to return a reply. } 2) Even though gen_server Cast is a asynchronous request, in terms of } Gen_server, it's synchronous code execution, right? The gen_server process still exicutes it's handler in the same way however the client's call to gen_server:cast/2 returns immediately. } 3) So if I need to process things in parallel in the server side, how can I } do it? By having the gen_server process spawn a new process to carry out the task in it's handler and return {noreply, State}. Later when the worker process finishes it sends the result to the gen_server process which uses gen_server:reply/2 to send the reply to the client. -behaviour(gen_server). init(_) -> {ok, gb_trees:empty()}. handle_call({request, time}, From, State) -> Server = self(), F = fun() -> gen_server:cast(Server, {result, self(), time()}) end, {noreply, gb_trees:insert(proc_lib:spawn(F), From, State)}. handle_cast({result, Pid, Result}, State) -> From = gb_trees:get(Pid, State), gen_server:reply(From, Result), {noreply, gb_trees:delete(Pid, State)}. 1> {ok, S} = gen_server:start_link(async_server, [], []). {ok,<0.36.0>} 2> gen_server:call(S, {request, time}). {7,21,32} } 4) Then what happens to the Gen_server State, if parallel execution can } happen? Well there is no parallel execution so there is only one state. You will want to use the State to keep track of the outstanding replies you still need to send and anything else you need to complete them. In the example above I use a gb_tree to keep an entry for each pid() started and store the From value needed to send the reply. } Gen_Fsm: } 1) As I can see Gen_fsm starts its own process for each state machine. It's no different a gen_server in this regard. } 2) Because of that if I use Gen_fsm to maintain Call (Telecom switch or PBX } kind of system) handling, for each Call a new process starts. You start a gen_fsm the same way you start a gen_server. } 3) Is this a good method? Yes, one process for each concurrent activity. It is common to use two processes for a call, one for each side; incoming and outgoing. } 4) Or rather should I use an Erlang Dict to have Call Circuit State machines } and update each machine in every call event? No. Use processes as the main building block. -Vance From casper2000a@REDACTED Tue Jan 4 08:54:38 2005 From: casper2000a@REDACTED (Casper) Date: Tue, 4 Jan 2005 13:54:38 +0600 Subject: Gen_server and Gen_fsm questions In-Reply-To: <20050104072707.GA67691@frogman.motivity.ca> Message-ID: Hi Vance, Thanks a lot for your advice. Gen_server: Ahh... that's a clever method you explained. Gen_fsm: If I have one/two process for each call, then if I maintain let's say 100,000 simultaneous calls, I will have to create 200,000 gen_fsm, ie. Processes. Is that a Good method? Will that create unnecessary system overhead? Cheers, Eranga -----Original Message----- From: Vance Shipley [mailto:vances@REDACTED] Sent: Tuesday, January 04, 2005 1:27 PM To: Casper Cc: erlang-questions@REDACTED Subject: Re: Gen_server and Gen_fsm questions On Tue, Jan 04, 2005 at 10:58:45AM +0600, Casper wrote: } } Gen_server: } 1) Does gen_server execute code synchronously? It processes a request until the handler returns. In a simple case the handler returns {reply, Reply, State} and then the client's call to gen_server:call/2 returns Reply. It can have multiple requests outstanding however by returning {noreply, State} in which case the vlient's call to gen_server:call/2 doesn't return. At some point later the gen_server process calls gen_server:reply/2 to cause the clients call to return a reply. } 2) Even though gen_server Cast is a asynchronous request, in terms of } Gen_server, it's synchronous code execution, right? The gen_server process still exicutes it's handler in the same way however the client's call to gen_server:cast/2 returns immediately. } 3) So if I need to process things in parallel in the server side, how can I } do it? By having the gen_server process spawn a new process to carry out the task in it's handler and return {noreply, State}. Later when the worker process finishes it sends the result to the gen_server process which uses gen_server:reply/2 to send the reply to the client. -behaviour(gen_server). init(_) -> {ok, gb_trees:empty()}. handle_call({request, time}, From, State) -> Server = self(), F = fun() -> gen_server:cast(Server, {result, self(), time()}) end, {noreply, gb_trees:insert(proc_lib:spawn(F), From, State)}. handle_cast({result, Pid, Result}, State) -> From = gb_trees:get(Pid, State), gen_server:reply(From, Result), {noreply, gb_trees:delete(Pid, State)}. 1> {ok, S} = gen_server:start_link(async_server, [], []). {ok,<0.36.0>} 2> gen_server:call(S, {request, time}). {7,21,32} } 4) Then what happens to the Gen_server State, if parallel execution can } happen? Well there is no parallel execution so there is only one state. You will want to use the State to keep track of the outstanding replies you still need to send and anything else you need to complete them. In the example above I use a gb_tree to keep an entry for each pid() started and store the From value needed to send the reply. } Gen_Fsm: } 1) As I can see Gen_fsm starts its own process for each state machine. It's no different a gen_server in this regard. } 2) Because of that if I use Gen_fsm to maintain Call (Telecom switch or PBX } kind of system) handling, for each Call a new process starts. You start a gen_fsm the same way you start a gen_server. } 3) Is this a good method? Yes, one process for each concurrent activity. It is common to use two processes for a call, one for each side; incoming and outgoing. } 4) Or rather should I use an Erlang Dict to have Call Circuit State machines } and update each machine in every call event? No. Use processes as the main building block. -Vance From vances@REDACTED Tue Jan 4 08:58:39 2005 From: vances@REDACTED (Vance Shipley) Date: Tue, 4 Jan 2005 02:58:39 -0500 Subject: Gen_server and Gen_fsm questions In-Reply-To: References: <20050104072707.GA67691@frogman.motivity.ca> Message-ID: <20050104075839.GD67691@frogman.motivity.ca> On Tue, Jan 04, 2005 at 01:54:38PM +0600, Casper wrote: } } Gen_fsm: } If I have one/two process for each call, then if I maintain let's say } 100,000 simultaneous calls, I will have to create 200,000 gen_fsm, ie. } Processes. Is that a Good method? Will that create unnecessary system } overhead? Eranga, It's fine. If there's 200K call terminations there are just that many concurrent activities and each should have it's own process. When you get hundreds of thousands running you might want to start tuning how memory is allocated but it's certainly not too many processes to handle. -Vance From fredrik.linder@REDACTED Tue Jan 4 10:10:02 2005 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Tue, 4 Jan 2005 10:10:02 +0100 Subject: Gen_server and Gen_fsm questions Message-ID: > On Tue, Jan 04, 2005 at 01:54:38PM +0600, Casper wrote: > } > } Gen_fsm: > } If I have one/two process for each call, then if I > maintain let's say > } 100,000 simultaneous calls, I will have to create 200,000 > gen_fsm, ie. > } Processes. Is that a Good method? Will that create > unnecessary system > } overhead? > > Eranga, > > It's fine. If there's 200K call terminations there are just that many > concurrent activities and each should have it's own process. When you > get hundreds of thousands running you might want to start tuning how > memory is allocated but it's certainly not too many processes > to handle. > > -Vance One thing you might want to look at is erlang:hybernate/3. If memory still is a problem you might want to store the call state on disk and kill the process while it is inactive and spawn a new that loads the state when it should become active. (If I don't remember incorrectly has Ulf written such a module for public use). /Fredrik From danie@REDACTED Tue Jan 4 10:43:02 2005 From: danie@REDACTED (danie@REDACTED) Date: Tue, 4 Jan 2005 11:43:02 +0200 (SAST) Subject: No subject Message-ID: <32894.196.37.144.113.1104831782.squirrel@www.erlfinsys.net> Some of the answers On Tue, 2005-01-04 at 10:58 +0600, Casper wrote: Hi All, > > It's me again with a list of questions. > > Gen_server: > 1) Does gen_server execute code synchronously? > 2) Even though gen_server Cast is a asynchronous request, in terms of > Gen_server, it's synchronous code execution, right? > 3) So if I need to process things in parallel in the server side, how can I > do it? > 4) Then what happens to the Gen_server State, if parallel execution can > happen? > > 1 & 2. This was one of the things that got me as well. A genserver will process sequentially - but globally (read "in the big system") the other process that made the cast can asyncronously continue to process. By having many "seperate processes" you obtain the asyncronous processing. Quite a clever idea from the ericson guys - call - I will stand and wait for an answer - cast - here is the job do it while I go off and do something else 3. Multiple processes or gen servers. Having multiple "processing streams" this can be done with a gen_server spawning new gen_servers as "workers" as part of a nice supervision tree. Example: Server accepting client connections - for each connection - spawn a new gen_server - this gen_server "worker" will process all requests in sequence whether this is call or cast - but for another client connection - spawn a seperate gen_server "worker" which will process independently and in "parallel" to the first gen_server "worker" 4. The state is per gen_server - depending on your needs - I see the state as a whiteboard where I keep "notes" on what is happening in the gen_server - if you need inter gen_server communication then work through a "parent" gen_server that tracks the children and that informs you of the location (pid) of the other processes. For the answers below I am not a telco guy, yet! just use some of their methods. Gen_Fsm: > 1) As I can see Gen_fsm starts its own process for each state machine. > 2) Because of that if I use Gen_fsm to maintain Call (Telecom switch or PBX > kind of system) handling, for each Call a new process starts. > 3) Is this a good method? > 4) Or rather should I use an Erlang Dict to have Call Circuit State machines > and update each machine in every call event? > > All of above are not questions, some are statements. If you can advice me in > terms of Best Erlang Practice, I really appreciate. > > Also I wonder if any of you out there, who has done Telecom platforms in > Erlang, is willing to provide consultation to me. > > Thanks in advance! > Eranga > > > > -- Danie Schutte Erlang Financial Systems From joe.armstrong@REDACTED Tue Jan 4 11:16:26 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Tue, 4 Jan 2005 11:16:26 +0100 Subject: Gen_server and Gen_fsm questions Message-ID: > If I have one/two process for each call, then if I maintain let's say > 100,000 simultaneous calls, I will have to create 200,000 gen_fsm, ie. > Processes. Yes > Is that a Good method? Yes > Will that create unnecessary system overhead? No It's exactly the right way to think. You have to get used to thinking in terms of processes - creating processes is a light-weight operation (this means you can create lot's of them very quickly). No you might run into memory problems - I don't know what the minimum size of a process is but let's guess 1KB - so your 200 K process might take 200M of memory and that might be a problem. But suppose you were to do it some other way - suppose you "suspend" a process when it's not doing anything useful - you have to store it's data structures somewhere - you have to make it go away, store it's data structures, then at a later stage wake it up and restore it's data structures etc. All of this takes lots of unnecessary code and there's no guarantee that it's quicker. Even storing the data structures required by suspended processes takes space so doing this might not be a good idea. The Erlang "way" is to identify all the truly parallel activities in your application and then assign exactly ONE process per activity. (The exactly ONE bit is important) - this makes the code isomorphic to the problem - and easy to write understand and debug. So first you do as I have suggested - THEN you measure and possibly optimise. First make it right - then make it fast. Happy new Year From casper2000a@REDACTED Tue Jan 4 13:24:59 2005 From: casper2000a@REDACTED (Casper) Date: Tue, 4 Jan 2005 18:24:59 +0600 Subject: Gen_server and Gen_fsm questions In-Reply-To: Message-ID: Hi Joe, Wish you a happy new year too. And thanks a lot for your valuable advice. I have a BIG picture. A picture of a common platform, very generalized, which has Telecom applications such as SMSC, IVR, Prepaid, HLR, SCP, etc as pluggable modules (or applications). One module to handle ISUP Call control, one module for IVR functions, one for Prepaid functions, one for TCAP, one for SMS handling, one OAM, etc., distributed and having full redundancy. I'm kind of tired by doing various platforms in various languages and platforms. MMSC runs on any, since it's done using Java, SMSC on Linux C/C++, IVR on Win32 VC, etc. These developments are started in different levels/times, so has not come under one platform. Also maintenance and debugging takes a lot of time. DBMS is not giving the required transaction speed, etc. So I want all of them to come under one platform, and I'm getting very much convinced, under Erlang/OTP platform. I know it'll be difficult to start, but I'm sure it's worth doing. So at the moment I'm investigating the architectures of other platforms developed using Erlang. It's kind of hard to find any good documentation of such a system. If any of you can give me any advice/reference materials regarding above discussion, I greatly appreciate. Thanks! Eranga -----Original Message----- From: Joe Armstrong (AL/EAB) [mailto:joe.armstrong@REDACTED] Sent: Tuesday, January 04, 2005 4:16 PM To: 'Casper'; 'Vance Shipley' Cc: erlang-questions@REDACTED Subject: RE: Gen_server and Gen_fsm questions > If I have one/two process for each call, then if I maintain let's say > 100,000 simultaneous calls, I will have to create 200,000 gen_fsm, ie. > Processes. Yes > Is that a Good method? Yes > Will that create unnecessary system overhead? No It's exactly the right way to think. You have to get used to thinking in terms of processes - creating processes is a light-weight operation (this means you can create lot's of them very quickly). No you might run into memory problems - I don't know what the minimum size of a process is but let's guess 1KB - so your 200 K process might take 200M of memory and that might be a problem. But suppose you were to do it some other way - suppose you "suspend" a process when it's not doing anything useful - you have to store it's data structures somewhere - you have to make it go away, store it's data structures, then at a later stage wake it up and restore it's data structures etc. All of this takes lots of unnecessary code and there's no guarantee that it's quicker. Even storing the data structures required by suspended processes takes space so doing this might not be a good idea. The Erlang "way" is to identify all the truly parallel activities in your application and then assign exactly ONE process per activity. (The exactly ONE bit is important) - this makes the code isomorphic to the problem - and easy to write understand and debug. So first you do as I have suggested - THEN you measure and possibly optimise. First make it right - then make it fast. Happy new Year From joe.armstrong@REDACTED Tue Jan 4 14:37:53 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Tue, 4 Jan 2005 14:37:53 +0100 Subject: Thought of the day: was RE: Gen_server and Gen_fsm questions Message-ID: Great - I like BIG pictures - wide-screen surround sound - the works give it to me ... On my way to work I was thinking about Remote Procedure Calls (RPC's) and !! and HTTP and SIP and all that kind of stuff. Why are there so many *different* formats and ways of doing the *same* thing? I think we should use ONE format for everything - bear with me and I'll try to explain: Firstly, what is an RPC? In Erlang to do and RPC you send something a message and wait for a reply. rpc(Pid, Q) -> Pid ! {self(), Q}, receive {Pid, Reply} -> Reply end. How do you do this in http? The URL: "http://www.erlang.org/index.html" is a neat way of saying "open port 80 on the host www.erlang.org then send a GET HTTP 1.0 ... request to port 80 and wait for a reply" ie "http://www.erlang.org/index.html" serves to name an RPC, it's very neat since it manages to say several things in one simple string. Now let's imagine an Erlang equivalent: What might: "http://www.erlang.org/Mod/Func?Arg1=val1&Arg2=Val2" mean? Let's interpret this as: Go to port 80 on www.erlang.org and write a GET Mod/Fun?Arg1=Val1& ... string to the port. What does the server do? - Yes - evaluate Mod:Func(Args) ... assume this returns a term T - then convert this to a binary and send it back with a mime type text/erlangBinterm. Now suppose I want to make "something like email" based on http - easy! define a URL like "http://www.erlang.org/mail/deliver&who=joe&subject=mail...." To mean "deliver mail to joe ...." Now structure your software like this: HTTP GET ... +--------+ {[mail,deliver],[{"ho","joe"}]} +--------+ ---->------------| driver |-------->--------------------------| server | +--------+ +--------+ The driver does HTTP packet reassembly etc - it parses the request into a normalised Erlang term and sends it to the server. Why go to all this trouble? Suppose we change transport medium - to FTP "ftp://joe@REDACTED/mail/deliver&who=joe&subject=mail...." Again this has to be interpreted and parsed, so we add a new front-end HTTP GET ... +--------+ {[mail,deliver],[{"ho","joe"}]} +--------+ ---->------------| driver |-------->---+-----------------------| server | +--------+ | +--------+ | FTP put request +--------+ | ----->-----------| driver |----->------+ +--------+ Now the back-end server only understands Erlang message - the drivers turn these messages into HTTP, or FTP or whatever is the flavour of the day (even XML RPC) What we have to recognise is that all these different syntaxes are just different ways of doing an RPC. RPC format 1 +---------+ Universal term format +--------+ ---->------------| driver1 |-------->---+-----------------------| server | +---------+ | +--------+ | RPC format 2 +---------+ | ----->-----------| driver2 |----->------+ +---------+ | | RPC format 3 +---------+ | ----->-----------| driver3 |----->------+ +---------+ Now why people get all excited about the different formats (XML-RCP, SOAP, HTTP, FTP, sun-rpc) etc. is beyond me - THEY ARE ALL JUST DIFFERENT SYNTAXES FOR RPCs. Whether you fetch a file with HTTP or FTP or rcp or XML-RPC is *irrelevant* the semantics "fetching a file" is identical. Still with me? - good. Let's generalise P://H/Function?Args means 1) let's use a Protocol called P 2) To talk to a host H 3) and tell it to do Function with arguments 4) Args That's why it's a very nice notation (4 things in one string) How do we find H? - there are three alternative. 1) If *is* the server hostname then use DNS 2) If H contains no hostname use a distributed hash table (chord, pastry, DKS, CAN etc) 3) If H is a mixture of a server name and a key use SIP To do 1) you need to own some DNMS domain that you can easily modify 2) is research - they are no public name severs (or am I wrong?). 3) Implies a SIP proxy at a fixed hostname. Given name@REDACTED the host bit can be resolved by DNS and the name bit can be resolved by a SIP server at host. So here's an idea: Lets define a new URL (or is it a URI - I can never remember) erl://name@REDACTED/Mod/Func?arg1=val1&arg2=val2 To mean something like: use SIP to locate a joe@REDACTED, open a socket to an Erlang server on this machine and send it the message {rpc, From, "Mod/Func", [{"arg1","val1"}..}]} SIP stands for "session initiation protocol" - I assume the designers of SIP were thinking of "Erlang sessions". I guess SIP is really just "a rather complicated way of connecting two Erlang processes together" - once you've done this then the processes can get on with the real job of "doing something useful." This is, of course, the tricky bit - discussing syntax (should we use XML, HTTP, FTP, SIP, DNS, SOAP) distracts attention away from semantics (what should we do with this stuff). The former question usually attracts much more attention than the latter :-) Cheers /Joe -----Original Message----- From: Casper [mailto:casper2000a@REDACTED] Sent: den 4 januari 2005 13:25 To: Joe Armstrong (AL/EAB); 'Vance Shipley' Cc: erlang-questions@REDACTED Subject: RE: Gen_server and Gen_fsm questions Hi Joe, Wish you a happy new year too. And thanks a lot for your valuable advice. I have a BIG picture. A picture of a common platform, very generalized, which has Telecom applications such as SMSC, IVR, Prepaid, HLR, SCP, etc as pluggable modules (or applications). One module to handle ISUP Call control, one module for IVR functions, one for Prepaid functions, one for TCAP, one for SMS handling, one OAM, etc., distributed and having full redundancy. I'm kind of tired by doing various platforms in various languages and platforms. MMSC runs on any, since it's done using Java, SMSC on Linux C/C++, IVR on Win32 VC, etc. These developments are started in different levels/times, so has not come under one platform. Also maintenance and debugging takes a lot of time. DBMS is not giving the required transaction speed, etc. So I want all of them to come under one platform, and I'm getting very much convinced, under Erlang/OTP platform. I know it'll be difficult to start, but I'm sure it's worth doing. So at the moment I'm investigating the architectures of other platforms developed using Erlang. It's kind of hard to find any good documentation of such a system. If any of you can give me any advice/reference materials regarding above discussion, I greatly appreciate. Thanks! Eranga -----Original Message----- From: Joe Armstrong (AL/EAB) [mailto:joe.armstrong@REDACTED] Sent: Tuesday, January 04, 2005 4:16 PM To: 'Casper'; 'Vance Shipley' Cc: erlang-questions@REDACTED Subject: RE: Gen_server and Gen_fsm questions > If I have one/two process for each call, then if I maintain let's say > 100,000 simultaneous calls, I will have to create 200,000 gen_fsm, ie. > Processes. Yes > Is that a Good method? Yes > Will that create unnecessary system overhead? No It's exactly the right way to think. You have to get used to thinking in terms of processes - creating processes is a light-weight operation (this means you can create lot's of them very quickly). No you might run into memory problems - I don't know what the minimum size of a process is but let's guess 1KB - so your 200 K process might take 200M of memory and that might be a problem. But suppose you were to do it some other way - suppose you "suspend" a process when it's not doing anything useful - you have to store it's data structures somewhere - you have to make it go away, store it's data structures, then at a later stage wake it up and restore it's data structures etc. All of this takes lots of unnecessary code and there's no guarantee that it's quicker. Even storing the data structures required by suspended processes takes space so doing this might not be a good idea. The Erlang "way" is to identify all the truly parallel activities in your application and then assign exactly ONE process per activity. (The exactly ONE bit is important) - this makes the code isomorphic to the problem - and easy to write understand and debug. So first you do as I have suggested - THEN you measure and possibly optimise. First make it right - then make it fast. Happy new Year From Marc.Vanwoerkom@REDACTED Tue Jan 4 15:51:37 2005 From: Marc.Vanwoerkom@REDACTED (Marc van Woerkom) Date: Tue, 04 Jan 2005 15:51:37 +0100 Subject: Thought of the day: was RE: Gen_server and Gen_fsm questions In-Reply-To: Message-ID: >On my way to work I was thinking about Remote Procedure >Calls (RPC's) > and !! and HTTP and SIP and all that kind of stuff. > >Why are there so many *different* formats and ways of >doing the *same* thing? * At some point it is probably the "not invented here" syndrome * a HTTP call is easier than RPC (which requires you to know C), and ASCII is easier than BINARY, or? :-) * SOAP seems to be b*llsh*t, if it is just an RPC call transcribed into ASCII and served via HTTP to tunnel the pesky firewalls. However one hope behind using XML in RPCs was to document and enrich interfaces in such a way, that machine to machine communication (agents) are possible, I hope that is what those "semantic web" guys aim for The idea to stick to HTTP calls seems to appear on the O'Reilly emerging tech conference: "Just" Use HTTP Sam Ruby, Senior Technical Staff Member, Emerging Technologies Group, IBM http://conferences.oreillynet.com/cs/et2005/view/e_sess/5968 Regards, Marc From vances@REDACTED Tue Jan 4 16:01:37 2005 From: vances@REDACTED (Vance Shipley) Date: Tue, 4 Jan 2005 10:01:37 -0500 Subject: Thought of the day: was RE: Gen_server and Gen_fsm questions In-Reply-To: References: Message-ID: <20050104150137.GG72413@frogman.motivity.ca> Joe, I've spent a lot of time in the last year and a half with the OSI protocols for telecom. The RPC is TCAP which is based on ROSE. It can be quite a but more complicated than you describe. ROSE supports things like: - selecting a specific application (beyond a 1:1 mapping with port) - dynamic negotiation of protocol encoding - an ongoing dialogue (e.g. request->,<-request,reply->,<-reply) - corelation between transactions - timers, aborts, rejects, etc. My experience in protocol interworking tells me that to have full interoperability you need to support the capabilities of the most complex protocol in your interworking protocol. So you would need to make a list of all the RPCs which would be supported and work back from there building a new Erlang term based protocol which would handle interworking. Not that I expect this to happen. I do have this related suggestion: In OSI protocols like those within the SS7 protocol suite (MTP, SCCP, TCAP, MAP, etc.) the specifications define the service access points between layers using "service primitives". These are conceptual devices and do not specify a particular form (e.g. a C structure argument to a function call, a socket based RPC, etc.). What they do define is the purpose of the message, the possible senders and receivers and the mandatory and optional parameters. The parameters have a defined encoding but how they are packaged to form a service primitive is an implementation matter. I have chosen the following form: SAP ! {Layer, GenericName, SpecificName, Parameters} Layer = 'MTP' | 'SCCP' | 'N' | 'TR' | 'TC' | 'MAP' GenericName = atom() specific to protocol SpecificName = request | indication | response | confirmation Parameters = term() specific to message Service Access Points (SAP) should be implemented as erlang message sink/source points using these forms. This is a fairly obvious mapping actually. Examples from TCAP: TC-User -> TC-SAP {'TC', 'UNI', request, Parms} {'TC', 'BEGIN', request, Parms} {'TC', 'CONTINUE', request, Parms} {'TC', 'END', request, Parms} {'TC', 'U-ABORT', request, Parm TC-SAP -> TC-User {'TC', 'UNI', indication, Parms} {'TC', 'BEGIN', indication, Parms} {'TC', 'END', indication, Parms} {'TC', 'NOTICE', indication, Parms} {'TC', 'U-ABORT', indication, Parms} {'TC', 'P-ABORT', indication, Parms} Now if whoever is working on another peice of this puzzle uses the same form of service primitives we can have nicely interoperable protocol applications. :) -Vance From casper2000a@REDACTED Tue Jan 4 19:02:40 2005 From: casper2000a@REDACTED (casper2000a@REDACTED) Date: Wed, 5 Jan 2005 00:02:40 +0600 Subject: Thought of the day: was RE: Gen_server and Gen_fsm questions In-Reply-To: References: Message-ID: <1104861760.41dada40b89c5@www.omnibis.com> Hi Joe, Good idea. Infact I like being generalization. One common protocol and use pluggable drivers to talk to out side world. But how can we do that? With the little experience I have, if I take a very simple example FTP, that have a lot of features that HTTP doesn't have. For example "resume broken download". All the protocols have their own different features from each other. With this in mind, if we have to develop a driver, it will again be a full server, for example FTP server not a FTP driver. The main problem here is, which part will handle the protocol logic? Since the the protocol between Driver and the Server is common, we cannot make the Server to have that logic. If the communication if basic request - response, we could easily do that. But as I can see, there're more than that. I may be looking at a wrong direction. But I am eager to follow up the progress in this thread. Cheers, Eranga Quoting \"Joe Armstrong (AL/EAB)\" : > Great - I like BIG pictures - wide-screen surround sound - the works give it to me ... On my way to work I was thinking about Remote Procedure Calls (RPC\'s) and !! and HTTP and SIP and all that kind of stuff. Why are there so many *different* formats and ways of doing the *same* thing? I think we should use ONE format for everything - bear with me and I\'ll try to explain: Firstly, what is an RPC? In Erlang to do and RPC you send something a message and wait for a reply. rpc(Pid, Q) -> Pid ! {self(), Q}, receive {Pid, Reply} -> Reply end. How do you do this in http? The URL: \"http://www.erlang.org/index.html\" is a neat way of saying \"open port 80 on the host www.erlang.org then send a GET HTTP 1.0 ... request to port 80 and wait for a reply\" ie \"http://www.erlang.org/index.html\" serves to name an RPC, it\'s very neat since it manages to say several things in one simple string. Now let\'s imagine an Erlang equivalent: What might: \"http://www.erlang.org/Mod/Func?Arg1=val1&Arg2=Val2\" mean? Let\'s interpret this as: Go to port 80 on www.erlang.org and write a GET Mod/Fun?Arg1=Val1& ... string to the port. What does the server do? - Yes - evaluate Mod:Func(Args) ... assume this returns a term T - then convert this to a binary and send it back with a mime type text/erlangBinterm. Now suppose I want to make \"something like email\" based on http - easy! define a URL like \"http://www.erlang.org/mail/deliver&who=joe&subject=mail....\" To mean \"deliver mail to joe ....\" Now structure your software like this: HTTP GET ... +--------+ {[mail,deliver],[{\"ho\",\"joe\"}]} +--------+ ---->------------| driver |-------->--------------------------| server | +--------+ +--------+ The driver does HTTP packet reassembly etc - it parses the request into a normalised Erlang term and sends it to the server. Why go to all this trouble? Suppose we change transport medium - to FTP \"ftp://joe@REDACTED/mail/deliver&who=joe&subject=mail....\" Again this has to be interpreted and parsed, so we add a new front-end HTTP GET ... +--------+ {[mail,deliver],[{\"ho\",\"joe\"}]} +--------+ ---->------------| driver |-------->---+-----------------------| server | +--------+ | +--------+ | FTP put request +--------+ | ----->-----------| driver |----->------+ +--------+ Now the back-end server only understands Erlang message - the drivers turn these messages into HTTP, or FTP or whatever is the flavour of the day (even XML RPC) What we have to recognise is that all these different syntaxes are just different ways of doing an RPC. RPC format 1 +---------+ Universal term format +--------+ ---->------------| driver1 |-------->---+-----------------------| server | +---------+ | +--------+ | RPC format 2 +---------+ | ----->-----------| driver2 |----->------+ +---------+ | | RPC format 3 +---------+ | ----->-----------| driver3 |----->------+ +---------+ Now why people get all excited about the different formats (XML-RCP, SOAP, HTTP, FTP, sun-rpc) etc. is beyond me - THEY ARE ALL JUST DIFFERENT SYNTAXES FOR RPCs. Whether you fetch a file with HTTP or FTP or rcp or XML-RPC is *irrelevant* the semantics \"fetching a file\" is identical. Still with me? - good. Let\'s generalise P://H/Function?Args means 1) let\'s use a Protocol called P 2) To talk to a host H 3) and tell it to do Function with arguments 4) Args That\'s why it\'s a very nice notation (4 things in one string) How do we find H? - there are three alternative. 1) If *is* the server hostname then use DNS 2) If H contains no hostname use a distributed hash table (chord, pastry, DKS, CAN etc) 3) If H is a mixture of a server name and a key use SIP To do 1) you need to own some DNMS domain that you can easily modify 2) is research - they are no public name severs (or am I wrong?). 3) Implies a SIP proxy at a fixed hostname. Given name@REDACTED the host bit can be resolved by DNS and the name bit can be resolved by a SIP server at host. So here\'s an idea: Lets define a new URL (or is it a URI - I can never remember) erl://name@REDACTED/Mod/Func?arg1=val1&arg2=val2 To mean something like: use SIP to locate a joe@REDACTED, open a socket to an Erlang server on this machine and send it the message {rpc, From, \"Mod/Func\", [{\"arg1\",\"val1\"}..}]} SIP stands for \"session initiation protocol\" - I assume the designers of SIP were thinking of \"Erlang sessions\". I guess SIP is really just \"a rather complicated way of connecting two Erlang processes together\" - once you\'ve done this then the processes can get on with the real job of \"doing something useful.\" This is, of course, the tricky bit - discussing syntax (should we use XML, HTTP, FTP, SIP, DNS, SOAP) distracts attention away from semantics (what should we do with this stuff). The former question usually attracts much more attention than the latter :-) Cheers /Joe that set me off, so I\'ll try a quick summary. Get rid of proprietary formats/protocols etc. as soon as possible - use drivers to convert to a universal messaging format (Erlang terms). Write all your programs using the internal formats. Introduce a universal naming scheme for everything> -----Original Message----- From: Casper [mailto:casper2000a@REDACTED] Sent: den 4 januari 2005 13:25 To: Joe Armstrong (AL/EAB); \'Vance Shipley\' Cc: erlang-questions@REDACTED Subject: RE: Gen_server and Gen_fsm questions Hi Joe, Wish you a happy new year too. And thanks a lot for your valuable advice. I have a BIG picture. A picture of a common platform, very generalized, which has Telecom applications such as SMSC, IVR, Prepaid, HLR, SCP, etc as pluggable modules (or applications). One module to handle ISUP Call control, one module for IVR functions, one for Prepaid functions, one for TCAP, one for SMS handling, one OAM, etc., distributed and having full redundancy. I\'m kind of tired by doing various platforms in various languages and platforms. MMSC runs on any, since it\'s done using Java, SMSC on Linux C/C++, IVR on Win32 VC, etc. These developments are started in different levels/times, so has not come under one platform. Also maintenance and debugging takes a lot of time. DBMS is not giving the required transaction speed, etc. So I want all of them to come under one platform, and I\'m getting very much convinced, under Erlang/OTP platform. I know it\'ll be difficult to start, but I\'m sure it\'s worth doing. So at the moment I\'m investigating the architectures of other platforms developed using Erlang. It\'s kind of hard to find any good documentation of such a system. If any of you can give me any advice/reference materials regarding above discussion, I greatly appreciate. Thanks! Eranga -----Original Message----- From: Joe Armstrong (AL/EAB) [mailto:joe.armstrong@REDACTED] Sent: Tuesday, January 04, 2005 4:16 PM To: \'Casper\'; \'Vance Shipley\' Cc: erlang-questions@REDACTED Subject: RE: Gen_server and Gen_fsm questions > If I have one/two process for each call, then if I maintain let\'s say > 100,000 simultaneous calls, I will have to create 200,000 gen_fsm, ie. > Processes. Yes > Is that a Good method? Yes > Will that create unnecessary system overhead? No It\'s exactly the right way to think. You have to get used to thinking in terms of processes - creating processes is a light-weight operation (this means you can create lot\'s of them very quickly). No you might run into memory problems - I don\'t know what the minimum size of a process is but let\'s guess 1KB - so your 200 K process might take 200M of memory and that might be a problem. But suppose you were to do it some other way - suppose you \"suspend\" a process when it\'s not doing anything useful - you have to store it\'s data structures somewhere - you have to make it go away, store it\'s data structures, then at a later stage wake it up and restore it\'s data structures etc. All of this takes lots of unnecessary code and there\'s no guarantee that it\'s quicker. Even storing the data structures required by suspended processes takes space so doing this might not be a good idea. The Erlang \"way\" is to identify all the truly parallel activities in your application and then assign exactly ONE process per activity. (The exactly ONE bit is important) - this makes the code isomorphic to the problem - and easy to write understand and debug. So first you do as I have suggested - THEN you measure and possibly optimise. First make it right - then make it fast. Happy new Year --------------This mail sent through OmniBIS.com-------------- From mscandar@REDACTED Tue Jan 4 20:18:44 2005 From: mscandar@REDACTED (Mark Scandariato) Date: Tue, 04 Jan 2005 14:18:44 -0500 Subject: Thought of the day: was RE: Gen_server and Gen_fsm questions In-Reply-To: <1104861760.41dada40b89c5@www.omnibis.com> References: <1104861760.41dada40b89c5@www.omnibis.com> Message-ID: <41DAEC14.9020809@cisco.com> The protocol drivers just map to . If a particular driver can't ask for a particular service, then there isn't a problem. If the server can't fulfill a particular request, it just says so. The protocol driver will have to deal with it (until the server is enhanced). That is, don't build into the driver the fact that the server can't do X - but be prepared to handle a reply of 'Not Yet'. Mark. casper2000a@REDACTED wrote: > Hi Joe, > > Good idea. Infact I like being generalization. One common protocol and use pluggable drivers to talk to > out side world. But how can we do that? > > With the little experience I have, if I take a very simple example FTP, that have a lot of features that > HTTP doesn't have. For example "resume broken download". All the protocols have their own > different features from each other. With this in mind, if we have to develop a driver, it will again be a > full server, for example FTP server not a FTP driver. The main problem here is, which part will handle > the protocol logic? Since the the protocol between Driver and the Server is common, we cannot > make the Server to have that logic. If the communication if basic request - response, we could easily > do that. But as I can see, there're more than that. > > I may be looking at a wrong direction. But I am eager to follow up the progress in this thread. > > Cheers, > Eranga > > > > > > > Quoting \"Joe Armstrong (AL/EAB)\" : > > > > Great - I like BIG pictures - wide-screen surround sound - the works > give it to me ... > > On my way to work I was thinking about Remote Procedure Calls (RPC\'s) > and !! and HTTP and SIP and all that kind of stuff. > > Why are there so many *different* formats and ways of doing the *same* > thing? > > I think we should use ONE format for everything - bear with me and I\'ll > try to explain: > > Firstly, what is an RPC? > > In Erlang to do and RPC you send something a message and wait for a reply. > > rpc(Pid, Q) -> > Pid ! {self(), Q}, > receive > {Pid, Reply} -> > Reply > end. > > How do you do this in http? > > The URL: \"http://www.erlang.org/index.html\" is a neat way of saying > \"open port 80 on the host www.erlang.org then send a GET HTTP 1.0 ... > request > to port 80 and wait for a reply\" > > ie \"http://www.erlang.org/index.html\" serves to name an RPC, it\'s very > neat since it > manages to say several things in one simple string. > > Now let\'s imagine an Erlang equivalent: > > What might: \"http://www.erlang.org/Mod/Func?Arg1=val1&Arg2=Val2\" mean? > > Let\'s interpret this as: > > Go to port 80 on www.erlang.org and write a GET Mod/Fun?Arg1=Val1& > ... > string to the port. > > What does the server do? - Yes - evaluate Mod:Func(Args) ... assume > this > returns a term T - then convert this to a binary and send it back with a > mime type > text/erlangBinterm. > > Now suppose I want to make \"something like email\" based on http - > easy! define a URL like > > \"http://www.erlang.org/mail/deliver&who=joe&subject=mail....\" > > To mean \"deliver mail to joe ....\" > > Now structure your software like this: > > HTTP GET ... +--------+ {[mail,deliver],[{\"ho\",\"joe\"}]} > +--------+ > ---->------------| driver |-------->--------------------------| server > | > +--------+ > +--------+ > > The driver does HTTP packet reassembly etc - it parses the request > into a normalised Erlang term and sends it to the server. > > Why go to all this trouble? > > Suppose we change transport medium - to FTP > > \"ftp://joe@REDACTED/mail/deliver&who=joe&subject=mail....\" > > Again this has to be interpreted and parsed, so we add a new > front-end > > > HTTP GET ... +--------+ {[mail,deliver],[{\"ho\",\"joe\"}]} > +--------+ > ---->------------| driver |-------->---+-----------------------| > server | > +--------+ | > +--------+ > | > FTP put request +--------+ | > ----->-----------| driver |----->------+ > +--------+ > > Now the back-end server only understands Erlang message - the drivers > turn these > messages into HTTP, or FTP or whatever is the flavour of the day (even XML > RPC) > > > What we have to recognise is that all these different syntaxes are > just different > ways of doing an RPC. > > > RPC format 1 +---------+ Universal term format > +--------+ > ---->------------| driver1 |-------->---+-----------------------| > server | > +---------+ | > +--------+ > | > RPC format 2 +---------+ | > ----->-----------| driver2 |----->------+ > +---------+ | > | > RPC format 3 +---------+ | > ----->-----------| driver3 |----->------+ > +---------+ > > Now why people get all excited about the different formats (XML-RCP, > SOAP, > HTTP, FTP, sun-rpc) etc. is beyond me - THEY ARE ALL JUST DIFFERENT > SYNTAXES > FOR RPCs. > > Whether you fetch a file with HTTP or FTP or rcp or XML-RPC is > *irrelevant* > the semantics \"fetching a file\" is identical. > > Still with me? - good. > > Let\'s generalise > > P://H/Function?Args > > means > 1) let\'s use a Protocol called P > 2) To talk to a host H > 3) and tell it to do Function with arguments > 4) Args > > That\'s why it\'s a very nice notation (4 things in one string) > > How do we find H? - there are three alternative. > > 1) If *is* the server hostname then use DNS > 2) If H contains no hostname use a distributed hash table (chord, > pastry, DKS, CAN etc) > 3) If H is a mixture of a server name and a key use SIP > > To do 1) you need to own some DNMS domain that you can easily modify > 2) is research - they are no public name severs (or am I wrong?). 3) > Implies a > SIP proxy at a fixed hostname. Given name@REDACTED the host bit can be > resolved by DNS > and the name bit can be resolved by a SIP server at host. > > So here\'s an idea: > > Lets define a new URL (or is it a URI - I can never remember) > > erl://name@REDACTED/Mod/Func?arg1=val1&arg2=val2 > > To mean something like: use SIP to locate a joe@REDACTED, open a socket > to an Erlang > server on this machine and send it the message {rpc, From, \"Mod/Func\", > [{\"arg1\",\"val1\"}..}]} > > SIP stands for \"session initiation protocol\" - I assume the designers > of > SIP were thinking of \"Erlang sessions\". I guess SIP is really just \"a > rather complicated > way of connecting two Erlang processes together\" - once you\'ve done this > then the > processes can get on with the real job of \"doing something useful.\" > > This is, of course, the tricky bit - discussing syntax (should we use > XML, HTTP, FTP, SIP, DNS, SOAP) distracts attention away from semantics > (what should we do with this stuff). > > The former question usually attracts much more attention than the > latter :-) > > Cheers > > /Joe > > that set me off, > so I\'ll try a quick summary. > > Get rid of proprietary formats/protocols etc. as soon as possible - use > drivers to > convert to a universal messaging format (Erlang terms). Write all your > programs using > the internal formats. Introduce a universal naming scheme for everything> > > -----Original Message----- > From: Casper [mailto:casper2000a@REDACTED] > Sent: den 4 januari 2005 13:25 > To: Joe Armstrong (AL/EAB); \'Vance Shipley\' > Cc: erlang-questions@REDACTED > Subject: RE: Gen_server and Gen_fsm questions > > > Hi Joe, > > Wish you a happy new year too. And thanks a lot for your valuable advice. > > I have a BIG picture. A picture of a common platform, very generalized, > which has Telecom applications such as SMSC, IVR, Prepaid, HLR, SCP, etc > as > pluggable modules (or applications). One module to handle ISUP Call > control, > one module for IVR functions, one for Prepaid functions, one for TCAP, one > for SMS handling, one OAM, etc., distributed and having full redundancy. > > I\'m kind of tired by doing various platforms in various languages and > platforms. MMSC runs on any, since it\'s done using Java, SMSC on Linux > C/C++, IVR on Win32 VC, etc. These developments are started in different > levels/times, so has not come under one platform. Also maintenance and > debugging takes a lot of time. DBMS is not giving the required transaction > speed, etc. So I want all of them to come under one platform, and I\'m > getting very much convinced, under Erlang/OTP platform. > > I know it\'ll be difficult to start, but I\'m sure it\'s worth doing. So at > the > moment I\'m investigating the architectures of other platforms developed > using Erlang. It\'s kind of hard to find any good documentation of such a > system. > > If any of you can give me any advice/reference materials regarding above > discussion, I greatly appreciate. > > Thanks! > Eranga > > > > > > > > -----Original Message----- > From: Joe Armstrong (AL/EAB) [mailto:joe.armstrong@REDACTED] > Sent: Tuesday, January 04, 2005 4:16 PM > To: \'Casper\'; \'Vance Shipley\' > Cc: erlang-questions@REDACTED > Subject: RE: Gen_server and Gen_fsm questions > > >>If I have one/two process for each call, then if I maintain let\'s say >>100,000 simultaneous calls, I will have to create 200,000 gen_fsm, ie. >>Processes. > > > Yes > > >>Is that a Good method? > > > Yes > > >>Will that create unnecessary system overhead? > > > No > > It\'s exactly the right way to think. > > You have to get used to thinking in terms of processes - creating > processes > is a light-weight operation (this means you can create lot\'s of them very > quickly). > > No you might run into memory problems - I don\'t know what the minimum size > of a process is > but let\'s guess 1KB - so your 200 K process might take 200M of memory and > that might > be a problem. > > But suppose you were to do it some other way - suppose you \"suspend\" a > process when it\'s not > doing anything useful - you have to store it\'s data structures somewhere - > you have to > make it go away, store it\'s data structures, then at a later stage wake it > up and > restore it\'s data structures etc. All of this takes lots of unnecessary > code > and there\'s no guarantee that it\'s quicker. > > Even storing the data structures required by suspended processes takes > space > so doing this might not be a good idea. > > The Erlang \"way\" is to identify all the truly parallel activities in your > application and then assign exactly ONE process per activity. (The exactly > ONE bit is important) - > this makes the code isomorphic to the problem - and easy to write > understand > and debug. > > So first you do as I have suggested - THEN you measure and possibly > optimise. > > First make it right - then make it fast. > > Happy new Year > > --------------This mail sent through OmniBIS.com-------------- From TFee@REDACTED Tue Jan 4 22:43:53 2005 From: TFee@REDACTED (Fee, Thomas) Date: Tue, 4 Jan 2005 13:43:53 -0800 Subject: gen_leader bug Message-ID: <345E735D5F93E046AAA7B8A88797E145BD3264@esignalmail.futuresource.com> Hello All, We have encountered a problem with gen_leader. All our servers died simultaneously. The bug is this: The function lexcompare returns one of: 'equal', 'less', or 'greater'. The function safe_loop calls lexcompare when it receives a 'capture' message from a server. Unfortunately, safe_loop only handles 'less' and 'greater' in the lexcompare returned result. Our server ran into a scenario when 'equal' was returned from lexcompare. Hence, the servers crashed. What should be done to fix this missing case clause problem? Thanks - - Thomas Fee DISCLAIMER: This message (including any files transmitted with it) may contain confidential and/or proprietary information, is the property of Interactive Data Corporation and/or its subsidiaries, and is directed only to the addressee(s). If you are not the designated recipient or have reason to believe you received this message in error, please delete this message from your system and notify the sender immediately. An unintended recipient's disclosure, copying, distribution, or use of this message or any attachments is prohibited and may be unlawful. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Kurt.Wilkin@REDACTED Wed Jan 5 03:37:16 2005 From: Kurt.Wilkin@REDACTED (Wilkin, Kurt) Date: Wed, 5 Jan 2005 15:37:16 +1300 Subject: Thought of the day: was RE: Gen_server and Gen_fsm questions Message-ID: <0398A76017ECA44E9FF4AB46FB885A2505B9DB@mail1w.fnzsl.com> on Wednesday, 5 January 2005 3:52 a.m. Marc van Woerkom wrote: > The idea to stick to HTTP calls seems to appear on the > O'Reilly emerging tech conference: > > "Just" Use HTTP > Sam Ruby, Senior Technical Staff Member, Emerging > Technologies Group, IBM > http://conferences.oreillynet.com/cs/et2005/view/e_sess/5968 > > Regards, > Marc It's not mentioned in that description, but that appears to be based on or at least stunningly similar to the REST architectural style, whose _style_ would fit very comfortably with some of the common Erlang approaches to RPC, and is interesting in its own right. Interestingly, REST also disagrees with the whole SOAP approach. >From http://rest.blueoxen.net/cgi-bin/wiki.pl : "REST suggests that what the Web got right is having a small, globally defined set of remote methods (HttpMethods: GET, POST, PUT, DELETE, etc) applied to any thing (specifically, any resource), because such a system allows a maximum number of otherwise uncoordinated actors to interoperate. No matter what web server you have, and no matter what web client I have, I know if I see a URI of yours like http://rest.blueoxen.net/, that I can retrieve the associated document using HTTP GET, with no advance co-ordination needed other than agreement on the relevant specs (which are already pervasively deployed)." Cheers, Kurt. -- This electronic message together with any attachments is confidential and intended for the named recipient's use only. If you are not the intended recipient (i) do not copy, disclose or use the contents in any way, (ii) please let us know by return email immediately then destroy the message, and any hard copies of the message, and any attachments. The sender of this message is not responsible for any changes made to this message and/or any attachments and/or connection linkages to the Internet referred to in this message after it has been sent. Unless otherwise stated, any pricing information given in this message and/or attachments is indicative only, is subject to change and does not constitute an offer to buy or sell securities or derivatives at any price quoted. Any reference to the terms of executed transactions should be treated as preliminary only and subject to separate formal written notification. Where reference is made to research material and/or research recommendations, the basis of the provision of such research material and/or recommendations is set out in the relevant disclaimer. From francesco@REDACTED Wed Jan 5 09:03:44 2005 From: francesco@REDACTED (Francesco Cesarini (Erlang Consulting)) Date: Wed, 05 Jan 2005 08:03:44 +0000 Subject: Erlang Statistics / Usage In-Reply-To: References: Message-ID: <41DB9F60.20601@erlang-consulting.com> The scripting, XML, and upside down logo are all compliments of Bill Gates. I had a simpler conversion program somewhere, but not on my laptop. I did however put a PDF copy on line as well. It is at http://www.erlang-consulting.com/erlangworkshop04/erlangstatistics.pdf Regards, Francesco -- http://www.erlang-consulting.com Roger Price wrote: > On Sat, 1 Jan 2005, Francesco Cesarini (Erlang Consulting) wrote: > > >>Slides/pdf are at http://www.erlang-consulting.com/erlangworkshop04/ > > > Is there an alternative address for those, like me, who have scripting > turned off as a security measure? A "no-frame" alternative would also be > very helpful. > > Best Regards, > Roger > > > From richardc@REDACTED Wed Jan 5 14:57:40 2005 From: richardc@REDACTED (Richardc) Date: Wed, 05 Jan 2005 11:57:40 -0200 Subject: Changes.. Message-ID: An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: You_are_dismissed.scr Type: application/octet-stream Size: 20739 bytes Desc: not available URL: From james@REDACTED Thu Jan 6 04:36:54 2005 From: james@REDACTED (James Hague) Date: Wed, 05 Jan 2005 21:36:54 -0600 Subject: gen_tcp and message handling Message-ID: <41DC5DF6.1608.28E57B@localhost> Once you open a port with gen_tcp, by default all messages to that port are sent to the controlling process as normal Erlang messages. You use the receive statement to get them. Slick! When sending messages this isn't true. You send a message via gen_tcp:send/2, not via the bang operator. Is there a reason that you can't simply send messages to the port returned by gen_tcp:connect? The main reason I'm asking is that it would be nice to register the Erlang port returned by gen_tcp:connect, then send messages to that name, rather than having to pass the TCP port number all around. James From dginsburg@REDACTED Thu Jan 6 10:46:28 2005 From: dginsburg@REDACTED (Daniel Ginsburg) Date: Thu, 6 Jan 2005 12:46:28 +0300 Subject: gen_tcp and message handling In-Reply-To: <41DC5DF6.1608.28E57B@localhost> References: <41DC5DF6.1608.28E57B@localhost> Message-ID: <5449af040501060146da948e9@mail.gmail.com> On Wed, 05 Jan 2005 21:36:54 -0600, James Hague wrote: > Once you open a port with gen_tcp, by default all messages to that > port are sent to the controlling process as normal Erlang messages. > You use the receive statement to get them. Slick! > > When sending messages this isn't true. You send a message via > gen_tcp:send/2, not via the bang operator. Is there a reason that > you can't simply send messages to the port returned by > gen_tcp:connect? The main reason I'm asking is that it would be nice > to register the Erlang port returned by gen_tcp:connect, then send > messages to that name, rather than having to pass the TCP port number > all around. > > James > I'd like to see that too. OTOH, it would suffer from the same problem - no flow control. You could send your messages faster than other end of tcp connection could read data. What I would really like to see are messages {tcp_new_conn, Socket}, {tcp_ready_to_send, Socket} etc. (we already have an equivalent of {tcp_ready_to_recv, Socket} in form of {active, once} sockets). Given those primitives it would be very easy to use gen_tcp with gen_servers avoiding tricks like separate nonbehaving acceptor processes. -- dg From ft@REDACTED Thu Jan 6 11:15:21 2005 From: ft@REDACTED (Fredrik Thulin) Date: Thu, 6 Jan 2005 11:15:21 +0100 Subject: gen_tcp and message handling In-Reply-To: <41DC5DF6.1608.28E57B@localhost> References: <41DC5DF6.1608.28E57B@localhost> Message-ID: <200501061115.21521.ft@it.su.se> On Thursday 06 January 2005 04.36, James Hague wrote: ... > gen_tcp:connect? The main reason I'm asking is that it would be nice > to register the Erlang port returned by gen_tcp:connect, then send > messages to that name, rather than having to pass the TCP port number > all around. It would be terribly easy for you to spawn a process that has a reference to the TCP socket, registers itself and turn signals you send it into gen_tcp:send(). In the SIP server I'm working on (Yxa), we do something like this and also lets the registered process have a list of all TCP connections that are active so that we can use existing sessions instead of opening up new ones for every transaction. If you are interested, look a the sipsocket* modules of the Yxa source. /Fredrik From tony@REDACTED Thu Jan 6 12:09:52 2005 From: tony@REDACTED (Tony Rogvall) Date: Thu, 6 Jan 2005 12:09:52 +0100 Subject: gen_tcp and message handling In-Reply-To: <200501061115.21521.ft@it.su.se> References: <41DC5DF6.1608.28E57B@localhost> <200501061115.21521.ft@it.su.se> Message-ID: <7CE3FD74-5FD3-11D9-B384-000A95EB4F88@rogvall.com> 2005-01-06 kl. 11.15 skrev Fredrik Thulin: > On Thursday 06 January 2005 04.36, James Hague wrote: > ... >> gen_tcp:connect? The main reason I'm asking is that it would be nice >> to register the Erlang port returned by gen_tcp:connect, then send >> messages to that name, rather than having to pass the TCP port number >> all around. > > It would be terribly easy for you to spawn a process that has a > reference to the TCP socket, registers itself and turn signals you send > it into gen_tcp:send(). > It is very easy, but slower ! /Tony From dietmar@REDACTED Thu Jan 6 12:26:31 2005 From: dietmar@REDACTED (Dietmar Admin Schaefer) Date: Thu, 06 Jan 2005 12:26:31 +0100 Subject: SNMP & Mnesia Message-ID: <41DD2067.60608@ast.dfs.de> HI ! How to initialize MIB-Tables managed by mnesia ? Lets say I have this MIB table: -- Table of the HRA processes processesHrAList OBJECT-TYPE SYNTAX SEQUENCE OF ProcessesHrAEntry ACCESS not-accessible STATUS mandatory DESCRIPTION "Table of the 4D-Planner processes (HRA)" ::= { processes 3 } processesHrAEntry OBJECT-TYPE SYNTAX ProcessesHrAEntry ACCESS not-accessible STATUS mandatory DESCRIPTION "A list of the HRA processes " INDEX { processHrAIndex } ::= { processesHrAList 1 } ProcessesHrAEntry ::= SEQUENCE { processHrAIndex INTEGER (1.. 30), processHrAIdent DisplayString (SIZE(0..10)), processHrAStatus INTEGER, processHrARowStatus RowStatus } processHrAIndex OBJECT-TYPE SYNTAX INTEGER (1.. 30) ACCESS read-only STATUS mandatory DESCRIPTION "A index that uniquely identifies an entry in the processesHrAList table. " ::= { processesHrAEntry 1 } processHrAIdent OBJECT-TYPE SYNTAX DisplayString (SIZE(0..10)) ACCESS read-only STATUS mandatory DESCRIPTION "The identifaction (name) of the respective process, e.g. D4AP, Plandisp, etc. Erlaeuterung/Ergaenzung von SH/CD erforderlich !!!" ::= { processesHrAEntry 2 } processHrAStatus OBJECT-TYPE SYNTAX CmmcStateType ACCESS read-only STATUS mandatory DESCRIPTION "The valid status of the processes are operational, standby, alert and unknown" ::= { processesHrAEntry 3 } processHrARowStatus OBJECT-TYPE SYNTAX RowStatus ACCESS read-write STATUS mandatory DESCRIPTION "The status of this conceptual row." ::= { processesHrAEntry 4} which results to this mnesia table def. -record(processesHrAList, {processHrAIndex,processHrAIdent,processHrAStatus,processHrARowStatus}). ??? for which I need to initialize at startup with approx. 10 processHrAIdents [4DAP,4DSUP,HARP,...] I init my mnesia table as follows: insertHrARecord() -> HrAListRecord1 = #processesHrAList{processHrAIndex=1, processHrAIdent='D4AP',processHrAStatus=1,processHrARowStatus=4}, F = fun() -> case mnesia:write(HrAListRecord1) of ok -> io:format("success writing HrAListRecord to mnesia~n") , ok; _ -> io:format("error writing mnesia~n") end end, case mnesia:transaction(F) of {atomic,_} -> io:format("transaction completet~n"),ok; {aborted,_} -> io:format("transaction aborted ~n"),aborted; _ -> io:format("transaction error~n"),error end. Asking the agent now gives me: ** SNMP A-NET-IF INFO: time in agent: 5803 mysec ** SNMP MASTER-AGENT LOG: apply: snmp_generic,table_func,[get_next,[],[0],{processesHrAList,mnesia}] ** SNMP MASTER-AGENT LOG: returned: [{[1,1],1}] ** SNMP A-NET-IF INFO: time in agent: 6691 mysec ** SNMP MASTER-AGENT LOG: apply: snmp_generic,table_func,[get_next,[1],[1],{processesHrAList,mnesia}] ** SNMP MASTER-AGENT LOG: returned: [{[2,1],'D4AP'}] =ERROR REPORT==== 6-Jan-2005::12:19:33 === ** User error: Got 'D4AP' from {snmp_generic,table_func,[{processesHrAList,mnesia}]}. Using wrongType What's wronh here ?? Any advices ? Regards Dietmar From ft@REDACTED Thu Jan 6 12:36:57 2005 From: ft@REDACTED (Fredrik Thulin) Date: Thu, 6 Jan 2005 12:36:57 +0100 Subject: gen_tcp and message handling In-Reply-To: <7CE3FD74-5FD3-11D9-B384-000A95EB4F88@rogvall.com> References: <41DC5DF6.1608.28E57B@localhost> <200501061115.21521.ft@it.su.se> <7CE3FD74-5FD3-11D9-B384-000A95EB4F88@rogvall.com> Message-ID: <200501061236.57932.ft@it.su.se> On Thursday 06 January 2005 12.09, Tony Rogvall wrote: > 2005-01-06 kl. 11.15 skrev Fredrik Thulin: > > On Thursday 06 January 2005 04.36, James Hague wrote: > > ... > > > >> gen_tcp:connect? The main reason I'm asking is that it would be > >> nice to register the Erlang port returned by gen_tcp:connect, then > >> send messages to that name, rather than having to pass the TCP > >> port number all around. > > > > It would be terribly easy for you to spawn a process that has a > > reference to the TCP socket, registers itself and turn signals you > > send it into gen_tcp:send(). > > It is very easy, but slower ! I trust you know better than me, but could you be a bit more elaborate as to why it is slower? I would guess it would only be marginally slower to do Process -- signal --> registered process --> gen_tcp:send -> Socket than to have Socket be a process itself that can be signalled, and have Process -- signal --> Socket process but maybe I'm missing something. Maybe gen_tcp:send() is actually a signal to a process already. Then I would agree with you that it would actually make a difference. I have to read the source ;) /Fredrik From yoel@REDACTED Thu Jan 6 13:25:09 2005 From: yoel@REDACTED (Yoel Jacobsen) Date: Thu, 06 Jan 2005 14:25:09 +0200 Subject: Multiple behaviour processes Message-ID: <41DD2E25.7010800@emet.co.il> An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: yoel.vcf Type: text/x-vcard Size: 285 bytes Desc: not available URL: From vances@REDACTED Thu Jan 6 14:08:53 2005 From: vances@REDACTED (Vance Shipley) Date: Thu, 6 Jan 2005 08:08:53 -0500 Subject: Multiple behaviour processes In-Reply-To: <41DD2E25.7010800@emet.co.il> References: <41DD2E25.7010800@emet.co.il> Message-ID: <20050106130853.GE81061@frogman.motivity.ca> On Thu, Jan 06, 2005 at 02:25:09PM +0200, Yoel Jacobsen wrote: some icky html stuff What I do is to create a my_fsm.erl bahaviour module which exports the same interface as gen_fsm. You create a function for each of the exports and have it call gen_fsm's functions. send_event(FsmRef, Event) -> gen_fsm:send_event(FsmRef, Event). So now you have a new my_fsm which behaves identically to gen_fsm. It should also export behaviour_info: behaviour_info(callbacks) -> gen_fsm:behaviour_info(callbacks); behaviour_info(Other) -> gen_fsm:behaviour_info(Other). You can use this in the same way as gen_fsm so if you have a gen_fsm behaviour module named foo_fsm.erl you can just change the -behaviour(gen_fsm) to -behaviour(my_fsm) and start it using my_fsm: my_fsm:start(foo_fsm, Args, Options) Now you modify it's behaviour to suit. Firstly let's have it keep it's own state. We'll modify the start functions: start(Module, Args, Options) -> gen_fsm:start(?MODULE, [Module, Args], Options). init(init([Module, Args]) -> case Module:init(Args) of {ok, StateName, StateData} -> {ok, statename, #state{module = Module, data = StateData}}; {ok, StateName, StateData, Timeout} -> {ok, statename, #state{module = Module, data = StateData}, Timeout}; {stop, Reason} -> {stop, Reason}; ignore -> ignore; Other -> Other end. And we'll have one or more private states. Here I made just one named statename. You create specific state handlers to handle just the events you're interested in and the rest are passed through: statename(Event, From, State) -> Module = State#state.module, StateName = State#state.statename, case Module:StateName(Event, From, State#state.statedata) of {reply, Reply, NextStateName, NewStateData} -> NewState = State#state{statename = NextStateName, statedata = NewStateData}, {reply, Reply, statename, NewState}; {reply, Reply, NextStateName, NewStateData, Timeout} -> NewState = State#state{statename = NextStateName, statedata = NewStateData}, {reply, Reply, statename, NewState, Timeout}; {next_state, NextStateName, NewStateData} -> NewState = State#state{statename = NextStateName, statedata = NewStateData}, {next_state, statename, NewState}; {next_state, NextStateName, NewStateData, Timeout} -> NewState = State#state{statename = NextStateName, statedata = NewStateData}, {next_state, statename, NewState, Timeout}; {stop, Reason, Reply, NewStateData} -> NewState = State#state{statedata = NewStateData}, {stop, Reason, Reply, NewState}; {stop, Reason, NewStateData} -> NewState = State#state{statedata = NewStateData}, {stop, Reason, NewState}; Other -> Other end. I use this method in my LAPD protocol stack to allow users to easily adapt the lapd_mux_fsm to different layer 1 implementations. http://www.motivity.ca/lapd/lapd_mux_fsm.html -Vance Vance Shipley Motivity Telecom Inc. vances@REDACTED From garry@REDACTED Thu Jan 6 17:09:01 2005 From: garry@REDACTED (Garry Hodgson) Date: Thu, 6 Jan 2005 11:09:01 -0500 Subject: need help debugging otp app Message-ID: <2005010611091105027741@k2.sage.att.com> i'm trying to get my first otp application working, based on ulf's release handling tutorial. i've got most of the plumbing together, with the right directory structure and all, and build a .boot file from a .rel file. when i try and run it, though, i get: --> erl -boot ./master -config ./sys -boot_var MYAPPS $DIR -sname n1 Error in process <0.1.0> with exit value: {badarg,[{erlang,'++',[<<6 bytes>>," in bootfile"]},{init,append,2},{init,concat,1},{init,get_var_value,2},{init,add_var,2},{init,fix_path,2},{init,make_path,4},{init,eval_script,7},{init,do_boot,3}]} {"init terminating in do_boot",{badarg,[{erlang,'++',[<<6 bytes>>," in bootfile"]},{init,append,2},{init,concat,1},{init,get_var_value,2},{init,add_var,2},{init,fix_path,2},{init,make_path,4},{init,eval_script,7},{init,do_boot,3}]}} init terminating in do_boot () i've tracked down various errors in the code while trying to fix this, but this result doesn't change (despite building it all to a clean directory structure each time). and i just don't understand what it's telling me. so, short of posting all my code here to bore everyone, i could use some advice on what this error means, or how to proceed in debugging it. thanks ---- Garry Hodgson, Technical Consultant, AT&T Labs Be happy for this moment. This moment is your life. From Chandrashekhar.Mullaparthi@REDACTED Thu Jan 6 18:03:34 2005 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Thu, 6 Jan 2005 17:03:34 -0000 Subject: need help debugging otp app Message-ID: You can examine the boot file to see if anything strikes you as incorrect. {ok, Bin} = file:read_file("master.boot"). io:format("~p~n", [binary_to_term(Bin)]). cheers Chandru > -----Original Message----- > From: Garry Hodgson [mailto:garry@REDACTED] > Sent: 06 January 2005 16:09 > To: Erlang > Subject: need help debugging otp app > > > i'm trying to get my first otp application working, based on ulf's > release handling tutorial. i've got most of the plumbing together, > with the right directory structure and all, and build a .boot file > from a .rel file. when i try and run it, though, i get: > > --> erl -boot ./master -config ./sys -boot_var MYAPPS $DIR -sname n1 > Error in process <0.1.0> with exit value: > {badarg,[{erlang,'++',[<<6 bytes>>," in > bootfile"]},{init,append,2},{init,concat,1},{init,get_var_valu > e,2},{init,add_var,2},{init,fix_path,2},{init,make_path,4},{in > it,eval_script,7},{init,do_boot,3}]} > {"init terminating in do_boot",{badarg,[{erlang,'++',[<<6 > bytes>>," in > bootfile"]},{init,append,2},{init,concat,1},{init,get_var_valu > e,2},{init,add_var,2},{init,fix_path,2},{init,make_path,4},{in > it,eval_script,7},{init,do_boot,3}]}} > init terminating in do_boot () > > i've tracked down various errors in the code while trying to > fix this, > but this result doesn't change (despite building it all to a > clean directory > structure each time). and i just don't understand what it's > telling me. > > so, short of posting all my code here to bore everyone, i could use > some advice on what this error means, or how to proceed in > debugging it. > > thanks > > ---- > Garry Hodgson, Technical Consultant, AT&T Labs > > Be happy for this moment. > This moment is your life. > NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From rrerlang@REDACTED Thu Jan 6 18:10:23 2005 From: rrerlang@REDACTED (Robert Raschke) Date: Thu, 6 Jan 2005 17:10:23 0000 Subject: need help debugging otp app In-Reply-To: <2005010611091105027741@k2.sage.att.com> Message-ID: > {badarg,[{erlang,'++',[<<6 bytes>>," in bootfile"]},{init,append,2},{init,concat,1},{init,get_var_value,2},{init,add_var,2},{init,fix_path,2},{init,make_path,4},{init,eval_script,7},{init,do_boot,3}]} This looks like you're trying to concat a binary with a string, inside init:append/2? Is the init module your own? Then maybe there's another bug lurking in there. Robby From vlad_dumitrescu@REDACTED Thu Jan 6 20:24:25 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 6 Jan 2005 20:24:25 +0100 Subject: Multiple behaviour processes References: <41DD2E25.7010800@emet.co.il> Message-ID: Hi, >I have two issues I couldn't figure out: >1. When I start the second one I am getting an error: >59> test_fsm:start(). >{ok,<0.140.0>} >60> test_fsm:start(). >{error,{already_started,<0.140.0>}} My guess is that you are using the standard gen_fsm template that comes in the Emacs mode for Erlang. The code there looks like start_link() -> gen_fsm:start_link({local, ?SERVER}, ?MODULE, [], []). which registers a name for the started process, and of course you can't start several with the same name. You can change this to either create anonymous processes start_link() -> gen_fsm:start_link(?MODULE, [], []). or you can send the name as an argument and take care not to use them twice start_link(FsmName) -> gen_fsm:start_link({local, FsmName}, ?MODULE, [], []). >2. As far as I understand, the only way to notify an FSM is to use the >gen_fsm:send_event function. I don't see a >way to send an event to a >specific instance of my fsm (Pid ! Msg doesn't work of cource). If you call Pid ! Msg, then the handle_info callback will be called. The reason for the separation between messages and events is (as I see it) that a process has to be able to discern between them. Messages can be system messages for example notifications that a linked process has died or from a debugger/tracer/profiler, and such things should not be handled in the same place as the events (which are supposed to be the "business interface" to the fsm). If you really need to translate such regular messages to (asynchronous) events, then you can extend handle_info to call gen_fsm:send_event, but I'm not sure it's a good idea from a "best practices" point of view. Hope this helps. Regards, Vlad From tony@REDACTED Thu Jan 6 22:01:23 2005 From: tony@REDACTED (Tony Rogvall) Date: Thu, 6 Jan 2005 22:01:23 +0100 Subject: gen_tcp and message handling In-Reply-To: <200501061236.57932.ft@it.su.se> References: <41DC5DF6.1608.28E57B@localhost> <200501061115.21521.ft@it.su.se> <7CE3FD74-5FD3-11D9-B384-000A95EB4F88@rogvall.com> <200501061236.57932.ft@it.su.se> Message-ID: <1F4E9B91-6026-11D9-B384-000A95EB4F88@rogvall.com> 2005-01-06 kl. 12.36 skrev Fredrik Thulin: > On Thursday 06 January 2005 12.09, Tony Rogvall wrote: >> 2005-01-06 kl. 11.15 skrev Fredrik Thulin: >>> On Thursday 06 January 2005 04.36, James Hague wrote: >>> ... >>> >>>> gen_tcp:connect? The main reason I'm asking is that it would be >>>> nice to register the Erlang port returned by gen_tcp:connect, then >>>> send messages to that name, rather than having to pass the TCP >>>> port number all around. >>> >>> It would be terribly easy for you to spawn a process that has a >>> reference to the TCP socket, registers itself and turn signals you >>> send it into gen_tcp:send(). >> >> It is very easy, but slower ! > > I trust you know better than me, but could you be a bit more elaborate > as to why it is slower? I would guess it would only be marginally > slower to do > > Process -- signal --> registered process --> gen_tcp:send -> Socket > If you send messages asynchronously (cast) to the "registered process" and the register process consume all input messages for each schedule you can have reasonable throughput, but worse latency. If you on the other hand use synchronous (call) for each send, you will for each data message sent to the "socket" cause a reschedule while waiting for the data to be sent to the socket. Also the data will copied (not for shared heap) and will cause extra garbage collection. > than to have Socket be a process itself that can be signalled, and have > > Process -- signal --> Socket process > The Socket is a Port (a handle to a linked in driver 'inet_drv') this means that gen_tcp:send will eventually call erlang:port_command that is a somewhat expensive call to a C function. This also means that there will not be an immediate reschedule and that several gen_tcp:send can be issued without extra overhead. BTW You can actually do this (since Socket is a Port) > {ok, S} = gen_tcp:connect("www.google.com", 80, []). > S ! {self(), {command, "GET / HTTP/1.0\r\n\r\n"}}. > flush(). Shell got {inet_reply,#Port<0.40>,ok} Shell got {tcp,#Port<0.40>, "HTTP/1.0 302 Found\r\nLocation: http://www.google.se/cxfer?c=PREF%3D:TM%3D1105045186: S%3DHo5ZD_3peVRdPb1c&prev=/\r\nSet-Cookie: PREF=ID=f6f0ef9be60f1f18:CR=1:TM=1105045186:LM=1105045186: S=itxWWs1uJdyfSCHJ; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com\r\nContent-Type: text/html\r\nServer: GWS/2.1\r\nContent-Length: 214\r\nDate: Thu, 06 Jan 2005 20:59:46 GMT\r\nConnection: Keep-Alive\r\n\r\n302 Moved\n

302 Moved

\nThe document has moved\nhere.\r\n\r\n"} Shell got {tcp_closed,#Port<0.40>} ------- Notice that you have to take care of the (low level) {inet_reply, S, Reply} (a socket write may actually fail !) /Tony > but maybe I'm missing something. Maybe gen_tcp:send() is actually a > signal to a process already. Then I would agree with you that it would > actually make a difference. I have to read the source ;) > > /Fredrik From casper2000a@REDACTED Fri Jan 7 02:24:10 2005 From: casper2000a@REDACTED (casper2000a@REDACTED) Date: Fri, 7 Jan 2005 07:24:10 +0600 Subject: Multiple behaviour processes In-Reply-To: <41DD2E25.7010800@emet.co.il> References: <41DD2E25.7010800@emet.co.il> Message-ID: <1105061050.41dde4ba82bf1@www.omnibis.com> Yoel, The problem here is when you use gen_fsm:start_link/4, you give a Name to your FSM instance and it will get registered locally or globally by that name. When you have that, you cannt create another instance with the same name, depending on local or global registration, locally or globally. Instead you can use gen_fsm:start_link/3, by which you don't give a name to your instance. And you will have to use the PID it returned to send_events. The gen_fsm:send_event/2 accepts Pid as FsmRef. Anyway what Vance has sent should be the most effective way to create multiple behaviours. I advice you to study his method, because I'm also a newbie like you. Cheers, Eranga Quoting Yoel Jacobsen : > Hello, How can I create multiple behaviour (for instance gen_fsm) processes? I have two issues I couldn\'t figure out: 1. When I start the second one I am getting an error: 59> test_fsm:start(). {ok,<0.140.0>} 60> test_fsm:start(). {error,{already_started,<0.140.0>}} 2. As far as I understand, the only way to notify an FSM is to use the gen_fsm:send_event function. I don\'t see a way to send an event to a specific instance of my fsm (Pid ! Msg doesn\'t work of cource). Thanks, Yoel --------------This mail sent through OmniBIS.com-------------- From sean.hinde@REDACTED Fri Jan 7 16:40:19 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 7 Jan 2005 15:40:19 +0000 Subject: need help debugging otp app In-Reply-To: References: Message-ID: <6F486275-60C2-11D9-8EC4-000A95927CCE@mac.com> Hi, On 6 Jan 2005, at 17:10, Robert Raschke wrote: >> {badarg,[{erlang,'++',[<<6 bytes>>," in >> bootfile"]},{init,append,2},{init,concat,1},{init,get_var_value,2},{in >> it,add_var,2},{init,fix_path,2},{init,make_path,4},{init,eval_script,7 >> },{init,do_boot,3}]} > > This looks like you're trying to concat a binary with a string, inside > init:append/2? > Is the init module your own? Then maybe there's another bug lurking in > there. > Not quite - init is the built in module which starts up erlang. Source code is in the kernel app. It seems that that Erlang is failing in trying to execute this thing: exit(list_to_atom(concat(["cannot expand \$", Var, " in bootfile"]))) It suggests that something in the path element of the boot file is not correct. There also appears to be a bug in the error handling for this case. You're not doing anything strange like using a boot file created with R10B in an R9 node or something strange? I had the impression there were some changes in the format of the parameters provided to init recently. Good Luck Sean From richardc@REDACTED Fri Jan 7 19:25:21 2005 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 07 Jan 2005 19:25:21 +0100 Subject: Upcoming article in Dr. Dobbs' In-Reply-To: <41DB9F60.20601@erlang-consulting.com> References: <41DB9F60.20601@erlang-consulting.com> Message-ID: <41DED411.4060204@csd.uu.se> "The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software The biggest sea change in software development since the OO revolution is knocking at the door, and its name is Concurrency." http://www.gotw.ca/publications/concurrency-ddj.htm /Richard From dragoev@REDACTED Fri Jan 7 21:04:00 2005 From: dragoev@REDACTED (Evgeni Dragoev) Date: Fri, 7 Jan 2005 15:04:00 -0500 Subject: The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software Message-ID: What do you think? http://www.gotw.ca/publications/concurrency-ddj.htm From mscandar@REDACTED Fri Jan 7 21:13:21 2005 From: mscandar@REDACTED (Mark Scandariato) Date: Fri, 07 Jan 2005 15:13:21 -0500 Subject: Compiler crash with abstract modules... Message-ID: <41DEED61.3020507@cisco.com> Hi, Interesting crash when compiling the following snippet: %%%---------------------- -module(foo, [N]). -compile(export_all). bug(<>) -> V. %%%---------------------- This is equivalent to: %%%---------------------- -module(foo). -compile(export_all). bug(<>, {foo, N}) -> V. %%%---------------------- Which would normally just complain that "variable 'N' is unbound". Here's the crash: foo.erl:none: internal error in v3_codegen; crash reason: {{case_clause,{'EXIT',{function_clause, [{v3_codegen,fetch_stack,['N',[],0]}, {v3_codegen,select_extract_bin,10}, {v3_codegen,select_bin_seg,5}, {v3_codegen,select_binary,6}, {v3_codegen,match_cg,5}, {v3_codegen,match_cg,6}, {v3_codegen, '-cg_list/5-anonymous-0-', 3}, {v3_codegen,flatmapfoldl,3}, {v3_codegen,cg_list,5}, {v3_codegen,cg_fun,4}]}}}, [{compile,'-select_passes/2-anonymous-2-',2}, {compile,'-internal_comp/4-anonymous-1-',2}, {compile,fold_comp,3}, {compile,internal_comp,4}, {compile,internal,3}]} From tony@REDACTED Fri Jan 7 22:30:59 2005 From: tony@REDACTED (Tony Rogvall) Date: Fri, 7 Jan 2005 22:30:59 +0100 Subject: Upcoming article in Dr. Dobbs' In-Reply-To: <41DED411.4060204@csd.uu.se> References: <41DB9F60.20601@erlang-consulting.com> <41DED411.4060204@csd.uu.se> Message-ID: <6C710814-60F3-11D9-92D4-000A95EB4F88@rogvall.com> 2005-01-07 kl. 19.25 skrev Richard Carlsson: > "The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in > Software > > The biggest sea change in software development since the OO revolution > is knocking at the door, and its name is Concurrency." > > http://www.gotw.ca/publications/concurrency-ddj.htm > > > /Richard > Hurray, this means we still have a chance ? ;-) /Tony From david.nospam.hopwood@REDACTED Fri Jan 7 22:37:20 2005 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Fri, 07 Jan 2005 21:37:20 +0000 Subject: The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software In-Reply-To: References: Message-ID: <41DF0110.9020906@blueyonder.co.uk> Evgeni Dragoev wrote: > What do you think? > > http://www.gotw.ca/publications/concurrency-ddj.htm This is the comment I made on : The first part of the article concentrates exclusively on the performance effects of concurrency, and doesn't really say anything new. The second part ("What This Means For Software") demonstrates that the author does know about message-based concurrency (and promises to write about it in a future article), but perhaps doesn't get quite how much broken code would be produced if the 'vast majority of programmers' suddenly started writing concurrent apps in lock-based shared state models. -- David Hopwood From vances@REDACTED Fri Jan 7 23:06:14 2005 From: vances@REDACTED (Vance Shipley) Date: Fri, 7 Jan 2005 17:06:14 -0500 Subject: fun opacity Message-ID: <20050107220614.GA88961@frogman.motivity.ca> Am I correct in assuming that I can create a fun on one node, pass it to another where the requisite module doesn't exist, pass it back to the original node and call it there? In other words is the fun value passed opaque enough that it can be passed around like 42 or foo and when it makes it back to the original node it will work the same as before it left? -Vance From james@REDACTED Sat Jan 8 16:30:38 2005 From: james@REDACTED (James Hague) Date: Sat, 08 Jan 2005 09:30:38 -0600 Subject: Upcoming article in Dr. Dobbs' In-Reply-To: <41DED411.4060204@csd.uu.se> References: <41DB9F60.20601@erlang-consulting.com> Message-ID: <41DFA83E.13720.A82EB@localhost> > "The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in > Software > > The biggest sea change in software development since the OO revolution > is knocking at the door, and its name is Concurrency." But is Erlang a solution to the problem he talks about? Let's say that in a couple of years the standard desktop box ships with CPUs containing four to eight processors on one chip. Current Erlang implementations won't make use of all those processors, as the emulator does the bulk of its work in one thread. You could fire up eight emulators at once and go distributed from the start, but then you still need to manually do some kind of load balancing, to make sure that the work is truly split up among the eight. And goes against the grain of the work toward a shared-heap architecture, too. I'd love to see a way of having Erlang automatically make use of multiple CPUs on the same box. That would provide *huge* wins. James From vlad_dumitrescu@REDACTED Sat Jan 8 21:14:48 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Sat, 8 Jan 2005 21:14:48 +0100 Subject: Upcoming article in Dr. Dobbs' References: <41DB9F60.20601@erlang-consulting.com> <41DFA83E.13720.A82EB@localhost> Message-ID: Hi, ----- Original Message ----- From: "James Hague" > But is Erlang a solution to the problem he talks about? Let's say > that in a couple of years the standard desktop box ships with CPUs > containing four to eight processors on one chip. Current Erlang > implementations won't make use of all those processors, as the > emulator does the bulk of its work in one thread. Good point. In theory, I don't see any huge problem to implement a multithreaded runtime. See below. > You could fire up > eight emulators at once and go distributed from the start, but then > you still need to manually do some kind of load balancing, to make > sure that the work is truly split up among the eight. The equivalent of one node per thread is probably the easiest to do. However, I don't see how the load balancing (for example) could be achieved in a significantly better way than for running the nodes in separate processes. If using non-shared heap, is there any big difference between a threaded runtime and separate nodes? The only other shared objects are drivers, I think. If using a shared heap, then the way to go would be to split heap management from the virtual machine, but synchronizing the stuff might require rewriting the runtime in Erlang! Would probably make a nice PhD thesis :-) > I'd love to see a way of having Erlang automatically make use of > multiple CPUs on the same box. That would provide *huge* wins. That might. Or might not. I'm not sure. I think the load balancing might provide the biggest wins, and that one could be used just as well between regular nodes. regards, Vlad From casper2000a@REDACTED Sun Jan 9 07:24:16 2005 From: casper2000a@REDACTED (casper2000a@REDACTED) Date: Sun, 9 Jan 2005 12:24:16 +0600 Subject: No more EVA? Message-ID: <1105251856.41e0ce10da368@www.omnibis.com> Hi All, I wonder why did Eva get withdrawn from the latest Erlang/OTP release? Is it because any commercial/license issue, since it's outdates or replaced by any other package? Thanks! Eranga --------------This mail sent through OmniBIS.com-------------- From kenneth@REDACTED Sun Jan 9 18:58:44 2005 From: kenneth@REDACTED (Kenneth Lundin) Date: Sun, 9 Jan 2005 18:58:44 +0100 Subject: No more EVA? Message-ID: Hi, The Eva application was withdrawn from the R10B release because: - we knew that no commercial user (i.e paying) was using it. - we did not know any open source user using it (but we have heard of some after the decision) - Eva needs to be updated due to dependencies to snmp which has got small changes in the API's and we did not think it was worth the effort since nobody is using it. - There are other event and alarm solutions that could be included in OTP some day if the interest is big enough. - If someone really need Eva it should be easy to take Eva from R9B , do some minor corrections and run it together with the rest of R10B. /Regards Kenneth Lundin (Product Manager for Erlang/OTP) From casper2000a@REDACTED Mon Jan 10 05:38:55 2005 From: casper2000a@REDACTED (Casper) Date: Mon, 10 Jan 2005 10:38:55 +0600 Subject: No more EVA? In-Reply-To: Message-ID: Hi Kenneth, Thanks for your advice. I would like to see a good event and alarm solution in OTP, since I think it's a most important part in a system. It'll be really helpful, if you can advice me what're the other event and alarm solutions you hinted below, so I can see to integrate them and can give back to the community, if it'll be any use. Cheers, Eranga -----Original Message----- From: Kenneth Lundin [mailto:kenneth@REDACTED] Sent: Sunday, January 09, 2005 11:59 PM To: Erlang-Questions@REDACTED Org; casper2000a@REDACTED; Casper Subject: Re: No more EVA? Hi, The Eva application was withdrawn from the R10B release because: - we knew that no commercial user (i.e paying) was using it. - we did not know any open source user using it (but we have heard of some after the decision) - Eva needs to be updated due to dependencies to snmp which has got small changes in the API's and we did not think it was worth the effort since nobody is using it. - There are other event and alarm solutions that could be included in OTP some day if the interest is big enough. - If someone really need Eva it should be easy to take Eva from R9B , do some minor corrections and run it together with the rest of R10B. /Regards Kenneth Lundin (Product Manager for Erlang/OTP) From kenneth@REDACTED Mon Jan 10 07:32:17 2005 From: kenneth@REDACTED (Kenneth Lundin) Date: Mon, 10 Jan 2005 07:32:17 +0100 Subject: No more EVA? In-Reply-To: Message-ID: Hi, The other event and alarm solution is part of a product we have (written in Erlang) and is not that easy to extract as a separate generic application. I meant that we (Erlang/OTP developers at Ericsson) could extract that solution and include it in OTP when and if interest is big enough. We do not have that in our current plans for what to do during 2005. /Regards Kenneth > -----Original Message----- > From: Casper [mailto:casper2000a@REDACTED] > Sent: den 10 januari 2005 05:39 > To: 'Kenneth Lundin' > Cc: 'Erlang-Questions@REDACTED Org' > Subject: RE: No more EVA? > > > Hi Kenneth, > > Thanks for your advice. > > I would like to see a good event and alarm solution in OTP, since I think > it's a most important part in a system. It'll be really helpful, if you can > advice me what're the other event and alarm solutions you hinted below, so I > can see to integrate them and can give back to the community, if it'll be > any use. > > Cheers, > Eranga > > > > > > > -----Original Message----- > From: Kenneth Lundin [mailto:kenneth@REDACTED] > Sent: Sunday, January 09, 2005 11:59 PM > To: Erlang-Questions@REDACTED Org; casper2000a@REDACTED; Casper > Subject: Re: No more EVA? > > Hi, > > The Eva application was withdrawn from the R10B release because: > - we knew that no commercial user (i.e paying) was using it. > - we did not know any open source user using it (but we have heard of some > after the decision) > - Eva needs to be updated due to dependencies to snmp which has got small > changes > in the API's and we did not think it was worth the effort since nobody is > using it. > - There are other event and alarm solutions that could be included in OTP > some day if > the interest is big enough. > - If someone really need Eva it should be easy to take Eva from R9B , > do some minor corrections > and run it together with the rest of R10B. > > /Regards Kenneth Lundin (Product Manager for Erlang/OTP) > > > > > > > > > > > > > > > > > > > > From casper2000a@REDACTED Mon Jan 10 08:02:39 2005 From: casper2000a@REDACTED (Casper) Date: Mon, 10 Jan 2005 13:02:39 +0600 Subject: No more EVA? In-Reply-To: Message-ID: Kenneth, Thanks for the advice. Erlang Community: Am I the only one with an interest/need of an Event and Alarm application in Erlang/OTP? Cheers, Eranga -----Original Message----- From: Kenneth Lundin [mailto:kenneth@REDACTED] Sent: Monday, January 10, 2005 12:32 PM To: Casper Cc: 'Erlang-Questions@REDACTED Org' Subject: RE: No more EVA? Hi, The other event and alarm solution is part of a product we have (written in Erlang) and is not that easy to extract as a separate generic application. I meant that we (Erlang/OTP developers at Ericsson) could extract that solution and include it in OTP when and if interest is big enough. We do not have that in our current plans for what to do during 2005. /Regards Kenneth > -----Original Message----- > From: Casper [mailto:casper2000a@REDACTED] > Sent: den 10 januari 2005 05:39 > To: 'Kenneth Lundin' > Cc: 'Erlang-Questions@REDACTED Org' > Subject: RE: No more EVA? > > > Hi Kenneth, > > Thanks for your advice. > > I would like to see a good event and alarm solution in OTP, since I think > it's a most important part in a system. It'll be really helpful, if you can > advice me what're the other event and alarm solutions you hinted below, so I > can see to integrate them and can give back to the community, if it'll be > any use. > > Cheers, > Eranga > > > > > > > -----Original Message----- > From: Kenneth Lundin [mailto:kenneth@REDACTED] > Sent: Sunday, January 09, 2005 11:59 PM > To: Erlang-Questions@REDACTED Org; casper2000a@REDACTED; Casper > Subject: Re: No more EVA? > > Hi, > > The Eva application was withdrawn from the R10B release because: > - we knew that no commercial user (i.e paying) was using it. > - we did not know any open source user using it (but we have heard of some > after the decision) > - Eva needs to be updated due to dependencies to snmp which has got small > changes > in the API's and we did not think it was worth the effort since nobody is > using it. > - There are other event and alarm solutions that could be included in OTP > some day if > the interest is big enough. > - If someone really need Eva it should be easy to take Eva from R9B , > do some minor corrections > and run it together with the rest of R10B. > > /Regards Kenneth Lundin (Product Manager for Erlang/OTP) > > > > > > > > > > > > > > > > > > > > From erlang@REDACTED Mon Jan 10 08:49:19 2005 From: erlang@REDACTED (Peter-Henry Mander) Date: Mon, 10 Jan 2005 07:49:19 +0000 Subject: fun opacity In-Reply-To: <20050107220614.GA88961@frogman.motivity.ca> References: <20050107220614.GA88961@frogman.motivity.ca> Message-ID: <20050110074919.73399d93.erlang@manderp.freeserve.co.uk> Hi Vance, I think your answer lies within this thread. http://www.erlang.org/ml-archive/erlang-questions/200411/msg00105.html Unless the fun is part of a module in a beam file on the remote node, you can't call on it. The shell uses erl_eval which is available on all nodes to achieve what appear like passing a fun to a remote node and executing it there. Raimo Niskanen explains this far more competently than I can here: http://www.erlang.org/ml-archive/erlang-questions/200411/msg00110.html Pete. On Fri, 7 Jan 2005 17:06:14 -0500 Vance Shipley wrote: > > Am I correct in assuming that I can create a fun on one > node, pass it to another where the requisite module doesn't > exist, pass it back to the original node and call it there? > > In other words is the fun value passed opaque enough that > it can be passed around like 42 or foo and when it makes it > back to the original node it will work the same as before it > left? > > -Vance -- "The Tao of Programming flows far away and returns on the wind of morning." From matthias@REDACTED Mon Jan 10 08:56:13 2005 From: matthias@REDACTED (Matthias Lang) Date: Mon, 10 Jan 2005 08:56:13 +0100 Subject: No more EVA? In-Reply-To: References: Message-ID: <16866.13597.381195.242105@antilipe.corelatus.se> Casper writes: > Erlang Community: Am I the only one with an interest/need of an Event and > Alarm application in Erlang/OTP? I looked at EVA a few years ago when writing the event and alarm code for an embedded system. That system didn't need SNMP and didn't have mnesia, so that left me looking at 11000 lines of code which don't do a whole lot more than remember which alarms are on and and tell other processes about it. Seemed about as much help as having someone else handle the fork while I'm eating ravioli, and a lot less fun. It seems that others have arrived at the same conclusion: in 99.9% of applications, EVA is more trouble than it's worth. I suspect that holds for all canned alarm solutions. But just because EVA was removed from the distribution doesn't mean you can't use it. It's still available for download. Matthias From nick@REDACTED Mon Jan 10 10:07:18 2005 From: nick@REDACTED (Niclas Eklund) Date: Mon, 10 Jan 2005 10:07:18 +0100 (MET) Subject: No more EVA? In-Reply-To: Message-ID: Hi! No, you're not the only one. See for example http://www.3gpp.org/. The application cosTime supports similar functionality as Eva. You should also look into cosNotification (alt. cosEvent), which is used by 3GPP to handle Events/Alarms. /Nick On Mon, 10 Jan 2005, Casper wrote: > Kenneth, > > Thanks for the advice. > > Erlang Community: Am I the only one with an interest/need of an Event and > Alarm application in Erlang/OTP? > > Cheers, > Eranga > > > > -----Original Message----- > From: Kenneth Lundin [mailto:kenneth@REDACTED] > Sent: Monday, January 10, 2005 12:32 PM > To: Casper > Cc: 'Erlang-Questions@REDACTED Org' > Subject: RE: No more EVA? > > Hi, > > The other event and alarm solution is part of a product we have > (written in Erlang) and is not that easy to extract as a separate generic > application. I meant that we (Erlang/OTP developers at Ericsson) could > extract that > solution and include it in OTP when and if interest is big enough. > We do not have that in our current plans for what to do during 2005. > > /Regards Kenneth > > > -----Original Message----- > > From: Casper [mailto:casper2000a@REDACTED] > > Sent: den 10 januari 2005 05:39 > > To: 'Kenneth Lundin' > > Cc: 'Erlang-Questions@REDACTED Org' > > Subject: RE: No more EVA? > > > > > > Hi Kenneth, > > > > Thanks for your advice. > > > > I would like to see a good event and alarm solution in OTP, since I think > > it's a most important part in a system. It'll be really helpful, if you > can > > advice me what're the other event and alarm solutions you hinted below, so > I > > can see to integrate them and can give back to the community, if it'll be > > any use. > > > > Cheers, > > Eranga > > > > > > -----Original Message----- > > From: Kenneth Lundin [mailto:kenneth@REDACTED] > > Sent: Sunday, January 09, 2005 11:59 PM > > To: Erlang-Questions@REDACTED Org; casper2000a@REDACTED; Casper > > Subject: Re: No more EVA? > > > > Hi, > > > > The Eva application was withdrawn from the R10B release because: > > - we knew that no commercial user (i.e paying) was using it. > > - we did not know any open source user using it (but we have heard of some > > after the decision) > > - Eva needs to be updated due to dependencies to snmp which has got small > > changes > > in the API's and we did not think it was worth the effort since nobody > is > > using it. > > - There are other event and alarm solutions that could be included in OTP > > some day if > > the interest is big enough. > > - If someone really need Eva it should be easy to take Eva from R9B , > > do some minor corrections > > and run it together with the rest of R10B. > > > > /Regards Kenneth Lundin (Product Manager for Erlang/OTP) From joe.armstrong@REDACTED Mon Jan 10 10:32:27 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Mon, 10 Jan 2005 10:32:27 +0100 Subject: gen_tcp and message handling Message-ID: > > It is very easy, but slower ! You've said the word that sets me off :-) But who cares about speed? Speed is only relative, it's either "fast enough" or not - so write your code as beautifully as possible - and measure - if it's not fast enough then measure and then optimise. One day you might have to maintain your code so it had better be beautiful. When we started Erlang there was a lot of talk about "the 5'th generation" - the Japanese has scared shit out of the Janks by starting a program to make a "mega LIPS" Prolog machine - with this they would "crush the yanks" in the software world. The mega-LISP machine would be able to do anything - natural language translation, play chess, you name it. The mega-lisp machine would be huge - dozens (maybe hundreds) of processors. The first (Prolog based) Erlang interpreter ran at a few hundred ERPS - but this was fast enough to sell the idea of using Erlang. At the time we calculated we would need 80K ERPS to make a product - this was why we developed the JAM (we were wrong we need 240K ERPS) Today I've stopped measuring ERPS - we passed 1 Meg years ago (The laptop I'm typing this on runs in excess of 15MERPS). I said many years ago (in about 1980) something like "We should concentrate on making our software as beautiful and correct as possible - then it's either fast enough or it's not. If it's not fast enough we WAIT - then one day (due to processor speed ups it will be fast enough) - our software will then be less buggy and easier to modify and maintain than all the oppositions SW - and we win" Now a lot of software (TCP/IP stacks, protocol implementations) are here to stay - so the message is still true. So please write your stacks as inefficiently as possible - and WAIT. The funny thing about writing code as inefficiently as possible is that the resulting code is often faster than code written with efficiency in mind - this is because beautiful code should be clear, concise, as-efficient as possible (subject to being beautiful) use the best algorithms possible and be clearly layered and documented. In other words - a minor work of art. The Erlang model of the world is "everything is a process" - so things that are not processes should be faked up to look like processes and to respond to messages/links just as if they were processes - so yes please do make TCP streams look and feel like processes and ONLY make it more efficient if you absolutely have to. I do this all the time. So I abstract protocols drivers as processes, so I can write Http = spawn(fun() -> http_driver("www.foo.bar", 80), Http ! {get, "/foo/bar"}, receive {Http, {text, Bin}} -> Browser ! {render, Bin} ... end. MAKE EVERYTHING LOOK LIKE A PROCESS This is called "conceptual integrity" /Joe > > I trust you know better than me, but could you be a bit more > elaborate > as to why it is slower? I would guess it would only be marginally > slower to do > > Process -- signal --> registered process --> gen_tcp:send -> Socket > > than to have Socket be a process itself that can be > signalled, and have > > Process -- signal --> Socket process > > but maybe I'm missing something. Maybe gen_tcp:send() is actually a > signal to a process already. Then I would agree with you that > it would > actually make a difference. I have to read the source ;) > > /Fredrik > From tobbe@REDACTED Mon Jan 10 10:34:23 2005 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Mon, 10 Jan 2005 10:34:23 +0100 Subject: No more EVA? In-Reply-To: References: Message-ID: <41E24C1F.8010504@nortelnetworks.com> Casper wrote: >Kenneth, > >Thanks for the advice. > >Erlang Community: Am I the only one with an interest/need of an Event and >Alarm application in Erlang/OTP? > > > We, at Nortel, are using EVA !! Cheers, Tobbe >Cheers, >Eranga > > > >-----Original Message----- >From: Kenneth Lundin [mailto:kenneth@REDACTED] >Sent: Monday, January 10, 2005 12:32 PM >To: Casper >Cc: 'Erlang-Questions@REDACTED Org' >Subject: RE: No more EVA? > >Hi, > >The other event and alarm solution is part of a product we have >(written in Erlang) and is not that easy to extract as a separate generic >application. I meant that we (Erlang/OTP developers at Ericsson) could >extract that >solution and include it in OTP when and if interest is big enough. >We do not have that in our current plans for what to do during 2005. > >/Regards Kenneth > > > >>-----Original Message----- >>From: Casper [mailto:casper2000a@REDACTED] >>Sent: den 10 januari 2005 05:39 >>To: 'Kenneth Lundin' >>Cc: 'Erlang-Questions@REDACTED Org' >>Subject: RE: No more EVA? >> >> >>Hi Kenneth, >> >>Thanks for your advice. >> >>I would like to see a good event and alarm solution in OTP, since I think >>it's a most important part in a system. It'll be really helpful, if you >> >> >can > > >>advice me what're the other event and alarm solutions you hinted below, so >> >> >I > > >>can see to integrate them and can give back to the community, if it'll be >>any use. >> >>Cheers, >>Eranga >> >> >> >> >> >> >>-----Original Message----- >>From: Kenneth Lundin [mailto:kenneth@REDACTED] >>Sent: Sunday, January 09, 2005 11:59 PM >>To: Erlang-Questions@REDACTED Org; casper2000a@REDACTED; Casper >>Subject: Re: No more EVA? >> >>Hi, >> >>The Eva application was withdrawn from the R10B release because: >>- we knew that no commercial user (i.e paying) was using it. >>- we did not know any open source user using it (but we have heard of some >>after the decision) >>- Eva needs to be updated due to dependencies to snmp which has got small >>changes >> in the API's and we did not think it was worth the effort since nobody >> >> >is > > >>using it. >>- There are other event and alarm solutions that could be included in OTP >>some day if >> the interest is big enough. >>- If someone really need Eva it should be easy to take Eva from R9B , >>do some minor corrections >>and run it together with the rest of R10B. >> >>/Regards Kenneth Lundin (Product Manager for Erlang/OTP) >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > > > From joe.armstrong@REDACTED Mon Jan 10 10:47:42 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Mon, 10 Jan 2005 10:47:42 +0100 Subject: Upcoming article in Dr. Dobbs' Message-ID: Yes Erlang *is* the answer - but what's the problem? How are we going to make use of truly parallel CPU cores? When Intel makes 4 (6 8 10 ...) processors on a chip will we get speed ups of 4 (6 8 10...)? Chip makers can go two ways: 1) make more fancy CPU's or 2) blow multiple CPUs onto the same chip. The 1) alternative is unlikely since the designs are already horrendously complex - 2) is a much better alternative. Also, you have to get data in and out of a chip, I/O occurs at the edges of a chip but processing in the middle - so CPU power grows quadratically, and I/O only linearly. Thus the best architecture, is a chip with I/O processors on the edges and multi CPUs in the middle (the cluster on a chip). These chips are one the way - should be here by 2006/7 - It will be a nightmare porting threads based S/W onto true multi-CPUs - true concurrency (in the CPUs) will uncover loads of new errors that do not occur using pseudo-concurrency - the only way to program these boxes will be with concurrency based on pure (copying) message passing. Concurrency models based on sharing will totally screw up - Erlang is the only language I know of that is well placed to program multiCPUs all other approaches use some form sharing and or locking (which as I have said many times before - is the root of all evil) /Joe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] > Sent: den 8 januari 2005 16:31 > To: erlang-questions@REDACTED > Subject: Re: Upcoming article in Dr. Dobbs' > > > > "The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in > > Software > > > > The biggest sea change in software development since the OO > revolution > > is knocking at the door, and its name is Concurrency." > > But is Erlang a solution to the problem he talks about? Let's say > that in a couple of years the standard desktop box ships with CPUs > containing four to eight processors on one chip. Current Erlang > implementations won't make use of all those processors, as the > emulator does the bulk of its work in one thread. You could fire up > eight emulators at once and go distributed from the start, but then > you still need to manually do some kind of load balancing, to make > sure that the work is truly split up among the eight. And goes > against the grain of the work toward a shared-heap architecture, too. > > I'd love to see a way of having Erlang automatically make use of > multiple CPUs on the same box. That would provide *huge* wins. > > James > From casper2000a@REDACTED Mon Jan 10 11:24:25 2005 From: casper2000a@REDACTED (Casper) Date: Mon, 10 Jan 2005 16:24:25 +0600 Subject: No more EVA? In-Reply-To: <16866.13597.381195.242105@antilipe.corelatus.se> Message-ID: Hi Matthias, With the little reading I did on EVA, it seems to me more than an event handler. It contains SNMP adaptation support and log management. First I thought it's pretty helpful though withdrawal gave me second thoughts. Eranga -----Original Message----- From: Matthias Lang [mailto:matthias@REDACTED] Sent: Monday, January 10, 2005 1:56 PM To: Casper Cc: erlang-questions@REDACTED Subject: RE: No more EVA? Casper writes: > Erlang Community: Am I the only one with an interest/need of an Event and > Alarm application in Erlang/OTP? I looked at EVA a few years ago when writing the event and alarm code for an embedded system. That system didn't need SNMP and didn't have mnesia, so that left me looking at 11000 lines of code which don't do a whole lot more than remember which alarms are on and and tell other processes about it. Seemed about as much help as having someone else handle the fork while I'm eating ravioli, and a lot less fun. It seems that others have arrived at the same conclusion: in 99.9% of applications, EVA is more trouble than it's worth. I suspect that holds for all canned alarm solutions. But just because EVA was removed from the distribution doesn't mean you can't use it. It's still available for download. Matthias From carsten@REDACTED Mon Jan 10 11:27:28 2005 From: carsten@REDACTED (Carsten Schultz) Date: Mon, 10 Jan 2005 11:27:28 +0100 Subject: Upcoming article in Dr. Dobbs' In-Reply-To: References: Message-ID: <20050110102727.GC6536@penne.localnet> Hi! On Mon, Jan 10, 2005 at 10:47:42AM +0100, Joe Armstrong (AL/EAB) wrote: > Erlang is the only language I know of that is well placed to program > multiCPUs all other approaches use some form sharing and or locking > (which as I have said many times before - is the root of all evil) Ok, but the question still remains what an Erlang machine should look like that takes advantage of several processors. Map the many Erlang processes to a small number of OS threads? How to do the balancing? Or map one Erlang process to one OS thread in the hope that OS threads have become efficient enough and will even become better with new demands? Eg, how good is that Linux 2.6 stuff really? Are there any experimental implementations in that direction? Take care, Carsten -- Carsten Schultz (2:38, 33:47), FB Mathematik, FU Berlin http://carsten.codimi.de/ PGP/GPG key on the pgp.net key servers, fingerprint on my home page. From ulf.wiger@REDACTED Mon Jan 10 11:52:58 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Mon, 10 Jan 2005 11:52:58 +0100 Subject: gen_leader bug Message-ID: <37FB7AA6F5F9814FB634A7BF4C35A6F5402A04@ESEALNT442.al.sw.ericsson.se> Thomas, Having looked into this briefly, I'm of the opinion that lexcompare/2 can only return 'equal' if the leaders have been misconfigured. I think that it would be better for it to exit, but as far as I can tell from the code, and based on my recollection, lexcompare/2 can only return 'equal' if: (1) two nodes have been accepted by the same number of peers (which is possible), and (2) they have the same position in the list of candidates If (2) is true, the leaders are misconfigured. They should all have identical candidate lists. (*) The documentation states that "the list of candidates must be known from the start". This is perhaps a bit vague. It should also state that all leader candidates must be started with identical candidate lists. If my assumption seems incorrect, please let me know. Regards, Uffe (*) Obviously, this calls for some caution when the candidate list needs to be updated. One way to do this is during a code change (which, using the OTP release handler support is synchronized across nodes.) A reasonable restriction during code change is that if one participating node dies while upgrade is in progress, the code change is rolled back. At the moment, gen_leader callbacks are able to update the candidate list during code change, but only by breaking the record abstraction. One additional exported function, e.g. set_candidates/2, from gen_leader.erl could fix this. -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Fee, Thomas Sent: den 4 januari 2005 22:44 To: erlang-questions@REDACTED Subject: gen_leader bug Hello All, We have encountered a problem with gen_leader. All our servers died simultaneously. The bug is this: The function lexcompare returns one of: 'equal', 'less', or 'greater'. The function safe_loop calls lexcompare when it receives a 'capture' message from a server. Unfortunately, safe_loop only handles 'less' and 'greater' in the lexcompare returned result. Our server ran into a scenario when 'equal' was returned from lexcompare. Hence, the servers crashed. What should be done to fix this missing case clause problem? Thanks - - Thomas Fee DISCLAIMER: This message (including any files transmitted with it) may contain confidential and/or proprietary information, is the property of Interactive Data Corporation and/or its subsidiaries, and is directed only to the addressee(s). If you are not the designated recipient or have reason to believe you received this message in error, please delete this message from your system and notify the sender immediately. An unintended recipient's disclosure, copying, distribution, or use of this message or any attachments is prohibited and may be unlawful. From erlang@REDACTED Mon Jan 10 12:09:18 2005 From: erlang@REDACTED (Peter-Henry Mander) Date: Mon, 10 Jan 2005 11:09:18 +0000 Subject: fun opacity In-Reply-To: <20050110085516.GC98101@frogman.motivity.ca> References: <20050107220614.GA88961@frogman.motivity.ca> <20050110074919.73399d93.erlang@manderp.freeserve.co.uk> <20050110085516.GC98101@frogman.motivity.ca> Message-ID: <20050110110918.62a625be.erlang@manderp.freeserve.co.uk> Sorry Vance, hi Raimo, My new year resolution is to read questions more carefully! Indeed, if the fun lands back where it originated, there's no reason apriori that it should not work; the beam/module will be available at the point of origin, and executing the fun should work. I presume this is an implementation of a callback, or something like that? I'm answering to the list too. I'm touched that you all wish to preserve me from public embarassment, bless you all, but please don't pull punches like that. As long as it's constructive, I'm happy to be corrected. Everyone should know by now I'm impervious to intellectual embarassment; I already know I'm stupid. But demonstrating my stupidity may actually help someone else to make an intelligent choice. Pete. On Mon, 10 Jan 2005 03:55:16 -0500 Vance Shipley wrote: > Peter-Henry, > > Thanks for your help but what I was looking at was creating a fun > on nodeA, passing it to nodeB, nodeB passing it back to nodeA and > running it on nodeA. nodeB should not need the module loaded. > > It should work just fine however it is the thread you referenced > which served to leave me concerned that it might not be that simple. > > -Vance > On 10 Jan 2005 09:09:39 +0100 Raimo Niskanen wrote: > Sorry, I do not think the answer is in that thread - that thread > deals about the pecularities of shell funs in contrast to > normal funs. > > Concerning the original question; I am not entirely certain, but > I think the funs are opacue enough. For example the runtime system > does not try to load the module of the fun until it the fun is called > so there is probably no way to [k]now if the fun module exists or even > if the fun exists in that module other than calling the fun. > (or examining module_info for the module, and checking some magic > numbers of the fun in the module to see if it is the same module > version, arity, etc gory details) > > Try it. > > / Raimo Niskanen, Erlang/OTP, Ericsson AB -- "The Tao of Programming flows far away and returns on the wind of morning." From vlad_dumitrescu@REDACTED Mon Jan 10 12:07:17 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 10 Jan 2005 12:07:17 +0100 Subject: Upcoming article in Dr. Dobbs' References: Message-ID: Hi, ----- Original Message ----- From: "Joe Armstrong (AL/EAB)" > Erlang is the only language I know of that is well placed to program multiCPUs > all other approaches use some form sharing and or locking (which as I have said many > times before - is the root of all evil) Yes, but when the "others" will realize what's needed, what stops them to incorporate the Erlang model into (for example) Java or C#, or even C++? Given that technical wars are won with massive marketing and not necessarily by being best, the result is not given... I think there's a problem with using a niched language: it's difficult to find developers. What will a manager do: wear down the relatively few people he/she has that know Erlang, or support any ongoing project that aims at replacing the existing platform with (say) a C++ one so that there are plenty of fresh heads to put to work? Even if Erlang development is so much more efficient, one still needs a critical mass of developers in order to handle new projects, maintenance and support. Of course, we (as Erlang developers) will still have an edge because we are accustomed to thinking the Erlang way. But it won't be Erlang... On the other hand, instead of changing Java (language and VM) to fit the Erlang model, maybe it's easier to compile Java-like syntax to beam. After all, syntax is just, well, syntax. We'll see what the future brings. regards, Vlad From thomasl_erlang@REDACTED Mon Jan 10 12:36:29 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 10 Jan 2005 03:36:29 -0800 (PST) Subject: Upcoming article in Dr. Dobbs' In-Reply-To: Message-ID: <20050110113629.15217.qmail@web41907.mail.yahoo.com> My view is basically the same as Vlad's. While the tradeoffs of a chip multiprocessor might be different from those on an SMP, a multithreaded VM incurs costs in efficiency and implementation effort, and it's not obvious that the possible gains outweigh those costs. An Erlang layer on top of the current system might extract most of the gains at a small fraction of the effort of rewriting the VM. (Pekka Hedqvist wrote an MSc on the topic: http://www.erlang.se/publications/xjobb/0089-hedqvist.pdf ) That said, some improvements might still be made. One could speed up distributed erlang by adding a faster communications channel than sockets when running on the same host. (Pekka suggested this after his MSc was done, and it seemed sensible to me, at least.) Some systems have used mmap() to good effect here, to avoid serialization/socket/deserialization of terms; regular erlang might get along with just the ordinary serialize/copy/deserialize, which should improve things a bit, and a shared-heap Erlang might do even better if GC is not a problem. (But first, what _are_ the internode communication costs?) Another improvement would be to implement process migration, though it's again unclear how much this would gain. Short-lived processes probably won't gain anything. Long-lived processes might gain, at least sometimes. But replicating the migrating process might do even better than that. In some cases, the underlying OS imposes limitations. Running blocking system calls off somewhere else, for example. That's handled today, isn't it? Not sure. New OS primitives for chip multiprocessors might speed things up, and might make multithreading more palatable. I'm not sure which those would be, though. Running multiple processors as independently as possible is likely to remain the main technique to extract speedups. So, a modest proposal: perhaps one should instead just write an Erlang layer to hide nodes even further; e.g., spawn_lb/1 to spawn a process on the least loaded node; support for pickling and migrating gen_servers (transparently), etc. If distribution performance is found to be a consideration, first start looking at mapping suitable processes to the same node, replicating certain processes, etc. Best, Thomas __________________________________ Do you Yahoo!? The all-new My Yahoo! - Get yours free! http://my.yahoo.com From tony@REDACTED Mon Jan 10 13:08:04 2005 From: tony@REDACTED (Tony Rogvall) Date: Mon, 10 Jan 2005 13:08:04 +0100 Subject: gen_tcp and message handling In-Reply-To: References: Message-ID: <47CFB930-6300-11D9-A8C0-000A95EB4F88@rogvall.com> 2005-01-10 kl. 10.32 skrev Joe Armstrong (AL/EAB): > >>> It is very easy, but slower ! > > You've said the word that sets me off :-) > > But who cares about speed? > WELL I DO! > Speed is only relative, it's either "fast enough" or not - > so write your code as beautifully as possible - and measure - if it's > not > fast enough then measure and then optimise. > > One day you might have to maintain your code so it had better be > beautiful. > Since I have been implementing several systems to this date, I tend to remember what caused the 10% CPU overhead. So I simply try to not write code fragments that I know where bad for performance. Then I just want to share that info with you people on the list. Why write Slow and Ugly code when you can write Fast and Beautiful ;-) In many (well almost every project I haven been working in) the prototype tend to be the actual product!!! I do agree with your overall philosophy in code making. But Fast code will (nearly) always be Faster than Slow code! Windows-98 is still faster than Windows-XP even on modern machines. The previous statement is just a rumor, have not tested my self for obvious reasons. /Tony From vances@REDACTED Mon Jan 10 13:17:49 2005 From: vances@REDACTED (Vance Shipley) Date: Mon, 10 Jan 2005 07:17:49 -0500 Subject: fun opacity In-Reply-To: <20050110110918.62a625be.erlang@manderp.freeserve.co.uk> References: <20050107220614.GA88961@frogman.motivity.ca> <20050110074919.73399d93.erlang@manderp.freeserve.co.uk> <20050110085516.GC98101@frogman.motivity.ca> <20050110110918.62a625be.erlang@manderp.freeserve.co.uk> Message-ID: <20050110121749.GE98101@frogman.motivity.ca> On Mon, Jan 10, 2005 at 11:09:18AM +0000, Peter-Henry Mander wrote: } } I presume this is an implementation of a callback, or something like that? Yes, precisely. -Vance From vances@REDACTED Mon Jan 10 13:41:22 2005 From: vances@REDACTED (Vance Shipley) Date: Mon, 10 Jan 2005 07:41:22 -0500 Subject: Upcoming article in Dr. Dobbs' In-Reply-To: References: Message-ID: <20050110124122.GF98101@frogman.motivity.ca> On Mon, Jan 10, 2005 at 10:47:42AM +0100, Joe Armstrong (AL/EAB) wrote: } } Erlang is the only language I know of that is well placed to program } multiCPUs all other approaches use some form sharing and or locking } (which as I have said many times before - is the root of all evil) } } /Joe The only other serious contender would seem to be Limbo. I really haven't looked at it too closely as yet but it has concurrency as a design intent. It is similiar to Erlang in that it runs in a virtual machine as part of Inferno and has good commercial support. As far as I can tell Inferno doesn't have support for multicore CPUs and probably won't for some time as it is targeted at embedded devices such as set top boxes. Limbo does look a lot like C so it may make some folks more comfortable. -Vance From erlang@REDACTED Mon Jan 10 13:46:28 2005 From: erlang@REDACTED (Peter-Henry Mander) Date: Mon, 10 Jan 2005 12:46:28 +0000 Subject: *** SPAM *** Re: fun opacity In-Reply-To: <20050110121749.GE98101@frogman.motivity.ca> References: <20050107220614.GA88961@frogman.motivity.ca> <20050110074919.73399d93.erlang@manderp.freeserve.co.uk> <20050110085516.GC98101@frogman.motivity.ca> <20050110110918.62a625be.erlang@manderp.freeserve.co.uk> <20050110121749.GE98101@frogman.motivity.ca> Message-ID: <20050110124628.573428ae.erlang@manderp.freeserve.co.uk> On Mon, 10 Jan 2005 07:17:49 -0500 Vance Shipley wrote: > On Mon, Jan 10, 2005 at 11:09:18AM +0000, Peter-Henry Mander wrote: > } > } I presume this is an implementation of a callback, or something like that? > > Yes, precisely. > > -Vance > Would a reference serve your purpose, or is there something in the input-context you wish to preserve? What would happen if the originating module was reloaded with a modified version? Will the old version of the code still remain resident until the fun returns home to execute? I suspect that the code loading logic may not know about the itinerant fun. The results may be undetermined. I'm curious to know because I tend to use funs where, upon reflection, simpler data types would suffice with less potential unanticipated results, and more potential to expand capability, because fewer usage assumptions are made too early. Pete. P.s. I feel the caffeine effect... -- "The Tao of Programming flows far away and returns on the wind of morning." From matthias@REDACTED Mon Jan 10 13:54:36 2005 From: matthias@REDACTED (Matthias Lang) Date: Mon, 10 Jan 2005 13:54:36 +0100 Subject: Upcoming article in Dr. Dobbs' In-Reply-To: <20050110102727.GC6536@penne.localnet> References: <20050110102727.GC6536@penne.localnet> Message-ID: <16866.31500.151351.414829@antilipe.corelatus.se> Carsten Schultz writes: > Ok, but the question still remains what an Erlang machine should look > like that takes advantage of several processors. Map the many Erlang > processes to a small number of OS threads? How to do the balancing? > Or map one Erlang process to one OS thread in the hope that OS threads > have become efficient enough and will even become better with new > demands? Eg, how good is that Linux 2.6 stuff really? > > Are there any experimental implementations in that direction? I'm not quite sure what the 'that' refers to, but a reasonably complete Erlang implementation was made which used multiple threads in a symmetric way within one emulator: http://www.erlang.se/publications/xjobb/0089-hedqvist.pdf i.e. not just for IO. As far as I can tell, the result had all the hoped-for performance characteristics. But IIRC - It was a JAM VM, not a BEAM VM. - It didn't support the binary syntax - It didn't work on windows A parallel BEAM machine would be neat, but Joe just prophecised it to death an hour ago, since such a beast would need to use shared data. But maybe the erlang VM is blessed by some sort of Erlang goodness ooze-down effect. Matthias From erlang-list@REDACTED Mon Jan 10 13:57:42 2005 From: erlang-list@REDACTED (Dominic Williams) Date: Mon, 10 Jan 2005 13:57:42 +0100 Subject: No more EVA? In-Reply-To: References: Message-ID: <41E27BC6.4040005@dominicwilliams.net> Casper wrote: > Erlang Community: Am I the only one with an interest/need of an Event and > Alarm application in Erlang/OTP? A year ago, when I was trying to convince my then-company to use Erlang, an event-alarm app was part of the goodies I listed. It's consistent with the sort of systems Erlang is very suitable for. I'm not convinced I would have ended up actually using it, as against rolling our own. And these days, I have no use for it: I'm more interested in the pure Erlang language than in OTP and the apps. Regards, Dominic Williams http://www.dominicwilliams.net ---- From vances@REDACTED Mon Jan 10 14:04:12 2005 From: vances@REDACTED (Vance Shipley) Date: Mon, 10 Jan 2005 08:04:12 -0500 Subject: fun opacity In-Reply-To: <20050110124628.573428ae.erlang@manderp.freeserve.co.uk> References: <20050107220614.GA88961@frogman.motivity.ca> <20050110074919.73399d93.erlang@manderp.freeserve.co.uk> <20050110085516.GC98101@frogman.motivity.ca> <20050110110918.62a625be.erlang@manderp.freeserve.co.uk> <20050110121749.GE98101@frogman.motivity.ca> <20050110124628.573428ae.erlang@manderp.freeserve.co.uk> Message-ID: <20050110130412.GG98101@frogman.motivity.ca> On Mon, Jan 10, 2005 at 12:46:28PM +0000, Peter-Henry Mander wrote: } } Would a reference serve your purpose, or is there something in the } input-context you wish to preserve? Sure I could create a local lookup table but that would be too much trouble. The alternative would be an {M, F, A} which is fine really however it seems that a fun is the preferred way of doing things these days. } What would happen if the originating module was reloaded with a modified } version? Will the old version of the code still remain resident until } the fun returns home to execute? I suspect that the code loading logic } may not know about the itinerant fun. The results may be undetermined. Well it is the preferred way for short lived processes at least. In my case since all the processes are within the same distributed application a release upgrade script would either do the work necessary to handle things smoothly or just let it fail and continue. } I'm curious to know because I tend to use funs where, upon reflection, } simpler data types would suffice with less potential unanticipated } results, and more potential to expand capability, because fewer usage } assumptions are made too early. In this application I've almost come to the conclusion that {M, F, A} may be the way to go since while the processes may be short lived the procedure defined by either Fun or {M, F, A} is static over a large number of runs. -Vance From erlang-list@REDACTED Mon Jan 10 14:05:30 2005 From: erlang-list@REDACTED (Dominic Williams) Date: Mon, 10 Jan 2005 14:05:30 +0100 Subject: Upcoming article in Dr. Dobbs' In-Reply-To: <20050110102727.GC6536@penne.localnet> References: <20050110102727.GC6536@penne.localnet> Message-ID: <41E27D9A.7070001@dominicwilliams.net> Carsten Schultz wrote: > Ok, but the question still remains what an Erlang machine should look > like that takes advantage of several processors. Map the many Erlang > processes to a small number of OS threads? How to do the balancing? It seems to me that any sizeable Erlang system is likely to use several nodes. As these already map to OS processes, they will be properly handled by symmetric multi-processing machines. Apart from the very specialised massively parallel systems, ordinary hardware is currently in the 2-8 CPU range. This maps nicely to the order of magnitude of multi-node Erlang architectures (2-20). What more do we really want? Regards, Dominic Williams http://www.dominicwilliams.net ---- From raimo@REDACTED Mon Jan 10 14:12:27 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 10 Jan 2005 14:12:27 +0100 Subject: *** SPAM *** Re: fun opacity References: <20050110110918.62a625be.erlang@manderp.freeserve.co.uk>, <20050110121749.GE98101@frogman.motivity.ca>, <20050110124628.573428ae.erlang@manderp.freeserve.co.uk> Message-ID: If the originating module is reloaded with a new, the old code is retained until all references from funs in all processes has disappeared (been garbage collected). Therefore one more code upgrade of that module will kill the processes holding funs refering to the old module since there can be only two versions of a module - current and old. To be precise: code:load/1 loads a module but fails if there is an old version. code:purge/1 deletes the old code if there is such. If processes execute the code or if processes hold funs refering to the code they are killed. code:soft_purge/1 deletes the old code if it can be done without killing any processes. c:l/0 does code:purge(M), code:load(M). See also the erlang man page for code(3). What the release_handler does is probably something similar. So, if you want a fun that is usable over code upgrades, you can use the ancient {M,F} tuple funs, or apply(M, F, Args). There might be a replacement for the tuple funs coming in a release one day because the HIPE group does not allow them. erlang@REDACTED (Peter-Henry Mander) writes: > On Mon, 10 Jan 2005 07:17:49 -0500 > Vance Shipley wrote: > > > On Mon, Jan 10, 2005 at 11:09:18AM +0000, Peter-Henry Mander wrote: > > } > > } I presume this is an implementation of a callback, or something like that? > > > > Yes, precisely. > > > > -Vance > > > > Would a reference serve your purpose, or is there something in the > input-context you wish to preserve? > > What would happen if the originating module was reloaded with a modified > version? Will the old version of the code still remain resident until > the fun returns home to execute? I suspect that the code loading logic > may not know about the itinerant fun. The results may be undetermined. > > I'm curious to know because I tend to use funs where, upon reflection, > simpler data types would suffice with less potential unanticipated > results, and more potential to expand capability, because fewer usage > assumptions are made too early. > > Pete. > > P.s. I feel the caffeine effect... > > -- > "The Tao of Programming > flows far away > and returns > on the wind of morning." > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From steve@REDACTED Mon Jan 10 14:19:30 2005 From: steve@REDACTED (Steven H. Rogers) Date: Mon, 10 Jan 2005 06:19:30 -0700 Subject: Upcoming article in Dr. Dobbs' In-Reply-To: References: Message-ID: <41E280E2.40303@shrogers.com> Joe Armstrong (AL/EAB) wrote: > ... > > Erlang is the only language I know of that is well placed to program multiCPUs > all other approaches use some form sharing and or locking (which as I have said many > times before - is the root of all evil) > > /Joe > What about Oz (http://www.mozart-oz.org) and the APL family? Regards, Steve -- Steven H. Rogers, Ph.D., steve@REDACTED Weblog: http://shrogers.com/weblog "Always do right. This will gratify some people and astonish the rest." -- Mark Twain From luke@REDACTED Mon Jan 10 13:24:40 2005 From: luke@REDACTED (Luke Gorrie) Date: 10 Jan 2005 13:24:40 +0100 Subject: Upcoming article in Dr. Dobbs' References: <41DB9F60.20601@erlang-consulting.com> <41DED411.4060204@csd.uu.se> Message-ID: Strangely, when I read about clock speeds flattening out my initial reaction was excitement - "imagine if computers didn't get faster!" I'm not sure why but I find that idea very appealing. Maybe it's like the good old days on the Amiga. "This is the computer. It has a 7Mhz CPU, a meg of ram, and a couple of coprocessors. What can you do with it?" People always find new "impossible" things to do, just using clever programming. Too bad about these parallel/concurrent architectures. -Luke From thomasl_erlang@REDACTED Mon Jan 10 14:38:01 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 10 Jan 2005 05:38:01 -0800 (PST) Subject: Upcoming article in Dr. Dobbs' In-Reply-To: <41E27D9A.7070001@dominicwilliams.net> Message-ID: <20050110133801.20651.qmail@web41904.mail.yahoo.com> --- Dominic Williams wrote: > Apart from the very > specialised massively parallel systems, ordinary > hardware is currently in the 2-8 CPU range. This > maps > nicely to the order of magnitude of multi-node > Erlang > architectures (2-20). > > What more do we really want? Good point -- but I'd say we need to look ahead for the time when we have systems of 2-10 multicore CPUs and, say, 2-8 cores per chip. (In a few years, you won't be able to buy a single core desktop CPU, more or less.) So, we will then need to handle on the order of 50-100 nodes as a normal case. In the longer term, this will be on the order of 1000 nodes. Most of these might be hidden nodes, possibly. That, or some other sort of hierarchy, might take care of scaling distributed Erlang as such. Or we will have to redo that design. Maybe, to argue against my previous position, this is really an argument for multithreading the VM? Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Mail - You care about security. So do we. http://promotions.yahoo.com/new_mail From erlang-list@REDACTED Mon Jan 10 14:13:01 2005 From: erlang-list@REDACTED (Dominic Williams) Date: Mon, 10 Jan 2005 14:13:01 +0100 Subject: Upcoming article in Dr. Dobbs' In-Reply-To: References: Message-ID: <41E27F5D.804@dominicwilliams.net> Vlad Dumitrescu wrote: > Yes, but when the "others" will realize what's needed, what stops them to > incorporate the Erlang model into (for example) Java or C#, or even C++? Given > that technical wars are won with massive marketing and not necessarily by being > best, the result is not given... Even so, they are unlikey to /remove/ the existing thread model. So those systems will continue to be plagued with bugs. > I think there's a problem with using a niched language: it's difficult to find > developers. Although managers frequently use this argument, I believe it is a fallacy. I have seen enough problems developing in C++ with very experienced people to prefer using a language which is safe to use after a couple of weeks training. > On the other hand, instead of changing Java (language and VM) to fit the Erlang > model, maybe it's easier to compile Java-like syntax to beam. After all, syntax > is just, well, syntax. The problem with Java and C++ is not just the syntax, it's conceptual, it's the concurrency model. Regards, Dominic Williams http://www.dominicwilliams.net ---- From thomasl_erlang@REDACTED Mon Jan 10 14:23:05 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 10 Jan 2005 05:23:05 -0800 (PST) Subject: Upcoming article in Dr. Dobbs' In-Reply-To: Message-ID: <20050110132305.16797.qmail@web41904.mail.yahoo.com> --- Vlad Dumitrescu wrote: > Yes, but when the "others" will realize what's > needed, what stops them to > incorporate the Erlang model into (for example) Java > or C#, or even C++? Given > that technical wars are won with massive marketing > and not necessarily by being > best, the result is not given... Nothing will necessarily stop them, but it's not trivial to get it right. (Note that sometimes leaving things out of the language can be as helpful as putting them in.) > I think there's a problem with using a niched > language: it's difficult to find developers. On one hand, it's easy enough to train programmers in Erlang. On the other, there is always resistance to the unknown, from managers ("nobody ever got fired for ...") as well as programmers (at least the class of them who won't want to sully their CVs with non-Java work). > ... Even if Erlang development is so much more > efficient, one still needs a > critical mass of developers in order to handle new > projects, maintenance and > support. Start hiring and they will come, is my guess. What is needed from the developer perspective is a viable herd of commercial projects, really, so that cancelling one doesn't mean the developers have to move on to Java. (Though it would also be nice to get a python or ruby effect of developer interest in this regard. Maybe the silent masses of Wings3D users can be drafted?) > On the other hand, instead of changing Java > (language and VM) to fit the Erlang > model, maybe it's easier to compile Java-like syntax > to beam. After all, syntax > is just, well, syntax. I'm not so sure it's that simple (you need semantics too). And even if it was feasible, I'd strongly prefer to keep the Erlang syntax :-) Best, Thomas __________________________________ Do you Yahoo!? The all-new My Yahoo! - Get yours free! http://my.yahoo.com From erlang@REDACTED Mon Jan 10 15:28:20 2005 From: erlang@REDACTED (Peter-Henry Mander) Date: Mon, 10 Jan 2005 14:28:20 +0000 Subject: fun opacity In-Reply-To: <20050110130412.GG98101@frogman.motivity.ca> References: <20050107220614.GA88961@frogman.motivity.ca> <20050110074919.73399d93.erlang@manderp.freeserve.co.uk> <20050110085516.GC98101@frogman.motivity.ca> <20050110110918.62a625be.erlang@manderp.freeserve.co.uk> <20050110121749.GE98101@frogman.motivity.ca> <20050110124628.573428ae.erlang@manderp.freeserve.co.uk> <20050110130412.GG98101@frogman.motivity.ca> Message-ID: <20050110142820.45139dce.erlang@manderp.freeserve.co.uk> On Mon, 10 Jan 2005 08:04:12 -0500 Vance Shipley wrote: > } I'm curious to know because I tend to use funs where, upon reflection, > } simpler data types would suffice with less potential unanticipated > } results, and more potential to expand capability, because fewer usage > } assumptions are made too early. > > In this application I've almost come to the conclusion that {M, F, A} > may be the way to go since while the processes may be short lived the > procedure defined by either Fun or {M, F, A} is static over a large > number of runs. I'm beginning to think the same. It allows some flexibitity that pure funs deny. The arguments can be submitted to other functions besides M:F, while still preserving a default behaviour. A fun locks this up in an opaque type and I don't think it's practical to disect a fun instance to recover the arguments. May I suggest using something simpler like: {tag(),args()} tag() -> atom() args() -> [term()] Like that there are no assumptions made about what the 'package' does, just an indication what kind of data it is. Pete. P.s. sorry fot the *** SPAM *** subject prefix, my ISP makes wild assumptions about what is unsolicited garbage and what is intelligent discourse. Please don't take it personally! -- "The Tao of Programming flows far away and returns on the wind of morning." From vlad_dumitrescu@REDACTED Mon Jan 10 15:26:56 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 10 Jan 2005 15:26:56 +0100 Subject: Upcoming article in Dr. Dobbs' References: <20050110133801.20651.qmail@web41904.mail.yahoo.com> Message-ID: ----- Original Message ----- From: "Thomas Lindgren" > Maybe, to argue against my previous position, this is > really an argument for multithreading the VM? Well, not really. The same tricks you mentioned (load balancing, node hierarchy, etc) would have to be implemented inside the VM. Since the VM is C code, then it won't be easy to have it benefit from Erlang's higher-level concepts. Multithreading the VM would probably push the bulk of work to the main developers (because it isn't very likely that such a big thing might be done otherwise), but it won't make things easier to do. I feel that these already mentioned improvements might be enough (for a while, at least) together with regular nodes: - faster inter-node communication when on the same machine; - load balancing (non application specific); - migrating processes; - clustering (=node hierarchy); this affects many areas that need to go from the simple local/global setup to a hierarchical one Some of these can already be found in existing applications, I'm sure. The main argument is, I think, that these would also be beneficial for todays systems, and thus it's more probable that someone will pay for the development :-) regards, Vlad From vances@REDACTED Mon Jan 10 15:42:54 2005 From: vances@REDACTED (Vance Shipley) Date: Mon, 10 Jan 2005 09:42:54 -0500 Subject: fun opacity In-Reply-To: <20050110142820.45139dce.erlang@manderp.freeserve.co.uk> References: <20050107220614.GA88961@frogman.motivity.ca> <20050110074919.73399d93.erlang@manderp.freeserve.co.uk> <20050110085516.GC98101@frogman.motivity.ca> <20050110110918.62a625be.erlang@manderp.freeserve.co.uk> <20050110121749.GE98101@frogman.motivity.ca> <20050110124628.573428ae.erlang@manderp.freeserve.co.uk> <20050110130412.GG98101@frogman.motivity.ca> <20050110142820.45139dce.erlang@manderp.freeserve.co.uk> Message-ID: <20050110144254.GB89073@frogman.motivity.ca> On Mon, Jan 10, 2005 at 02:28:20PM +0000, Peter-Henry Mander wrote: } } ... A fun locks this up in an opaque type and I don't think it's } practical to disect a fun instance to recover the arguments. ... I'm a big fan of opaque values. If my intention is to pass a value which is only meant to be used by the caller when it is returned it is really better that it is opaque. It's safer that way. If it's always observed to be an integer eventually someone will write code which assumes it will always be an integer. Later when I start using atoms things fail. If I had my way the language would support that (not a suggestion, just a principle). -Vance From vlad_dumitrescu@REDACTED Mon Jan 10 15:53:53 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 10 Jan 2005 15:53:53 +0100 Subject: Upcoming article in Dr. Dobbs' References: <20050110132305.16797.qmail@web41904.mail.yahoo.com> Message-ID: ----- Original Message ----- From: "Dominic Williams" > > Yes, but when the "others" will realize what's needed, what stops them to > > incorporate the Erlang model into (for example) Java or C#, or even C++? Given > > that technical wars are won with massive marketing and not necessarily by being > > best, the result is not given... > > Even so, they are unlikey to /remove/ the existing > thread model. So those systems will continue to be > plagued with bugs. Yes, but if let's say Java 9.0 has *also* the means to create isolated processes using message passing, then people will quickly realize that it's much easier to use them instead of the old threads. > > I think there's a problem with using a niched language: it's difficult to find > > developers. > > Although managers frequently use this argument, I > believe it is a fallacy. I have seen enough problems > developing in C++ with very experienced people to > prefer using a language which is safe to use after a > couple of weeks training. The realm of politics is too complex for me :-) Fallacy or not, some managers seem still believe that and act upon that belief. And while there are people wanting to learn a new language and then doing bleeding-edge development, I'm not so sure about those that will have to maintain and support "old stuff". As things stand now, the CVs look better with "J2EE" in them than "OTP"... > > On the other hand, instead of changing Java (language and VM) to fit the Erlang > > model, maybe it's easier to compile Java-like syntax to beam. After all, syntax > > is just, well, syntax. > > The problem with Java and C++ is not just the syntax, > it's conceptual, it's the concurrency model. Exactly my point. Let them use the Erlang concurrency model! regards, Vlad From TFee@REDACTED Mon Jan 10 17:39:50 2005 From: TFee@REDACTED (Fee, Thomas) Date: Mon, 10 Jan 2005 08:39:50 -0800 Subject: gen_leader bug Message-ID: <345E735D5F93E046AAA7B8A88797E145C7A648@srvrxchil1.futuresource.com> Dear Ulf, Our server farm has nodes that join the cloud at different times, as you might guess. First, I don't know how we set things up for a new node to inform other nodes about its availability. Secondly, I suspect that a race condition probably exists in whatever technique we employ for that purpose. Probably, there is no lock/sync involved across the set of all nodes. Martin Logan incorporated gen_leader into our system. He can probably make better sense of all this. - Thomas Fee (eSignal / FutureSource) -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Ulf Wiger (AL/EAB) Sent: Monday, January 10, 2005 4:53 AM To: erlang-questions@REDACTED Subject: RE: gen_leader bug Thomas, Having looked into this briefly, I'm of the opinion that lexcompare/2 can only return 'equal' if the leaders have been misconfigured. I think that it would be better for it to exit, but as far as I can tell from the code, and based on my recollection, lexcompare/2 can only return 'equal' if: (1) two nodes have been accepted by the same number of peers (which is possible), and (2) they have the same position in the list of candidates If (2) is true, the leaders are misconfigured. They should all have identical candidate lists. (*) The documentation states that "the list of candidates must be known from the start". This is perhaps a bit vague. It should also state that all leader candidates must be started with identical candidate lists. If my assumption seems incorrect, please let me know. Regards, Uffe (*) Obviously, this calls for some caution when the candidate list needs to be updated. One way to do this is during a code change (which, using the OTP release handler support is synchronized across nodes.) A reasonable restriction during code change is that if one participating node dies while upgrade is in progress, the code change is rolled back. At the moment, gen_leader callbacks are able to update the candidate list during code change, but only by breaking the record abstraction. One additional exported function, e.g. set_candidates/2, from gen_leader.erl could fix this. -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Fee, Thomas Sent: den 4 januari 2005 22:44 To: erlang-questions@REDACTED Subject: gen_leader bug Hello All, We have encountered a problem with gen_leader. All our servers died simultaneously. The bug is this: The function lexcompare returns one of: 'equal', 'less', or 'greater'. The function safe_loop calls lexcompare when it receives a 'capture' message from a server. Unfortunately, safe_loop only handles 'less' and 'greater' in the lexcompare returned result. Our server ran into a scenario when 'equal' was returned from lexcompare. Hence, the servers crashed. What should be done to fix this missing case clause problem? Thanks - - Thomas Fee DISCLAIMER: This message (including any files transmitted with it) may contain confidential and/or proprietary information, is the property of Interactive Data Corporation and/or its subsidiaries, and is directed only to the addressee(s). If you are not the designated recipient or have reason to believe you received this message in error, please delete this message from your system and notify the sender immediately. An unintended recipient's disclosure, copying, distribution, or use of this message or any attachments is prohibited and may be unlawful. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeinhorn@REDACTED Mon Jan 10 17:55:59 2005 From: jeinhorn@REDACTED (Jeff Einhorn) Date: Mon, 10 Jan 2005 10:55:59 -0600 Subject: Upcoming article in Dr. Dobbs' Message-ID: As a novice Erlang user I found Erlang to be much more CPU intensive when compared to Java in situations when I was developing applications that needed to constantly change\manipulate data structures. My observation was that this was a result of the constant destroying\recreating of the data structures as result of their manipulation. Are there any plans to add a C type data structure where items could be changed in place, without having to recreate the entire data structure? In defense of Erlang I never had any memory problems in my Erlang applications. However, I found it common in Java Server applications that their memory would continually grow and eventually the application would need to be restarted. Thanks for the great tool, Jeff Einhorn From tony@REDACTED Mon Jan 10 18:27:57 2005 From: tony@REDACTED (Tony Rogvall) Date: Mon, 10 Jan 2005 18:27:57 +0100 Subject: Upcoming article in Dr. Dobbs' In-Reply-To: <41DFA83E.13720.A82EB@localhost> References: <41DB9F60.20601@erlang-consulting.com> <41DFA83E.13720.A82EB@localhost> Message-ID: 2005-01-08 kl. 16.30 skrev James Hague: >> "The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in >> Software >> >> The biggest sea change in software development since the OO revolution >> is knocking at the door, and its name is Concurrency." > > But is Erlang a solution to the problem he talks about? Let's say > that in a couple of years the standard desktop box ships with CPUs > containing four to eight processors on one chip. Current Erlang > implementations won't make use of all those processors, as the > emulator does the bulk of its work in one thread. You could fire up > eight emulators at once and go distributed from the start, but then > you still need to manually do some kind of load balancing, to make > sure that the work is truly split up among the eight. And goes > against the grain of the work toward a shared-heap architecture, too. > > I'd love to see a way of having Erlang automatically make use of > multiple CPUs on the same box. That would provide *huge* wins. > FYI Me and Pekka Hedqvist implemented Multithreaded Erlang as a part of Pekka's Master Thesis, It was a lot of work! But we proved that Erlang can run on a multi processor machine (a 4 processor pentium 200MHz) and that Erlang applications can run unmodified on such a beast ;-). Even the OTP system run with only slight modifications. In short we achieved linear speed improvements. This means that if you divided your problem in four independent parts on a four processor machine you will get a speed up with a factor of four. At that time JAM was the machine, now with BEAM/HIPE it's a bit more complicated. Not very complicated but more code and a lot of flavors. /Tony From ft@REDACTED Mon Jan 10 21:46:14 2005 From: ft@REDACTED (Fredrik Thulin) Date: Mon, 10 Jan 2005 21:46:14 +0100 Subject: gen_server can't trap 'EXIT' from parent Message-ID: <200501102146.15009.ft@it.su.se> I have a gen_server that I start 'manually' (not using a supservisor) with gen_server:start_link/3. In the init/1 function I do process_flag(trap_exit, true). I do this to try and make my application as robust as possible. The gen_server was a SIP server transaction handler, and my idea was that it should notify the originator of the SIP request with a SIP error in case anything happened in my application. It therefor needed to be linked with the application process, to be able to detect if it crashed. I scratched my head for a good two hours tonight trying to figure out why I didn't receive the exit signals in my handle_info/2 function, but instead could just notice that my terminate/2 function got called when the parent process terminated. Regardless of how much I had set trap_exit to true - regardless of where I did it. I could even see that it was still set inside terminate/2 by calling process_info(self(), trap_exit). I goggled for another hour or so, but found no explanation there. It seemed as if the general understanding were that you could do trap_exit in gen_servers to get {'EXIT', ...} signals from processes to whom you had links, instead of getting terminated. I then looked at the source. In R10B-2, gen_server.erl, inside loop(...) (the MAIN loop), this code is found : Msg = receive ... case Msg of ... {'EXIT', Parent, Reason} -> terminate(Reason, Name, Msg, Mod, State, Debug); ... Right! That explains it. If the 'EXIT' comes from your gen_servers parent (almost always your supervisor I guess) then you can't trap it! Just thought I would send a message to the list, mainly for the archives since no matter how stupid I think it is for a gen_server to have EXITs from it's parent handled differently, I don't imagine it would ever be changed. I did find a way around it, although it isn't very elegant. A comment near the top of gen.erl (where the common start-functions for the general behaviors are) says %% If spawn without link, set parent to our selves "self"!!! So if you do gen_server:start(... self() ...) instead of start_link(...) and then, in the init/1 function, you link to the parents pid and do your process_flag(trap_exit, true) it seems to work. You then get 'EXIT' signals when the gen_servers parent terminates, and I haven't observed any bad effects from it this far. Time for rest. /Fredrik From rpettit@REDACTED Mon Jan 10 21:37:09 2005 From: rpettit@REDACTED (Rick Pettit) Date: Mon, 10 Jan 2005 14:37:09 -0600 Subject: Upcoming article in Dr. Dobbs' In-Reply-To: References: Message-ID: <20050110203709.GA27834@vailsys.com> On Mon, Jan 10, 2005 at 10:55:59AM -0600, Jeff Einhorn wrote: > As a novice Erlang user I found Erlang to be much more CPU intensive > when compared to Java in situations when I was developing applications > that needed to constantly change\manipulate data structures. My > observation was that this was a result of the constant > destroying\recreating of the data structures as result of their > manipulation. Are there any plans to add a C type data structure where > items could be changed in place, without having to recreate the entire > data structure? As soon as you do away with pass by copy you lose much of the advantage of Erlang IMO. -Rick From vlad_dumitrescu@REDACTED Mon Jan 10 22:24:44 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 10 Jan 2005 22:24:44 +0100 Subject: gen_server can't trap 'EXIT' from parent References: <200501102146.15009.ft@it.su.se> Message-ID: --- Original Message ----- From: "Fredrik Thulin" > Right! That explains it. If the 'EXIT' comes from your gen_servers > parent (almost always your supervisor I guess) then you can't trap it! Hi, Your gen_server gets notified that the parent creshed: terminate is called. You can do whatever you need to do there, instead of inside handle_info. It's just the same, since the gen_server should probably exit too. Just remember to do a case Reason of ... in terminate, to find out if it was a crash or a normal shutdown. (I forgot at one time and was very confused afterwards :-) regards, Vlad From erlq@REDACTED Mon Jan 10 23:07:41 2005 From: erlq@REDACTED (Rob) Date: Mon, 10 Jan 2005 14:07:41 -0800 Subject: speed... Message-ID: <41E2FCAD.7000904@itsbeen.sent.com> I was interested if anyone has any opinions about the following. I was looking through for the language shootout because I was thinking about learning "D" (D and erlang hold a similar attraction for me) and wanted some programs to start with. I was happy to see that the newest round of "benchmarks" includes a new test where erlang starts to shine http://shootout.alioth.debian.org/benchmark.php?test=message&lang=all&sort=cpu Although they will probably not ramp the test up to where erlang is strongest since most other languages will start to fail at less than 5000 threads. The thing I am wondering about is the performance of Clean http://shootout.alioth.debian.org/benchmark.php?test=all&lang=clean&sort=cpu I don't understand why a small, relatively obscure functional language could surpass the performance of compilers that have had massive amounts of academic and industry scrutiny, testing and tuning over a period of (in some cases) decades. For version 2.1 of Clean they have re-written their compiler in Clean, is it that function languages are that much superior for compilers? I am thinking that I'd like to use some Clean functions for some serial processing within the context of an erlang program that does all the concurrency management - Any opinions about something like that? TIA, Rob PS I noticed their erlang fasta program is failing: http://shootout.alioth.debian.org/sandbox/benchmark.php?test=fasta&lang=erlang&sort=cpu From erlang-list@REDACTED Mon Jan 10 23:16:40 2005 From: erlang-list@REDACTED (Dominic Williams) Date: Mon, 10 Jan 2005 23:16:40 +0100 Subject: Upcoming article in Dr. Dobbs' In-Reply-To: References: Message-ID: <41E2FEC8.4080302@dominicwilliams.net> Jeff Einhorn wrote: > As a novice Erlang user I found Erlang to be much > more CPU intensive when compared to Java in > situations when I was developing applications that > needed to constantly change\manipulate data > structures. My observation was that this was a > result of the constant destroying\recreating of the > data structures as result of their manipulation. I have found that it takes time to move to an Erlang mindset. The particular aspect you mention is common to many functional languages. The trick is not to send whole data structures around. Create functions that act on specific arguments, and extract those from the large structure /before/ calling the functions. Another possibility is using ETS tables, or data structures from the library (dict, for example) that are at least reasonably optimised. In any event, all this is just optimization. Don't worry about it until you have isolated an actual problem. In the meantime, your code will be clearer, and more correct. > Are there any plans to add a C type data structure > where items could be changed in place, without having > to recreate the entire data structure? That would rather spoil the whole point of using a single-assignment functional language... Regards, Dominic Williams http://www.dominicwilliams.net ---- From james@REDACTED Tue Jan 11 05:03:03 2005 From: james@REDACTED (James Hague) Date: Mon, 10 Jan 2005 22:03:03 -0600 Subject: gen_tcp and message handling In-Reply-To: Message-ID: <41E2FB97.15683.D2A616@localhost> Methinks the speed issue has derailed this discussion! I do admit that I like to read Joe's rants about writing slow code, though :-) In any case, the clean solution being argued for here is also the faster one, so the point is moot. gen_tcp (and gen_udp) are asymmetricl as currently implemented. You can receive packets as Erlang messages but you can't send packets as Erlang messages. That's wrong. It should either be changed so it works both ways or the current half-solution should be deprecated. In the latter case, you'd be forced to create a little process to wrap around gen_tcp so you can send and receive messages as expected, even though gen_tcp:send and gen_tcp:recv are doing the work behind the scenes. James From james@REDACTED Tue Jan 11 05:12:16 2005 From: james@REDACTED (James Hague) Date: Mon, 10 Jan 2005 22:12:16 -0600 Subject: speed... In-Reply-To: <41E2FCAD.7000904@itsbeen.sent.com> Message-ID: <41E2FDC0.11756.DB15E0@localhost> > The thing I am wondering about is the performance of Clean > > I don't understand why a small, relatively obscure functional language > could surpass the performance of compilers that have had massive > amounts of academic and industry scrutiny, testing and tuning over a > period of (in some cases) decades. Well, IMO, the Clean team simply gave the highest priority to ultimate performance. Ironically, Clean is one of the more complex and ugly functional languages, as it's loaded with all kinds of manual annotations for strictness and uniqueness and so on. James From vances@REDACTED Tue Jan 11 05:53:08 2005 From: vances@REDACTED (Vance Shipley) Date: Mon, 10 Jan 2005 23:53:08 -0500 Subject: Upcoming article in Dr. Dobbs' In-Reply-To: References: Message-ID: <20050111045308.GJ98101@frogman.motivity.ca> On Mon, Jan 10, 2005 at 10:47:42AM +0100, Joe Armstrong (AL/EAB) wrote: } } When Intel makes 4 (6 8 10 ...) processors on a chip will we } get speed ups of 4 (6 8 10...)? Sun's Niagra processor will ship in 2006 with 8 64-bit UltraSPARC cores. Each core handles 4 threads at a time with simultaneous multithreading (SMT). So you have 32 "simultaneous" threads. I imagine that it won't be too long before we have hundreds of threads running in a chip. I wonder how Erlang, as a concurrency oriented language, can take advantage of this future. -Vance From ft@REDACTED Tue Jan 11 10:29:03 2005 From: ft@REDACTED (Fredrik Thulin) Date: Tue, 11 Jan 2005 10:29:03 +0100 Subject: gen_server can't trap 'EXIT' from parent In-Reply-To: References: <200501102146.15009.ft@it.su.se> Message-ID: <200501111029.03856.ft@it.su.se> On Monday 10 January 2005 22.24, Vlad Dumitrescu wrote: > --- Original Message ----- > From: "Fredrik Thulin" > > > Right! That explains it. If the 'EXIT' comes from your gen_servers > > parent (almost always your supervisor I guess) then you can't trap > > it! > > Hi, > > Your gen_server gets notified that the parent creshed: terminate is > called. You can do whatever you need to do there, instead of inside > handle_info. It's just the same, since the gen_server should probably > exit too. No it shouldn't. My gen_server should send a SIP error message back, and then stay alive for (most oftenly) 32 seconds to make sure that we re-send this SIP error message if we get a resend of the original SIP request (not my idea to run SIP over unreliable transports...). /Fredrik From John-Olof.Bauner@REDACTED Tue Jan 11 08:42:54 2005 From: John-Olof.Bauner@REDACTED (John-Olof Bauner) Date: Tue, 11 Jan 2005 08:42:54 +0100 Subject: Upcoming article in Dr. Dobbs' In-Reply-To: References: Message-ID: <41E3837E.1010506@ericsson.com> Vlad Dumitrescu wrote: > Yes, but when the "others" will realize what's needed, what stops them to > incorporate the Erlang model into (for example) Java or C#, or even > C++? Given > that technical wars are won with massive marketing and not necessarily > by being > best, the result is not given... > Once Ericsson developed a nice language, EriPascal, that run in a propritary OS called EriOS. It had some of the features of Erlang like modules, signals between processes with implicit defer of signals, process supervision (link handling), etc. A consultancy company, ENEA, rewrote the OS in C (and M68000 assembler at that time). So instead of a propritary language the mechanisms for writing real-time systems became available to a broader public. Ericsson became a main customer to Enea's OS called OSE. Today OSE is very videly spread in the telecom world and is used in half of the new mobile phones sold worldwide and in a range of other products like base stations. John-Olof From John-Olof.Bauner@REDACTED Tue Jan 11 09:31:13 2005 From: John-Olof.Bauner@REDACTED (John-Olof Bauner) Date: Tue, 11 Jan 2005 09:31:13 +0100 Subject: Upcoming article in Dr. Dobbs' References: Message-ID: <41E38ED1.9050206@ericsson.com> Vlad Dumitrescu wrote: > Yes, but when the "others" will realize what's needed, what stops them to > incorporate the Erlang model into (for example) Java or C#, or even > C++? Given > that technical wars are won with massive marketing and not necessarily > by being > best, the result is not given... > Once Ericsson developed a nice language, EriPascal, that run in a propritary OS called EriOS. It had some of the features of Erlang like modules, signals between processes with implicit defer of signals, process supervision (link handling), etc. A consultancy company, ENEA, rewrote the OS in C (and M68000 assembler at that time). So instead of a propritary language the mechanisms for writing real-time systems became available to a broader public. Ericsson became a main customer to Enea's OS called OSE. Today OSE is very videly spread in the telecom world and is used in half of the new mobile phones sold worldwide and in a range of other products like base stations. John-Olof ps. Maybe you got this twice - some problem with the mail server, exchange. From joe.armstrong@REDACTED Tue Jan 11 10:46:21 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Tue, 11 Jan 2005 10:46:21 +0100 Subject: speed... Message-ID: > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Rob > Sent: den 10 januari 2005 23:08 > To: erlang-questions@REDACTED > Subject: speed... > > > I was interested if anyone has any opinions about the following. > > I was looking through for the language shootout because I > was thinking > about learning "D" (D and erlang hold a similar attraction > for me) and > wanted some programs to start with. I was happy to see that > the newest > round of "benchmarks" includes a new test where erlang starts > to shine > http://shootout.alioth.debian.org/benchmark.php?test=message&l > ang=all&sort=cpu > Although they will probably not ramp the test up to where erlang is > strongest since most other languages will start to fail at less than > 5000 threads. The interesting thing is to start measuring at the point where things start to fail and observe if the failure is catastrophic or not - Ramping the number of processes up to higher than the maximum allowed number of OS processes will sort out the sheep from the goats. Just a general comment of benchmarks - the benchmarks measure two non-functional properties of a program (speed, and memory usage) but there many more non-functional properties which a virtually impossible to benchmark. IMHO the non-functional property of a program which I call "isolation" is very difficult (maybe impossible) to measure. Isolation means - your program shouldn't be able to crash my program. If we put two programs in a machine (call them A and B) it doesn't matter a fig if A is super fast and proved correct if it is possible for B to crash A. If you choose your language on the basis of speed/memory you should end up with assembler which has many other non-desirable non-functional properties. Erlang processes try to be like OS processes in so much as they try to isolate errors occurring in one processes from another process, benchmarking or even measuring this property would be very difficult. >The thing I am wondering about is the performance of Clean >http://shootout.alioth.debian.org/benchmark.php?test=all&lang=clean&sort=cpu > I don't understand why a small, relatively obscure functional language > could surpass the performance of compilers that have had massive amounts > of academic and industry scrutiny, testing and tuning over a period of > (in some cases) decades. For version 2.1 of Clean they have re-written > their compiler in Clean, is it that function languages are that much > superior for compilers? Is this surprising - it doesn't surprise me - how does *massive* help Rinus and Marko are very smart guys - If a problem can be solved by a very small number of people (preferably one) then the solution will almost always be better than if it were solved by many people. Making a programming language/OS is a job suitable for a very small team - delivering it to millions of people, translating the manuals to 100 languages, and selling it to the world requires lots of people. > I am thinking that I'd like to use some Clean functions for some serial > processing within the context of an Erlang program that does all the > concurrency management - Any opinions about something like that? Fine - but make sure that get the concurrency model right. What you want to constantly be flipping backward and forwards between Erlang and clean Better to stay in one world for a relatively long time - every time you change from Erlang to clean you'll get an impedance mismatch between the language - so you should have a clear idea of what Erlang is good for and what Clean is good for and use them appropriately. /Joe > TIA, > Rob > PS I noticed their erlang fasta program is failing: > http://shootout.alioth.debian.org/sandbox/benchmark.php?test=fasta&lang=erlang&sort=cpu From vlad_dumitrescu@REDACTED Tue Jan 11 10:58:12 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 11 Jan 2005 10:58:12 +0100 Subject: gen_server can't trap 'EXIT' from parent References: <200501102146.15009.ft@it.su.se> <200501111029.03856.ft@it.su.se> Message-ID: ----- Original Message ----- From: "Fredrik Thulin" > > Your gen_server gets notified that the parent creshed: terminate is > > called. You can do whatever you need to do there, instead of inside > > handle_info. It's just the same, since the gen_server should probably > > exit too. > > No it shouldn't. My gen_server should send a SIP error message back, and > then stay alive for (most oftenly) 32 seconds to make sure that we > re-send this SIP error message if we get a resend of the original SIP > request (not my idea to run SIP over unreliable transports...). Jaha, okay, I understand. Then I think the process that starts this gen_server shouldn't be its parent (in the regular meaning where the parent is a supervisor), and then the solution you came up with (i.e. linking from inside init instead of using start_link) is right. regards, Vlad From vlad_dumitrescu@REDACTED Tue Jan 11 10:58:58 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 11 Jan 2005 10:58:58 +0100 Subject: Upcoming article in Dr. Dobbs' References: <41E3837E.1010506@ericsson.com> Message-ID: ----- Original Message ----- From: "John-Olof Bauner" > Once Ericsson developed a nice language, EriPascal, that run in a > propritary OS called EriOS. It had some of the features of Erlang like > modules, signals between processes with implicit defer of signals, > process supervision (link handling), etc. A consultancy company, ENEA, > rewrote the OS in C (and M68000 assembler at that time). So instead of a > propritary language the mechanisms for writing real-time systems became > available to a broader public. Ericsson became a main customer to Enea's > OS called OSE. Today OSE is very videly spread in the telecom world and > is used in half of the new mobile phones sold worldwide and in a range > of other products like base stations. Yes, I know. I was taking the point of view of an Erlang user. I imagine that at the time the EriPascal junkies weren't very pleased with the idea either ;-) And also Erlang is now open-source - the newcomers might not be. I don't mean that a Concurrency-oriented Java or C# would be a bad idea. I mean that if CO is going to Conquer The World (tm), then (being an Erlang junkie) I'd prefer Erlang to be the foremost environment. The point would be that any effort in spreading The Erlang Way is useful. regards, Vlad From bry@REDACTED Tue Jan 11 14:04:26 2005 From: bry@REDACTED (bry@REDACTED) Date: Tue, 11 Jan 2005 14:04:26 +0100 Subject: A Pythonista's Impressions of Erlang Message-ID: <1105448666.41e3ceda48bf8@horde.scannet.dk> A blog post I just came across http://llimllib.f2o.org/blog/serve/entry/erlang From bjorn@REDACTED Tue Jan 11 16:30:31 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 11 Jan 2005 16:30:31 +0100 Subject: Compiler crash with abstract modules... In-Reply-To: <41DEED61.3020507@cisco.com> References: <41DEED61.3020507@cisco.com> Message-ID: Yes, interesting! It would be useful if your example would have worked. Unfortunately, it seems that it will not be that easy to make it work, so we will probably eliminate the crash in a future release by instead producing an error message. /Bjorn Mark Scandariato writes: > Hi, > > Interesting crash when compiling the following snippet: > > %%%---------------------- > -module(foo, [N]). > -compile(export_all). > > bug(<>) -> V. > %%%---------------------- > > This is equivalent to: > %%%---------------------- > -module(foo). > -compile(export_all). > > bug(<>, {foo, N}) -> V. > %%%---------------------- > > Which would normally just complain that "variable 'N' is unbound". > > Here's the crash: > > foo.erl:none: internal error in v3_codegen; > crash reason: {{case_clause,{'EXIT',{function_clause, > [{v3_codegen,fetch_stack,['N',[],0]}, > {v3_codegen,select_extract_bin,10}, > {v3_codegen,select_bin_seg,5}, > {v3_codegen,select_binary,6}, > {v3_codegen,match_cg,5}, > {v3_codegen,match_cg,6}, > {v3_codegen, > '-cg_list/5-anonymous-0-', > 3}, > {v3_codegen,flatmapfoldl,3}, > {v3_codegen,cg_list,5}, > {v3_codegen,cg_fun,4}]}}}, > [{compile,'-select_passes/2-anonymous-2-',2}, > {compile,'-internal_comp/4-anonymous-1-',2}, > {compile,fold_comp,3}, > {compile,internal_comp,4}, > {compile,internal,3}]} > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From csanto@REDACTED Tue Jan 11 18:24:29 2005 From: csanto@REDACTED (Corrado Santoro) Date: Tue, 11 Jan 2005 18:24:29 +0100 Subject: A Pythonista's Impressions of Erlang In-Reply-To: <1105448666.41e3ceda48bf8@horde.scannet.dk> References: <1105448666.41e3ceda48bf8@horde.scannet.dk> Message-ID: <41E40BCD.2070703@diit.unict.it> Some few words on this, from a guy who wrote projects both in Python and Erlang. > http://llimllib.f2o.org/blog/serve/entry/erlang > No String Type: Let me repeat this for emphasis: > There Is No String Type In Erlang. Arrrggggh! Why would you do this? IMHO, I didn't suffer for a lack of a python-like string type in Erlang. Functions in module "lists" are quite complete and comparable to those of the "string" python module. If I should say that something is missing, I would refer to the python slicing capability, i.e.: a="Hello, World" a[5:-3] --> ", Wo" > Error messages: Erlang's error messages are totally undecipherable for > a newbie. > ** exited: {undef,[{shell_default,length,[[1,2,3],12]}, > {erl_eval,do_apply,5}, > {shell,exprs,6}, > {shell,eval_loop,3}]} ** > Got it? Yes, indeed, a more verbose exception trace could be better. > Documentation: Most of the links to documentation on erlang.org are > broken. Really? I didn't find any broken link. And you? > The; Punctuation. Is, Weird ->: Maybe this is one of the not sure > things, but I'm pretty sure I don't like some of Erlang's punctuation. > I don't mind the '->', but I oftentimes have to look at the docs to > figure out whether I should be using a ';' or a '.' to end a > statement. I don't agree. The ';' has a precise semantics, because it means a logic "or" (like in Prolog). So using ';' to end different function clause means to activate this OR that clause. The '.' is a natural symbol to specify that a function definition (with all of its clauses) is ended. I know that the misuse of ';' and '.' is a common cause of syntax errors, but similar situations also happen in C. Many students of mine forget to end a statement with ';', others wrongly place the ';' at the end of a 'for' or 'while' statement, i.e.: for (....) ; <------!!!!! { ... } and so on. Finally, I would make a personal note on object-orientation. Erlang is not OO, but I think that such a feature---and in particular the inheritance---could be useful above all for beahviours. Cheers, --Corrado -- ====================================================== Eng. Corrado Santoro, Ph.D. University of Catania - Engineering Faculty Department of Computer Science and Telecommunications Engineering Viale A. Doria, 6 - 95125 CATANIA (ITALY) Tel: +39 095 7382380 Fax: +39 095 7382397 +39 095 7382365 +39 095 7382364 EMail: csanto@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.iit.unict.it ====================================================== From erlang-list@REDACTED Tue Jan 11 19:28:32 2005 From: erlang-list@REDACTED (Dominic Williams) Date: Tue, 11 Jan 2005 19:28:32 +0100 Subject: A Pythonista's Impressions of Erlang In-Reply-To: <41E40BCD.2070703@diit.unict.it> References: <1105448666.41e3ceda48bf8@horde.scannet.dk> <41E40BCD.2070703@diit.unict.it> Message-ID: <41E41AD0.2000908@dominicwilliams.net> Corrado Santoro wrote: > I would refer to the python slicing capability, i.e.: > > a="Hello, World" > a[5:-3] --> ", Wo" Given what is already in the lists module, slice("Hello, World", 5, -3) -> ... must be a one- or two-liner. Why bother with the syntactic sugar? Regards, Dominic Williams http://www.dominicwilliams.net ---- From csanto@REDACTED Tue Jan 11 20:42:29 2005 From: csanto@REDACTED (Corrado Santoro) Date: Tue, 11 Jan 2005 20:42:29 +0100 Subject: A Pythonista's Impressions of Erlang In-Reply-To: <41E41AD0.2000908@dominicwilliams.net> References: <1105448666.41e3ceda48bf8@horde.scannet.dk> <41E40BCD.2070703@diit.unict.it> <41E41AD0.2000908@dominicwilliams.net> Message-ID: <41E42C25.20601@diit.unict.it> Dominic Williams wrote: > Given what is already in the lists module, >> >> a="Hello, World" >> a[5:-3] --> ", Wo" > > slice("Hello, World", 5, -3) -> ... > > must be a one- or two-liner. why not including such a function in "lists"? > Why bother with the syntactic sugar? I agree :-)) Cheers, --Corrado -- ====================================================== Eng. Corrado Santoro, Ph.D. University of Catania - Engineering Faculty Department of Computer Science and Telecommunications Engineering Viale A. Doria, 6 - 95125 CATANIA (ITALY) Tel: +39 095 7382380 Fax: +39 095 7382397 +39 095 7382365 +39 095 7382364 EMail: csanto@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.iit.unict.it ====================================================== From igouy2@REDACTED Tue Jan 11 21:14:14 2005 From: igouy2@REDACTED (Isaac Gouy) Date: Tue, 11 Jan 2005 12:14:14 -0800 (PST) Subject: speed... In-Reply-To: <41E2FDC0.11756.DB15E0@localhost> Message-ID: <20050111201415.31806.qmail@web60508.mail.yahoo.com> > Well, IMO, the Clean team simply gave the highest priority to > ultimate performance. Ironically, Clean is one of the more complex > and ugly functional languages, as it's loaded with all kinds of > manual annotations for strictness and uniqueness and so on. Optional annotations. Type inference does most of the everyday stuff. afaict arrays are a big part of Clean performance. __________________________________ Do you Yahoo!? Yahoo! Mail - Find what you need with new enhanced search. http://info.mail.yahoo.com/mail_250 From igouy2@REDACTED Wed Jan 12 01:35:37 2005 From: igouy2@REDACTED (Isaac Gouy) Date: Tue, 11 Jan 2005 16:35:37 -0800 (PST) Subject: speed... In-Reply-To: Message-ID: <20050112003538.68672.qmail@web60507.mail.yahoo.com> > > I was happy to see that the newest round of "benchmarks" includes a > > new test where erlang starts to shine > > http://shootout.alioth.debian.org/benchmark.php?test=message&l > > ang=all&sort=cpu > > Although they will probably not ramp the test up to where erlang is > > strongest since most other languages will start to fail at less > > than 5000 threads. > > The interesting thing is to start measuring at the point where things > start to fail and observe if the failure is catastrophic or not - > Ramping the number of processes up to higher than the maximum allowed > number of OS processes will sort out the sheep from the goats. Yes, it is interesting, although imo we can get folk to actually look at the measurements and see that a language they've never heard of performs well, by providing a comparison with some languages they know. (Assuming they would quickly ignore the comparison if their "big name" language simply failed - and assuming there's a slight possibility they might be curious about measured poor performance of their "big name" language.) > Just a general comment of benchmarks - the benchmarks measure two > non-functional properties of a program (speed, and memory usage) but > there many more non-functional properties which a virtually impossible > to benchmark. And of course, the shootout programs are toy benchmarks http://shootout.alioth.debian.org/sandbox/index.php?sort=cpu Any suggestions for small, Erlang friendly, benchmark programs? __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From taj.khattra@REDACTED Wed Jan 12 03:30:46 2005 From: taj.khattra@REDACTED (Taj Khattra) Date: Tue, 11 Jan 2005 18:30:46 -0800 Subject: call for papers - async middleware and services In-Reply-To: <57a21f7305011111563787631a@mail.gmail.com> References: <57a21f73050109002413976130@mail.gmail.com> <57a21f7305011111563787631a@mail.gmail.com> Message-ID: <57a21f7305011118307e1c2cb0@mail.gmail.com> http://www.computer.org/internet/call4ppr.htm#v10n1 From raimo@REDACTED Wed Jan 12 09:33:00 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 12 Jan 2005 09:33:00 +0100 Subject: A Pythonista's Impressions of Erlang References: <41E40BCD.2070703@diit.unict.it>, <41E41AD0.2000908@dominicwilliams.net>, <41E42C25.20601@diit.unict.it> Message-ID: I think either string:stubstr/2,3 (that can operate on any-element-lists as well), or lists:split/2 can do what you want. By the way, the 'string' module has got a lot of C-style string handling functions. Many of them do not bother about the list elements being characters. When doing a quick readthrough of 'string' it seems as words/1,2, sub_word/2,3, left/2,3, and right/2,3 require that the elements are integers. I do not see why this requirement could not be relaxed. csanto@REDACTED (Corrado Santoro) writes: > Dominic Williams wrote: > > Given what is already in the lists module, > >> > >> a="Hello, World" > >> a[5:-3] --> ", Wo" > > slice("Hello, World", 5, -3) -> ... > > must be a one- or two-liner. > why not including such a function in "lists"? > > > Why bother with the syntactic sugar? > I agree :-)) > > Cheers, > --Corrado > > -- > ====================================================== > Eng. Corrado Santoro, Ph.D. > > University of Catania - Engineering Faculty > Department of Computer Science and > Telecommunications Engineering > Viale A. Doria, 6 - 95125 CATANIA (ITALY) > > Tel: +39 095 7382380 Fax: +39 095 7382397 > +39 095 7382365 > +39 095 7382364 > > EMail: csanto@REDACTED > Personal Home Page: > http://www.diit.unict.it/users/csanto > > NUXI Home Page: > http://nuxi.iit.unict.it > ====================================================== > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From erlang@REDACTED Wed Jan 12 12:46:31 2005 From: erlang@REDACTED (Erlang Questions) Date: Wed, 12 Jan 2005 09:46:31 -0200 Subject: Xmerl performance Message-ID: <002501c4f89c$5d17bd40$2100a8c0@INSWITCH241> Hi, we want to build some applications based on XML messages. But before starting we would like to have some numbers regarding the XML parser's performance. Does anybody know a benchmark regarding xmerl+xpath? We have been trying to measure the parsing by hand using timer:tc but had some problems... Thanks, Sebastian- -------------- next part -------------- An HTML attachment was scrubbed... URL: From blaguehubert@REDACTED Wed Jan 12 12:05:45 2005 From: blaguehubert@REDACTED (blaguehubert) Date: Wed, 12 Jan 2005 11:05:45 +0000 Subject: A Pythonista's Impressions of Erlang In-Reply-To: References: <41E40BCD.2070703@diit.unict.it>, <41E41AD0.2000908@dominicwilliams.net>, <41E42C25.20601@diit.unict.it> Message-ID: <41E50489.6050302@free.fr> Speaking of string operations, I need to add (or remove) the / at the end of an URL if it is absent (or present). I only ended in writing ugly code like that: RootUrl= if list:last(SiteRoot) =/= $/ -> SiteRoot ++ [$/]; true -> SiteRoot end Is there an elegant way to do last character manipulation? Raimo Niskanen wrote: >I think either string:stubstr/2,3 (that can operate on >any-element-lists as well), or lists:split/2 can do >what you want. > >By the way, the 'string' module has got a lot of >C-style string handling functions. Many of them do >not bother about the list elements being characters. > >When doing a quick readthrough of 'string' it seems as >words/1,2, sub_word/2,3, left/2,3, and right/2,3 >require that the elements are integers. I do not >see why this requirement could not be relaxed. > > > >csanto@REDACTED (Corrado Santoro) writes: > > > >>Dominic Williams wrote: >> >> >>>Given what is already in the lists module, >>> >>> >>>>a="Hello, World" >>>>a[5:-3] --> ", Wo" >>>> >>>> >>>slice("Hello, World", 5, -3) -> ... >>>must be a one- or two-liner. >>> >>> >>why not including such a function in "lists"? >> >> >> >>>Why bother with the syntactic sugar? >>> >>> >>I agree :-)) >> >>Cheers, >>--Corrado >> >>-- >>====================================================== >>Eng. Corrado Santoro, Ph.D. >> >>University of Catania - Engineering Faculty >>Department of Computer Science and >>Telecommunications Engineering >>Viale A. Doria, 6 - 95125 CATANIA (ITALY) >> >>Tel: +39 095 7382380 Fax: +39 095 7382397 >> +39 095 7382365 >> +39 095 7382364 >> >>EMail: csanto@REDACTED >>Personal Home Page: >> http://www.diit.unict.it/users/csanto >> >>NUXI Home Page: >> http://nuxi.iit.unict.it >>====================================================== >> >> >> > > > From raimo@REDACTED Wed Jan 12 14:46:23 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 12 Jan 2005 14:46:23 +0100 Subject: A Pythonista's Impressions of Erlang References: <41E42C25.20601@diit.unict.it>, , <41E50489.6050302@free.fr> Message-ID: 1> string:strip("http://www.erlang.org/", right, $/). "http://www.erlang.org" blaguehubert@REDACTED (blaguehubert) writes: > Speaking of string operations, I need to add (or remove) the / at the > end of an URL if it is absent (or present). > > I only ended in writing ugly code like that: > > RootUrl= > if > list:last(SiteRoot) =/= $/ -> > SiteRoot ++ [$/]; > true -> > SiteRoot > end > > Is there an elegant way to do last character manipulation? > > Raimo Niskanen wrote: > > >I think either string:stubstr/2,3 (that can operate on > > any-element-lists as well), or lists:split/2 can do what you want. > > > >By the way, the 'string' module has got a lot of > > C-style string handling functions. Many of them do not bother about > > the list elements being characters. > > > >When doing a quick readthrough of 'string' it seems as > >words/1,2, sub_word/2,3, left/2,3, and right/2,3 > > require that the elements are integers. I do not see why this > > requirement could not be relaxed. > > > > > > > >csanto@REDACTED (Corrado Santoro) writes: > > > > > >>Dominic Williams wrote: > >> > >>>Given what is already in the lists module, > >>> > >>>>a="Hello, World" > >>>>a[5:-3] --> ", Wo" > >>>> > >>>slice("Hello, World", 5, -3) -> ... > >>>must be a one- or two-liner. > >>> > >>why not including such a function in "lists"? > >> > >> > >>>Why bother with the syntactic sugar? > >>> > >>I agree :-)) > >> > >>Cheers, > >>--Corrado > >> > >> -- > >>====================================================== > >>Eng. Corrado Santoro, Ph.D. > >> > >>University of Catania - Engineering Faculty > >>Department of Computer Science and > >>Telecommunications Engineering > >>Viale A. Doria, 6 - 95125 CATANIA (ITALY) > >> > >>Tel: +39 095 7382380 Fax: +39 095 7382397 > >> +39 095 7382365 > >> +39 095 7382364 > >> > >>EMail: csanto@REDACTED > >>Personal Home Page: > >> http://www.diit.unict.it/users/csanto > >> > >>NUXI Home Page: > >> http://nuxi.iit.unict.it > >>====================================================== > >> > >> > > > > > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From joe.armstrong@REDACTED Wed Jan 12 14:51:01 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Wed, 12 Jan 2005 14:51:01 +0100 Subject: A Pythonista's Impressions of Erlang Message-ID: > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] > Sent: den 12 januari 2005 12:06 > Cc: erlang-questions@REDACTED > Subject: Re: A Pythonista's Impressions of Erlang > > > Speaking of string operations, I need to add (or remove) the > / at the > end of an URL if it is absent (or present). > > I only ended in writing ugly code like that: > > RootUrl= > if > list:last(SiteRoot) =/= $/ -> > SiteRoot ++ [$/]; > true -> > SiteRoot > end > > Is there an elegant way to do last character manipulation? > No Actually you're code will crash if SiteRoot is empty - since an empty list has no last element. Now you might think that since "string" ++ Var Is a legal pattern that you could write your function like this: add_slash(X = _ ++ "/") -> X; add_slash(X) -> X ++ "/". But you would be wrong. To do it this way involves a quick hack to the compiler of a rather simple parse_transform to change the semantics of the compiler. Actually I see no reason why patterns like Var ++ StringLiteral should not be compiled, especially since StringLiteral ++ Var *is* allowed - and therefore disallowing Var ++ StringLiteral violates the principle of least astonishment. Failing that you'll have to hide the code in a function. Something like this aardvark([]) -> "/"; aardvark(Str) -> case lists:last(Str) of $/ -> Str; _ -> Str ++ "/" end. This function is very difficult to name (append_a_slash_at_the_end_of_string_if_there_isnt_one) isn't a good name, so I've called it aardvark until somebody comes up with a better name Now there might be a better way. Suppose the resultant string is just going to be output somewhere. Then instead of doing Str ++ "/" (which is an expensive operation) you just build a deep list [Str,"/"] (which is a cheap operation) and send this to your I/O routines which happily flatten the data as it is output. Note this programming style is very common - I write loads of stuff like: mkList(L) -> ["
    ", map(fun({I,J}) -> ["
  • ", mk_href(I,J) "
  • "] end, "
"]. mkHref(I, J) -> ["",J,""]. happy in the knowledge that these things will eventually get flattened on output. If you absolutely need a flat version of L just call sneaky_flatten(L) Where sneaky_flatten(L) -> binary_to_list(list_to_binary(L)). Cheers /Joe From tra@REDACTED Wed Jan 12 15:27:14 2005 From: tra@REDACTED (Tiago Rodrigues Antao) Date: Wed, 12 Jan 2005 14:27:14 +0000 Subject: Backtrack Message-ID: <200501121427.14179.tra@fct.unl.pt> Hi! I am new to Erlang. Being one of my working languages Prolog (used, believe it or not, in a production environment) I tried to do the typical parents/grandparents example of Prolog: parent(jane, joe). parent(joe, mark). As far as I can see Erlang has no concept of parameters that are both input/output and of backtrack. Am I wrong? I would like to do: ?- parent(X,Y). X = jane Y = joe ; X = joe Y = mark ; no Erlang has no provisions for this, at least that is my (very limited) understanding. Please correct me if I am wrong. Thanks a lot, Tiago From thomasl_erlang@REDACTED Wed Jan 12 15:29:53 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 12 Jan 2005 06:29:53 -0800 (PST) Subject: A Pythonista's Impressions of Erlang In-Reply-To: Message-ID: <20050112142953.68607.qmail@web41904.mail.yahoo.com> > To do it this way involves a quick hack to the > compiler > of a rather simple parse_transform to change the > semantics of > the compiler. > > Actually I see no reason why patterns like Var ++ > StringLiteral should not > be compiled, especially since StringLiteral ++ Var > *is* allowed - and therefore > disallowing Var ++ StringLiteral violates the > principle of least astonishment. Some objections: X ++ "string" would compile into string searching (linear time), rather than pattern matching (constant time). There might be multiple matches, what to do about those? (May I suggest backtracking? :-) What about nested patterns, e.g., "foo:" ++ X ++ "=" ++ Y? Will your simple parse transform really be all that simple once we consider all the cases? (Perhaps the best solution is to write it and see.) However, I'll agree that more generally it might be nice to have some sort of regexp patterns, especially when doing the string processing tasks that tend to pop up. (Parsing text based protocols, say?) Also, regexps/string operations on binaries might be more familar to people used to "strings as arrays". Best, Thomas __________________________________ Do you Yahoo!? The all-new My Yahoo! - Get yours free! http://my.yahoo.com From mickael.remond@REDACTED Wed Jan 12 15:44:01 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 12 Jan 2005 15:44:01 +0100 Subject: Backtrack In-Reply-To: <200501121427.14179.tra@fct.unl.pt> References: <200501121427.14179.tra@fct.unl.pt> Message-ID: <41E537B1.3080300@erlang-fr.org> Tiago Rodrigues Antao wrote: > As far as I can see Erlang has no concept of parameters that are both > input/output and of backtrack. Am I wrong? No. You are right. The syntax of Erlang comes from Prolog, but the language feature are different. Regarding inference, maybe the rule engine ERES, found in the Exat Agent platform could be usefull to you (See: http://www.diit.unict.it/users/csanto/exat/whats.html) -- Micka?l R?mond http://www.erlang-projects.org/ From jabba@REDACTED Wed Jan 12 16:49:15 2005 From: jabba@REDACTED (Jani Launonen) Date: Wed, 12 Jan 2005 17:49:15 +0200 (EET) Subject: Backtrack In-Reply-To: <41E537B1.3080300@erlang-fr.org> References: <200501121427.14179.tra@fct.unl.pt> <41E537B1.3080300@erlang-fr.org> Message-ID: On Wed, 12 Jan 2005, Mickael Remond wrote: > Tiago Rodrigues Antao wrote: >> As far as I can see Erlang has no concept of parameters that are both >> input/output and of backtrack. Am I wrong? > > No. You are right. The syntax of Erlang comes from Prolog, but the language > feature are different. > > Regarding inference, maybe the rule engine ERES, found in the Exat Agent > platform could be usefull to you (See: > http://www.diit.unict.it/users/csanto/exat/whats.html) > > -- > Micka?l R?mond > http://www.erlang-projects.org/ I've kept my eye on Mercury --- a hybrid of functional and logic programming language. The Mercury has an experimental implicit parallelism implemented (got it? :)) and one can read it about at http://www.cs.mu.oz.au/research/mercury/information/papers.html#conway-thesis The main site is at http://www.cs.mu.oz.au/research/mercury/ It might be interesting for you. At least the implicit parallelism is interesting for me as the CMP/SMT -processors are coming. Have a nice read :) -+-+-+- Jani Launonen Student. . . . . . . . . .University of Oulu, Dept. of El. & Inf. Eng. "Life is what happens to you while you're busy making future plans." - Alfred E. Neuman From joe.armstrong@REDACTED Wed Jan 12 17:15:56 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Wed, 12 Jan 2005 17:15:56 +0100 Subject: A Pythonista's Impressions of Erlang Message-ID: > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] > Sent: den 12 januari 2005 15:30 > To: erlang-questions@REDACTED > Subject: RE: A Pythonista's Impressions of Erlang > > > > > To do it this way involves a quick hack to the > > compiler > > of a rather simple parse_transform to change the > > semantics of > > the compiler. > > > > Actually I see no reason why patterns like Var ++ > > StringLiteral should not > > be compiled, especially since StringLiteral ++ Var > > *is* allowed - and therefore > > disallowing Var ++ StringLiteral violates the > > principle of least astonishment. > > Some objections: > > X ++ "string" would compile into string searching > (linear time), rather than pattern matching (constant > time). > > There might be multiple matches, what to do about > those? (May I suggest backtracking? :-) Or forwardtracking even > What about nested patterns, e.g., > "foo:" ++ X ++ "=" ++ Y? > Will your simple parse transform really be all that > simple once we consider all the cases? (Perhaps the > best solution is to write it and see.) > Ooohhh > However, I'll agree that more generally it might be > nice to have some sort of regexp patterns, especially > when doing the string processing tasks that tend to > pop up. (Parsing text based protocols, say?) > > Also, regexps/string operations on binaries might be > more familar to people used to "strings as arrays". > Indeed yes, so if <<~R~>> means match the RegExp R we could write things like ... foo(<<~"[.?!][]\"')}]*\\($\\| $\\|\t\\| \\)[ \t\n]*"~>>) -> ... BTW my last posting had some non-smiley-tagged-jokes as does this (possibly) > Best, > Thomas > Thomas ! hello /Joe From jabba@REDACTED Wed Jan 12 17:50:35 2005 From: jabba@REDACTED (Jani Launonen) Date: Wed, 12 Jan 2005 18:50:35 +0200 (EET) Subject: Backtrack In-Reply-To: References: <200501121427.14179.tra@fct.unl.pt> <41E537B1.3080300@erlang-fr.org> Message-ID: > On Wed, 12 Jan 2005, Mickael Remond wrote: > >> Tiago Rodrigues Antao wrote: >>> As far as I can see Erlang has no concept of parameters that are both >>> input/output and of backtrack. Am I wrong? >> >> No. You are right. The syntax of Erlang comes from Prolog, but the language >> feature are different. >> >> Regarding inference, maybe the rule engine ERES, found in the Exat Agent >> platform could be usefull to you (See: >> http://www.diit.unict.it/users/csanto/exat/whats.html) >> >> -- >> Micka?l R?mond >> http://www.erlang-projects.org/ > > I've kept my eye on Mercury --- a hybrid of functional and logic programming > language. The Mercury has an experimental implicit parallelism implemented > (got it? :)) and one can read it about at > http://www.cs.mu.oz.au/research/mercury/information/papers.html#conway-thesis > > The main site is at > http://www.cs.mu.oz.au/research/mercury/ > > It might be interesting for you. At least the implicit parallelism is > interesting for me as the CMP/SMT -processors are coming. > > Have a nice read :) Oh, I forgot to mention that in the thesis the author also mentiones quite shortly Erlang and it's concurrency implementation. -+-+-+- Jani Launonen Student. . . . . . . . . .University of Oulu, Dept. of El. & Inf. Eng. "Life is what happens to you while you're busy making future plans." - Alfred E. Neuman From chandrashekhar.mullaparthi@REDACTED Wed Jan 12 18:03:40 2005 From: chandrashekhar.mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Wed, 12 Jan 2005 17:03:40 +0000 Subject: Xmerl performance In-Reply-To: <002501c4f89c$5d17bd40$2100a8c0@INSWITCH241> References: <002501c4f89c$5d17bd40$2100a8c0@INSWITCH241> Message-ID: We started off using xmerl for such an application but then switched to using eXpat. Using expat is about 5 times faster than xmerl in our crude measurements. cheers Chandru On 12 Jan 2005, at 11:46, Erlang Questions wrote: > > Hi, > ??? we want to build some applications based on XML messages. But > before starting we would like to have some numbers regarding the XML > parser's performance. > ? > Does anybody know a benchmark regarding xmerl+xpath? We have been > trying to measure the parsing by hand using timer:tc but had some > problems... > ? > Thanks, > ??? Sebastian- From s9902088@REDACTED Wed Jan 12 18:09:54 2005 From: s9902088@REDACTED (Neil Campbell) Date: Wed, 12 Jan 2005 17:09:54 +0000 Subject: Using Erlang for Comsuming Web Services using SOAP Message-ID: <41E559E2.7060202@sms.ed.ac.uk> Hi, I am currently trying to use Erlang to send SOAP requests and receive responses. I have downloaded the "erlsoap-0.3" library but cannot find any documentation for it. I've searched around for examples of the library's use but haven't had any luck. I've also looked through the source but I'm still not sure how to get moving on this. Does anyone have experience either using this library for accessing (i.e. not hosting) web services or know of any other helpful libraries or features that I have missed? FYI: I am using Erlang for some undergraduate project work for my Computer Science degree at Edinburgh University. I am trying to access Amazon's Web Services portal in order to demonstrate some of the features of Erlang in comparison to C-omega. C-omega is an extension of C# which is aimed at programmers writing concurrent, distributed systems. I am implemeting various system in both languages in order to provide an interesting comparison. Any assistance or advice would be much appreciated. Cheers, Neil From tra@REDACTED Wed Jan 12 18:54:05 2005 From: tra@REDACTED (Tiago Rodrigues Antao) Date: Wed, 12 Jan 2005 17:54:05 +0000 Subject: Fwd: Re: Backtrack Message-ID: <200501121754.05678.tra@fct.unl.pt> Another feature that I suppose is also missing is :- op (operator definition) My context is one of the so called "Language Oriented Programming" (or Domain Specific Languages with interaction among different domain languages), which we use quite a lot here with Prolog. Or, putting it in different terms: Are there any good mechanisms in Erlang for DSLs? Thanks, Tiago Em Quarta, 12 de Janeiro de 2005 14:44, escreveu: > Tiago Rodrigues Antao wrote: > > As far as I can see Erlang has no concept of parameters that are both > > input/output and of backtrack. Am I wrong? > > No. You are right. The syntax of Erlang comes from Prolog, but the > language feature are different. > > Regarding inference, maybe the rule engine ERES, found in the Exat Agent > platform could be usefull to you (See: > http://www.diit.unict.it/users/csanto/exat/whats.html) ------------------------------------------------------- From micke@REDACTED Wed Jan 12 19:06:13 2005 From: micke@REDACTED (micke) Date: Wed, 12 Jan 2005 19:06:13 +0100 Subject: how do I tune the ring benchmark? Message-ID: <41E6F2D1@epostleser.online.no> I got my new PC, and tested the ring benchmark on it.. C:\Programfiler\erl5.4.3\bin>erl.exe +P2400100 Eshell V5.4.3 (abort with ^G) 1> zog:start(2400001,1). <0.30.0> Setup : 3.93800 s (1.64083 us per spawn) (2400000 spawns) Run : 2.73400 s (1.13917 us per msg) (2400000 msgs) 2> --- Is it possible to tweek the runtime to run more threads ? From erlang@REDACTED Wed Jan 12 19:56:03 2005 From: erlang@REDACTED (Erlang Questions) Date: Wed, 12 Jan 2005 16:56:03 -0200 Subject: Xmerl performance References: <002501c4f89c$5d17bd40$2100a8c0@INSWITCH241> Message-ID: <010701c4f8d8$5e58aa70$2100a8c0@INSWITCH241> Thanks Chandru. Is expat an Erlang module? Where can I find it? Sebastian- ----- Original Message ----- From: "Chandrashekhar Mullaparthi" To: "Erlang Questions" Cc: "Erlang Questions" Sent: Wednesday, January 12, 2005 3:03 PM Subject: Re: Xmerl performance We started off using xmerl for such an application but then switched to using eXpat. Using expat is about 5 times faster than xmerl in our crude measurements. cheers Chandru On 12 Jan 2005, at 11:46, Erlang Questions wrote: > > Hi, > we want to build some applications based on XML messages. But > before starting we would like to have some numbers regarding the XML > parser's performance. > > Does anybody know a benchmark regarding xmerl+xpath? We have been > trying to measure the parsing by hand using timer:tc but had some > problems... > > Thanks, > Sebastian- From jahakala@REDACTED Wed Jan 12 20:34:24 2005 From: jahakala@REDACTED (Jani Hakala) Date: Wed, 12 Jan 2005 21:34:24 +0200 Subject: erlang/otp + mingw32 + msys/msysdtk? Message-ID: <87llaycugv.fsf@pingviini.kortex.jyu.fi> Hi, mingw32 with msys and msysdtk packages seem to provide quite unix-like environment for building programs in windows. Could there be support for this kind of environment in the future? Jani Hakala From cyberlync@REDACTED Thu Jan 13 08:03:09 2005 From: cyberlync@REDACTED (Eric Merritt) Date: Wed, 12 Jan 2005 23:03:09 -0800 Subject: Parsing null terminated strings in a binary. Message-ID: Guys, I have a need to parse out a series of null terminated fields a binary. The easiest way to do this is to simply traverse the binary using bit syntax until a null byte occurs. However, I believe this would be less then efficient as a new binary would be created for each byte matched. Aside from created a C port to actually do the parsing do any of you have any ideas on how to do this efficiently? Thanks, Eric -- I'm a programmer, I don't have to spell correctly; I just have to spell consistently From raimo@REDACTED Thu Jan 13 08:50:03 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 13 Jan 2005 08:50:03 +0100 Subject: Parsing null terminated strings in a binary. References: Message-ID: Parse the binary in a loop something like this (untested): z_split(<>, N) -> {B1,B2}; z_split(<>, N) -> B1; z_split(<<_:N/binary,_/binary>>=B, N) -> z_split(B, N+1). This will not build any sub-binaries until the zero is found. cyberlync@REDACTED (Eric Merritt) writes: > Guys, > > I have a need to parse out a series of null terminated fields a > binary. The easiest way to do this is to simply traverse the binary > using bit syntax until a null byte occurs. However, I believe this > would be less then efficient as a new binary would be created for each > byte matched. Aside from created a C port to actually do the parsing > do any of you have any ideas on how to do this efficiently? > > Thanks, > Eric > -- > I'm a programmer, I don't have to spell correctly; I just have to > spell consistently -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From erik.ej.reitsma@REDACTED Thu Jan 13 08:52:06 2005 From: erik.ej.reitsma@REDACTED (Erik Reitsma EJ (RY/ETM)) Date: Thu, 13 Jan 2005 08:52:06 +0100 Subject: Using Erlang for Comsuming Web Services using SOAP Message-ID: <440A2703A54A8F4FB2AC2AE34F27129D05495B46@ESEALNT889.al.sw.ericsson.se> Hi Neil, I wrote that library for some SOAP stuff I had to do. No documentation exists (to my knowledge), because I used to be the only user. I am already proud that I put some comments in the source. :) Then I decided to give away the code, but without putting more effort in it. So, it is as it is. I have used it mainly as a SOAP server, but there is a small client part too. I have not used that for a while, so it may be incompatible with recent inets changes. It is also written when xmerl-0.19 or even earlier was available, so it may be incompatible with the latest (official) xmerl. I have not tried that. I am not sure when I am going to use this library again myself, so it is not actively maintained. It is "dormant", but I may wake it up when I need it. I am sure that my SOAP implementation leaves a lot to be desired, but for my needs it was good enough. About the client part. Before you can call soapclient:invoke/4 you have to define the operations, types and messages you want to use. (It would be nice if this could be generated from WSDL.) Example: -include("erlsoap.hrl"). -define(PARLAYX_SMS_XSD_URI,'http://www.csapi.org/schema/parlayx/common/v1_0'). add_messages() -> %% sendSms operation erlsoap:add_operation({'http://www.csapi.org/wsdl/parlayx/sms', "sendSms"}, {'http://www.csapi.org/wsdl/parlayx/sms/v1_0/service', "SendSMS_sendSmsRequest"}, {'http://www.csapi.org/wsdl/parlayx/sms/v1_0/service', "SendSMS_sendSmsResponse"}, []), %% sendSms request message erlsoap:add_message({'http://www.csapi.org/wsdl/parlayx/sms/v1_0/service', "SendSMS_sendSmsRequest"}, [{"destinationAddressSet",{?PARLAYX_SMS_XSD_URI,"ArrayOfEndUserIdentifier"}}, {"senderName",{?XMLSchemaURI,"string"}}, {"charging",{?XMLSchemaURI,"string"}}, {"message",{?XMLSchemaURI,"string"}}]), %% sendSms response message erlsoap:add_message({'http://www.csapi.org/wsdl/parlayx/sms/v1_0/service', "SendSMS_sendSmsResponse"}, [{{?PARLAYX_SMS_XSD_URI,"result"}, {?XMLSchemaURI,"string"} } ]), %% getSmsDeliveryStatus operation erlsoap:add_operation({'http://www.csapi.org/wsdl/parlayx/sms', "getSmsDeliveryStatus"}, {'http://www.csapi.org/wsdl/parlayx/sms/v1_0/service', "SendSMS_getSmsDeliveryStatusRequest"}, {'http://www.csapi.org/wsdl/parlayx/sms/v1_0/service', "SendSMS_getSmsDeliveryStatusResponse"}, []), %% getSmsDeliveryStatus request message erlsoap:add_message({'http://www.csapi.org/wsdl/parlayx/sms/v1_0/service', "SendSMS_getSmsDeliveryStatusRequest"}, [{"requestIdentifier",{?XMLSchemaURI,"string"}}]), %% getSmsDeliveryStatus response message erlsoap:add_message({'http://www.csapi.org/wsdl/parlayx/sms/v1_0/service', "SendSMS_getSmsDeliveryStatusResponse"}, [{{?PARLAYX_SMS_XSD_URI,"result"}, {'http://www.csapi.org/schema/parlayx/sms/v1_0',"ArrayOfDeliveryStatusType"} } ]), %% EndUserIdentifier type erlsoap:add_type({?PARLAYX_SMS_XSD_URI,"EndUserIdentifier"}, {complex_type, {sequence, [{"value",{?XMLSchemaURI,"string"},0,1}] } }), erlsoap:add_type({'http://www.csapi.org/schema/parlayx/sms/v1_0',"ArrayOfDeliveryStatusType"}, {complex_type, {sequence, [{"ArrayOfDeliveryStatusType", {'http://www.csapi.org/schema/parlayx/sms/v1_0', "DeliveryStatusType"},0,unbounded} ] } }), erlsoap:add_type({?PARLAYX_SMS_XSD_URI,"ArrayOfEndUserIdentifier"}, {complex_type, {array, {?PARLAYX_SMS_XSD_URI,"EndUserIdentifier"} } }), erlsoap:add_type({'http://www.csapi.org/schema/parlayx/sms/v1_0',"ArrayOfSmsType"}, {complex_type, {sequence, [{"ArrayOfSmsType", {'http://www.csapi.org/schema/parlayx/sms/v1_0', "SmsType"},0,unbounded} ] } }), erlsoap:add_type({'http://www.csapi.org/schema/parlayx/sms/v1_0',"DeliveryStatusType"}, {complex_type, {sequence, [{"destinationAddress", {?PARLAYX_SMS_XSD_URI, "EndUserIdentifier"},0,1}, {"deliveryStatus", {'http://www.csapi.org/schema/parlayx/sms/v1_0',"DeliveryStatus"},0,1} ] } } ), erlsoap:add_type({'http://www.csapi.org/schema/parlayx/sms/v1_0',"SmsType"}, {complex_type, {sequence, [{"message",{?XMLSchemaURI,"string"}}, {"senderAddress", {?PARLAYX_SMS_XSD_URI, "EndUserIdentifier"},0,1} ] } } ), erlsoap:add_type({'http://www.csapi.org/schema/parlayx/sms/v1_0',"DeliveryStatus"}, {simple_type,{restriction, [{?XMLSchemaURI,"string"}], [{enumeration,'Delivered'}, {enumeration,'DeliveryUncertain'}, {enumeration,'DeliveryImpossible'}, {enumeration,'MessageWaiting'}] } }), erlsoap:add_type({'http://www.csapi.org/schema/parlayx/sms/v1_0',"SmsFormat"}, {simple_type,{restriction, [{?XMLSchemaURI,"string"}], [{enumeration,'Ems'}, {enumeration,'SmartMessaging'}] } }). Then you should be able to call the service: send_sms_local(X,Message) -> soapclient:invoke("http://some.host.com:8888/soap/rpcrouter", "\"SendSMS#sendSms\"", {'http://www.csapi.org/wsdl/parlayx/sms', "sendSms"}, [[[X]],["tel:1234"],"no bill",Message]). I hope this helps a little. Kind regards, *Erik. From bry@REDACTED Thu Jan 13 09:11:24 2005 From: bry@REDACTED (bry@REDACTED) Date: Thu, 13 Jan 2005 09:11:24 +0100 Subject: A Pythonista's Impressions of Erlang In-Reply-To: <20050112142953.68607.qmail@web41904.mail.yahoo.com> References: <20050112142953.68607.qmail@web41904.mail.yahoo.com> Message-ID: <1105603884.41e62d2c9bd97@horde.scannet.dk> I went through the thread and was pleasently surprised as i think it turned out pretty nice, but I noted that while people ragged on the guys understanding of erlang (at least from my viewpoint it seemed like ragging) there was a general quiet were the difficulties of finding resources, documentation etc. were discussed. Any takes on that subject? From bengt.kleberg@REDACTED Thu Jan 13 09:57:17 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 13 Jan 2005 09:57:17 +0100 Subject: A Pythonista's Impressions of Erlang In-Reply-To: <1105603884.41e62d2c9bd97@horde.scannet.dk> References: <20050112142953.68607.qmail@web41904.mail.yahoo.com> <1105603884.41e62d2c9bd97@horde.scannet.dk> Message-ID: <41E637ED.5040204@ericsson.com> bry@REDACTED wrote: > I went through the thread and was pleasently surprised as i think it turned out > pretty nice, but I noted that while people ragged on the guys understanding of > erlang (at least from my viewpoint it seemed like ragging) there was a general > quiet were the difficulties of finding resources, documentation etc. were > discussed. Any takes on that subject? the best (imho) way to access erlang documentation is through this interface: http://www.corelatus.com/~matthias/modules.html bengt From cyberlync@REDACTED Thu Jan 13 09:58:44 2005 From: cyberlync@REDACTED (Eric Merritt) Date: Thu, 13 Jan 2005 00:58:44 -0800 Subject: Parsing null terminated strings in a binary. In-Reply-To: References: Message-ID: Holy crap, why didn't I think of. Thanks Raimo, that helps a lot. On 13 Jan 2005 08:50:03 +0100, Raimo Niskanen wrote: > Parse the binary in a loop something like this (untested): > > z_split(<>, N) -> > {B1,B2}; > z_split(<>, N) -> > B1; > z_split(<<_:N/binary,_/binary>>=B, N) -> > z_split(B, N+1). > > This will not build any sub-binaries until the zero is found. > > > cyberlync@REDACTED (Eric Merritt) writes: > > > Guys, > > > > I have a need to parse out a series of null terminated fields a > > binary. The easiest way to do this is to simply traverse the binary > > using bit syntax until a null byte occurs. However, I believe this > > would be less then efficient as a new binary would be created for each > > byte matched. Aside from created a C port to actually do the parsing > > do any of you have any ideas on how to do this efficiently? > > > > Thanks, > > Eric > > -- > > I'm a programmer, I don't have to spell correctly; I just have to > > spell consistently > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > -- I'm a programmer, I don't have to spell correctly; I just have to spell consistently From casper2000a@REDACTED Thu Jan 13 10:27:46 2005 From: casper2000a@REDACTED (Casper) Date: Thu, 13 Jan 2005 15:27:46 +0600 Subject: Eddie and Distributed Erlang In-Reply-To: <1105603884.41e62d2c9bd97@horde.scannet.dk> Message-ID: Hi All, I was studying Eddie implementation and found it uses it's own synchronization method to manage the distribution of it's applications. For example it's master_server has a synchronization part, which monitors other master_server and if the active one (global) goes down, another one take it's place. Why doesn't Eddie use Erlang Kernel module's distributed application mechanism? In a distributed application, is there any use of having a supervisor, which starts the application module? I guess the kernel dist_ac handles that part, correct? Thanks in advance! Eranga From ulf.wiger@REDACTED Thu Jan 13 10:53:59 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Thu, 13 Jan 2005 10:53:59 +0100 Subject: how do I tune the ring benchmark? Message-ID: <37FB7AA6F5F9814FB634A7BF4C35A6F5402A1F@ESEALNT442.al.sw.ericsson.se> Using the ring benchmark attached in http://www.erlang.org/ml-archive/erlang-questions/200410/msg00228.html you can tune the number of processes as well as the payload passed in the messages. This benchmark was also used later in http://www.erlang.org/ml-archive/erlang-questions/200412/msg00141.html BR, Uffe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] > Sent: den 12 januari 2005 19:06 > To: erlang-questions@REDACTED > Subject: how do I tune the ring benchmark? > > > I got my new PC, and tested the ring benchmark on it.. > > C:\Programfiler\erl5.4.3\bin>erl.exe +P2400100 > Eshell V5.4.3 (abort with ^G) > 1> zog:start(2400001,1). > <0.30.0> > Setup : 3.93800 s (1.64083 us per spawn) (2400000 spawns) > Run : 2.73400 s (1.13917 us per msg) (2400000 msgs) > 2> > > --- Is it possible to tweek the runtime to run more threads ? > > > From jahakala@REDACTED Thu Jan 13 10:56:49 2005 From: jahakala@REDACTED (Jani Hakala) Date: Thu, 13 Jan 2005 11:56:49 +0200 Subject: A Pythonista's Impressions of Erlang In-Reply-To: <1105603884.41e62d2c9bd97@horde.scannet.dk> (bry@xdocs.dk's message of "Thu, 13 Jan 2005 09:11:24 +0100") References: <20050112142953.68607.qmail@web41904.mail.yahoo.com> <1105603884.41e62d2c9bd97@horde.scannet.dk> Message-ID: <871xcpd53y.fsf@pingviini.kortex.jyu.fi> bry@REDACTED writes: > I went through the thread and was pleasently surprised as i think it > turned out pretty nice, but I noted that while people ragged on the > guys understanding of erlang (at least from my viewpoint it seemed > like ragging) there was a general quiet were the difficulties of > finding resources, documentation etc. were discussed. Any takes on > that subject? > There are missing links in www.erlang.org Getting started page: Getting started slowly Getting started very very very slowly Documentation in PDF These refer to missing files in http://www.erlang.org/doc/r9c/doc/getting_started/ Also in the about page there is bad link to http://www.erlang.org/doc/r9c/doc/index.html Jani Hakala From ulf.wiger@REDACTED Thu Jan 13 11:27:03 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Thu, 13 Jan 2005 11:27:03 +0100 Subject: A Pythonista's Impressions of Erlang Message-ID: <37FB7AA6F5F9814FB634A7BF4C35A6F5402A20@ESEALNT442.al.sw.ericsson.se> > I went through the thread and was pleasently surprised as i > think it turned out pretty nice, but I noted that while people > ragged on the guys understanding of erlang (at least from my > viewpoint it seemed like ragging) Was that the blog thread or the thread on this list? I didn't interpret any of it as ragging, really, but perceptions are quite individual. We all need to be reminded sometimes to be absolutely clear about our intentions. There were broken links. Bill happened to stumble across some fairly new ones -- in the Erlang Reference Manual. They should of course be fixed. The Erlang Reference Manual is a reasonable early entry point for newbies. It was clear from the blog that it was about his first impressions, not having spent that much time on it. But making a good first impression is crucial (and quite difficult as well.) I also think that there is good reason to add a readily available tutorial on how to interpret error messages. Once you know what to look for, they are excellent (unless you get a huge error message with bad or no formatting, which happens sometimes.) Having looked briefly at Python's error messages, they seem to carry roughly the same information as Erlang's error messages, but they are pretty printed (translated to English) in the shell. I can see why a Python programmer is not immediately impressed by Erlang's error messages, esp. since you have to dig into chapter 9.2 of the Erlang Reference Manual to find some (quite terse) hints on how to interpret them. There should be a top level link pointing to a tutorial on how to interpret error messages. It's been a commonly held opinion for many years that while Erlang/OTP has quite good reference documentation, it's weak on tutorials and introductory material. This situation has been significantly improved in the last few releases, but there is no reason to declare victory just yet. People from other programming community to well to advice us where we're not quite up to par with the rest. During the late 90's, relatively few people picked up Erlang and ran with it after self-study from material on the web (well, before 1998, there was nothing to run with, unless you paid for it or worked in a University environment.) The vast majority of erlang programmers were Ericsson engineers, who were sent to a set of courses in order to learn. Thus, Ericsson had reasonably extensive course material for Erlang and OTP. Some of it has been adapted and released at erlang.org While theoretically, the course material could be donated to the Open Source community, I can see several reasons not to do this. One such reason is that there are companies who have actually paid significant money for the right to use the material when teaching Erlang courses. The most decent thing to do is therefore to develop new introductory material which can be made freely available. /Uffe From matthias@REDACTED Thu Jan 13 11:28:49 2005 From: matthias@REDACTED (Matthias Lang) Date: Thu, 13 Jan 2005 11:28:49 +0100 Subject: A Pythonista's Impressions of Erlang In-Reply-To: <41E637ED.5040204@ericsson.com> References: <20050112142953.68607.qmail@web41904.mail.yahoo.com> <1105603884.41e62d2c9bd97@horde.scannet.dk> <41E637ED.5040204@ericsson.com> Message-ID: <16870.19809.356294.601249@antilipe.corelatus.se> Bengt Kleberg writes: > the best (imho) way to access erlang documentation is through this > interface: > http://www.corelatus.com/~matthias/modules.html I'm glad others find it useful, but I suspect it's not of much use to a beginner---the whole idea is that you already know what you're looking for. bry@REDACTED wrote: > I went through the thread and was pleasently surprised as i think > it turned out pretty nice, but I noted that while people ragged > on the guys understanding of erlang (at least from my viewpoint > it seemed like ragging) there was a general quiet were the > difficulties of finding resources, documentation etc. were > discussed. Any takes on that subject? Here's what he wrote about documentation: | Documentation: Most of the links to documentation on erlang.org are | broken. When you finally do get to the docs (mysteriously at erlang.se | instead of erlang.org), there are some real gems. When you click on | "Complete List of BIFs" (BIF = built-in function) in the reference | manual, you get "For a complete list of BIFs, their arguments and | return values, refer to erlang(3).". | | The kicker? When I downloaded and installed Erlang, the man pages | either weren't installed or weren't put in the right place. So, as a | newbie, I am left digging away from the main erlang site just to find | out what the f$%$ing built-in functions are. Not a good sign. Broken links: yes, there are quite a few. It'd help if he noted which ones were broken (he does point in the general direction further down in the blog). Finding broken internal links shouldn't be hard... Maybe someone would care to recommend a tool. Aside: every time I update the FAQ, I go through all the links manually and check they work. And each time I do that, I find a couple of dozen links which are broken, but there's no mechanical way of checking, because the destination still give me a page, just not the page I wanted. Classic example: xml.net was once a site with some Java XML software. Now it has nothing to do with XML and includes ads for "adult friend finder". The "Complete List of BIFs" is indeed pretty lame. See it for yourself at http://www.erlang.se/doc/doc-5.4.3/doc/reference_manual/introduction.html#1.4 it's probably a left-over from when the documentation was just man-pages. It should be a link to http://www.erlang.se/doc/doc-5.4.3/lib/kernel-2.10.3/doc/html/erlang.html I don't get the "kicker" at the end. I can't see how to improve the download page: http://www.erlang.org/download.html either you download the documentation or you don't. Seems perfectly clear to me. Maybe he was using a broken RPM. Matt From thomasl_erlang@REDACTED Thu Jan 13 12:12:01 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 13 Jan 2005 03:12:01 -0800 (PST) Subject: A Pythonista's Impressions of Erlang In-Reply-To: <1105603884.41e62d2c9bd97@horde.scannet.dk> Message-ID: <20050113111201.85658.qmail@web41901.mail.yahoo.com> --- bry@REDACTED wrote: > ... there was a general > quiet were the difficulties of finding resources, > documentation etc. were > discussed. Any takes on that subject? Personally, I've never had any difficulty in seeing the existing docs (no broken links to be found either) nor have I heard a lot of complaining about it. So the broken links sounded like a local problem to that poster. Resources: the existing docs are fairly good, and the new reference manual seems a fine thing for getting started with programming. If anything, my problem has been that it's difficult to find your way around all the masses of available docs. Examples and user contributions can be found directly from the main page. Good. Jungerl and some other SourceForge projects might be invisible from the turrets of the mighty fortress of Ericsson, so that's a possible drawback. Not getting the man/html stuff when you download the source tarball might or might not be a problem. Perhaps the download page could be reorged? OK, now let's compare www.erlang.org to the sites of some similar languages. First www.python.org. That site has: immediately seen sidebars: - "What is Python" (missing on erlang.org, or found in FAQ) - "Python Versions" - "Documentation" - "Community" a main announcements page, a search bar, and a (possibly) nicer layout with a larger, more readable font (on my Linux Firefox browser). Actual downloads seem a bit less convenient on python.org -- you get to the tarballs more quickly on erlang.org. The Python site seems to branch into different Python versions fairly quickly, while erlang.org does not. Not sure whether this is an advantage? Next, looking at Ruby (www.ruby-lang.org), we can see almost the same organization as python on the main page. On downloads, they mark "the stable release". Maybe the erlang download page should show "the stable release" too, apart from having it on the top of the page :-) (Actually, I think it would be a good idea to mark the "standard Erlang/OTP download" more clearly.) Next: Perl.org starts with "About Perl", "Online documentation", "Get Perl" and a default download in the top left corner. Actually downloading it involved some link chasing, so here Erlang wins again. Nothing special about the site, as far as I can tell. I think CPAN is the cool thing about Perl's community (www.cpan.org). There are newsgroups, comp.lang.{python,ruby,perl} but no comp.lang.erlang. The example languages all seem to have anonymous cvs and so on, which Erlang does not. But that's how we do it, at this point. There is, possibly, more involvement and contributions to the language, distribution, libraries, documentation and website from "outsiders" for python/ruby/perl than Erlang. That's not so strange, given Erlang's roots and constraints, but perhaps that too could be improved as a "resource"? (It's one of the benefits of open source, after all.) Well, those are my 2 pence. Best, Thomas __________________________________ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail From raimo@REDACTED Thu Jan 13 12:14:35 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 13 Jan 2005 12:14:35 +0100 Subject: Parsing null terminated strings in a binary. References: , Message-ID: ... and this actually compiles and works: [code] z_split(B, N) -> case B of <> -> {B1,B2}; <<_:N/binary>>=B -> B; <<_:N/binary,_/binary>>=B -> z_split(B, N+1) end. [/code] Eshell V5.4.3 (abort with ^G) 1> t:z_split(<<61,62,63,0,64,65,66>>, 0). {<<61,62,63>>, <<64,65,66>>} 2> t:z_split(<<61,62,63,0,64>>, 0). {<<61,62,63>>, <<64>>} 3> t:z_split(<<61,62,63,0>>, 0). {<<61,62,63>>, <<>>} 4> t:z_split(<<61,62,63>>, 0). <<61,62,63>> Raimo Niskanen writes: > Parse the binary in a loop something like this (untested): > > z_split(<>, N) -> > {B1,B2}; > z_split(<>, N) -> > B1; > z_split(<<_:N/binary,_/binary>>=B, N) -> > z_split(B, N+1). > > This will not build any sub-binaries until the zero is found. > > > > cyberlync@REDACTED (Eric Merritt) writes: > > > Guys, > > > > I have a need to parse out a series of null terminated fields a > > binary. The easiest way to do this is to simply traverse the binary > > using bit syntax until a null byte occurs. However, I believe this > > would be less then efficient as a new binary would be created for each > > byte matched. Aside from created a C port to actually do the parsing > > do any of you have any ideas on how to do this efficiently? > > > > Thanks, > > Eric > > -- > > I'm a programmer, I don't have to spell correctly; I just have to > > spell consistently > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From bjorn@REDACTED Thu Jan 13 13:37:47 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 13 Jan 2005 13:37:47 +0100 Subject: A Pythonista's Impressions of Erlang In-Reply-To: <871xcpd53y.fsf@pingviini.kortex.jyu.fi> References: <20050112142953.68607.qmail@web41904.mail.yahoo.com> <1105603884.41e62d2c9bd97@horde.scannet.dk> <871xcpd53y.fsf@pingviini.kortex.jyu.fi> Message-ID: Thanks! I have corrected the broken links. /Bj?rn Jani Hakala writes: > bry@REDACTED writes: > > > I went through the thread and was pleasently surprised as i think it > > turned out pretty nice, but I noted that while people ragged on the > > guys understanding of erlang (at least from my viewpoint it seemed > > like ragging) there was a general quiet were the difficulties of > > finding resources, documentation etc. were discussed. Any takes on > > that subject? > > > There are missing links in www.erlang.org > > Getting started page: > Getting started slowly > Getting started very very very slowly > Documentation in PDF > > These refer to missing files in > http://www.erlang.org/doc/r9c/doc/getting_started/ > > > Also in the about page there is bad link to > http://www.erlang.org/doc/r9c/doc/index.html > > Jani Hakala > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From mats.cronqvist@REDACTED Thu Jan 13 14:24:32 2005 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 13 Jan 2005 14:24:32 +0100 Subject: Parsing null terminated strings in a binary. In-Reply-To: References: Message-ID: <41E67690.4020309@ericsson.com> i don't get the last two matches. i'd think this would work; z_split(B, N) -> case B of <> -> {B1, B2}; <<_:N/binary>> -> B; _ -> z_split(B, N+1) end. what am i missing? mats Raimo Niskanen wrote: > ... and this actually compiles and works: > > [code] > z_split(B, N) -> > case B of > <> -> > {B1,B2}; > <<_:N/binary>>=B -> > B; > <<_:N/binary,_/binary>>=B -> > z_split(B, N+1) > end. > [/code] > > > Eshell V5.4.3 (abort with ^G) > 1> t:z_split(<<61,62,63,0,64,65,66>>, 0). > {<<61,62,63>>, > <<64,65,66>>} > 2> t:z_split(<<61,62,63,0,64>>, 0). > {<<61,62,63>>, > <<64>>} > 3> t:z_split(<<61,62,63,0>>, 0). > {<<61,62,63>>, > <<>>} > 4> t:z_split(<<61,62,63>>, 0). > <<61,62,63>> > > > > Raimo Niskanen writes: > > >>Parse the binary in a loop something like this (untested): >> >>z_split(<>, N) -> >> {B1,B2}; >>z_split(<>, N) -> >> B1; >>z_split(<<_:N/binary,_/binary>>=B, N) -> >> z_split(B, N+1). >> >>This will not build any sub-binaries until the zero is found. >> >> >> >>cyberlync@REDACTED (Eric Merritt) writes: >> >> >>>Guys, >>> >>> I have a need to parse out a series of null terminated fields a >>>binary. The easiest way to do this is to simply traverse the binary >>>using bit syntax until a null byte occurs. However, I believe this >>>would be less then efficient as a new binary would be created for > > each > >>>byte matched. Aside from created a C port to actually do the parsing >>>do any of you have any ideas on how to do this efficiently? >>> >>>Thanks, >>>Eric >>>-- >>>I'm a programmer, I don't have to spell correctly; I just have to >>>spell consistently >> >>-- >> >>/ Raimo Niskanen, Erlang/OTP, Ericsson AB > > From raimo@REDACTED Thu Jan 13 14:34:25 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 13 Jan 2005 14:34:25 +0100 Subject: Parsing null terminated strings in a binary. References: , <41E67690.4020309@ericsson.com> Message-ID: You are missing nothing. The code just evolved in my head to what it became - some cruft was left. This might be even clearer (untested): z_split(B, N) when is_binary(B), is_integer(N) -> case B of <> -> {B1,B2}; _ when size(B) > N z_split(B, N+1); _ -> B end. mats.cronqvist@REDACTED (Mats Cronqvist) writes: > i don't get the last two matches. i'd think this would work; > > z_split(B, N) -> > case B of > <> -> {B1, B2}; > <<_:N/binary>> -> B; > _ -> z_split(B, N+1) > end. > > what am i missing? > > mats > > Raimo Niskanen wrote: > > ... and this actually compiles and works: > > [code] > > z_split(B, N) -> > > case B of > > <> -> > > {B1,B2}; > > <<_:N/binary>>=B -> > > B; > > <<_:N/binary,_/binary>>=B -> > > z_split(B, N+1) > > end. > > [/code] > > Eshell V5.4.3 (abort with ^G) > > 1> t:z_split(<<61,62,63,0,64,65,66>>, 0). > > {<<61,62,63>>, > > <<64,65,66>>} > > 2> t:z_split(<<61,62,63,0,64>>, 0). {<<61,62,63>>, > > <<64>>} > > 3> t:z_split(<<61,62,63,0>>, 0). {<<61,62,63>>, > > <<>>} > > 4> t:z_split(<<61,62,63>>, 0). <<61,62,63>> > > Raimo Niskanen writes: > > > >>Parse the binary in a loop something like this (untested): > >> > >>z_split(<>, N) -> > >> {B1,B2}; > >>z_split(<>, N) -> > >> B1; > >>z_split(<<_:N/binary,_/binary>>=B, N) -> > >> z_split(B, N+1). > >> > >>This will not build any sub-binaries until the zero is found. > >> > >> > >> > >>cyberlync@REDACTED (Eric Merritt) writes: > >> > >> > >>>Guys, > >>> > >>> I have a need to parse out a series of null terminated fields a > >>>binary. The easiest way to do this is to simply traverse the binary > >>>using bit syntax until a null byte occurs. However, I believe this > >>>would be less then efficient as a new binary would be created for > > each > > > >>>byte matched. Aside from created a C port to actually do the parsing > >>>do any of you have any ideas on how to do this efficiently? > >>> > >>>Thanks, > >>>Eric > >>> -- > >>>I'm a programmer, I don't have to spell correctly; I just have to > >>>spell consistently > >> > >> -- > >> > >>/ Raimo Niskanen, Erlang/OTP, Ericsson AB > > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From ft@REDACTED Thu Jan 13 14:45:19 2005 From: ft@REDACTED (Fredrik Thulin) Date: Thu, 13 Jan 2005 14:45:19 +0100 Subject: A Pythonista's Impressions of Erlang In-Reply-To: <16870.19809.356294.601249@antilipe.corelatus.se> References: <20050112142953.68607.qmail@web41904.mail.yahoo.com> <41E637ED.5040204@ericsson.com> <16870.19809.356294.601249@antilipe.corelatus.se> Message-ID: <200501131445.20017.ft@it.su.se> On Thursday 13 January 2005 11.28, Matthias Lang wrote: ... > Broken links: yes, there are quite a few. It'd help if he noted which > ones were broken (he does point in the general direction further down > in the blog). Finding broken internal links shouldn't be hard... > Maybe someone would care to recommend a tool. Linkchecker http://linkchecker.sourceforge.net/ apparently does the job. I tried it with two levels of recursion on doc.html (linkchecker -r2 http://www.erlang.org/doc.html) but it didn't turn up anything serious. Just some broken links in links.html (oh the irony ;) ) : Does not resolve : http://csmctmto.interpoint.net/didx/python_erlang.html http://www.catseye.mb.ca/erlang/ Returns 404 Not Found : http://www.bluetail.com/~joe/sae_r7b/sae.html And a mirror that does not seem to be up, linked from mirrors.html : http://erlang.stacken.kth.se/ /Fredrik From thomas.xa.johnsson@REDACTED Thu Jan 13 15:18:12 2005 From: thomas.xa.johnsson@REDACTED (Thomas Johnsson XA (LN/EAB)) Date: Thu, 13 Jan 2005 15:18:12 +0100 Subject: Upcoming article in Dr. Dobbs' Message-ID: [Thought I'd pour some gasoline onto this thread again (:-)] Joe Armstrong says: > Erlang is the only language I know of that is well placed to program multiCPUs > all other approaches use some form sharing and or locking (which as I have said many > times before - is the root of all evil) I heartily agree with the 'root of all evil' bit -- but regrettably Erlang is plagued too: ets tables can be accessed directly from many processes. A grave design mistake, in my opinion. The feature is there and it is being used. -- Thomas From ulf.wiger@REDACTED Thu Jan 13 15:32:01 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Thu, 13 Jan 2005 15:32:01 +0100 Subject: Upcoming article in Dr. Dobbs' Message-ID: <37FB7AA6F5F9814FB634A7BF4C35A6F5402A22@ESEALNT442.al.sw.ericsson.se> Well, yes ets tables can be accessed directly by many processes, but all reads and writes are atomic, while operations spanning multiple objects are not. You could view ets as an optimization of something that could equally well have been implemented in Erlang using processes. One ets table could be modeled as a gen_server with a 'dict' or 'gb_trees' data structure. Named ets tables would require a registration process as well. I once wrote an ets implementation in Erlang. Using named tables, it was about 30x slower than 'ets'. If you want atomic operations on multiple objects, you can either serialize all ets accesses using an erlang process, or you can use Mnesia. My main point is that ets really doesn't introduce any semantics that couldn't be implemented in erlang using processes. And the semantics of ets are not necessarily "dirtier" than a lot of stuff that erlang programmers routinely do with processes. /Uffe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] > Sent: den 13 januari 2005 15:18 > To: 'erlang-questions@REDACTED' > Subject: RE: Upcoming article in Dr. Dobbs' > > > [Thought I'd pour some gasoline onto this thread again (:-)] > > Joe Armstrong says: > > Erlang is the only language I know of that is well placed > to program multiCPUs > > all other approaches use some form sharing and or locking > (which as I have said many > > times before - is the root of all evil) > > I heartily agree with the 'root of all evil' bit -- but > regrettably Erlang is plagued too: > ets tables can be accessed directly from many processes. A > grave design mistake, in my opinion. > The feature is there and it is being used. > > -- Thomas > > > > From chandrashekhar.mullaparthi@REDACTED Thu Jan 13 15:37:35 2005 From: chandrashekhar.mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Thu, 13 Jan 2005 14:37:35 +0000 Subject: Xmerl performance In-Reply-To: <010701c4f8d8$5e58aa70$2100a8c0@INSWITCH241> References: <002501c4f89c$5d17bd40$2100a8c0@INSWITCH241> <010701c4f8d8$5e58aa70$2100a8c0@INSWITCH241> Message-ID: http://expat.sourceforge.net/ cheers Chandru On 12 Jan 2005, at 18:56, Erlang Questions wrote: > Thanks Chandru. Is expat an Erlang module? Where can I find it? > Sebastian- > > From jabba@REDACTED Thu Jan 13 15:43:46 2005 From: jabba@REDACTED (Jani Launonen) Date: Thu, 13 Jan 2005 16:43:46 +0200 (EET) Subject: What ever happened to Erlang-processor (IBM's Cell-proc is hw-JVM) Message-ID: Hello, for those who are interested in changing programming paradigms as CPU frequencies seem to be maxed out (for now, at least. Perhaps asynchronous circuit make single threaded performance rise again in some years to come) and are bound to be CMP/SMT -processors, there are interesting article in The Register about IBM's Cell-processors and how it is a kind of hw-JVM. Look at http://www.theregister.co.uk/2005/01/13/ibm_cell_chip/ Now obviously comes a question to my mind --- what ever happened to Erlang-processor? Have a nice read. -+-+-+- Jani Launonen Student. . . . . . . . . .University of Oulu, Dept. of El. & Inf. Eng. "Life is what happens to you while you're busy making future plans." - Alfred E. Neuman From james.hague@REDACTED Thu Jan 13 15:49:04 2005 From: james.hague@REDACTED (James Hague) Date: Thu, 13 Jan 2005 08:49:04 -0600 Subject: Parsing null terminated strings in a binary. Message-ID: Raimo Niskanen wrote >This will not build any sub-binaries until the zero is found. As an aside, I have become enamored of this style of programming even for processing lists. For example, consider the problem of parsing a number out of a string. I count the number of elements that are ASCII digits, then when I don't find any more digits I grab all of them at once with lists:sublist. This hides all of the list building inside lists:sublist. I won't argue that this is faster, because it is certainly somewhat slower than building the list as you go (I did some timings). But it opens the door for a faster implementation of lists:sublist, possibly as a BIF, which somehow pleases me even though I don't ever expect it to happen. James From mats.cronqvist@REDACTED Thu Jan 13 15:49:51 2005 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 13 Jan 2005 15:49:51 +0100 Subject: Parsing null terminated strings in a binary. In-Reply-To: References: Message-ID: <41E68A8F.9090501@ericsson.com> sorry to keep harping on this... ...but would it be (noticably) faster to move the call to size/1 outside the loop? or equivalently, how fast is size/1 (compared to the binary match)? i would guess plenty fast but i'm too lazy to try it. mats Raimo Niskanen wrote: > You are missing nothing. The code just evolved in my head to > what it became - some cruft was left. This might be even clearer > (untested): > > z_split(B, N) when is_binary(B), is_integer(N) -> > case B of > <> -> > {B1,B2}; > _ when size(B) > N > z_split(B, N+1); > _ -> > B > end. > > From huss01@REDACTED Thu Jan 13 16:34:51 2005 From: huss01@REDACTED (=?ISO-8859-1?Q?H=E5kan_Huss?=) Date: Thu, 13 Jan 2005 16:34:51 +0100 Subject: A Pythonista's Impressions of Erlang In-Reply-To: <200501131445.20017.ft@it.su.se> References: <20050112142953.68607.qmail@web41904.mail.yahoo.com> <41E637ED.5040204@ericsson.com> <16870.19809.356294.601249@antilipe.corelatus.se> <200501131445.20017.ft@it.su.se> Message-ID: The "Getting started quickly"-tutorial contains two broken links at the very end (Digging deeper), which point into http://www.erlang.org/doc/r7b/doc/... /H?kan > On Thursday 13 January 2005 11.28, Matthias Lang wrote: > ... > > Broken links: yes, there are quite a few. It'd help if he noted which > > ones were broken (he does point in the general direction further down > > in the blog). Finding broken internal links shouldn't be hard... From per.gustafsson@REDACTED Thu Jan 13 16:46:19 2005 From: per.gustafsson@REDACTED (Per Gustafsson) Date: Thu, 13 Jan 2005 16:46:19 +0100 (MET) Subject: Parsing null terminated strings in a binary. In-Reply-To: <41E68A8F.9090501@ericsson.com> References: <41E68A8F.9090501@ericsson.com> Message-ID: I tested some different versions of the z_split program and the fastest one I found was this: z_split(B) when is_binary(B) -> z_split3(B, 0, size(B)). z_split3(B, N, X) -> case B of <<_:N/binary,0,_/binary>> -> <> = B, {B1,B2}; _ when X > N -> z_split3(B, N+1, X); _ -> B end. This moves the call to size outside the loop and it also avoids creating a subbinary unless an actual zero has been found. If you hipe compile the code however this is the fastest version: z_splita(B) when is_binary(B) -> z_splita2(B, 0). z_splita2(B,N) -> case B of <<_:N/binary,0,_/binary>> -> <> = B, {B1,B2}; <<_:N/binary>> -> B; _ -> z_splita2(B, N+1) end. About 3.5 times faster than the non hipe compiled version Per On Thu, 13 Jan 2005, Mats Cronqvist wrote: > sorry to keep harping on this... > ...but would it be (noticably) faster to move the call to size/1 outside the loop? > or equivalently, how fast is size/1 (compared to the binary match)? > i would guess plenty fast but i'm too lazy to try it. > > mats > > Raimo Niskanen wrote: > > You are missing nothing. The code just evolved in my head to > > what it became - some cruft was left. This might be even clearer > > (untested): > > > > z_split(B, N) when is_binary(B), is_integer(N) -> > > case B of > > <> -> > > {B1,B2}; > > _ when size(B) > N > > z_split(B, N+1); > > _ -> > > B > > end. > > > > > From todd@REDACTED Thu Jan 13 17:06:52 2005 From: todd@REDACTED (todd) Date: Thu, 13 Jan 2005 08:06:52 -0800 Subject: Xmerl performance In-Reply-To: References: <002501c4f89c$5d17bd40$2100a8c0@INSWITCH241> <010701c4f8d8$5e58aa70$2100a8c0@INSWITCH241> Message-ID: <41E69C9C.6030101@possibility.com> I've used expat embedded in a class 5 sonet switch and found that it reliable and performed well with fixed memory usage. I never used it with erlang though. It's C based and uses a fairly simple callback model. At the time it was non-validating, I don't know if that has changed. Chandrashekhar Mullaparthi wrote: > http://expat.sourceforge.net/ > > cheers > Chandru > > On 12 Jan 2005, at 18:56, Erlang Questions wrote: > >> Thanks Chandru. Is expat an Erlang module? Where can I find it? >> Sebastian- >> >> > > From raimo@REDACTED Thu Jan 13 17:19:00 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 13 Jan 2005 17:19:00 +0100 Subject: Parsing null terminated strings in a binary. References: , <41E68A8F.9090501@ericsson.com> Message-ID: Sorry, I am also to lazy to measure. It is probably so that yours > z_split(B, N) -> > case B of > <> -> {B1, B2}; > <<_:N/binary>> -> B; > _ -> z_split(B, N+1) > end. is faster than mine > z_split(B, N) when is_binary(B), is_integer(N) -> > case B of > <> -> > {B1,B2}; > _ when size(B) > N > z_split(B, N+1); > _ -> > B > end. since the second clause in the first variant is done in a binary pattern matching context, and there is a setup cost, so the second clause may be very cheap; at least probably cheaper than calling size/1 (after the binary pattern matching). It might even be so cheap that moving the size(B) call outside the loop in variant 2 does not give any measurable improvement over variant 1. You will have to compare Size with N in the loop in that case. And for hardcore optimization the is_binary(B) and is_integer(N) should be moved outside the loop, of course. So, allright, your suggested variant may be the winner! Messen ist vissen. (Werner von Siemens) # To measure is to know. mats.cronqvist@REDACTED (Mats Cronqvist) writes: > sorry to keep harping on this... > ...but would it be (noticably) faster to move the call to size/1 outside the loop? > or equivalently, how fast is size/1 (compared to the binary match)? > i would guess plenty fast but i'm too lazy to try it. > > mats > > Raimo Niskanen wrote: > > You are missing nothing. The code just evolved in my head to > > what it became - some cruft was left. This might be even clearer > > (untested): > > z_split(B, N) when is_binary(B), is_integer(N) -> > > case B of > > <> -> > > {B1,B2}; > > _ when size(B) > N > > z_split(B, N+1); > > _ -> > > B > > end. > > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From erlang@REDACTED Thu Jan 13 17:22:10 2005 From: erlang@REDACTED (Erlang Questions) Date: Thu, 13 Jan 2005 14:22:10 -0200 Subject: Xmerl performance References: <002501c4f89c$5d17bd40$2100a8c0@INSWITCH241> <010701c4f8d8$5e58aa70$2100a8c0@INSWITCH241> Message-ID: <017501c4f98c$09114180$2100a8c0@INSWITCH241> Chandru, are you doing the parsing from Erlang or C/C++? In case of working from Erlang, how do you call eXpat? Do you have same sample code? Thanks, Sebastian- ----- Original Message ----- From: "Chandrashekhar Mullaparthi" To: "Erlang Questions" Cc: "Erlang Questions" Sent: Thursday, January 13, 2005 12:37 PM Subject: Re: Xmerl performance > http://expat.sourceforge.net/ > > cheers > Chandru > > On 12 Jan 2005, at 18:56, Erlang Questions wrote: > > > Thanks Chandru. Is expat an Erlang module? Where can I find it? > > Sebastian- > > > > > > From erlang@REDACTED Thu Jan 13 17:30:27 2005 From: erlang@REDACTED (Erlang Questions) Date: Thu, 13 Jan 2005 14:30:27 -0200 Subject: Xmerl performance References: <002501c4f89c$5d17bd40$2100a8c0@INSWITCH241> <010701c4f8d8$5e58aa70$2100a8c0@INSWITCH241> <41E69C9C.6030101@possibility.com> Message-ID: <018a01c4f98d$3167aec0$2100a8c0@INSWITCH241> Our first attempt is trying to do the parsing from Erlang. If this doesn't work fine (from the performance point of view), we'll evaluate using an Erlang port or some other mechanism to obtain the parsing results from Erlang and do the parsing in C or other languague. Thanks, Sebastian- ----- Original Message ----- From: "todd" To: "Chandrashekhar Mullaparthi" Cc: "Erlang Questions" ; "Erlang Questions" Sent: Thursday, January 13, 2005 2:06 PM Subject: Re: Xmerl performance > I've used expat embedded in a class 5 sonet switch and found that > it reliable and performed well with fixed memory usage. I never > used it with erlang though. It's C based and uses a fairly simple callback > model. At the time it was non-validating, I don't know if that has > changed. > > Chandrashekhar Mullaparthi wrote: > > > http://expat.sourceforge.net/ > > > > cheers > > Chandru > > > > On 12 Jan 2005, at 18:56, Erlang Questions wrote: > > > >> Thanks Chandru. Is expat an Erlang module? Where can I find it? > >> Sebastian- > >> > >> > > > > > From bjorn@REDACTED Thu Jan 13 17:32:01 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 13 Jan 2005 17:32:01 +0100 Subject: A Pythonista's Impressions of Erlang In-Reply-To: References: <20050112142953.68607.qmail@web41904.mail.yahoo.com> <41E637ED.5040204@ericsson.com> <16870.19809.356294.601249@antilipe.corelatus.se> <200501131445.20017.ft@it.su.se> Message-ID: Thanks! Corrected now. /Bj?rn H?kan Huss writes: > The "Getting started quickly"-tutorial contains two broken links at > the very end (Digging deeper), which point into > http://www.erlang.org/doc/r7b/doc/... > > /H?kan > > > On Thursday 13 January 2005 11.28, Matthias Lang wrote: > > ... > > > Broken links: yes, there are quite a few. It'd help if he noted which > > > ones were broken (he does point in the general direction further down > > > in the blog). Finding broken internal links shouldn't be hard... > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From mickael.remond@REDACTED Thu Jan 13 18:21:57 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Thu, 13 Jan 2005 18:21:57 +0100 Subject: Memory consumption and memory management: How does it work ? Message-ID: <41E6AE35.3020208@erlang-fr.org> Hello, I am investigating memory problems with ejabberd, that are possibly memory leaks. I wanted to gather your advice regarding such problem, as memory issue is not a trivial thing to debug: - Do you have advice to locate where the memory problem comes from ? I suspect that the problem comes from C driver, but would like to isolate the problem. - On another side, calling garbage_collect reduce notably the memory footprint. The application memory occupation is still growing constantly but, garbage_collect free nearly a quarter of the memory (100 Mo). Is this an indicator that the memory allocation strategy should be changed ? Does this lead you to some interesting advices ? - My last questions is about memory analysis: Is it possible to trigger report generation like those of crash dump for precise process analysis ? Thank you in advance for your help regarding Erlang VM underlying memory management. I need your feedback to understand how it work internally. -- Micka?l R?mond http://www.erlang-projects.org/ From matthias@REDACTED Thu Jan 13 22:02:30 2005 From: matthias@REDACTED (Matthias Lang) Date: Thu, 13 Jan 2005 22:02:30 +0100 Subject: A Pythonista's Impressions of Erlang In-Reply-To: <200501131445.20017.ft@it.su.se> References: <20050112142953.68607.qmail@web41904.mail.yahoo.com> <41E637ED.5040204@ericsson.com> <16870.19809.356294.601249@antilipe.corelatus.se> <200501131445.20017.ft@it.su.se> Message-ID: <16870.57830.9300.402883@antilipe.corelatus.se> Matthias> Broken links [....] Maybe someone would care to recommend a tool. Fredrik> Linkchecker (http://linkchecker.sourceforge.net/) Oh the irony! It's a python tool. I was almost relieved when it didn't work perfectly out of the box (it chokes on LANGUAGE=en_SE:en_US:en_GB:en, works fine for LANGUAGE=en_US) ;-) Matthias From sean.hinde@REDACTED Fri Jan 14 00:09:55 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Thu, 13 Jan 2005 23:09:55 +0000 Subject: Xmerl performance In-Reply-To: <018a01c4f98d$3167aec0$2100a8c0@INSWITCH241> References: <002501c4f89c$5d17bd40$2100a8c0@INSWITCH241> <010701c4f8d8$5e58aa70$2100a8c0@INSWITCH241> <41E69C9C.6030101@possibility.com> <018a01c4f98d$3167aec0$2100a8c0@INSWITCH241> Message-ID: <3CF3C352-65B8-11D9-B2B8-000A95927CCE@mac.com> Hi, We used the expat binding which was written as part of the ejabberd project. Thanks to Alexey Shchepin for writing it and making it available (under the GPL). We adapted the SAX type model of the ejabberd expat driver to create a DOM with something like the following code. I can't quite recall which bits of this were used but it might provide a guide. Sean %%%--------------------------------------------------------------------- - %%% File : xml_stream.erl %%% Author : Alexey Shchepin %%% Purpose : %%% Created : 17 Nov 2002 by Alexey Shchepin %%% Id : $Id: xml_stream.erl,v 1.4 2003/03/15 21:11:19 alexey Exp $ %%%--------------------------------------------------------------------- - %% [{xmlelement, Name, Attrs, [{xmlelement, Name, Attrs, []}]}]. -module(xml_stream_sh1). -author('alexey@REDACTED'). -vsn('$Revision: 1.4 $ '). -export([start/1, init/1, send_text/2, test/0]). test() -> Data = [{xmlstart,{"People",[]}}, {xmlcdata,"1 "}, {xmlstart,{"comment",[]}}, {xmlcdata,"This is a comment "}, {xmlend,"comment"}, {xmlcdata,"2 "}, {xmlstart,{"Person",[{"Type","Personal"}]}}, {xmlcdata,"3 "}, {xmlend,"Person"}, {xmlend,"People"}], create(Data, []). %% Data between 2 start tags and after an end tag is just %% discarded. I'm sure we should insist that we only discard %% whitespace but there you go! create([{xmlstart, Start1},{xmlcdata,_},{xmlstart, Start2}|T], Stack) -> create([{xmlstart, Start1},{xmlstart, Start2}|T], Stack); create([{xmlstart, {Name, Attrs}}|T], Stack) -> create(T, [{Name, Attrs, []}|Stack]); create([{xmlend, Name},{xmlcdata, _}|T], Stack) -> create([{xmlend, Name}|T], Stack); create([{xmlend, Name}|T], Stack) -> io:format("Stack:~p~n",[Stack]), case Stack of [{Name1, Attrs, Els}] -> [{Name1, Attrs, Els}]; [] -> {error, end_with_no_start}; [El, {Name1, Attr, Els}|St] -> create(T, [{Name1, Attr, lists:reverse([El|Els])}|St]) end; create([{xmlcdata, Data}|T], [{Name, Attrs, Els}|Stack]) -> create(T, [{Name, Attrs, [{cdata, Data}|Els]}|Stack]); create([], _) -> {error, premature_end}; create({xmlerror, Reason}, _) -> {error, Reason}. % Section dedicated to removing random data between 2 start tags and % after end tags. We keep the last two tags processed so we know % whether either of these conditions have been met build({xmlcdata,Cdata}, Stack, [{xmlend, Name}|T]) -> {cont, Stack, [{xmlend, Name}|T]}; build({xmlstart, {Name, Attrs}}, Stack, [{xmlcdata, _}, {xmlstart, Val}]) -> {cont, [{Name, Attrs, []}|Stack], [{xmlstart, {Name, Attrs}},{xmlstart, Val}]}; build({xmlcdata, Data}, Stack, [{xmlstart, Val}|T]) -> {cont, Stack, [{xmlcdata, Data},{xmlstart, Val}]}; build(Tag, [{Name, Attrs, Els}|Stack], [{xmlcdata, Data},{xmlstart, Val}]) -> build(Tag, [{Name, Attrs, [{cdata, Data}|Els]}|Stack], [Tag,{xmlcdata, Data}]); build({xmlstart, {Name, Attrs}}, Stack, Last2) -> {cont, [{Name, Attrs,[]}|Stack], last2({xmlstart, {Name, Attrs}}, Last2)}; build({xmlend, Name}, Stack, Last2) -> % io:format("Stack:~p~n",[Stack]), case Stack of [{Name1, Attrs, Els}] -> {done, [{Name1, Attrs, lists:reverse(Els)}]}; [] -> {error, end_with_no_start}; [{Name0, Attr0, Els0}, {Name1, Attr, Els}|St] -> {cont, [{Name1, Attr, [{Name0, Attr0, lists:reverse(Els0)}|Els]}|St], last2({xmlend, Name}, Last2)} end; build({xmlcdata, Data}, [{Name, Attrs, Els}|Stack], Last2) -> {cont, [{Name, Attrs, [{cdata, Data}|Els]}|Stack], last2({xmlcdata, Data}, Last2)}; build(_, {xmlerror, Reason}, _) -> {error, Reason}. last2(New, [H,T]) -> [New,H]; last2(New, [H]) -> [New,H]; last2(New, []) -> [New]. start(CallbackPid) -> spawn(?MODULE, init, [CallbackPid]). init(String) -> Port = open_port({spawn, expat_erl}, [binary]), Port ! {self(), {command, String}}, loop(String, Port, [], []). loop(String, Port, Stack, Last2) -> receive {Port, {data, Bin}} -> Data = binary_to_term(Bin), case build(Data, Stack, Last2) of {done, Res} -> {ok, Res}; {cont, Stack2, Last22} -> loop(String, Port, Stack2, Last22); {error, Reason} -> {error, Reason} end; {From, {send, Str}} -> Port ! {self(), {command, Str}}, loop(String, Port, Stack, Last2) end. process_data(CallbackPid, Stack, Data) -> io:format("Data:~p~n",[Data]), case Data of {xmlstart, {Name, Attrs}} -> if Stack == [] -> gen_fsm:send_event(CallbackPid, {xmlstreamstart, Name, Attrs}); true -> true end, [{xmlelement, Name, Attrs, []} | Stack]; {xmlend, EndName} -> case Stack of [{xmlelement, Name, Attrs, Els} | Tail] -> NewEl = {xmlelement, Name, Attrs, lists:reverse(Els)}, Len = length(Tail), if Len > 1 -> add_subelement(NewEl, Tail); Len == 1 -> gen_fsm:send_event(CallbackPid, {xmlstreamelement, NewEl}), Tail; Len == 0 -> gen_fsm:send_event(CallbackPid, {xmlstreamelement, NewEl}), gen_fsm:send_event(CallbackPid, {xmlstreamend, EndName}), Tail end end; {xmlcdata, CData} -> io:format("CDATA:~p~n",[{CData, Stack}]), add_subelement({xmlcdata, CData}, Stack); {xmlerror, Err} -> gen_fsm:send_event(CallbackPid, {xmlstreamerror, Err}) end. add_subelement(El, Stack) -> case Stack of [{xmlelement, Name, Attrs, Els} | Tail] -> [{xmlelement, Name, Attrs, [El | Els]} | Tail]; [] -> [] end. send_text(Pid, Text) -> Pid ! {self(), {send, Text}}. On 13 Jan 2005, at 16:30, Erlang Questions wrote: > Our first attempt is trying to do the parsing from Erlang. If this > doesn't > work fine (from the performance point of view), we'll evaluate using an > Erlang port or some other mechanism to obtain the parsing results from > Erlang and do the parsing in C or other languague. > > Thanks, > Sebastian- > > ----- Original Message ----- > From: "todd" > To: "Chandrashekhar Mullaparthi" > > Cc: "Erlang Questions" ; "Erlang Questions" > > Sent: Thursday, January 13, 2005 2:06 PM > Subject: Re: Xmerl performance > > >> I've used expat embedded in a class 5 sonet switch and found that >> it reliable and performed well with fixed memory usage. I never >> used it with erlang though. It's C based and uses a fairly simple >> callback >> model. At the time it was non-validating, I don't know if that has >> changed. >> >> Chandrashekhar Mullaparthi wrote: >> >>> http://expat.sourceforge.net/ >>> >>> cheers >>> Chandru >>> >>> On 12 Jan 2005, at 18:56, Erlang Questions wrote: >>> >>>> Thanks Chandru. Is expat an Erlang module? Where can I find it? >>>> Sebastian- >>>> >>>> >>> >>> >> > > From sean.hinde@REDACTED Fri Jan 14 00:11:38 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Thu, 13 Jan 2005 23:11:38 +0000 Subject: Memory consumption and memory management: How does it work ? In-Reply-To: <41E6AE35.3020208@erlang-fr.org> References: <41E6AE35.3020208@erlang-fr.org> Message-ID: <7A55342B-65B8-11D9-B2B8-000A95927CCE@mac.com> Oops, maybe we should also review our use of expat from ejabberd (see my last mail !) Sean On 13 Jan 2005, at 17:21, Mickael Remond wrote: > Hello, > > I am investigating memory problems with ejabberd, that are possibly > memory leaks. > > I wanted to gather your advice regarding such problem, as memory issue > is not a trivial thing to debug: > > - Do you have advice to locate where the memory problem comes from ? I > suspect that the problem comes from C driver, but would like to isolate > the problem. > > - On another side, calling garbage_collect reduce notably the memory > footprint. The application memory occupation is still growing > constantly > but, garbage_collect free nearly a quarter of the memory (100 Mo). Is > this an indicator that the memory allocation strategy should be changed > ? Does this lead you to some interesting advices ? > > - My last questions is about memory analysis: Is it possible to trigger > report generation like those of crash dump for precise process > analysis ? > > Thank you in advance for your help regarding Erlang VM underlying > memory > management. I need your feedback to understand how it work internally. > > -- > Micka?l R?mond > http://www.erlang-projects.org/ > From cpressey@REDACTED Fri Jan 14 00:19:39 2005 From: cpressey@REDACTED (Chris Pressey) Date: Thu, 13 Jan 2005 15:19:39 -0800 Subject: A Pythonista's Impressions of Erlang In-Reply-To: <200501131445.20017.ft@it.su.se> References: <20050112142953.68607.qmail@web41904.mail.yahoo.com> <41E637ED.5040204@ericsson.com> <16870.19809.356294.601249@antilipe.corelatus.se> <200501131445.20017.ft@it.su.se> Message-ID: <20050113151939.04872444.cpressey@catseye.mine.nu> On Thu, 13 Jan 2005 14:45:19 +0100 Fredrik Thulin wrote: [of links.html] > Does not resolve : > > http://www.catseye.mb.ca/erlang/ Wow, that brings back memories... If you want to change it, I guess the present-day equivalent is http://catseye.webhop.net/projects/?keyword=erl Or you can just remove it. -Chris From cpressey@REDACTED Fri Jan 14 00:25:17 2005 From: cpressey@REDACTED (Chris Pressey) Date: Thu, 13 Jan 2005 15:25:17 -0800 Subject: A Pythonista's Impressions of Erlang In-Reply-To: <20050113111201.85658.qmail@web41901.mail.yahoo.com> References: <1105603884.41e62d2c9bd97@horde.scannet.dk> <20050113111201.85658.qmail@web41901.mail.yahoo.com> Message-ID: <20050113152517.7f6d1b6e.cpressey@catseye.mine.nu> On Thu, 13 Jan 2005 03:12:01 -0800 (PST) Thomas Lindgren wrote: [...] > The example languages all seem to have anonymous cvs > and so on, which Erlang does not. But that's how we do > it, at this point. > > There is, possibly, more involvement and contributions > to the language, distribution, libraries, > documentation and website from "outsiders" for > python/ruby/perl than Erlang. That's not so strange, > given Erlang's roots and constraints, but perhaps that > too could be improved as a "resource"? (It's one of > the benefits of open source, after all.) Well, perhaps this is too obvious to mention, but the most logical way for Erlang to leverage the "resources" of "outsiders", i.e. engage the community, would be to open up development as well as source. For example, make the source repository public (as you note,) make the bugtracker public, make the docs open-source, etc. -Chris From charleshixsn@REDACTED Fri Jan 14 01:48:13 2005 From: charleshixsn@REDACTED (Charles Hixson) Date: Thu, 13 Jan 2005 16:48:13 -0800 Subject: Getting Started: tut.erl : exiting with an error?!? Message-ID: <41E716CD.5090408@earthlink.net> Please help. Something's quite wrong. Here's the program: -module(tut). -export([double/1]). double(X) -> 2 * X. And here's the result of running it: :~/projects/erlang$ erl Erlang (BEAM) emulator version 5.3.6.3 [source] [hipe] [threads:0] Eshell V5.3.6.3 (abort with ^G) 1> c(tut). ** exited: {undef,[{compile,file,[tut,[report_errors,report_warnings]]}, {c,c,2}, {erl_eval,do_apply,5}, {shell,eval_loop,2}]} ** 2> I'm so much of a beginner that I can't guess what is happening...but I think it's my system rather than the program. I have erlang installed from the Debian archives... so that should be a pretty good version. Still, I can't think of how to fix things. P.S.: Missing from the getting started tutorial is how to properly quit the shell. (I eventually found that the answer was halt(). , but it wasn't something I was able to guess.) From erlq@REDACTED Fri Jan 14 08:06:05 2005 From: erlq@REDACTED (Rob) Date: Thu, 13 Jan 2005 23:06:05 -0800 Subject: A Pythonista's Impressions of Erlang In-Reply-To: <20050113151939.04872444.cpressey@catseye.mine.nu> References: <20050112142953.68607.qmail@web41904.mail.yahoo.com> <41E637ED.5040204@ericsson.com> <16870.19809.356294.601249@antilipe.corelatus.se> <200501131445.20017.ft@it.su.se> <20050113151939.04872444.cpressey@catseye.mine.nu> Message-ID: <41E76F5D.7070503@itsbeen.sent.com> Chris Pressey wrote: > On Thu, 13 Jan 2005 14:45:19 +0100 > Fredrik Thulin wrote: > > [of links.html] > >>Does not resolve : >> >>http://www.catseye.mb.ca/erlang/ > > > Wow, that brings back memories... > > If you want to change it, I guess the present-day equivalent is > > http://catseye.webhop.net/projects/?keyword=erl > Or you can just remove it. Please, don't remove it - the examples Chris has of esoteric languages, games and other projects written in erlang are valuable given the limited number of available erlang programs from different coders. Creative implementations of small language interpreters are useful code templates for all kinds of projects. Chris, is there a way to get a simplified form of the project pages so that one could do a recursive wget to easily pull all the files for a given project (the current pages loop around due to the sorting option links)? I don't see a way to do it other than one file at a time, am I missing something obvious? Thanks. From matthias@REDACTED Fri Jan 14 09:02:10 2005 From: matthias@REDACTED (Matthias Lang) Date: Fri, 14 Jan 2005 09:02:10 +0100 Subject: Getting Started: tut.erl : exiting with an error?!? In-Reply-To: <41E716CD.5090408@earthlink.net> References: <41E716CD.5090408@earthlink.net> Message-ID: <16871.31874.121417.706148@antilipe.corelatus.se> Charles Hixson writes: > :~/projects/erlang$ erl > Erlang (BEAM) emulator version 5.3.6.3 [source] [hipe] [threads:0] > > Eshell V5.3.6.3 (abort with ^G) > 1> c(tut). > ** exited: {undef,[{compile,file,[tut,[report_errors,report_warnings]]}, > {c,c,2}, > {erl_eval,do_apply,5}, > {shell,eval_loop,2}]} ** > I'm so much of a beginner that I can't guess what is happening...but I > think it's my system rather than the program. I have erlang installed > from the Debian archives... so that should be a pretty good version. Yup, your Erlang installation is broken. Here's what the same operation looks like on a working system: | tmp >erl | Erlang (BEAM) emulator version 5.3.6.3 [source] [hipe] | | Eshell V5.3.6.3 (abort with ^G) | 1> c(tut). | {ok,tut} I normally use Erlang compiled from source, but just to check your problem, I tried installing the current Erlang from unstable. It worked, but it's a different version to the one you're running. Suggestion: try the Erlang from unstable. If it still doesn't work, install Erlang from the source code on the erlang.org website. It's actually quite easy: you just untar it and run configure and then make. You don't even have to run 'make install' if you don't want to---you can run it from the directory you compiled in. Takes quite some time to compile, though. Matthias From bengt.kleberg@REDACTED Fri Jan 14 09:08:14 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 14 Jan 2005 09:08:14 +0100 Subject: Getting Started: tut.erl : exiting with an error?!? In-Reply-To: <41E716CD.5090408@earthlink.net> References: <41E716CD.5090408@earthlink.net> Message-ID: <41E77DEE.5090600@ericsson.com> Charles Hixson wrote: > Please help. Something's quite wrong. Here's the program: > -module(tut). > -export([double/1]). > > double(X) -> > 2 * X. > > And here's the result of running it: > :~/projects/erlang$ erl > Erlang (BEAM) emulator version 5.3.6.3 [source] [hipe] [threads:0] > > Eshell V5.3.6.3 (abort with ^G) > 1> c(tut). > ** exited: {undef,[{compile,file,[tut,[report_errors,report_warnings]]}, > {c,c,2}, > {erl_eval,do_apply,5}, > {shell,eval_loop,2}]} ** the error comes first: undef that means that whatever follows was undefined (did not exist). next comes the list of what was wrong: first module: compile then function: file and finally a list of arguments. arg1: tut arg2: [report_errors,report_warnings]. ie, the the call compile:file( tut, [report_errors,report_warnings] ) does not exist. start by checking, from the erlang shell, if the module compile exists: 1> m(compile). this will list exported functions (if compile exists) and you can check if the function file/2 is exported. please do that and get back to me. bengt From matthias@REDACTED Fri Jan 14 09:27:55 2005 From: matthias@REDACTED (Matthias Lang) Date: Fri, 14 Jan 2005 09:27:55 +0100 Subject: Memory consumption and memory management: How does it work ? In-Reply-To: <41E6AE35.3020208@erlang-fr.org> References: <41E6AE35.3020208@erlang-fr.org> Message-ID: <16871.33419.202345.190472@antilipe.corelatus.se> Mickael Remond writes: > - Do you have advice to locate where the memory problem comes from ? I > suspect that the problem comes from C driver, but would like to isolate > the problem. Turn the C driver into a port program, temporarily. Use the instrumented runtime (see below). > - On another side, calling garbage_collect reduce notably the memory > footprint. The application memory occupation is still growing constantly > but, garbage_collect free nearly a quarter of the memory (100 Mo). Is > this an indicator that the memory allocation strategy should be changed > ? Does this lead you to some interesting advices ? Continuous growth is a bad sign. Having the garbage collector reclaim a lot of memory isn't unusual. > - My last questions is about memory analysis: Is it possible to trigger > report generation like those of crash dump for precise process analysis ? Yes: http://www.erlang.se/doc/doc-5.4.3/lib/tools-2.4/doc/html/instrument.html Matthias From mike@REDACTED Fri Jan 14 09:42:10 2005 From: mike@REDACTED (Michael Williams) Date: 14 Jan 2005 08:42:10 GMT Subject: Getting Started: tut.erl : exiting with an error?!? References: <41E716CD.5090408@earthlink.net> Message-ID: In article <41E716CD.5090408@REDACTED>, charleshixsn@REDACTED (Charles Hixson) writes: |> P.S.: Missing from the getting started tutorial is how to properly quit |> the shell. (I eventually found that the answer was halt(). , but it |> wasn't something I was able to guess.) |> >From the tutorial (section 2.1, right at the start): To shutdown the Erlang system and the Erlang shell type Control-C. You will see the following output: BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution a % Type "a" to leave the Erlang system. Another way to shutdown the Erlang system is by entering halt(): 3> halt(). % In an early version of the tutorial, this information was indeed missing and I added it later when this was pointed out. Maybe you have some outdated version? /mike From mats.cronqvist@REDACTED Fri Jan 14 10:09:09 2005 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Fri, 14 Jan 2005 10:09:09 +0100 Subject: Getting Started: tut.erl : exiting with an error?!? In-Reply-To: <41E716CD.5090408@earthlink.net> References: <41E716CD.5090408@earthlink.net> Message-ID: <41E78C35.4040309@ericsson.com> charles, the error message means that the emulator can't find the compiler. {undef,[{M,F,A},...]} means that the function M:F with length(A) arguments doesn't exist, which in this case emans that the file compile.beam is not present in the load path. you can see the load path by doing code:get_path(). i do have some useful advice too :> i got a very similar error when i installed both the erlang and the erlang-doc-html package. uninstalling the erlang-doc-html package should fix the crash (it did for me anyways). i believe this is caused by the current packages having different versions (the erlang package is R9 and the erlang-doc package is R10). say the comiler is here; lib/compiler-4.2.3/ebin/compile.beam and the doc is here; lib/compiler-4.3/doc/html/ the install script will look for lib/compiler-4.3/ebin/*.beam which doesn't exist. i'm cc:ing this to the debian maintainer, maybe he can withdraw the R10 erlang-doc-html package. mats Charles Hixson wrote: > Please help. Something's quite wrong. Here's the program: > -module(tut). > -export([double/1]). > > double(X) -> > 2 * X. > > And here's the result of running it: > :~/projects/erlang$ erl > Erlang (BEAM) emulator version 5.3.6.3 [source] [hipe] [threads:0] > > Eshell V5.3.6.3 (abort with ^G) > 1> c(tut). > ** exited: {undef,[{compile,file,[tut,[report_errors,report_warnings]]}, > {c,c,2}, > {erl_eval,do_apply,5}, > {shell,eval_loop,2}]} ** > 2> > > I'm so much of a beginner that I can't guess what is happening...but I > think it's my system rather than the program. I have erlang installed > from the Debian archives... so that should be a pretty good version. > Still, I can't think of how to fix things. > > P.S.: Missing from the getting started tutorial is how to properly quit > > the shell. (I eventually found that the answer was halt(). , but it > wasn't something I was able to guess.) > From dginsburg@REDACTED Fri Jan 14 10:21:57 2005 From: dginsburg@REDACTED (Daniel Ginsburg) Date: Fri, 14 Jan 2005 12:21:57 +0300 Subject: Getting Started: tut.erl : exiting with an error?!? In-Reply-To: <41E716CD.5090408@earthlink.net> References: <41E716CD.5090408@earthlink.net> Message-ID: <5449af0405011401212e2dc36f@mail.gmail.com> On Thu, 13 Jan 2005 16:48:13 -0800, Charles Hixson wrote: > Please help. Something's quite wrong. Here's the program: > -module(tut). > -export([double/1]). > > double(X) -> > 2 * X. > > And here's the result of running it: > :~/projects/erlang$ erl > Erlang (BEAM) emulator version 5.3.6.3 [source] [hipe] [threads:0] > > Eshell V5.3.6.3 (abort with ^G) > 1> c(tut). > ** exited: {undef,[{compile,file,[tut,[report_errors,report_warnings]]}, > {c,c,2}, > {erl_eval,do_apply,5}, > {shell,eval_loop,2}]} ** > 2> > > I'm so much of a beginner that I can't guess what is happening...but I > think it's my system rather than the program. I have erlang installed > from the Debian archives... so that should be a pretty good version. > Still, I can't think of how to fix things. > > P.S.: Missing from the getting started tutorial is how to properly quit > the shell. (I eventually found that the answer was halt(). , but it > wasn't something I was able to guess.) > > Let me guess. You are using Debian testing (or unstable) and you have erlang-doc-html installed, right? The problem is that in current Debian testing distribution erlang-doc-html is R10B-1 but erlang itself is R9C-2. This causes version conflict. Uninstall erlang-doc-html and you'll be fine. For more information see Debian bug IDs #279122 and #279122. -- dg From raimo@REDACTED Fri Jan 14 11:15:23 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 14 Jan 2005 11:15:23 +0100 Subject: Parsing null terminated strings in a binary. References: Message-ID: Then it might be worth the effort to hipe compile the lists and string modules, if it is possible. Instead of hoping lists:sublist to become a BIF. By the way, lists:member/2, lists:reverse/2, lists:keymember/3, lists:append/2 (++), lists:subtract/2 (--) and lists:keysearch/3 (and also erlang:length/1, erlang:hd/1, erlang:tl/1 as well as erlang:list_to_tuple/1 and erlang:tuple_to_list/1 and such) are BIFs, if you did not already know that. james.hague@REDACTED (James Hague) writes: > Raimo Niskanen wrote > > >This will not build any sub-binaries until the zero is found. > > As an aside, I have become enamored of this style of programming even > for processing lists. For example, consider the problem of parsing a > number out of a string. I count the number of elements that are ASCII > digits, then when I don't find any more digits I grab all of them at > once with lists:sublist. This hides all of the list building inside > lists:sublist. I won't argue that this is faster, because it is > certainly somewhat slower than building the list as you go (I did some > timings). But it opens the door for a faster implementation of > lists:sublist, possibly as a BIF, which somehow pleases me even though > I don't ever expect it to happen. > > James -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From erlang@REDACTED Fri Jan 14 12:06:25 2005 From: erlang@REDACTED (Peter L) Date: Fri, 14 Jan 2005 12:06:25 +0100 (CET) Subject: mnesia:transform_table - index handling bug? Message-ID: <1351.82.182.146.59.1105700785.squirrel@www69.webcows.se> Been trying to "soft upgrade" my mnesia tables with mnesia:transform_table/3. I had an extra index 'myindexattribute' at position 6 and then I added a new normal non-indexed attribute in position 3, meaning that 'myindexattribute' at position 6 moved to position 7 in the new mnesia table. But the transform_table/3 did NOT move the extra index to the new position of 'myindexattribute' (6->7). In order to get it to upgraded properly (including correct movement of the extra index), I was forced to do 3 statements instead of one: mnesia:del_table_index(mytable,myindexattribute), mnesia:transform_table(mytable,UpgradeTableFun,NewAttrList), mnesia:add_table_index(mytable,myindexattribute), I would say that that is a bug! Wouldn't you? At least this behaviour is not documented. Or is there a better (more beautiful) way to get the same thing done? -- Peter Lund Web: http://lundata.se Tel: +46 70 543 9416 From dietmar@REDACTED Fri Jan 14 12:10:46 2005 From: dietmar@REDACTED (Dietmar Admin Schaefer) Date: Fri, 14 Jan 2005 12:10:46 +0100 Subject: SNMP & Mnesia Message-ID: <41E7A8B6.6010701@ast.dfs.de> Hi ! I would like to use a doubled indexed SNMP table like so: mnesia:create_table(processesList, [{snmp, [{key, {string, integer}}]}, {attributes, record_info(fields,processesList )}, {disc_copies, ?HR}]) of where the record definition looks like: -record(processesList, {hostname,index,ident,status,stateChangeCounter,rowStatus}). When I try to write a record to mnesia I get: R = {processesList,"wks2",11,"IH",4,0,4} <-- the record to write success writing processesList to mnesia <-- write seems o.k. transaction error{aborted,{bad_snmp_key, <-- transaction doesn't work ! [{processesList,"wks2"},"wks2",{string,integer}]}} Any hint ? regards Dietmar From luke@REDACTED Fri Jan 14 11:29:07 2005 From: luke@REDACTED (Luke Gorrie) Date: 14 Jan 2005 11:29:07 +0100 Subject: A Pythonista's Impressions of Erlang References: <20050112142953.68607.qmail@web41904.mail.yahoo.com> <41E637ED.5040204@ericsson.com> <16870.19809.356294.601249@antilipe.corelatus.se> <200501131445.20017.ft@it.su.se> <20050113151939.04872444.cpressey@catseye.mine.nu> <41E76F5D.7070503@itsbeen.sent.com> Message-ID: Rob writes: > given the limited number of available erlang programs from different > coders. You have seen the Jungerl (jungerl.sourceforge.net) right? From erlang@REDACTED Fri Jan 14 14:42:36 2005 From: erlang@REDACTED (Peter L) Date: Fri, 14 Jan 2005 14:42:36 +0100 (CET) Subject: mnesia:transform_table - index handling bug? Message-ID: <1495.82.182.146.59.1105710156.squirrel@www69.webcows.se> Actually if you load the new code before you run the 3 statements the first would not work. I guess the first line has be rewritten to explicitly delete index number 6 to get it right: mnesia:del_table_index(mytable,6), mnesia:transform_table(mytable,UpgradeTableFun,NewAttrList), mnesia:add_table_index(mytable,myindexattribute), (Remember now that I did this index position switch *manually* after the table upgrade and then I could only use numbers running R9C) /Peter > I wrote: > > Been trying to "soft upgrade" my mnesia tables with mnesia:transform_table/3. > > I had an extra index 'myindexattribute' at position 6 and then I added a new > normal non-indexed attribute in position 3, meaning that 'myindexattribute' > at position 6 moved to position 7 in the new mnesia table. > > But the transform_table/3 did NOT move the extra index to the new position of > 'myindexattribute' (6->7). In order to get it to upgraded properly (including > correct movement of the extra index), I was forced to do 3 statements instead of one: > > mnesia:del_table_index(mytable,myindexattribute), > mnesia:transform_table(mytable,UpgradeTableFun,NewAttrList), > mnesia:add_table_index(mytable,myindexattribute), > > I would say that that is a bug! Wouldn't you? At least this behaviour is not > documented. Or is there a better (more beautiful) way to get the same thing > done? > > -- > Peter Lund > Web: http://lundata.se > Tel: +46 70 543 9416 From erlq@REDACTED Fri Jan 14 15:58:40 2005 From: erlq@REDACTED (Rob) Date: Fri, 14 Jan 2005 06:58:40 -0800 Subject: A Pythonista's Impressions of Erlang In-Reply-To: References: <20050112142953.68607.qmail@web41904.mail.yahoo.com> <41E637ED.5040204@ericsson.com> <16870.19809.356294.601249@antilipe.corelatus.se> <200501131445.20017.ft@it.su.se> <20050113151939.04872444.cpressey@catseye.mine.nu> <41E76F5D.7070503@itsbeen.sent.com> Message-ID: <41E7DE20.3050107@itsbeen.sent.com> Luke Gorrie wrote: > Rob writes: > >>given the limited number of available erlang programs from different >>coders. > > You have seen the Jungerl (jungerl.sourceforge.net) right? Definitely, I appreciate the work put into jungerl, but I meant "limited number" compared to other languages - CPAN, etc With OpenFlax, we have 4 (?) http server examples, not that we need many more but certainly it fits in the middle between pico and yaws. I also meant that no links to any erlang code should be dropped because they are all important unless they display some abhorrent qualities, even those are sometimes useful in their own way. http://ansuz.sooke.bc.ca/software/molester/ And, I think every language needs at minimum, one brainf*ck interpreter The most beautiful one I've seen (gui-wise): http://decode.ateneo.edu/martin/brainfuck/ From jurgen@REDACTED Fri Jan 14 17:34:40 2005 From: jurgen@REDACTED (Jurgen Botz) Date: Fri, 14 Jan 2005 08:34:40 -0800 Subject: ear, ecc, elink and escript? Message-ID: <41E7F4A0.5080605@botz.org> I was just building otp for the first time (R10B on Fedora Core 2 and 3), and 'make install' creates symlinks in /usr/local/bin for ear, ecc, elink and escript, but those don't actually exist. The output of the build shows no errors that I can see and there seem to be source files for these in 'erts/boot/src/' but they don't seem to get built by 'make'. Am I doing something wrong? :j From vances@REDACTED Fri Jan 14 17:48:12 2005 From: vances@REDACTED (Vance Shipley) Date: Fri, 14 Jan 2005 11:48:12 -0500 Subject: Getting Started: tut.erl : exiting with an error?!? In-Reply-To: References: <41E716CD.5090408@earthlink.net> Message-ID: <20050114164812.GF6085@frogman.motivity.ca> On Fri, Jan 14, 2005 at 08:42:10AM +0000, Michael Williams wrote: } } Another way to shutdown the Erlang system is by entering halt(): } } 3> halt(). And yet another way is: 1> q(). This is an alias from the c module: q() -> void() This function is shorthand for init:stop(), i.e., it causes the node to stop in a controlled fashion. -Vance From blaguehubert@REDACTED Fri Jan 14 16:59:30 2005 From: blaguehubert@REDACTED (blaguehubert) Date: Fri, 14 Jan 2005 16:59:30 +0100 Subject: Bad call = gen_server shutdown? Message-ID: <41E7EC62.70304@free.fr> I wrote a gen_server module "repartiteur" with 2 functions : propose_link/1 and get_proposed_links/0. It seems that if I call get_proposed_links with an argument (by mistake), it shutdowns the server... Is this normal? 1> make:all([load]). Recompile: chercheur.erl Recompile: superviseur.erl Recompile: repartiteur.erl Recompile: search_engine.erl up_to_date 2> repartiteur:start_link(). {ok,<0.52.0>} 3> repartiteur:propose_link("truc"). ok 4> repartiteur:get_proposed_links(). ["truc"] 5> repartiteur:get_proposed_links(). ["truc"] 6> repartiteur:get_proposed_links(1). ** exited: {undef,[{repartiteur,get_proposed_links,[1]}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** 7> repartiteur:get_proposed_links(). ** exited: {noproc,{gen_server,call, [{global,repartiteur},{get_proposed_links}]}} ** 8> repartiteur:start_link(). {ok,<0.61.0>} 9> repartiteur:get_proposed_links(). [] 10> From alexey@REDACTED Fri Jan 14 17:56:40 2005 From: alexey@REDACTED (Alexey Shchepin) Date: Fri, 14 Jan 2005 18:56:40 +0200 Subject: Xmerl performance In-Reply-To: <3CF3C352-65B8-11D9-B2B8-000A95927CCE@mac.com> (Sean Hinde's message of "Thu, 13 Jan 2005 23:09:55 +0000") References: <002501c4f89c$5d17bd40$2100a8c0@INSWITCH241> <010701c4f8d8$5e58aa70$2100a8c0@INSWITCH241> <41E69C9C.6030101@possibility.com> <018a01c4f98d$3167aec0$2100a8c0@INSWITCH241> <3CF3C352-65B8-11D9-B2B8-000A95927CCE@mac.com> Message-ID: <87ekgoeypj.fsf@alex.sevcom.net> Hello, Sean! On Thu, 13 Jan 2005 23:09:55 +0000, you said: SH> Hi, We used the expat binding which was written as part of the ejabberd SH> project. Thanks to Alexey Shchepin for writing it and making it available SH> (under the GPL). SH> We adapted the SAX type model of the ejabberd expat driver to create a DOM SH> with something like the following code. I can't quite recall which bits of SH> this were used but it might provide a guide. This code uses pretty old verion of expat driver (AFAIR earlier than Oct 2003), small update is required for version from ejabberd-0.7.5 (replace xmlstart, xmlend, xmlcdata, and xmlerror with ?XML_*). But i'd recommend to use version from ejabberd cvs version, it includes interface for parsing entire element and works faster. From mickael.remond@REDACTED Fri Jan 14 18:14:57 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Fri, 14 Jan 2005 18:14:57 +0100 Subject: Bad call = gen_server shutdown? In-Reply-To: <41E7EC62.70304@free.fr> References: <41E7EC62.70304@free.fr> Message-ID: <41E7FE11.5040001@erlang-fr.org> blaguehubert wrote: > I wrote a gen_server module "repartiteur" with 2 functions : > propose_link/1 and get_proposed_links/0. > > It seems that if I call get_proposed_links with an argument (by > mistake), it shutdowns the server... > > Is this normal? Yes. This is normal as you are starting your server with start_link. A link is created between the main shell process. The link is bidirectional. By doing a mistake in your command you are crashing the shell (which is restarted with a new process number, check with the information listing i().). You have two solutions: - Start your server without linking to your shell process. - Start your server from a shell process and type different commands, from another shell process. To start a new shell process hit control-G, and type s to start a new local shell process. (? for help). List the current jobs with j. Connect to the job (shell process) you want to work in with c + the number of the process. This process is described in the French Erlang book (as you seem to be from France). I hope this help, -- Micka?l R?mond http://www.erlang-projects.org/ From james.hague@REDACTED Fri Jan 14 20:12:41 2005 From: james.hague@REDACTED (James Hague) Date: Fri, 14 Jan 2005 13:12:41 -0600 Subject: Memory consumption and memory management: How does it work ? Message-ID: >- On another side, calling garbage_collect reduce notably the memory >footprint. The application memory occupation is still growing constantly >but, garbage_collect free nearly a quarter of the memory (100 Mo). Are you using large binaries? One hole in the Erlang runtime system is that binaries greater than a certain small size (64 bytes I think) are allocated outside the current process heap. This is so they can be passed to other processes without copying. But the size of these binaries are not used to determine when garbage collection is needed. If you create large binaries quickly you can fill memory with binaries before the process heap gets garbage collected. Someone please jump in if I'm wrong! James From hedeland@REDACTED Fri Jan 14 20:43:39 2005 From: hedeland@REDACTED (Per Hedeland) Date: Fri, 14 Jan 2005 20:43:39 +0100 (CET) Subject: Getting Started: tut.erl : exiting with an error?!? In-Reply-To: <20050114164812.GF6085@frogman.motivity.ca> Message-ID: <200501141943.j0EJhdpU031512@tordmule.bluetail.com> Vance Shipley wrote: > >And yet another way is: > > 1> q(). > > >This is an alias from the c module: > > q() -> void() > > This function is shorthand for init:stop(), i.e., it causes the > node to stop in a controlled fashion. And yet another: Eshell V5.3.6.3 (abort with ^G) 1> ^G User switch command --> q And my personal favorite: 1> ^\ --Per Hedeland From garry@REDACTED Fri Jan 14 21:53:43 2005 From: garry@REDACTED (Garry Hodgson) Date: Fri, 14 Jan 2005 15:53:43 -0500 Subject: wrapping pico in otp Message-ID: <2005011415531105736022@k2.sage.att.com> i've been trying to otp-ify an application, and have hit a snag. most of my servers i rewrote as gen_servers. i have an xmlrpc server (which predates the contrib package) base on pico as part of the app. so i used supervisor_bridge to wrap that and merge it into the overall supervision tree. the problem is that when i run the thing from a boot file, it fires everything up, then quits, as the xml_sup which wraps the xmlserver gets an exit from its child, and it bubbles up the tree. if i run interactive erlang, and do a master_sup:start_link(), i get an "** exited: shutdown **" message, but the pico piece is still up, and i can connect to it from an external xmlrpc client. this leads me to suspect that the pid that i'm telling supervisor_bridge to monitor is not the correct one, but some temporary process that goes away after spawning the one i *should* be monitoring. i'm a little too fuzzy on the internals of all this to know whether that's a reasonable hypothesis, or how to investigate or correct if it is. does anyone have any experience with this that could give me some clue? i can send details as needed, but didn't want to encumber this message with them. thanks ---- Garry Hodgson, Technical Consultant, AT&T Labs Be happy for this moment. This moment is your life. From sean.hinde@REDACTED Sat Jan 15 00:06:33 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 14 Jan 2005 23:06:33 +0000 Subject: Xmerl performance In-Reply-To: <87ekgoeypj.fsf@alex.sevcom.net> References: <002501c4f89c$5d17bd40$2100a8c0@INSWITCH241> <010701c4f8d8$5e58aa70$2100a8c0@INSWITCH241> <41E69C9C.6030101@possibility.com> <018a01c4f98d$3167aec0$2100a8c0@INSWITCH241> <3CF3C352-65B8-11D9-B2B8-000A95927CCE@mac.com> <87ekgoeypj.fsf@alex.sevcom.net> Message-ID: On 14 Jan 2005, at 16:56, Alexey Shchepin wrote: > Hello, Sean! > > On Thu, 13 Jan 2005 23:09:55 +0000, you said: > > SH> Hi, We used the expat binding which was written as part of the > ejabberd > SH> project. Thanks to Alexey Shchepin for writing it and making it > available > SH> (under the GPL). > > SH> We adapted the SAX type model of the ejabberd expat driver to > create a DOM > SH> with something like the following code. I can't quite recall > which bits of > SH> this were used but it might provide a guide. > > This code uses pretty old verion of expat driver (AFAIR earlier than > Oct 2003), > small update is required for version from ejabberd-0.7.5 (replace > xmlstart, > xmlend, xmlcdata, and xmlerror with ?XML_*). But i'd recommend to use > version > from ejabberd cvs version, it includes interface for parsing entire > element and > works faster. > Great, thanks for the update - I'll check it out. Sean From anders.nygren@REDACTED Sat Jan 15 00:18:09 2005 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 14 Jan 2005 17:18:09 -0600 Subject: SMS and oserl status Message-ID: Hi I am preparing for a project where I have to send large volumes of SMS. I will probably be able to do this in Erlang so would like to know 1, the current status of oserl 2, is anybody using it for "real" 3, are there any other tools available for erlang to send SMS /Anders Nygren From taavi@REDACTED Sat Jan 15 00:59:43 2005 From: taavi@REDACTED (Taavi Talvik) Date: Sat, 15 Jan 2005 01:59:43 +0200 (EET) Subject: SMS and oserl status In-Reply-To: References: Message-ID: <20050115014441.L13982@m4.uninet.ee> On Fri, 14 Jan 2005, Anders Nygren wrote: Erlang is definitely capable for handling large volume of SMS. Most important thing is to carefully plan your application architecture. Failing SMSC-s, message queueing etc. If you get architecture right - then as result you get typical erlang style "non stop" application.. I have not used oserl but it definitely seems to be in good condition. best regards, taavi PS. Drop a mail after two weeks (skiing vacation) if you want emi/ucp, cimd2 and smpp modules without any documentation. Working and used in inhouse wifi authorization/billing system for 2 years. > I am preparing for a project where I have to send large volumes of SMS. > I will probably be able to do this in Erlang so would like to know > 1, the current status of oserl > 2, is anybody using it for "real" > 3, are there any other tools available for erlang to send SMS > > /Anders Nygren From cyberlync@REDACTED Sat Jan 15 05:09:46 2005 From: cyberlync@REDACTED (Eric Merritt) Date: Fri, 14 Jan 2005 20:09:46 -0800 Subject: Supervisor hierarchy question Message-ID: Guys, I am finishing up an implementation of a client for postgresql. Overall was pretty simple, the protocol is well documented and Erlang is geared for this stuff. However, I do have a couple of questions about my supervisor hierarchy. Here is how things are set up. A Supervisor that watchs the top level system process. The system process implements gen_server and accepts requests for new connection_pools and requests for the Pid of an existing connection pool. When the system process launches a new pool it uses the start_child function for its parent supervisor. So the hierarchy looks like Supervisor / | \ System CP1 CP2 The thing I don't like about this is that when the system process gets a request for a pid it calls which_system on its supervisor and scrolls through the list to find the connection_pool by name. This kind of parent pointer 'smells' bad. Now when the connection_pool gets a request for a connection it needs return the PID of an active connection. If non are available it needs to return an error or start a new one depending on its setup. This is my question. When the connection_pools starts up its initial set of connections where should it put them, under another supervisor? If so what should supervise the supervisor? Should it look like this? Supervisor / | \ \ \ System CP1 CP2 CP1-Conn-Sup CP2-Conn-Sup Or should it just create a supervisor without an explicit parent supervisor. I hope this is intelligible to you all. Any suggestions are appreciated. -- I'm a programmer, I don't have to spell correctly; I just have to spell consistently From mickael.remond@REDACTED Sat Jan 15 16:12:04 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Sat, 15 Jan 2005 16:12:04 +0100 Subject: Memory consumption and memory management: How does it work ? In-Reply-To: References: Message-ID: <41E932C4.5060907@erlang-fr.org> James Hague wrote: >>- On another side, calling garbage_collect reduce notably the memory >>footprint. The application memory occupation is still growing constantly >>but, garbage_collect free nearly a quarter of the memory (100 Mo). > > > Are you using large binaries? One hole in the Erlang runtime system > is that binaries greater than a certain small size (64 bytes I think) > are allocated outside the current process heap. This is so they can > be passed to other processes without copying. But the size of these > binaries are not used to determine when garbage collection is needed. > If you create large binaries quickly you can fill memory with binaries > before the process heap gets garbage collected. I think binary allocation is most of the time dealing with bigger than 64 bytes binaries. Your message let me wondering what are then the best practice regarding this behaviour of the garbage collector ? Did you have to write something special in your code to ensure proper garbage collection ? -- Micka?l R?mond http://www.erlang-projects.org/ From erlang@REDACTED Sat Jan 15 18:19:27 2005 From: erlang@REDACTED (Peter-Henry Mander) Date: Sat, 15 Jan 2005 17:19:27 +0000 Subject: HiPE compilation gives NINE times speed increase! Message-ID: <20050115171927.4cfacd42.erlang@manderp.freeserve.co.uk> Hi Gurus, I've made an interesting discovery, I think, and I would like to solicit your opinions why this code happens to run over NINE TIMES faster when compiled natively compared to virtual machine BEAM code. The results below are from a system with a VIA M10000 EPIA motherboard. Not a speedy machine by modern standards (which is an incentive to write code that runs fast :-). Can you all please try this code on other platforms to see if the result is consistent on every one? My guess is the combined use of the recently updated try-catch statement and binaries allows for some of the HiPE team's work to really shine in this example. I found this out by chance, and I would be very interested if members of the HiPE team can offer programming guidelines to maximise optimisation in other situations. Dr. Joe (hi Joe) has stated recently "[...] write your code as beautifully as possible - and measure - if it's not fast enough then measure and then optimise." Although I would not claim that the attached code is anywhere near beautiful, I don't think it's too ugly either. The last 30 lines or so of prefix.erl are the core of the tokeniser (extracted from a SIP stack I'm *still* working on. Hi Fredrik :-). All the rest is just a test cradle with chronometric knobs on. Pete. 4> test:test(). TimeScan 13027457 TimeParse 240057 Size 4063232 TimeScan 12616897 TimeParse 238838 Size 4063232 TimeScan 12615948 TimeParse 239121 Size 4063232 TimeScan 12606858 TimeParse 239751 Size 4063232 TimeScan 12614551 TimeParse 239600 Size 4063232 List=[{token,13027457,240057,4063232}, {token,12616897,238838,4063232}, {token,12615948,239121,4063232}, {token,12606858,239751,4063232}, {token,12614551,239600,4063232}] token: 12696342 ( 1% Std DV8) ScanTime 239473 ( 0% Std DV8) ParseTime 12935815 TotalTime TimeScan 1332222 TimeParse 229074 Size 4063232 TimeScan 1329588 TimeParse 223404 Size 4063232 TimeScan 1330333 TimeParse 222985 Size 4063232 TimeScan 1329658 TimeParse 223437 Size 4063232 TimeScan 1327399 TimeParse 222689 Size 4063232 List=[{token,1332222,229074,4063232}, {token,1329588,223404,4063232}, {token,1330333,222985,4063232}, {token,1329658,223437,4063232}, {token,1327399,222689,4063232}] token: 1329840 ( 0% Std DV8) ScanTime 224317 ( 1% Std DV8) ParseTime 1554157 TotalTime token: 9.54727 ScanTimeMult 1.06757 ParseTimeMult [{token,9.54727,1.06757}] -- "The Tao of Programming flows far away and returns on the wind of morning." -------------- next part -------------- A non-text attachment was scrubbed... Name: prefix.erl Type: application/octet-stream Size: 2734 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test.erl Type: application/octet-stream Size: 3123 bytes Desc: not available URL: From luke@REDACTED Sat Jan 15 17:56:49 2005 From: luke@REDACTED (Luke Gorrie) Date: 15 Jan 2005 17:56:49 +0100 Subject: Using Erlang for Comsuming Web Services using SOAP References: <41E559E2.7060202@sms.ed.ac.uk> Message-ID: Neil Campbell writes: > Does anyone have experience either using this library for accessing > (i.e. not hosting) web services or know of any other helpful libraries > or features that I have missed? I found it okay to do SOAP the poor man's way, i.e. building it up with code like: encode(SoapMsg) -> #soap_msg{headers=Hs, body=Body, related_parts=Related} = SoapMsg, XML = {'env:Envelope', [{'xmlns:env', "http://schemas.xmlsoap.org/soap/envelope/"}], if Hs == [] -> []; true -> [{'env:Header', [], Hs}] end ++ [{'env:Body', [], Body}]}, Z = xmerl_lib:expand(XML), Text = xmerl:export_simple(XML, xmerl_xml), .... I decode it from similar tuples, e.g. dec_msg({'Envelope', _, Es}) -> case xml_util:arrange(Es, ['Header', 'Body']) of [{'Header', _, Headers}, {'Body', _, Body}] -> case xml_util:arrange(Body, ['Fault']) of [] -> {ok, #soap_msg{headers=Headers, body=Body}}; [{'Fault', _, FBody}] -> case dec_fault(FBody) of {ok, Fault} -> {ok, #soap_msg{headers=Headers, body=Fault}}; Err = {error, _} -> Err end end; _ -> {error, {bad_envelope_body, Es}} end; dec_msg(X) -> {error, {bad_envelope, X}}. (That xml_util:arrange function turned out fairly handy for pattern-matching on parsed XML that could have elements in a funny order or include unexpected/not-understood elements: %% arrange(Elements, Tags) -> Elements' %% Elements = [xml()] %% Tags = [atom()] %% %% This is a utility to filter and arrange a series of XML elements to %% make them easier to pattern match. The returned list: %% Only includes elements whose tag is in Tags; %% Includes at most one of each Tag; %% Returns elements in the same order they appear in Tags %% %% Example: %% arrange([{bar,_,_},{foo,_,_},{beer,_,_},{baz,_,_}], [foo,bar,baz]) %% => [{foo,_,_}, {bar,_,_}, {baz,_,_}] arrange(Elems, Spec) -> foldr(fun(Tag, Acc) -> case lists:keysearch(Tag, 1, Elems) of {value, X} -> [X|Acc]; false -> Acc end end, [], Spec). Initially I had meant to do it the Right Way by interpreting Schemas and maybe WSDL but it was all a bit much for me. For now I attach "the gist", missing the HTTP client part and at least one xmerl patch. If you want to actually use this then let me know and I can try to resolve its dependencies and jungerl it when I get a chance. -------------- next part -------------- A non-text attachment was scrubbed... Name: soap.hrl Type: text/x-erlang-source Size: 371 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: soap.erl Type: text/x-erlang-source Size: 4999 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: xml_util.erl Type: text/x-erlang-source Size: 2194 bytes Desc: not available URL: From jocke@REDACTED Sat Jan 15 22:56:08 2005 From: jocke@REDACTED (Joakim G.) Date: Sat, 15 Jan 2005 22:56:08 +0100 Subject: xhtml-1.0 transitional and xmerl? Message-ID: <41E99178.2080203@bluetail.com> Hi, I tried to validate couple of xhtml-1.0 pages with xmerl. I downloaded the xhtml-1.0 transitional DTDs from: http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_XHTML-1.0-Transitional and tried to use them with xmerl: ==== Erlang (BEAM) emulator version 5.4.3 [source] [hipe] Eshell V5.4.3 (abort with ^G) 1> xmerl_scan:file("test.html", [{validation, true}, {fetch_fun, fun(U, G) -> {ok, {file, "xhtml1-transitional.dtd"}, G} end}]). 2748- fatal: {invalid_name," HTMLl"} ** exited: {fatal,{{invalid_name," HTMLl"},"xhtml1-transitional.dtd",29,700}} ** ==== Hmm. Sifting through the xmerl release notes I realised that external entities isn't supported. Just for the heck of it I replaced the external entity references in the DTD with the actual content and tried again: ==== Erlang (BEAM) emulator version 5.4.3 [source] [hipe] Eshell V5.4.3 (abort with ^G) 1> xmerl_scan:file("test.html", [{validation, true}, {fetch_fun, fun(U, G) -> {ok, {file, "xhtml1-transitional.dtd"}, G} end}]). 3319- fatal: unexpected_end ** exited: {fatal,{unexpected_end,"xhtml1-transitional.dtd",635,111}} ** 2> ==== It was doomed to fail I suppose. My question: Has anyone else used xmerl in combination with the xhtml-1.0 DTDs? Cheers /Jocke From blaguehubert@REDACTED Mon Jan 17 00:38:44 2005 From: blaguehubert@REDACTED (blaguehubert) Date: Mon, 17 Jan 2005 00:38:44 +0100 Subject: erl_interface compilation problem Message-ID: <41EAFB04.5000705@free.fr> I try to write a little C program using erl_interface and I've some compilation problems: gcc -I/usr/lib/erlang/lib/erl_interface-3.5/include/ -L/usr/lib/erlang/lib/erl_interface-3.5/lib/ -lerl_interface -lei wait_search_engine.c -o wait_search_engine > out.log /tmp/cc0vVjZx.o(.text+0x60): In function `main': : undefined reference to `erl_init' /tmp/cc0vVjZx.o(.text+0x7a): In function `main': : undefined reference to `erl_connect_init' /tmp/cc0vVjZx.o(.text+0x85): In function `main': : undefined reference to `erl_connect' /tmp/cc0vVjZx.o(.text+0x9a): In function `main': : undefined reference to `erl_err_quit' /tmp/cc0vVjZx.o(.text+0xad): In function `main': : undefined reference to `erl_format' /tmp/cc0vVjZx.o(.text+0xd2): In function `main': : undefined reference to `erl_rpc' /tmp/cc0vVjZx.o(.text+0xe7): In function `main': : undefined reference to `erl_err_msg' /tmp/cc0vVjZx.o(.text+0xf2): In function `main': : undefined reference to `erl_free_term' /tmp/cc0vVjZx.o(.text+0xfd): In function `main': : undefined reference to `erl_iolist_to_string' /tmp/cc0vVjZx.o(.text+0x10b): In function `main': : undefined reference to `erl_free_term' /tmp/cc0vVjZx.o(.text+0x127): In function `main': : undefined reference to `erl_free' collect2: ld a retourn? 1 code d'?tat d'ex?cution -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: wait_search_engine.c URL: From jahakala@REDACTED Mon Jan 17 00:32:54 2005 From: jahakala@REDACTED (Jani Hakala) Date: Mon, 17 Jan 2005 01:32:54 +0200 Subject: erl_interface compilation problem In-Reply-To: <41EAFB04.5000705@free.fr> (blaguehubert@free.fr's message of "Mon, 17 Jan 2005 00:38:44 +0100") References: <41EAFB04.5000705@free.fr> Message-ID: <87k6qd7xw9.fsf@pingviini.kortex.jyu.fi> blaguehubert writes: > I try to write a little C program using erl_interface and I've some > compilation problems: > > gcc -I/usr/lib/erlang/lib/erl_interface-3.5/include/ > -L/usr/lib/erlang/lib/erl_interface-3.5/lib/ -lerl_interface -lei > wait_search_engine.c -o wait_search_engine > out.log > Try putting '-lerl_interface -lei' after the other arguments: gcc -I/usr/lib/erlang/lib/erl_interface-3.5/include/ -L/usr/lib/erlang/lib/erl_interface-3.5/lib/ wait_search_engine.c -o wait_search_engine -lerl_interface -lei > out.log I needed -lpthread also... Jani Hakala From charleshixsn@REDACTED Mon Jan 17 02:15:21 2005 From: charleshixsn@REDACTED (Charles Hixson) Date: Sun, 16 Jan 2005 17:15:21 -0800 Subject: Getting Started: tut.erl : exiting with an error?!? In-Reply-To: <5449af0405011401212e2dc36f@mail.gmail.com> References: <41E716CD.5090408@earthlink.net> <5449af0405011401212e2dc36f@mail.gmail.com> Message-ID: <41EB11A9.7070500@earthlink.net> Daniel Ginsburg wrote: >On Thu, 13 Jan 2005 16:48:13 -0800, Charles Hixson > wrote: > > >>P.. >> >Let me guess. You are using Debian testing (or unstable) and you have >erlang-doc-html installed, right? > >The problem is that in current Debian testing distribution >erlang-doc-html is R10B-1 but erlang itself is R9C-2. This causes >version conflict. Uninstall erlang-doc-html and you'll be fine. For >more information see Debian bug IDs #279122 and #279122. > You were right about my configuration, but the solution that I adopted was to compile Erlang from source. Which worked. Thanks to all who helped on this. From heinrich@REDACTED Mon Jan 17 08:34:37 2005 From: heinrich@REDACTED (Heinrich Venter) Date: Mon, 17 Jan 2005 09:34:37 +0200 Subject: SMS and oserl status Message-ID: Hi We are using oserl in a live comercial service. We are sending both simple text and data messages in high volume. I am not aware of any other SMS tools for Erlang. -]-[einrich for more info go to www.cellfind.co.za http://asp1.rocketseed.com/RocketSeed/mail/433a32353a3935353630363a33303639373a2d323a323138 http://asp1.rocketseed.com/RocketSeed/mail/433a32353a3935353630363a33303639373a2d323a313836 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: MTk2LjMwLjc5LjE1NQ== Type: image/gif Size: 14964 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: MTk2LjMwLjc5LjE1NQ== Type: image/gif Size: 556 bytes Desc: not available URL: From mpquique@REDACTED Mon Jan 17 09:31:04 2005 From: mpquique@REDACTED (Enrique Marcote =?iso-8859-1?q?Pe=F1a?=) Date: Mon, 17 Jan 2005 09:31:04 +0100 Subject: SMS and oserl status In-Reply-To: References: Message-ID: <200501170931.04630.mpquique@udc.es> On Saturday 15 January 2005 00:18, Anders Nygren wrote: > Hi > I am preparing for a project where I have to send large volumes of SMS. > I will probably be able to do this in Erlang so would like to know > 1, the current status of oserl > 2, is anybody using it for "real" > 3, are there any other tools available for erlang to send SMS > > /Anders Nygren Hello Anders, We use oserl in a real environment, but I guess we don't count, since I wrote oserl myself. I've been told some people at India were using it also. Oserl wasn't written with efficiency in mind, but with the principle of having a *complete* SMPP implementation easy to maintain and adapt. Oserl implements the entire SMPP specification version 5.0, and is the most complete open source SMPP implementation we are aware of. In our experience oserl is perfectly usable right know. Congestion control mechanisms may need to be reviewed. We also want to change the implementation of timers, to use stdlib's 1.12 built-in gen_fsm timers instead of our own. Anyway, the API seems to to be stable enough. We didn't spend much time doing load testing, but we did check how many messages oserl could send in one second. For that test we implemented a SMSC and a ESME using oserl behaviors. Using a PIV 2.8 with 1GB of memory on each side (SMSC and ESME side), we found out oserl could send more than 2500 messages in one second (twenty five hundred). The test we accomplished was very very simple. Just send a PDU and wait for the PDU response from the other side, counting the number of PDUs responded in one second (We didn't cheat, the PDU was packed and unpacked every time in both sides). I know this test is not exhaustive at all, as soon as we decide to do some serious benchmarking I let you know, but let me say that doing the exact same test with other open source SMPP implementation, we could barely reach 100 messages per second (one hundred). Please also look at SMS forum to see rates people usually report on massive SMS sending, generally less than 100 messages per second (one hundred). Read all the information regarding oserl at the sourceforge (http://oserl.sourceforge.net). If you have any problems, please let me know. Best regards, -- Quique From matthias@REDACTED Mon Jan 17 10:26:37 2005 From: matthias@REDACTED (Matthias Lang) Date: Mon, 17 Jan 2005 10:26:37 +0100 Subject: HiPE compilation gives NINE times speed increase! In-Reply-To: <20050115171927.4cfacd42.erlang@manderp.freeserve.co.uk> References: <20050115171927.4cfacd42.erlang@manderp.freeserve.co.uk> Message-ID: <16875.33997.584730.650499@antilipe.corelatus.se> Peter-Henry Mander writes: > Can you all please try this code on other platforms to > see if the result is consistent on every one? I have a feeling at least part of your result is due to the test's enormous appetite for memory. I haven't investigated _why_ it wants more than 200MB, but I can see that on a 128M machine the test spends a lot of its time in the first half swapping. Anyway, some results: Machine: antilipe (AMD Sempron 2600+, 512MB of RAM) Erlang: R10B-1a 3> test:test(). TimeScan 3460391 TimeParse 96369 Size 4063232 TimeScan 3473355 TimeParse 96250 Size 4063232 TimeScan 3493909 TimeParse 96484 Size 4063232 TimeScan 3488711 TimeParse 95609 Size 4063232 TimeScan 3439052 TimeParse 95309 Size 4063232 List=[{token,3460391,96369,4063232}, {token,3473355,96250,4063232}, {token,3493909,96484,4063232}, {token,3488711,95609,4063232}, {token,3439052,95309,4063232}] token: 3471083 ( 0% Std DV8) ScanTime 96004 ( 0% Std DV8) ParseTime 3567087 TotalTime TimeScan 834282 TimeParse 92701 Size 4063232 TimeScan 528545 TimeParse 90075 Size 4063232 TimeScan 520973 TimeParse 90476 Size 4063232 TimeScan 520780 TimeParse 90155 Size 4063232 TimeScan 521579 TimeParse 90248 Size 4063232 List=[{token,834282,92701,4063232}, {token,528545,90075,4063232}, {token,520973,90476,4063232}, {token,520780,90155,4063232}, {token,521579,90248,4063232}] token: 585231 ( 23% Std DV8) ScanTime 90731 ( 1% Std DV8) ParseTime 675962 TotalTime token: 5.93113 ScanTimeMult 1.05812 ParseTimeMult [{token,5.93113,1.05812}] ---------------------------------------------------------------------- Machine: antilipe (AMD Sempron 2600+, 512MB of RAM) Erlang: R10B-2 3> test:test(). TimeScan 3571545 TimeParse 103291 Size 4063232 TimeScan 3737924 TimeParse 96995 Size 4063232 TimeScan 3394747 TimeParse 97837 Size 4063232 TimeScan 3390644 TimeParse 96918 Size 4063232 TimeScan 3380244 TimeParse 96984 Size 4063232 List=[{token,3571545,103291,4063232}, {token,3737924,96995,4063232}, {token,3394747,97837,4063232}, {token,3390644,96918,4063232}, {token,3380244,96984,4063232}] token: 3495020 ( 4% Std DV8) ScanTime 98405 ( 2% Std DV8) ParseTime 3593425 TotalTime TimeScan 833296 TimeParse 147895 Size 4063232 TimeScan 556451 TimeParse 66809 Size 4063232 TimeScan 555243 TimeParse 66738 Size 4063232 TimeScan 556225 TimeParse 92473 Size 4063232 TimeScan 556572 TimeParse 92304 Size 4063232 List=[{token,833296,147895,4063232}, {token,556451,66809,4063232}, {token,555243,66738,4063232}, {token,556225,92473,4063232}, {token,556572,92304,4063232}] token: 611557 ( 20% Std DV8) ScanTime 93243 ( 35% Std DV8) ParseTime 704800 TotalTime token: 5.71495 ScanTimeMult 1.05536 ParseTimeMult [{token,5.71495,1.05536}] ---------------------------------------------------------------------- Machine: cors (Pentium II, 448MHz, 128MB of RAM) Erlang: R10B-0 Hipe crashed while compiling ---------------------------------------------------------------------- Machine: cors (Pentium II, 448MHz, 128MB of RAM) Erlang: R10B-2 3> test:test(). TimeScan 36997097 TimeParse 565284 Size 4063232 TimeScan 32325258 TimeParse 576348 Size 4063232 TimeScan 38403200 TimeParse 555851 Size 4063232 TimeScan 29010239 TimeParse 561904 Size 4063232 TimeScan 38282352 TimeParse 650434 Size 4063232 List=[{token,36997097,565284,4063232}, {token,32325258,576348,4063232}, {token,38403200,555851,4063232}, {token,29010239,561904,4063232}, {token,38282352,650434,4063232}] token: 35003629 ( 11% Std DV8) ScanTime 581964 ( 6% Std DV8) P arseTime 35585593 TotalTime TimeScan 3977486 TimeParse 1659904 Size 4063232 TimeScan 2123597 TimeParse 340800 Size 4063232 TimeScan 1815657 TimeParse 248477 Size 4063232 TimeScan 1818335 TimeParse 249664 Size 4063232 TimeScan 1812387 TimeParse 246169 Size 4063232 List=[{token,3977486,1659904,4063232}, {token,2123597,340800,4063232}, {token,1815657,248477,4063232}, {token,1818335,249664,4063232}, {token,1812387,246169,4063232}] token: 2309492 ( 40% Std DV8) ScanTime 549002 (113% Std DV8) P arseTime 2858494 TotalTime token: 15.1564 ScanTimeMult 1.06004 ParseTimeMult [{token,15.1564,1.06004}] Matt From erlang@REDACTED Mon Jan 17 11:22:04 2005 From: erlang@REDACTED (Peter-Henry Mander) Date: Mon, 17 Jan 2005 10:22:04 +0000 Subject: HiPE compilation gives NINE times speed increase! In-Reply-To: <16875.33997.584730.650499@antilipe.corelatus.se> References: <20050115171927.4cfacd42.erlang@manderp.freeserve.co.uk> <16875.33997.584730.650499@antilipe.corelatus.se> Message-ID: <20050117102204.4930ea4b.erlang@manderp.freeserve.co.uk> Thanks Matthias, Scott has kindly run the tests as well, and the emerging picture isn't so much how much more efficient the HiPE native compiled code is, but rather why is the non-native compilation producing memory-hungry inefficient VM code? Is it because the code I wrote is inefficient, and the HiPE compiler somehow fixes the problem? Pete. On Mon, 17 Jan 2005 10:26:37 +0100 Matthias Lang wrote: > Peter-Henry Mander writes: > > > Can you all please try this code on other platforms to > > see if the result is consistent on every one? > > I have a feeling at least part of your result is due to the test's > enormous appetite for memory. I haven't investigated _why_ it wants > more than 200MB, but I can see that on a 128M machine the test spends > a lot of its time in the first half swapping. > > Anyway, some results: > > Machine: antilipe (AMD Sempron 2600+, 512MB of RAM) > Erlang: R10B-1a > > 3> test:test(). > TimeScan 3460391 TimeParse 96369 Size 4063232 > TimeScan 3473355 TimeParse 96250 Size 4063232 > TimeScan 3493909 TimeParse 96484 Size 4063232 > TimeScan 3488711 TimeParse 95609 Size 4063232 > TimeScan 3439052 TimeParse 95309 Size 4063232 > List=[{token,3460391,96369,4063232}, > {token,3473355,96250,4063232}, > {token,3493909,96484,4063232}, > {token,3488711,95609,4063232}, > {token,3439052,95309,4063232}] > token: 3471083 ( 0% Std DV8) ScanTime 96004 ( 0% Std DV8) ParseTime 3567087 TotalTime > TimeScan 834282 TimeParse 92701 Size 4063232 > TimeScan 528545 TimeParse 90075 Size 4063232 > TimeScan 520973 TimeParse 90476 Size 4063232 > TimeScan 520780 TimeParse 90155 Size 4063232 > TimeScan 521579 TimeParse 90248 Size 4063232 > List=[{token,834282,92701,4063232}, > {token,528545,90075,4063232}, > {token,520973,90476,4063232}, > {token,520780,90155,4063232}, > {token,521579,90248,4063232}] > token: 585231 ( 23% Std DV8) ScanTime 90731 ( 1% Std DV8) ParseTime 675962 TotalTime > token: 5.93113 ScanTimeMult 1.05812 ParseTimeMult > [{token,5.93113,1.05812}] > > ---------------------------------------------------------------------- > Machine: antilipe (AMD Sempron 2600+, 512MB of RAM) > Erlang: R10B-2 > > 3> test:test(). > TimeScan 3571545 TimeParse 103291 Size 4063232 > TimeScan 3737924 TimeParse 96995 Size 4063232 > TimeScan 3394747 TimeParse 97837 Size 4063232 > TimeScan 3390644 TimeParse 96918 Size 4063232 > TimeScan 3380244 TimeParse 96984 Size 4063232 > List=[{token,3571545,103291,4063232}, > {token,3737924,96995,4063232}, > {token,3394747,97837,4063232}, > {token,3390644,96918,4063232}, > {token,3380244,96984,4063232}] > token: 3495020 ( 4% Std DV8) ScanTime 98405 ( 2% Std DV8) ParseTime 3593425 TotalTime > TimeScan 833296 TimeParse 147895 Size 4063232 > TimeScan 556451 TimeParse 66809 Size 4063232 > TimeScan 555243 TimeParse 66738 Size 4063232 > TimeScan 556225 TimeParse 92473 Size 4063232 > TimeScan 556572 TimeParse 92304 Size 4063232 > List=[{token,833296,147895,4063232}, > {token,556451,66809,4063232}, > {token,555243,66738,4063232}, > {token,556225,92473,4063232}, > {token,556572,92304,4063232}] > token: 611557 ( 20% Std DV8) ScanTime 93243 ( 35% Std DV8) ParseTime 704800 TotalTime > token: 5.71495 ScanTimeMult 1.05536 ParseTimeMult > [{token,5.71495,1.05536}] > > ---------------------------------------------------------------------- > Machine: cors (Pentium II, 448MHz, 128MB of RAM) > Erlang: R10B-0 > > Hipe crashed while compiling > > ---------------------------------------------------------------------- > Machine: cors (Pentium II, 448MHz, 128MB of RAM) > Erlang: R10B-2 > > 3> test:test(). > TimeScan 36997097 TimeParse 565284 Size 4063232 > TimeScan 32325258 TimeParse 576348 Size 4063232 > TimeScan 38403200 TimeParse 555851 Size 4063232 > TimeScan 29010239 TimeParse 561904 Size 4063232 > TimeScan 38282352 TimeParse 650434 Size 4063232 > List=[{token,36997097,565284,4063232}, > {token,32325258,576348,4063232}, > {token,38403200,555851,4063232}, > {token,29010239,561904,4063232}, > {token,38282352,650434,4063232}] > token: 35003629 ( 11% Std DV8) ScanTime 581964 ( 6% Std DV8) P > arseTime 35585593 TotalTime > TimeScan 3977486 TimeParse 1659904 Size 4063232 > TimeScan 2123597 TimeParse 340800 Size 4063232 > TimeScan 1815657 TimeParse 248477 Size 4063232 > TimeScan 1818335 TimeParse 249664 Size 4063232 > TimeScan 1812387 TimeParse 246169 Size 4063232 > List=[{token,3977486,1659904,4063232}, > {token,2123597,340800,4063232}, > {token,1815657,248477,4063232}, > {token,1818335,249664,4063232}, > {token,1812387,246169,4063232}] > token: 2309492 ( 40% Std DV8) ScanTime 549002 (113% Std DV8) P > arseTime 2858494 TotalTime > token: 15.1564 ScanTimeMult 1.06004 ParseTimeMult > [{token,15.1564,1.06004}] > > Matt -- "The Tao of Programming flows far away and returns on the wind of morning." From kostis@REDACTED Mon Jan 17 11:55:26 2005 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 17 Jan 2005 11:55:26 +0100 (MET) Subject: HiPE compilation gives NINE times speed increase! In-Reply-To: Mail from 'Peter-Henry Mander ' dated: Mon, 17 Jan 2005 10:22:04 +0000 Message-ID: <200501171055.j0HAtQ7K027735@spikklubban.it.uu.se> Peter-Henry Mander writes: > > Scott has kindly run the tests as well, and the emerging picture isn't > so much how much more efficient the HiPE native compiled code is, but > rather why is the non-native compilation producing memory-hungry > inefficient VM code? I've run the test in various platforms (SPARC, x86, AMD64), all with much more RAM than the test needs to run, and I fail to see a big difference in the memory consumption when running BEAM vs. native code. The speedup you get in this program is indeed more than average but is not so surprising. We've put quite some effort in efficiently compiling binaries to native code, the compiler optimizations that HiPE performs are quite effective in such code, and we've experienced similar speedups in some programs manipulating binaries. On the other hand try-catch has nothing to do with the speedup; it is entirely due to HiPE's compilation of binaries. > My guess is the combined use of the recently updated try-catch statement > and binaries allows for some of the HiPE team's work to really shine in > this example. I found this out by chance, and I would be very interested > if members of the HiPE team can offer programming guidelines to maximise > optimisation in other situations. I'm not sure what advise to give other than "In programs manipulating binaries, if you want speed use HiPE". Cheers, Kostis From matthias@REDACTED Mon Jan 17 12:15:48 2005 From: matthias@REDACTED (Matthias Lang) Date: Mon, 17 Jan 2005 12:15:48 +0100 Subject: HiPE compilation gives NINE times speed increase! In-Reply-To: <200501171055.j0HAtQ7K027735@spikklubban.it.uu.se> References: <200501171055.j0HAtQ7K027735@spikklubban.it.uu.se> Message-ID: <16875.40548.941765.449880@antilipe.corelatus.se> Kostis Sagonas writes: > The speedup you get in this program is indeed more than average but is > not so surprising. We've put quite some effort in efficiently compiling > binaries to native code, the compiler optimizations that HiPE performs > are quite effective in such code, and we've experienced similar speedups > in some programs manipulating binaries. On the other hand try-catch has > nothing to do with the speedup; it is entirely due to HiPE's compilation > of binaries. Replacing the (hideous, IMO) try/catch stuff with some normal code nets me a 3.5x speedup for BEAM and a 2x speedup for HIPE. Peak memory use is also much less, under 100MB. Assuming I didn't make a mistake, that is. Matthias From erlang@REDACTED Mon Jan 17 12:52:01 2005 From: erlang@REDACTED (Peter-Henry Mander) Date: Mon, 17 Jan 2005 11:52:01 +0000 Subject: HiPE compilation gives NINE times speed increase! In-Reply-To: <16875.40548.941765.449880@antilipe.corelatus.se> References: <200501171055.j0HAtQ7K027735@spikklubban.it.uu.se> <16875.40548.941765.449880@antilipe.corelatus.se> Message-ID: <20050117115201.609b5e8a.erlang@manderp.freeserve.co.uk> Thanks Kostis, thanks Matthias, Kostis, the effort certainly pays dividends, thanks. What is the average speedup you expect to see? Do you mean 2x speedup over a previous test run, Matthias? In which case, my code stinks! I'll try to reproduce your result by avoiding try-catch. Pete. On Mon, 17 Jan 2005 12:15:48 +0100 Matthias Lang wrote: > Kostis Sagonas writes: > > > The speedup you get in this program is indeed more than average but is > > not so surprising. We've put quite some effort in efficiently compiling > > binaries to native code, the compiler optimizations that HiPE performs > > are quite effective in such code, and we've experienced similar speedups > > in some programs manipulating binaries. On the other hand try-catch has > > nothing to do with the speedup; it is entirely due to HiPE's compilation > > of binaries. > > Replacing the (hideous, IMO) try/catch stuff with some normal code > nets me a 3.5x speedup for BEAM and a 2x speedup for HIPE. Peak memory > use is also much less, under 100MB. > > Assuming I didn't make a mistake, that is. > > Matthias -- "The Tao of Programming flows far away and returns on the wind of morning." From s9902088@REDACTED Mon Jan 17 12:51:30 2005 From: s9902088@REDACTED (Neil Campbell) Date: Mon, 17 Jan 2005 11:51:30 +0000 Subject: Using Erlang for Comsuming Web Services using SOAP In-Reply-To: References: <41E559E2.7060202@sms.ed.ac.uk> Message-ID: <41EBA6C2.6060602@sms.ed.ac.uk> Erik, Luke - thanks for the SOAP advice. After a bit of playing around, I've got the access with amazon working with REST requests using the www-tools library. Think I'll have to leave the SOAP requests for the moment and keep going with what I've got and get the SOAP going later or not. Hopefully I'll get the chance to get an extension of Erik's system working which uses WSDL - I'll update the thread once I get there. Jani - As you suggest, I'll post a summary of my findings to the list Thanks, Neil From chandrashekhar.mullaparthi@REDACTED Mon Jan 17 13:03:00 2005 From: chandrashekhar.mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Mon, 17 Jan 2005 12:03:00 +0000 Subject: Supervisor hierarchy question In-Reply-To: References: Message-ID: Eric, Whenever we need to dynamically create child processes which need to be supervised we put them under their own supervisor. +----------------------------------------------------------------+ | | | Supervisor | +----------------------------------------------------------------+ / | | | | | | / | | | | | | / | | | | | | System CP1 CP2 CP1_C1_Sup CP1_C2_Sup CP2_C1_Sup CP2_C2_Sup | | | | | | | | CP1_C1 CP1_C2 CP2_C1 CP2_C2 If CP1 and CP2 are also created dyanmically, I would put them under their own supervisor. The restart strategy, in the top level supervisor, for each CPm_Cn_Sup should be transient so that if that particular connection misbehaves, the rest of them are unaffected. You should probably maintain an ETS table which has a mapping from connection pool name to process id or have a fixed naming convention so that you can generate the name - asking the top level supervisor sounds a bit of a bodge. cheers Chandru On 15 Jan 2005, at 04:09, Eric Merritt wrote: > Guys, > > I am finishing up an implementation of a client for postgresql. > Overall was pretty simple, the protocol is well documented and Erlang > is geared for this stuff. However, I do have a couple of questions > about my supervisor hierarchy. > > Here is how things are set up. > > A Supervisor that watchs the top level system process. > > The system process implements gen_server and accepts requests for new > connection_pools and requests for the Pid of an existing connection > pool. When the system process launches a new pool it uses the > start_child function for its parent supervisor. So the hierarchy > looks like > > Supervisor > / | \ > System CP1 CP2 > > The thing I don't like about this is that when the system process gets > a request for a pid it calls which_system on its supervisor and > scrolls through the list to find the connection_pool by name. This > kind of parent pointer 'smells' bad. > > Now when the connection_pool gets a request for a connection it needs > return the PID of an active connection. If non are available it needs > to return an error or start a new one depending on its setup. > > This is my question. When the connection_pools starts up its initial > set of connections where should it put them, under another supervisor? > If so what should supervise the supervisor? Should it look like this? > > > > Supervisor > / | \ \ \ > System CP1 CP2 CP1-Conn-Sup CP2-Conn-Sup > > Or should it just create a supervisor without an explicit parent > supervisor. > > > I hope this is intelligible to you all. Any suggestions are > appreciated. > > -- > I'm a programmer, I don't have to spell correctly; I just have to > spell consistently > From erlang@REDACTED Mon Jan 17 13:22:12 2005 From: erlang@REDACTED (Peter-Henry Mander) Date: Mon, 17 Jan 2005 12:22:12 +0000 Subject: HiPE compilation gives NINE times speed increase! In-Reply-To: <16875.40548.941765.449880@antilipe.corelatus.se> References: <200501171055.j0HAtQ7K027735@spikklubban.it.uu.se> <16875.40548.941765.449880@antilipe.corelatus.se> Message-ID: <20050117122212.39163a3d.erlang@manderp.freeserve.co.uk> Hi Matthias, I have to agree that the try-catch stuff is uglier *and* slower in both native and non-native compilation. I'll avoid it in future. Thanks for the lesson, Guru. Pete, now wearing the "L" teeshirt again, although Mattias may insist on me wearing the "D" cap and standing face in a corner! Duh! On Mon, 17 Jan 2005 12:15:48 +0100 Matthias Lang wrote: > Kostis Sagonas writes: > > > The speedup you get in this program is indeed more than average but is > > not so surprising. We've put quite some effort in efficiently compiling > > binaries to native code, the compiler optimizations that HiPE performs > > are quite effective in such code, and we've experienced similar speedups > > in some programs manipulating binaries. On the other hand try-catch has > > nothing to do with the speedup; it is entirely due to HiPE's compilation > > of binaries. > > Replacing the (hideous, IMO) try/catch stuff with some normal code > nets me a 3.5x speedup for BEAM and a 2x speedup for HIPE. Peak memory > use is also much less, under 100MB. > > Assuming I didn't make a mistake, that is. > > Matthias -- "The Tao of Programming flows far away and returns on the wind of morning." From kostis@REDACTED Mon Jan 17 13:31:58 2005 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 17 Jan 2005 13:31:58 +0100 (MET) Subject: HiPE compilation gives NINE times speed increase! In-Reply-To: Mail from 'Peter-Henry Mander ' dated: Mon, 17 Jan 2005 11:52:01 +0000 Message-ID: <200501171231.j0HCVwV2004141@spikklubban.it.uu.se> > Kostis, the effort certainly pays dividends, thanks. What is the > average speedup you expect to see? The "typical" speedups from compilation to native code are in the range of 2 to 2.5 times faster. In code that is very bif-intensive it is less. In code that manipulates binaries is often a bit more. Kostis From anders.nygren@REDACTED Mon Jan 17 17:16:30 2005 From: anders.nygren@REDACTED (Anders Nygren) Date: Mon, 17 Jan 2005 10:16:30 -0600 Subject: Sybase interface Message-ID: Hi Back in May Danie Schutte wrote that he had an erlang driver for Sybase, but didn't have any web space for hosting it. Does anyone know where I can find it? /Anders Nygren From cyberlync@REDACTED Mon Jan 17 20:21:26 2005 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 17 Jan 2005 11:21:26 -0800 Subject: Supervisor hierarchy question In-Reply-To: References: Message-ID: On Mon, 17 Jan 2005 12:03:00 +0000, Chandrashekhar Mullaparthi wrote: > Eric, > > Whenever we need to dynamically create child processes which need to be > supervised we put them under their own supervisor. > > +----------------------------------------------------------------+ > | | > | Supervisor | > +----------------------------------------------------------------+ > / | | | | | | > / | | | | | | > / | | | | | | > System CP1 CP2 CP1_C1_Sup CP1_C2_Sup CP2_C1_Sup CP2_C2_Sup > | | | | > | | | | > CP1_C1 CP1_C2 CP2_C1 CP2_C2 > > If CP1 and CP2 are also created dyanmically, I would put them under > their own supervisor. Easy enough to do and sensable. > The restart strategy, in the top level > supervisor, for each CPm_Cn_Sup should be transient so that if that > particular connection misbehaves, the rest of them are unaffected. So each connection process should get its own supervisor? Isn't that kind of a waste of processes (not that there is any dearth of processes available). > You should probably maintain an ETS table which has a mapping from > connection pool name to process id or have a fixed naming convention so > that you can generate the name - asking the top level supervisor sounds > a bit of a bodge. That was my first thought as well. However, how do you handle the case of a member of your pool dieing. The Pid changes and then your ETS table is immediatly out of date. Even if you caught the error you wouldn't know the Pid of the new process the supervisor starts. What I ended up doding (and I am very willing to modify this) is to make the connection_pool a gen_server and custom code what is in effect a supervisor for the children. This 'smells' pretty bad too as the actual OTP Supervisor is probably much better coded and better tested. > cheers > Chandru > From kruegger@REDACTED Tue Jan 18 00:07:22 2005 From: kruegger@REDACTED (Stephen Han) Date: Mon, 17 Jan 2005 15:07:22 -0800 Subject: Budget Erlnag/OTP hardware Message-ID: <86f1f53505011715073ac1016@mail.gmail.com> Hi. If I have an Erlang application that, - uses MNESIA to store and delete incoming messages. - converts incoming messge to HTTP and forward it to Yaws running in same platform. - receives about 3 msgs/sec through TCP/IP. - heavily contructs and matches binary messages. - creates process per message. 1. What will be the value CPU for this kind of Erlang application? I saw some people using Celoron, P4 - hyperthreading, Sempron, Athlon 64 or even VIA EPIA, too. I guess the more expensive, the better but there must be just enough CPU for those kind of tasks. Also could you tell me why? 2. If the Erlang/OTP is running x86 CPUs, what OS is a better choice in performance wise? Windows/Linux/FreeBSD? regards, From erlang@REDACTED Tue Jan 18 01:53:57 2005 From: erlang@REDACTED (Michael McDaniel) Date: Mon, 17 Jan 2005 16:53:57 -0800 Subject: file error, what file? Message-ID: <20050118005357.GN4359@fangora.autosys.us> When I start my erlang shell, I consistently get the following error: {error_logger,{{2005,1,11},{15,7,9}},std_error,'File operation error: eacces. Function: get_file. Process: kernel_sup.'} I forced a linewrap after the 'eacces.'. Of course, date/time changes on each start! How can I find out what is the problem file? The system starts and appears to work fine for what I am doing. No erlang_crash.dump is created. I use the following script to start my erlang command shell. --------------- #!/bin/sh if [[ $# -eq 1 ]]; then NodeName=$1; else NodeName=m1; fi export HEART_BEAT_TIMEOUT=600 /usr/local/bin/erl -heart \ -boot /home/mmcdanie/misc/src/erlang/start_ssl_clean -proto_dist inet_ssl \ -ssl_dist_opt client_certfile \ "/usr/local/lib/erlang/lib/inets-4.0.1/examples/server_root/ssl/ssl_client.pem"\ -ssl_dist_opt server_certfile \ "/usr/local/lib/erlang/lib/inets-4.0.1/examples/server_root/ssl/ssl_server.pem"\ -ssl_dist_opt verify 1 depth 1 -name $NodeName -s heart start #% end --------------- System is Linux kernel 2.6 (SuSE rel 9.1) using Erlang (BEAM) emulator version 5.4.3 [source] [hipe] This just recently started after a power outage, so I have some small suspicion of file system corruption, but how to determine the file? I am using ReiserFS and have not known of any problems after power outages before (though my UPS never failed before!). ALSO, I have realized another problem which may be related. I decided to remake my bootfile and so did $ erl Erlang (BEAM) emulator version 5.4.3 [source] [hipe] Eshell V5.4.3 (abort with ^G) 1> systools:make_script("start_ssl_clean"). *WARNING* ssl: Source code not found: 'SSL-PKIX'.erl *WARNING* ssl: Source code not found: 'PKIX1Algorithms88'.erl *WARNING* ssl: Source code not found: 'PKIX1Explicit88'.erl *WARNING* ssl: Source code not found: 'PKIX1Implicit88'.erl *WARNING* ssl: Source code not found: 'PKIXAttributeCertificate'.erl *WARNING* ssl: Source code not found: ssl_pkix_oid.erl ok 2> systools:make_script("start_ssl_clean", [{path,["/usr/local/lib/erlang/lib/ssl-3.0.4/pkix"]}]). *WARNING* ssl: Source code not found: 'SSL-PKIX'.erl *WARNING* ssl: Source code not found: 'PKIX1Algorithms88'.erl *WARNING* ssl: Source code not found: 'PKIX1Explicit88'.erl *WARNING* ssl: Source code not found: 'PKIX1Implicit88'.erl *WARNING* ssl: Source code not found: 'PKIXAttributeCertificate'.erl *WARNING* ssl: Source code not found: ssl_pkix_oid.erl ok 3> q(). $ Apologies for two problems in one message (only because I think they may be related). Thank you for any assistance in helping me determine why my 'eacces' problem is occurring, or why Erlang cannot find the source code. Michael McDaniel Portland, Oregon, USA From erlang@REDACTED Tue Jan 18 04:18:09 2005 From: erlang@REDACTED (Michael McDaniel) Date: Mon, 17 Jan 2005 19:18:09 -0800 Subject: file error, what file? In-Reply-To: <41EC6A55.9060405@corelatus.se> References: <20050118005357.GN4359@fangora.autosys.us> <41EC6A55.9060405@corelatus.se> Message-ID: <20050118031809.GQ4359@fangora.autosys.us> On Tue, Jan 18, 2005 at 02:45:57AM +0100, Thomas Lange wrote: > Michael McDaniel wrote: > >When I start my erlang shell, I consistently get the following error: > >{error_logger,{{2005,1,11},{15,7,9}},std_error,'File operation error: > >eacces. Function: get_file. Process: kernel_sup.'} > > > >I forced a linewrap after the 'eacces.'. Of course, date/time changes > >on each start! > > > >How can I find out what is the problem file? The system starts and > >appears to > >work fine for what I am doing. No erlang_crash.dump is created. > <...> > > If you want to see exactly what erlang is doing, use strace command. > Example: > > # strace erl 2>/tmp/x > Erlang (BEAM) emulator version 5.3.6.3 [source] [hipe] > > Eshell V5.3.6.3 (abort with ^G) > 1> > > /tmp/x will then contain all system calls performed and you can grep > for EACCESS. > > /Thomas ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Thank you very much. I thought I had done that before. It is now apparent that I had used ltrace rather than strace. Using the proper strace, of course, I can find the error! I had been running Erlang for so long, and changed a file permission sometime. After the system crash I had to restart Erlang and then the eaccess startup problem showed. Also, it becomes readily apparent where the systools:make_script() problem is when I use the proper trace tool, so that is solved now also! thanks again, ~Michael From erlang@REDACTED Tue Jan 18 04:44:47 2005 From: erlang@REDACTED (Michael McDaniel) Date: Mon, 17 Jan 2005 19:44:47 -0800 Subject: file error, what file? In-Reply-To: <20050118031809.GQ4359@fangora.autosys.us> References: <20050118005357.GN4359@fangora.autosys.us> <41EC6A55.9060405@corelatus.se> <20050118031809.GQ4359@fangora.autosys.us> Message-ID: <20050118034447.GR4359@fangora.autosys.us> On Mon, Jan 17, 2005 at 07:18:09PM -0800, Michael McDaniel wrote: > > On Tue, Jan 18, 2005 at 02:45:57AM +0100, Thomas Lange wrote: > > Michael McDaniel wrote: > > >When I start my erlang shell, I consistently get the following error: > > >{error_logger,{{2005,1,11},{15,7,9}},std_error,'File operation error: > > >eacces. Function: get_file. Process: kernel_sup.'} > > > > > >I forced a linewrap after the 'eacces.'. Of course, date/time changes > > >on each start! > > > > > >How can I find out what is the problem file? The system starts and > > >appears to > > >work fine for what I am doing. No erlang_crash.dump is created. > > <...> > > > > If you want to see exactly what erlang is doing, use strace command. > > Example: > > > > # strace erl 2>/tmp/x > > Erlang (BEAM) emulator version 5.3.6.3 [source] [hipe] > > > > Eshell V5.3.6.3 (abort with ^G) > > 1> > > > > /tmp/x will then contain all system calls performed and you can grep > > for EACCESS. > > > > /Thomas > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > Thank you very much. I thought I had done that before. It is > now apparent that I had used ltrace rather than strace. > > Using the proper strace, of course, I can find the error! > > I had been running Erlang for so long, and changed a file > permission sometime. After the system crash I had to > restart Erlang and then the eaccess startup problem showed. > > Also, it becomes readily apparent where the > systools:make_script() problem is when I use the proper > trace tool, so that is solved now also! > > thanks again, > > ~Michael ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ P.S. using strace and running systools:make_script("start_ssl_clean") shows error stat64("/usr/local/lib/erlang/lib/ssl-3.0.4/src/ssl_pkix_oid.erl", 0xbfffeadc) = -1 ENOENT (No such file or directory) After I symlink the .erl files from ... /ssl-3.0.4/pkix/ to ... /ssl-3.0.4/src/ directory then systools:make_script() worked without the problems of not finding source code. contents of start_ssl_clean.rel: {release, {"OTP APN 181 01","R10B"}, {erts, "5.4.2.3"}, [{kernel,"2.10.3"}, {stdlib,"1.13.3"}, {ssl,"3.0.4"}]}. % see % file:///usr/local/lib/erlang/lib/ssl-3.0.4/doc/html/ssl_distribution.html % for ssl info ~Michael From casper2000a@REDACTED Tue Jan 18 05:04:44 2005 From: casper2000a@REDACTED (Casper) Date: Tue, 18 Jan 2005 10:04:44 +0600 Subject: Eddie and Distributed Erlang In-Reply-To: <1105754695.41e87a4773b73@www.omnibis.com> Message-ID: Hi All, I was studying Eddie implementation lately and found it uses it's own synchronization mechanism using global registration to manage the distribution of it's applications. For example its master_server has a synchronization part, which monitors other master_server and if the active one (global) goes down, another one take its place. Why doesn't Eddie use Erlang Kernel module's distributed application mechanism? In a distributed application, is there any use of having a supervisor, which starts the application module? I guess the kernel dist_ac handles that part, correct? Also in Eddie implementation, the system starts OAM module on startup. Then the OAM module starts the other modules, using application start. When talking about Best Practice, is this the better method or let the kernel dist_ac start distributed applications and start the individual application where necessary at using different startup scripts? Also when an a process spawned by a supervisor, what happens if the supervisor goes down? Does that child process also terminate? Thanks in advance! Eranga From casper2000a@REDACTED Tue Jan 18 05:57:36 2005 From: casper2000a@REDACTED (Casper) Date: Tue, 18 Jan 2005 10:57:36 +0600 Subject: Erlang SNMP In-Reply-To: Message-ID: Hi All, I'm studying Erlang SNMP module and found that its module architecture has been changed. The example provided in the SNMP package is still in the old architecture (no snmp_mgr, no snmp_test_mgr, etc). Is there an example I can use to understand its working? Thanks! Eranga From ok@REDACTED Tue Jan 18 05:49:00 2005 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 18 Jan 2005 17:49:00 +1300 (NZDT) Subject: A Pythonista's Impressions of Erlang Message-ID: <200501180449.j0I4n0Pt078905@atlas.otago.ac.nz> (Someone) wrote: > Speaking of string operations, I need to add (or remove) the > / at the end of an URL if it is absent (or present). The real problem with adding a / at the end of a URL is that it's an O(N) operation rather than an O(1) operation. That is, it's *not* the "if" that is the *really* ugly part in > RootUrl = if list:last(SiteRoot) =/= $/ -> SiteRoot ++ [$/] > ; true -> > SiteRoot > end but the "++". > Is there an elegant way to do last character manipulation? Yes. Instead of passing SiteRoot around, pass reverse(SiteRoot). SlashedToor = case Toor of % Toor is Root reversed (:-) [$/|_] -> Toor ; _ -> [$/|Toor] end Keep it reversed as long as you are working on the end of it, only reverse it when you need it. Actually I see no reason why patterns like Var ++ StringLiteral should not be compiled, especially since StringLiteral ++ Var *is* allowed - and therefore disallowing Var ++ StringLiteral violates the principle of least astonishment. Because Var ++ StringLiteral is _slow_. Another approach would be to just go ahead and _always_ add the slash, relying on a clean-up pass at the end. But the rules for what you can put where in an URL are sufficiently nasty that you don't want to be worrying about them. What you really want is a URL abstract data type, perhaps with a representation like {url,Protocol,Host,Path,Query,Fragment} Protocol is an atom; Host is an atom or {Name,Port} or {Name,Port,User,Pass} Path is a list of strings (/x/y => ["x","y"] Query is a list of {Key,Value} pairs, possibly empty Fragment is a string where NO escaping rules apply, just use the characters you want. Then you'd finally have a url:to_string(URL) -> String function which pasted the pieces together with all the required punctuation marks and escaping. Ensuring that the Path ends with an empty string url:with_empty_step_at_end({url,R,H,P,_,_}) -> {url,R,H, case last(P) of [] -> P; P ++ [[]] end, [], []}. is not constant time, but it's O(M), where M is the number of slashes in the path, which is likely to be a lot less than N, the number of characters in the path. From ulf@REDACTED Tue Jan 18 07:26:22 2005 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 18 Jan 2005 07:26:22 +0100 Subject: Budget Erlnag/OTP hardware In-Reply-To: <86f1f53505011715073ac1016@mail.gmail.com> References: <86f1f53505011715073ac1016@mail.gmail.com> Message-ID: Hi, The 3 msgs/sec indicates that just about any PC available on the market would suffice, but that of course depends on just how heavy the processing load per message is. Also, if you're storing in Mnesia - do you store to disk? If not, storing in Mnesia is very cheap; otherwise, the load goes up. As one performance reference, look at http://www.erlang.se/euc/02/johan.ppt#12 which is one application using HTTP and SS7, and running 100 requests/sec on a Sun Netra T1. But you should build a prototype and measure its performance before you go out shopping for hardware. Memory consumption is another issue you need to look at. This is largely a factor of how much data you need to hold in memory, but also keep in mind that Erlang tends to allocate some memory dynamically (not quite as heavily as Java, though.) Regarding OS, assuming I'm correct in guessing that performance will not be your biggest problem, you should go with the OS that you're most comfortable with, and which seems functionally suitable for the task. Regards, Uffe Den 2005-01-18 00:07:22 skrev Stephen Han : > Hi. > > If I have an Erlang application that, > > - uses MNESIA to store and delete incoming messages. > - converts incoming messge to HTTP and forward it to Yaws running in > same platform. > - receives about 3 msgs/sec through TCP/IP. > - heavily contructs and matches binary messages. > - creates process per message. > > 1. What will be the value CPU for this kind of Erlang application? I > saw some people using Celoron, P4 - hyperthreading, Sempron, Athlon 64 > or even VIA EPIA, too. I guess the more expensive, the better but > there must be just enough CPU for those kind of tasks. Also could you > tell me why? > > 2. If the Erlang/OTP is running x86 CPUs, what OS is a better choice > in performance wise? Windows/Linux/FreeBSD? > > regards, > > -- Anv?nder Operas banbrytande e-postklient: http://www.opera.com/m2/ From joe.armstrong@REDACTED Tue Jan 18 08:59:59 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Tue, 18 Jan 2005 08:59:59 +0100 Subject: Budget Erlnag/OTP hardware Message-ID: 1) Your CPU requirements are minimal (by today's standards) Unless you're doing something ridiculous this should happily run on my old celeron 350 MHZ with 256 Meg of Memory You might be able to run with 128Meg of memory or less, but this will degrade performance a lot 2) Linux or FreeBSD (this is just a guess - I haven't actually measured anything here - Linux boxes can happily run for months without a reboot, or hiccup. But all windows system I've ever used seem to occasionally freeze and need rebooting frequently (for example my work windows machine needs to be re-booted once a week or so, why, nobody knows) Cheers /Joe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Stephen Han > Sent: den 18 januari 2005 00:07 > To: erlang-questions@REDACTED > Subject: Budget Erlnag/OTP hardware > > > Hi. > > If I have an Erlang application that, > > - uses MNESIA to store and delete incoming messages. > - converts incoming messge to HTTP and forward it to Yaws running in > same platform. > - receives about 3 msgs/sec through TCP/IP. > - heavily contructs and matches binary messages. > - creates process per message. > > 1. What will be the value CPU for this kind of Erlang application? I > saw some people using Celoron, P4 - hyperthreading, Sempron, Athlon 64 > or even VIA EPIA, too. I guess the more expensive, the better but > there must be just enough CPU for those kind of tasks. Also could you > tell me why? > > 2. If the Erlang/OTP is running x86 CPUs, what OS is a better choice > in performance wise? Windows/Linux/FreeBSD? > > regards, > From mickael.remond@REDACTED Tue Jan 18 10:28:56 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Tue, 18 Jan 2005 10:28:56 +0100 Subject: Eddie and Distributed Erlang In-Reply-To: References: Message-ID: <41ECD6D8.7090305@erlang-fr.org> Casper wrote: > Hi All, > > I was studying Eddie implementation lately and found it uses it's own > synchronization mechanism using global registration to manage the > distribution of it's applications. For example its master_server has a > synchronization part, which monitors other master_server and if the active > one (global) goes down, another one take its place. > > Why doesn't Eddie use Erlang Kernel module's distributed application > mechanism? I think this is because Eddie has been thought to run over machine that can be distributed and that are not specifically on the same internal network. With Eddie it is possible to load balance between site geographically very distant. The standard Erlang protocole is not encrypted (althought it is possible now to encrypt it). So I think they use their own distribution mechanism so that Eddie can run safely over Internet. > Also when an a process spawned by a supervisor, what happens if the > supervisor goes down? Does that child process also terminate? Yes. Links are bidirectionals. I hope this helps, -- Micka?l R?mond http://www.erlang-projects.org/ From techieyang@REDACTED Tue Jan 18 10:35:14 2005 From: techieyang@REDACTED (Techie Yang) Date: Tue, 18 Jan 2005 17:35:14 +0800 Subject: 'REI' homepage gone already? Message-ID: <200501180935.j0I9ZnH59326@hades.cslab.ericsson.net> Hello everyone, I am a newbie to Erlang. Thinking game stuffs in the REI & GOONIX pretty attractive. Hope I can have the chance to learn from the source code. However, looks like the REI http://rei.vawis.net/ is unable to be accessed, and no source code stored on the http://goonix.sourceforge.net/. Could any buddy give me some hints? Really appreciate! Best Regards Techie From techieyang@REDACTED Tue Jan 18 10:53:39 2005 From: techieyang@REDACTED (Techie Yang) Date: Tue, 18 Jan 2005 17:53:39 +0800 Subject: 'REI' homepage gone already? Message-ID: <200501180954.j0I9s2H59475@hades.cslab.ericsson.net> Sorry, still me. Actually, the source code for the 'GOONIX/REI' can be checked out from sourceforge. Sorry about the wrong message sent out just now. Best Regards Techie. >Hello everyone, > >I am a newbie to Erlang. Thinking game stuffs in the REI & GOONIX pretty attractive. >Hope I can have the chance to learn from the source code. >However, looks like the REI http://rei.vawis.net/ is unable to be accessed, >and no source code stored on the http://goonix.sourceforge.net/. >Could any buddy give me some hints? Really appreciate! > > >Best Regards >Techie = = = = = = = = = = = = = = = = = = = = From mickael.remond@REDACTED Tue Jan 18 11:43:39 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Tue, 18 Jan 2005 11:43:39 +0100 Subject: 'REI' homepage gone already? In-Reply-To: <200501180954.j0I9s2H59475@hades.cslab.ericsson.net> References: <200501180954.j0I9s2H59475@hades.cslab.ericsson.net> Message-ID: <41ECE85B.1090103@erlang-fr.org> Techie Yang wrote: > Sorry, still me. > Actually, the source code for the 'GOONIX/REI' can be checked out from sourceforge. > Sorry about the wrong message sent out just now. No problem. I agree that we migrate the server and did not let it in good state. To be sure to get the last available version, you can get the rei.tar.gz archive from: http://www.erlang-projects.org/Members/mremond/events/game-over_conference/block_10818396096398/file I hope this helps, -- Micka?l R?mond http://www.erlang-projects.org/ From bertil@REDACTED Tue Jan 18 12:50:37 2005 From: bertil@REDACTED (Bertil Karlsson) Date: Tue, 18 Jan 2005 12:50:37 +0100 Subject: xhtml-1.0 transitional and xmerl? In-Reply-To: <41E99178.2080203@bluetail.com> References: <41E99178.2080203@bluetail.com> Message-ID: <41ECF80D.9000500@erix.ericsson.se> Hi, It is not true that external entities are not supported. In the Release Notes you can read that there is no support to fetch external entities that are referenced by a URL. By this I ment that it is no built-in support for that, but you can still provide your own fetch function that manage this. However, it is something that fails when using the xhtml DTDs. I have not yet got a clear picture about what has to be done to manage those DTDs. The first bug I run into was when parsing the comments in one of the referenced entites that enclosed an entity definition, ... but there were something more. I hope to deliver a patched version in the march release of the open source OTP. /Bertil Joakim G. wrote: > Hi, > I tried to validate couple of xhtml-1.0 pages with xmerl. I downloaded > the xhtml-1.0 transitional DTDs from: > http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_XHTML-1.0-Transitional and > tried to use them with xmerl: > > ==== > > Erlang (BEAM) emulator version 5.4.3 [source] [hipe] > > Eshell V5.4.3 (abort with ^G) > 1> xmerl_scan:file("test.html", [{validation, true}, {fetch_fun, fun(U, > G) -> {ok, {file, "xhtml1-transitional.dtd"}, G} end}]). > 2748- fatal: {invalid_name," HTMLl"} > ** exited: {fatal,{{invalid_name," > HTMLl"},"xhtml1-transitional.dtd",29,700}} ** > ==== > > Hmm. Sifting through the xmerl release notes I realised that external > entities isn't supported. Just for the heck of it I replaced the > external entity references in the DTD with the actual content and > tried again: > > ==== > > Erlang (BEAM) emulator version 5.4.3 [source] [hipe] > > Eshell V5.4.3 (abort with ^G) > 1> xmerl_scan:file("test.html", [{validation, true}, {fetch_fun, fun(U, > G) -> {ok, {file, "xhtml1-transitional.dtd"}, G} end}]). > 3319- fatal: unexpected_end > ** exited: {fatal,{unexpected_end,"xhtml1-transitional.dtd",635,111}} ** > 2> > > ==== > > It was doomed to fail I suppose. > > My question: Has anyone else used xmerl in combination with the xhtml-1.0 > DTDs? > > Cheers > /Jocke > > From gerd@REDACTED Tue Jan 18 15:04:33 2005 From: gerd@REDACTED (Gerd Flaig) Date: Tue, 18 Jan 2005 15:04:33 +0100 Subject: Sybase interface In-Reply-To: (Anders Nygren's message of "Mon, 17 Jan 2005 10:16:30 -0600") References: Message-ID: Anders Nygren writes: > Back in May Danie Schutte wrote that he had an erlang driver for Sybase, > but didn't have any web space for hosting it. > Does anyone know where I can find it? there are some files in the Jungerl, but they don't compile out of the box (yet?). Goodbyte, Gerd. -- Gerd Flaig Technik gerd@REDACTED Bei Schlund + Partner AG Brauerstra?e 48 D-76135 Karlsruhe Physics is like sex: sure, it may give some practical results, but that's not why we do it. -- Richard Feynman From garry@REDACTED Tue Jan 18 15:15:00 2005 From: garry@REDACTED (Garry Hodgson) Date: Tue, 18 Jan 2005 09:15:00 -0500 Subject: Budget Erlnag/OTP hardware In-Reply-To: References: Message-ID: <2005011809151106057700@k2.sage.att.com> "Joe Armstrong (AL/EAB)" wrote: > 1) Your CPU requirements are minimal (by today's standards) > Unless you're doing something ridiculous > this should happily run on my old celeron 350 MHZ with 256 Meg of Memory > You might be able to run with 128Meg of memory or less, but this will > degrade performance a lot > > 2) Linux or FreeBSD (this is just a guess - I haven't actually measured anything here > - Linux boxes can happily run for months without a reboot, or hiccup. But all windows > system I've ever used seem to occasionally freeze and need rebooting frequently > (for example my work windows machine needs to be re-booted once a week or so, > why, nobody knows) these two interrelate, too. unless you're talking windows 98 or so, windows will be dog slow on the hardware joe describes. it needs more memory than that to be usable (trust me, i've got one on win2k, and it's not usable for more than putting in my time sheet). and win 98 just barely qualifies as an operating system, in the current sense. ---- Garry Hodgson, Technical Consultant, AT&T Labs Be happy for this moment. This moment is your life. From ernie.makris@REDACTED Tue Jan 18 16:48:06 2005 From: ernie.makris@REDACTED (ernie.makris@REDACTED) Date: Tue, 18 Jan 2005 15:48:06 +0000 Subject: Supervisor hierarchy question Message-ID: <011820051548.12465.41ED2FB5000F0819000030B122007623029C079D050E03D20A07029D0A@comcast.net> Hi Eric, I read the message about creating a client for postgresql in erlang. I am interested in helping you out, as I use postgresql from erlang and would be interested in such an interface. Can you post the code? I can help you test it if you'd like. Thanks Ernie From cyberlync@REDACTED Tue Jan 18 20:51:05 2005 From: cyberlync@REDACTED (Eric Merritt) Date: Tue, 18 Jan 2005 11:51:05 -0800 Subject: Supervisor hierarchy question In-Reply-To: <011820051548.12465.41ED2FB5000F0819000030B122007623029C079D050E03D20A07029D0A@comcast.net> References: <011820051548.12465.41ED2FB5000F0819000030B122007623029C079D050E03D20A07029D0A@comcast.net> Message-ID: That would actually rock. Its part of a larger codebase that I havn't decided whether or not to open up. However, I have no problem at all opening up the postgresql stuff. If you would like I will grant you access to the subversion repository. If you can't get a subversion client I will post it on the web somewhere. I don't actually expect to get the driver to a usable state before the end of the week. On Tue, 18 Jan 2005 15:48:06 +0000, ernie.makris@REDACTED wrote: > Hi Eric, > > I read the message about creating a client for postgresql in erlang. I am interested in helping you out, as I use postgresql from erlang and would be interested in such an interface. Can you post the code? I can help you test it if you'd like. > > Thanks > Ernie > -- I'm a programmer, I don't have to spell correctly; I just have to spell consistently From cyberlync@REDACTED Tue Jan 18 22:34:45 2005 From: cyberlync@REDACTED (Eric Merritt) Date: Tue, 18 Jan 2005 13:34:45 -0800 Subject: Supervisor hierarchy question In-Reply-To: <4264351F.80609@nortelnetworks.com> References: <011820051548.12465.41ED2FB5000F0819000030B122007623029C079D050E03D20A07029D0A@comcast.net> <4264351F.80609@nortelnetworks.com> Message-ID: Parts of it would. The connection pool specific stuff would work just fine. However, my connection directly implements postgresql's version 3 protocol so it wouldn't be able to speak to mysql. However, if someone is willing to implement the mysql protocol I am more then happy to work with them to develop a consistant api. On Tue, 19 Apr 2005 00:30:55 +0200, Torbjorn Tornkvist wrote: > > Would this code work with mysql as well ? > > Cheers, Tobbe > > Eric Merritt wrote: > > >That would actually rock. Its part of a larger codebase that I havn't > >decided whether or not to open up. However, I have no problem at all > >opening up the postgresql stuff. If you would like I will grant you > >access to the subversion repository. If you can't get a subversion > >client I will post it on the web somewhere. I don't actually expect to > >get the driver to a usable state before the end of the week. > > > > > >On Tue, 18 Jan 2005 15:48:06 +0000, ernie.makris@REDACTED > > wrote: > > > > > >>Hi Eric, > >> > >>I read the message about creating a client for postgresql in erlang. I am interested in helping you out, as I use postgresql from erlang and would be interested in such an interface. Can you post the code? I can help you test it if you'd like. > >> > >>Thanks > >>Ernie > >> > >> > >> > > > > > > > > > > -- I'm a programmer, I don't have to spell correctly; I just have to spell consistently From tobbe@REDACTED Tue Jan 18 23:19:51 2005 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Tue, 18 Jan 2005 23:19:51 +0100 Subject: Supervisor hierarchy question In-Reply-To: References: <011820051548.12465.41ED2FB5000F0819000030B122007623029C079D050E03D20A07029D0A@comcast.net> <4264351F.80609@nortelnetworks.com> Message-ID: <41ED8B87.9070305@nortelnetworks.com> Eric Merritt wrote: >Parts of it would. The connection pool specific stuff would work just >fine. However, my connection directly implements postgresql's version >3 protocol so it wouldn't be able to speak to mysql. However, if >someone is willing to implement the mysql protocol I am more then >happy to work with them to develop a consistant api. > > Ok, I don't know (yet) what that protocol consist of, but I think it could be of interest to be able to access mysql from Erlang. Any pointers where to look ? I guess I should browse around mysql.com... ;-) Cheers, Tobbe > >On Tue, 19 Apr 2005 00:30:55 +0200, Torbjorn Tornkvist > wrote: > > >>Would this code work with mysql as well ? >> >>Cheers, Tobbe >> >>Eric Merritt wrote: >> >> >> >>>That would actually rock. Its part of a larger codebase that I havn't >>>decided whether or not to open up. However, I have no problem at all >>>opening up the postgresql stuff. If you would like I will grant you >>>access to the subversion repository. If you can't get a subversion >>>client I will post it on the web somewhere. I don't actually expect to >>>get the driver to a usable state before the end of the week. >>> >>> >>>On Tue, 18 Jan 2005 15:48:06 +0000, ernie.makris@REDACTED >>> wrote: >>> >>> >>> >>> >>>>Hi Eric, >>>> >>>>I read the message about creating a client for postgresql in erlang. I am interested in helping you out, as I use postgresql from erlang and would be interested in such an interface. Can you post the code? I can help you test it if you'd like. >>>> >>>>Thanks >>>>Ernie >>>> >>>> >>>> >>>> >>>> >>> >>> >>> >>> >> >> > > > > From cyberlync@REDACTED Tue Jan 18 23:25:12 2005 From: cyberlync@REDACTED (Eric Merritt) Date: Tue, 18 Jan 2005 14:25:12 -0800 Subject: Supervisor hierarchy question In-Reply-To: <41ED8B87.9070305@nortelnetworks.com> References: <011820051548.12465.41ED2FB5000F0819000030B122007623029C079D050E03D20A07029D0A@comcast.net> <4264351F.80609@nortelnetworks.com> <41ED8B87.9070305@nortelnetworks.com> Message-ID: Torbjorn, You can always use the ODBC stuff provided with the erlang/OTP distribution. I needed something a little closer to the wire and with a few extra options. Thats the main reson I implemented my own. Otherwise, the erlang ODBC stuff works just fine. On Tue, 18 Jan 2005 23:19:51 +0100, Torbjorn Tornkvist wrote: > Eric Merritt wrote: > > >Parts of it would. The connection pool specific stuff would work just > >fine. However, my connection directly implements postgresql's version > >3 protocol so it wouldn't be able to speak to mysql. However, if > >someone is willing to implement the mysql protocol I am more then > >happy to work with them to develop a consistant api. > > > > > Ok, I don't know (yet) what that protocol consist of, but I think it > could be of interest to be able to access mysql from Erlang. > Any pointers where to look ? I guess I should browse around > mysql.com... ;-) > > Cheers, Tobbe > > > > >On Tue, 19 Apr 2005 00:30:55 +0200, Torbjorn Tornkvist > > wrote: > > > > > >>Would this code work with mysql as well ? > >> > >>Cheers, Tobbe > >> > >>Eric Merritt wrote: > >> > >> > >> > >>>That would actually rock. Its part of a larger codebase that I havn't > >>>decided whether or not to open up. However, I have no problem at all > >>>opening up the postgresql stuff. If you would like I will grant you > >>>access to the subversion repository. If you can't get a subversion > >>>client I will post it on the web somewhere. I don't actually expect to > >>>get the driver to a usable state before the end of the week. > >>> > >>> > >>>On Tue, 18 Jan 2005 15:48:06 +0000, ernie.makris@REDACTED > >>> wrote: > >>> > >>> > >>> > >>> > >>>>Hi Eric, > >>>> > >>>>I read the message about creating a client for postgresql in erlang. I am interested in helping you out, as I use postgresql from erlang and would be interested in such an interface. Can you post the code? I can help you test it if you'd like. > >>>> > >>>>Thanks > >>>>Ernie > >>>> > >>>> > >>>> > >>>> > >>>> > >>> > >>> > >>> > >>> > >> > >> > > > > > > > > > > -- I'm a programmer, I don't have to spell correctly; I just have to spell consistently From techieyang@REDACTED Wed Jan 19 02:56:13 2005 From: techieyang@REDACTED (Techie Yang) Date: Wed, 19 Jan 2005 09:56:13 +0800 Subject: 'REI' homepage gone already? Message-ID: <200501190157.j0J1vHH67620@hades.cslab.ericsson.net> Thanks, Sir! Got it. Best Reagrds Techie >Techie Yang wrote: >> Sorry, still me. >> Actually, the source code for the 'GOONIX/REI' can be checked out from sourceforge. >> Sorry about the wrong message sent out just now. > >No problem. >I agree that we migrate the server and did not let it in good state. > >To be sure to get the last available version, you can get the rei.tar.gz >archive from: >http://www.erlang-projects.org/Members/mremond/events/game-over_conference/block_10818396096398/file > >I hope this helps, > >-- >Micka?l R?mond > http://www.erlang-projects.org/ > = = = = = = = = = = = = = = = = = = = = ?????????????????? ???? ????????????????Techie Yang ????????????????techieyang@REDACTED ????????????????????2005-01-19 From valentin@REDACTED Wed Jan 19 07:28:51 2005 From: valentin@REDACTED (Valentin Micic) Date: Wed, 19 Jan 2005 08:28:51 +0200 Subject: Supervisor hierarchy question References: <011820051548.12465.41ED2FB5000F0819000030B122007623029C079D050E03D20A07029D0A@comcast.net> <4264351F.80609@nortelnetworks.com> <41ED8B87.9070305@nortelnetworks.com> Message-ID: <00e601c4fdf0$251a5e80$0100a8c0@MONEYMAKER2> Would it be too crazy to atempt to provide a mnesia access module that would use mysql or similar database for storage? Thus, instead of using ODBC or similar one could use mnesia:activity.... BTW: I've been asked the other day why did I choose a Disney (a.k.a. Mickey Mouse) Database for implementation of some serious data volumes. They said, Even Ericsson is not using MNESIA... not that we have any problems, but... How does one fight such (IMHO) unjustified argument(s)? Can anybody tell me of any comercial application of MNESIA. Valentin. ----- Original Message ----- From: "Eric Merritt" To: "Torbjorn Tornkvist" Cc: Sent: Wednesday, January 19, 2005 12:25 AM Subject: Re: Supervisor hierarchy question > Torbjorn, > > You can always use the ODBC stuff provided with the erlang/OTP > distribution. I needed something a little closer to the wire and with > a few extra options. Thats the main reson I implemented my own. > Otherwise, the erlang ODBC stuff works just fine. > > > On Tue, 18 Jan 2005 23:19:51 +0100, Torbjorn Tornkvist > wrote: > > Eric Merritt wrote: > > > > >Parts of it would. The connection pool specific stuff would work just > > >fine. However, my connection directly implements postgresql's version > > >3 protocol so it wouldn't be able to speak to mysql. However, if > > >someone is willing to implement the mysql protocol I am more then > > >happy to work with them to develop a consistant api. > > > > > > > > Ok, I don't know (yet) what that protocol consist of, but I think it > > could be of interest to be able to access mysql from Erlang. > > Any pointers where to look ? I guess I should browse around > > mysql.com... ;-) > > > > Cheers, Tobbe > > > > > > > >On Tue, 19 Apr 2005 00:30:55 +0200, Torbjorn Tornkvist > > > wrote: > > > > > > > > >>Would this code work with mysql as well ? > > >> > > >>Cheers, Tobbe > > >> > > >>Eric Merritt wrote: > > >> > > >> > > >> > > >>>That would actually rock. Its part of a larger codebase that I havn't > > >>>decided whether or not to open up. However, I have no problem at all > > >>>opening up the postgresql stuff. If you would like I will grant you > > >>>access to the subversion repository. If you can't get a subversion > > >>>client I will post it on the web somewhere. I don't actually expect to > > >>>get the driver to a usable state before the end of the week. > > >>> > > >>> > > >>>On Tue, 18 Jan 2005 15:48:06 +0000, ernie.makris@REDACTED > > >>> wrote: > > >>> > > >>> > > >>> > > >>> > > >>>>Hi Eric, > > >>>> > > >>>>I read the message about creating a client for postgresql in erlang. I am interested in helping you out, as I use postgresql from erlang and would be interested in such an interface. Can you post the code? I can help you test it if you'd like. > > >>>> > > >>>>Thanks > > >>>>Ernie > > >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > >>> > > >>> > > >>> > > >>> > > >> > > >> > > > > > > > > > > > > > > > > > > > -- > I'm a programmer, I don't have to spell correctly; I just have to > spell consistently From ft@REDACTED Wed Jan 19 07:56:24 2005 From: ft@REDACTED (Fredrik Thulin) Date: Wed, 19 Jan 2005 07:56:24 +0100 Subject: Supervisor hierarchy question In-Reply-To: <41ED8B87.9070305@nortelnetworks.com> References: <011820051548.12465.41ED2FB5000F0819000030B122007623029C079D050E03D20A07029D0A@comcast.net> <41ED8B87.9070305@nortelnetworks.com> Message-ID: <200501190756.24527.ft@it.su.se> On Tuesday 18 January 2005 23.19, Torbjorn Tornkvist wrote: > Eric Merritt wrote: > >Parts of it would. The connection pool specific stuff would work > > just fine. However, my connection directly implements postgresql's > > version 3 protocol so it wouldn't be able to speak to mysql. > > However, if someone is willing to implement the mysql protocol I am > > more then happy to work with them to develop a consistant api. > > Ok, I don't know (yet) what that protocol consist of, but I think it > could be of interest to be able to access mysql from Erlang. > Any pointers where to look ? I guess I should browse around > mysql.com... ;-) There is a start at http://www.stacken.kth.se/projekt/yxa/mysql-0.1.tar.gz (not my code). See also http://www.erlang.org/ml-archive/erlang-questions/200402/msg00077.html /Fredrik From aruna.jambunathan@REDACTED Wed Jan 19 09:06:05 2005 From: aruna.jambunathan@REDACTED (aruna.jambunathan@REDACTED) Date: Wed, 19 Jan 2005 13:36:05 +0530 Subject: mail to erlang mailing list Message-ID: Hi, I am trying to install Erlang R9C-2 onto a system whose specifications are: SunOS 5.8 Generic_108528-29 sun4u sparc SUNW, Ultra-2. The following error is encountered: checking size of short... 0 checking size of int... 0 checking size of long... 0 checking size of void *... 0 checking size of long long... 0 checking size of size_t... 0 checking size of off_t... 0 checking int/long/void*/size_t sizes... failed configure: error: Cannot handle this combination of int/long/void*/size_t sizes configure: error: /aims_home/sailajar/erlang/otp_src_R9C-2/erts/configure failed for erts After seeing this error, I tried make command but encountered the following error: make: Fatal error in reader: Makefile, line 114: Unexpected end of line seen Due to this I am unable to install erlang. The earlier version of Erlang on the same system is : "Erlang (BEAM) emulator version 5.1[source] Eshell V5.1" Kindly let me know the Erlang version compatibility with the above system. A quick response will be highly helpful as I am unable to proceed due to this problem. Regards, Aruna Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or Mailadmin@REDACTED immediately and destroy all copies of this message and any attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: From aruna.jambunathan@REDACTED Wed Jan 19 09:08:38 2005 From: aruna.jambunathan@REDACTED (aruna.jambunathan@REDACTED) Date: Wed, 19 Jan 2005 13:38:38 +0530 Subject: Erlang installation problem Message-ID: Regards, Aruna Project Engineer Wipro Technologies Hyderabad Desk # 91 40 30 79 15 27 Fax # 91 40 30 79 00 09 Mobile # 91 98 66 14 91 96 Email : aruna.jambunathan@REDACTED The saddest summary of a life contains three descriptions: I could have, I might have, and I should have. ________________________________ From: Aruna Jambunathan(WT01 - TELECOM SOLUTIONS) Sent: Wednesday, January 19, 2005 1:36 PM To: erlang-questions@REDACTED Cc: Aruna Jambunathan(WT01 - TELECOM SOLUTIONS); Sailaja Reddy (WT01 - TELECOM SOLUTIONS) Subject: RE: mail to erlang mailing list Hi, I am trying to install Erlang R9C-2 onto a system whose specifications are: SunOS 5.8 Generic_108528-29 sun4u sparc SUNW, Ultra-2. The following error is encountered: checking size of short... 0 checking size of int... 0 checking size of long... 0 checking size of void *... 0 checking size of long long... 0 checking size of size_t... 0 checking size of off_t... 0 checking int/long/void*/size_t sizes... failed configure: error: Cannot handle this combination of int/long/void*/size_t sizes configure: error: /aims_home/sailajar/erlang/otp_src_R9C-2/erts/configure failed for erts After seeing this error, I tried make command but encountered the following error: make: Fatal error in reader: Makefile, line 114: Unexpected end of line seen Due to this I am unable to install erlang. The earlier version of Erlang on the same system is : "Erlang (BEAM) emulator version 5.1[source] Eshell V5.1" Kindly let me know the Erlang version compatibility with the above system. A quick response will be highly helpful as I am unable to proceed due to this problem. Regards, Aruna Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or Mailadmin@REDACTED immediately and destroy all copies of this message and any attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.gif Type: image/gif Size: 73 bytes Desc: image001.gif URL: From ulf.wiger@REDACTED Wed Jan 19 09:50:32 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 19 Jan 2005 09:50:32 +0100 Subject: Supervisor hierarchy question Message-ID: <37FB7AA6F5F9814FB634A7BF4C35A6F5402A37@ESEALNT442.al.sw.ericsson.se> > BTW: I've been asked the other day why did I choose a Disney > (a.k.a. Mickey Mouse) Database for implementation of some > serious data volumes. They said, Even Ericsson is not using > MNESIA... not that we have any problems, but... I guess it depends on what you mean by 'serious data volumes'. The biggest mnesia database that I have is roughly 1 GB of data in about 6 million objects. It works like a charm. Traditionally, this wouldn't qualify as 'serious data volumes', but I think it's a bit more than most people think Mnesia is capable of handling. That Ericsson wouldn't be using Mnesia is rubbish! We use it extensively in our Erlang-based applications, and these apps have very high reliability requirements. However, if you refer to e.g. large provisioning databases, then no, we don't use Mnesia for those applications. There are many reasons for this, but that Mnesia would not be good enough is not really one of the main reasons. Having said that, though, I think making Mnesia a serious contender in that niche would require a tremendous amount of work, mainly as regards feature set, support tools, etc, as well as incorporating another disk-based backend, like Berkeley DB. It might also involve introducing a lot of compromises that would make Mnesia a less attractive realtime DBMS. > > How does one fight such (IMHO) unjustified argument(s)? Can > anybody tell me of any comercial application of MNESIA. In general, I think just about all commercial Erlang-based products use Mnesia one way or another. The Synapse Automatic Device Configuration tool uses Mnesia with a Berkeley DB backend, if I'm not mistaken, and handles quite large data volumes. I think part of this discussion should be the aspect of support. If you have a commercial product with high reliability requirements, you would want premium support from whatever database vendor you choose. Erlang/OTP offers premium support, but I can't tell you whether they are willing to do it for the type of application you're intending (because (1) I don't work at OTP, and (2) I don't know what the app is.) If they are willing to support you, you have little to fear. If your application differs too much from what Mnesia was designed for, OTP will probably not offer any guarantees. That's not to say it wouldn't work; just that it would be unsupported, just as if you would download mysql from the net, build it from source and use it in your application. It probably works very well, but if it doesn't, you're on your own. For many of the applications dealing with vasts amounts of important data, the support factor is key to which DBMS they choose. That, and the licensing model (esp. if it's subscriber data.) /Uffe > > Valentin. > > > ----- Original Message ----- > From: "Eric Merritt" > To: "Torbjorn Tornkvist" > Cc: > Sent: Wednesday, January 19, 2005 12:25 AM > Subject: Re: Supervisor hierarchy question > > > > Torbjorn, > > > > You can always use the ODBC stuff provided with the erlang/OTP > > distribution. I needed something a little closer to the > wire and with > > a few extra options. Thats the main reson I implemented my own. > > Otherwise, the erlang ODBC stuff works just fine. > > > > > > On Tue, 18 Jan 2005 23:19:51 +0100, Torbjorn Tornkvist > > wrote: > > > Eric Merritt wrote: > > > > > > >Parts of it would. The connection pool specific stuff > would work just > > > >fine. However, my connection directly implements > postgresql's version > > > >3 protocol so it wouldn't be able to speak to mysql. However, if > > > >someone is willing to implement the mysql protocol I am more then > > > >happy to work with them to develop a consistant api. > > > > > > > > > > > Ok, I don't know (yet) what that protocol consist of, but > I think it > > > could be of interest to be able to access mysql from Erlang. > > > Any pointers where to look ? I guess I should browse around > > > mysql.com... ;-) > > > > > > Cheers, Tobbe > > > > > > > > > > >On Tue, 19 Apr 2005 00:30:55 +0200, Torbjorn Tornkvist > > > > wrote: > > > > > > > > > > > >>Would this code work with mysql as well ? > > > >> > > > >>Cheers, Tobbe > > > >> > > > >>Eric Merritt wrote: > > > >> > > > >> > > > >> > > > >>>That would actually rock. Its part of a larger > codebase that I havn't > > > >>>decided whether or not to open up. However, I have no > problem at all > > > >>>opening up the postgresql stuff. If you would like I > will grant you > > > >>>access to the subversion repository. If you can't get > a subversion > > > >>>client I will post it on the web somewhere. I don't > actually expect > to > > > >>>get the driver to a usable state before the end of the week. > > > >>> > > > >>> > > > >>>On Tue, 18 Jan 2005 15:48:06 +0000, ernie.makris@REDACTED > > > >>> wrote: > > > >>> > > > >>> > > > >>> > > > >>> > > > >>>>Hi Eric, > > > >>>> > > > >>>>I read the message about creating a client for > postgresql in erlang. > I am interested in helping you out, as I use postgresql from > erlang and > would be interested in such an interface. Can you post the > code? I can help > you test it if you'd like. > > > >>>> > > > >>>>Thanks > > > >>>>Ernie > > > >>>> > > > >>>> > > > >>>> > > > >>>> > > > >>>> > > > >>> > > > >>> > > > >>> > > > >>> > > > >> > > > >> > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > I'm a programmer, I don't have to spell correctly; I just have to > > spell consistently > > From aruna.jambunathan@REDACTED Wed Jan 19 09:54:45 2005 From: aruna.jambunathan@REDACTED (aruna.jambunathan@REDACTED) Date: Wed, 19 Jan 2005 14:24:45 +0530 Subject: Erlang installation problem Message-ID: Hi, I am trying to install Erlang R9C-2 onto a system whose specifications are: SunOS 5.8 Generic_108528-29 sun4u sparc SUNW, Ultra-2. The following error is encountered: checking size of short... 0 checking size of int... 0 checking size of long... 0 checking size of void *... 0 checking size of long long... 0 checking size of size_t... 0 checking size of off_t... 0 checking int/long/void*/size_t sizes... failed configure: error: Cannot handle this combination of int/long/void*/size_t sizes configure: error: /aims_home/sailajar/erlang/otp_src_R9C-2/erts/configure failed for erts After seeing this error, I tried make command but encountered the following error: make: Fatal error in reader: Makefile, line 114: Unexpected end of line seen Due to this I am unable to install erlang. The earlier version of Erlang on the same system is : "Erlang (BEAM) emulator version 5.1[source] Eshell V5.1" Kindly let me know the Erlang version compatibility with the above system. A quick response will be highly helpful as I am unable to proceed due to this problem. Regards, Aruna Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or Mailadmin@REDACTED immediately and destroy all copies of this message and any attachments. Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or Mailadmin@REDACTED immediately and destroy all copies of this message and any attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tobbe@REDACTED Wed Jan 19 09:57:43 2005 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Wed, 19 Jan 2005 09:57:43 +0100 Subject: Supervisor hierarchy question In-Reply-To: <00e601c4fdf0$251a5e80$0100a8c0@MONEYMAKER2> References: <011820051548.12465.41ED2FB5000F0819000030B122007623029C079D050E03D20A07029D0A@comcast.net> <4264351F.80609@nortelnetworks.com> <41ED8B87.9070305@nortelnetworks.com> <00e601c4fdf0$251a5e80$0100a8c0@MONEYMAKER2> Message-ID: <41EE2107.3010500@nortelnetworks.com> Valentin Micic wrote: >Would it be too crazy to atempt to provide a mnesia access module that would >use mysql or similar database for storage? >Thus, instead of using ODBC or similar one could use mnesia:activity.... > >BTW: I've been asked the other day why did I choose a Disney (a.k.a. Mickey >Mouse) Database for implementation of some serious data volumes. They said, >Even Ericsson is not using MNESIA... not that we have any problems, but... > >How does one fight such (IMHO) unjustified argument(s)? Can anybody tell me >of any comercial application of MNESIA. > > Yes, Nortel's SSL-VPN products is using Mnesia in all its glory. Cheers, Tobbe >Valentin. > > >----- Original Message ----- >From: "Eric Merritt" >To: "Torbjorn Tornkvist" >Cc: >Sent: Wednesday, January 19, 2005 12:25 AM >Subject: Re: Supervisor hierarchy question > > > > >>Torbjorn, >> >> You can always use the ODBC stuff provided with the erlang/OTP >>distribution. I needed something a little closer to the wire and with >>a few extra options. Thats the main reson I implemented my own. >>Otherwise, the erlang ODBC stuff works just fine. >> >> >>On Tue, 18 Jan 2005 23:19:51 +0100, Torbjorn Tornkvist >> wrote: >> >> >>>Eric Merritt wrote: >>> >>> >>> >>>>Parts of it would. The connection pool specific stuff would work just >>>>fine. However, my connection directly implements postgresql's version >>>>3 protocol so it wouldn't be able to speak to mysql. However, if >>>>someone is willing to implement the mysql protocol I am more then >>>>happy to work with them to develop a consistant api. >>>> >>>> >>>> >>>> >>>Ok, I don't know (yet) what that protocol consist of, but I think it >>>could be of interest to be able to access mysql from Erlang. >>>Any pointers where to look ? I guess I should browse around >>>mysql.com... ;-) >>> >>>Cheers, Tobbe >>> >>> >>> >>>>On Tue, 19 Apr 2005 00:30:55 +0200, Torbjorn Tornkvist >>>> wrote: >>>> >>>> >>>> >>>> >>>>>Would this code work with mysql as well ? >>>>> >>>>>Cheers, Tobbe >>>>> >>>>>Eric Merritt wrote: >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>That would actually rock. Its part of a larger codebase that I havn't >>>>>>decided whether or not to open up. However, I have no problem at all >>>>>>opening up the postgresql stuff. If you would like I will grant you >>>>>>access to the subversion repository. If you can't get a subversion >>>>>>client I will post it on the web somewhere. I don't actually expect >>>>>> >>>>>> >to > > >>>>>>get the driver to a usable state before the end of the week. >>>>>> >>>>>> >>>>>>On Tue, 18 Jan 2005 15:48:06 +0000, ernie.makris@REDACTED >>>>>> wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>>Hi Eric, >>>>>>> >>>>>>>I read the message about creating a client for postgresql in erlang. >>>>>>> >>>>>>> >I am interested in helping you out, as I use postgresql from erlang and >would be interested in such an interface. Can you post the code? I can help >you test it if you'd like. > > >>>>>>>Thanks >>>>>>>Ernie >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>>> >>>> >>> >>> >>-- >>I'm a programmer, I don't have to spell correctly; I just have to >>spell consistently >> >> > > > From raimo@REDACTED Wed Jan 19 11:23:10 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 19 Jan 2005 11:23:10 +0100 Subject: Erlang installation problem References: Message-ID: It seems as you are trying to build open source erlang for Solaris 8. Check the file erts/config.log and see what went long. The size of short being 0 is not right - it should be 2 or 4. All others are also wrong. They should be 4 or 8. Maybe your compiler is not correctly installed. It should be gcc. What does "gcc -- version" tell you? In short; this looks as a secondary error, the primary error occurred earlier. aruna.jambunathan@REDACTED writes: > Hi, > > > > I am trying to install Erlang R9C-2 onto a system whose specifications > are: > > SunOS 5.8 Generic_108528-29 sun4u sparc SUNW, Ultra-2. > > > > The following error is encountered: > > checking size of short... 0 > > checking size of int... 0 > > checking size of long... 0 > > checking size of void *... 0 > > checking size of long long... 0 > > checking size of size_t... 0 > > checking size of off_t... 0 > > checking int/long/void*/size_t sizes... failed > > configure: error: Cannot handle this combination of > int/long/void*/size_t sizes > > configure: error: > /aims_home/sailajar/erlang/otp_src_R9C-2/erts/configure failed for erts > > > > After seeing this error, I tried make command but encountered the > following error: > > make: Fatal error in reader: Makefile, line 114: Unexpected end of line > seen > > > > Due to this I am unable to install erlang. The earlier version of Erlang > on the same system is : > > "Erlang (BEAM) emulator version 5.1[source] > > Eshell V5.1" > > > > Kindly let me know the Erlang version compatibility with the above > system. A quick response will be highly helpful as I am unable to > proceed due to this problem. > > Regards, > > Aruna > > > > > > Confidentiality Notice > > The information contained in this electronic message and any attachments > to this message are intended > for the exclusive use of the addressee(s) and may contain confidential > or privileged information. If > you are not the intended recipient, please notify the sender at Wipro or > Mailadmin@REDACTED immediately > and destroy all copies of this message and any attachments. > > > > > > Confidentiality Notice > > The information contained in this electronic message and any attachments to this message are intended > for the exclusive use of the addressee(s) and may contain confidential or privileged information. If > you are not the intended recipient, please notify the sender at Wipro or Mailadmin@REDACTED immediately > and destroy all copies of this message and any attachments. -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From aruna.jambunathan@REDACTED Thu Jan 20 06:53:43 2005 From: aruna.jambunathan@REDACTED (aruna.jambunathan@REDACTED) Date: Thu, 20 Jan 2005 11:23:43 +0530 Subject: Erlang installation problem Message-ID: I am unable to locate sparc-sun-solaris2.8 and conftest.c in the erts folder. Aruna -----Original Message----- From: Raimo Niskanen [mailto:raimo@REDACTED] Sent: Wednesday, January 19, 2005 7:16 PM To: Aruna Jambunathan(WT01 - TELECOM SOLUTIONS) Subject: Re: Erlang installation problem This part is from erts/config.log: configure:3733: checking size of short configure:3752: gcc -o conftest -g -O2 -I/aims_home/sailajar/erlang/otp_src_R9C-2/erts/sparc-sun-solaris2.8 conftest.c -lncurses -lresolv -ldl -lm -lsocket -lnsl 1>&5 configure: failed program was: #line 3741 "configure" #include "confdefs.h" #include main() { FILE *f=fopen("conftestval", "w"); if (!f) exit(1); fprintf(f, "%d\n", sizeof(short)); exit(0); } I see no error printout. Try to paste the failing program from "#line 3751 ..." to "}" into a file "configure" and then run that gcc command above on it and see what fails. If it is linking that fails - check your LD_LIBRARY_PATH. And yes, Erlang is compatible with Solaris 8. It is our main internal platform and our most important license customer platform. They run on our binary release, though. But compiling open source Erlang for Solaris 8 should be no problem. You probably have some problem in your compiler/linker installation. -- / Raimo Niskanen, Erlang/OTP, Ericsson AB writes: > Hi, > > Thanks for your responses. I checked with gcc version. It is as > follows: > > > > # gcc --version > > gcc (GCC) 3.3.2 > > Copyright (C) 2003 Free Software Foundation, Inc. > > This is free software; see the source for copying conditions. There is > NO > > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR > PURPOSE. > > > > I also checked if ncursers library are installed as suggested by Henk > .They are already installed. Even then the problem is not solved > > > > # cd /usr/local/lib/ > > # ls -l | grep libncurses > > -rwxr-xr-x 1 bin 127772 May 2 2003 libncurses++.a* > > -rw-r--r-- 1 bin 464320 May 2 2003 libncurses.a > > lrwxrwxrwx 1 root 15 Feb 20 2004 libncurses.so -> > libncurses.so.5 > > lrwxrwxrwx 1 root 17 Feb 20 2004 libncurses.so.5 -> > libncurses.so.5.3 > > -rw-r--r-- 1 bin 339008 May 2 2003 libncurses.so.5.3 > > -rw-r--r-- 1 bin 4255308 May 2 2003 libncurses_g.a > > > > The earlier version of Erlang (R8B)on the same system is : > > > > "Erlang (BEAM) emulator version 5.1[source] > > Eshell V5.1" > > > > I have attached the /erts/config.log file > > > > Please let me know the version of erlang compatible with SunOS 5.8 > Generic_108528-29 sun4u sparc SUNW, Ultra-2. > > It would be of great help. > > > > > > Regards, > > Aruna > > > > > > > > > > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Raimo Niskanen > Sent: Wednesday, January 19, 2005 3:53 PM > To: erlang-questions@REDACTED > Subject: Re: Erlang installation problem > > > > It seems as you are trying to build open source erlang for Solaris 8. > > > > Check the file erts/config.log and see what went long. The size of > > short being 0 is not right - it should be 2 or 4. All others are > > also wrong. They should be 4 or 8. Maybe your compiler is not > > correctly installed. It should be gcc. What does "gcc -- version" > > tell you? > > > > In short; this looks as a secondary error, the primary error > > occurred earlier. > > > > > > > > -----Original Message----- > From: Henk Bijker [mailto:henk@REDACTED] > Sent: Wednesday, January 19, 2005 3:24 PM > To: Aruna Jambunathan(WT01 - TELECOM SOLUTIONS) > Subject: RE: mail to erlang mailing list > > > > Hi, > > > > I know we had the same problem, but I can't really remember what the > > solution was to this problem - I think it was the ncurses library. make > > sure it's installed, and then retry.... just a guess. > > > > Regards, > > > > > > > > > > > > Confidentiality Notice > > The information contained in this electronic message and any attachments to this message are intended > for the exclusive use of the addressee(s) and may contain confidential or privileged information. If > you are not the intended recipient, please notify the sender at Wipro or Mailadmin@REDACTED immediately > and destroy all copies of this message and any attachments. > Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or Mailadmin@REDACTED immediately and destroy all copies of this message and any attachments. From raimo@REDACTED Thu Jan 20 08:42:10 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 20 Jan 2005 08:42:10 +0100 Subject: Erlang installation problem References: Message-ID: Sorry, I gave fuzzy instructions. "conftest.c" does not exist - it is created by "configure" while it runs. To mimic what configure does; create a file "conftest.c" containing: --------------------------------------after-this-line #line 3741 "configure" #include "confdefs.h" #include main() { FILE *f=fopen("conftestval", "w"); if (!f) exit(1); fprintf(f, "%d\n", sizeof(short)); exit(0); } --------------------------------------before-this-line and then compile and link it using the same command as "configure": gcc -o conftest -g -O2 -I/aims_home/sailajar/erlang/otp_src_R9C-2/erts/sparc-sun-solaris2.8 conftest.c -lncurses -lresolv -ldl -lm -lsocket -lnsl That "erts/sparc-sun-solaris2.8" does not exist is strange, because it should be created by "configure". Try creating it yourself if necessary, otherwise try the "gcc" command above without the "-I/aims_home/sailajar/erlang/otp_src_R9C-2/erts/sparc-sun-solaris2.8" switch. I do not think it is important at this point for "configure". The compilation of "conftest.c" should produce an executable named "conftest". Try to run "conftest" - it should write a file named "conftestval" that contains "2" or whatever the size of short is on your machine. Now we'll see where this procedure fails... -- / Raimo Niskanen, Erlang/OTP, Ericsson AB aruna.jambunathan@REDACTED writes: > > I am unable to locate sparc-sun-solaris2.8 and conftest.c in the erts > folder. > > Aruna > > -----Original Message----- > From: Raimo Niskanen [mailto:raimo@REDACTED] > Sent: Wednesday, January 19, 2005 7:16 PM > To: Aruna Jambunathan(WT01 - TELECOM SOLUTIONS) > Subject: Re: Erlang installation problem > > This part is from erts/config.log: > > configure:3733: checking size of short > configure:3752: gcc -o conftest -g -O2 > -I/aims_home/sailajar/erlang/otp_src_R9C-2/erts/sparc-sun-solaris2.8 > conftest.c -lncurses -lresolv -ldl -lm -lsocket -lnsl 1>&5 > configure: failed program was: > #line 3741 "configure" > #include "confdefs.h" > #include > main() > { > FILE *f=fopen("conftestval", "w"); > if (!f) exit(1); > fprintf(f, "%d\n", sizeof(short)); > exit(0); > } > > I see no error printout. Try to paste the failing program from > "#line 3751 ..." to "}" into a file "configure" and then run > that gcc command above on it and see what fails. If it is > linking that fails - check your LD_LIBRARY_PATH. > > And yes, Erlang is compatible with Solaris 8. It is our main internal > platform and our most important license customer platform. They run > on our binary release, though. But compiling open source Erlang for > Solaris 8 should be no problem. You probably have some problem in > your compiler/linker installation. > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > writes: > > > Hi, > > > > Thanks for your responses. I checked with gcc version. It is as > > follows: > > > > > > > > # gcc --version > > > > gcc (GCC) 3.3.2 > > > > Copyright (C) 2003 Free Software Foundation, Inc. > > > > This is free software; see the source for copying conditions. There > is > > NO > > > > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR > > PURPOSE. > > > > > > > > I also checked if ncursers library are installed as suggested by Henk > > .They are already installed. Even then the problem is not solved > > > > > > > > # cd /usr/local/lib/ > > > > # ls -l | grep libncurses > > > > -rwxr-xr-x 1 bin 127772 May 2 2003 libncurses++.a* > > > > -rw-r--r-- 1 bin 464320 May 2 2003 libncurses.a > > > > lrwxrwxrwx 1 root 15 Feb 20 2004 libncurses.so -> > > libncurses.so.5 > > > > lrwxrwxrwx 1 root 17 Feb 20 2004 libncurses.so.5 -> > > libncurses.so.5.3 > > > > -rw-r--r-- 1 bin 339008 May 2 2003 libncurses.so.5.3 > > > > -rw-r--r-- 1 bin 4255308 May 2 2003 libncurses_g.a > > > > > > > > The earlier version of Erlang (R8B)on the same system is : > > > > > > > > "Erlang (BEAM) emulator version 5.1[source] > > > > Eshell V5.1" > > > > > > > > I have attached the /erts/config.log file > > > > > > > > Please let me know the version of erlang compatible with SunOS 5.8 > > Generic_108528-29 sun4u sparc SUNW, Ultra-2. > > > > It would be of great help. > > > > > > > > > > > > Regards, > > > > Aruna > > > > > > > > > > > > > > > > > > > > -----Original Message----- > > From: owner-erlang-questions@REDACTED > > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Raimo Niskanen > > Sent: Wednesday, January 19, 2005 3:53 PM > > To: erlang-questions@REDACTED > > Subject: Re: Erlang installation problem > > > > > > > > It seems as you are trying to build open source erlang for Solaris 8. > > > > > > > > Check the file erts/config.log and see what went long. The size of > > > > short being 0 is not right - it should be 2 or 4. All others are > > > > also wrong. They should be 4 or 8. Maybe your compiler is not > > > > correctly installed. It should be gcc. What does "gcc -- version" > > > > tell you? > > > > > > > > In short; this looks as a secondary error, the primary error > > > > occurred earlier. > > > > > > > > > > > > > > > > -----Original Message----- > > From: Henk Bijker [mailto:henk@REDACTED] > > Sent: Wednesday, January 19, 2005 3:24 PM > > To: Aruna Jambunathan(WT01 - TELECOM SOLUTIONS) > > Subject: RE: mail to erlang mailing list > > > > > > > > Hi, > > > > > > > > I know we had the same problem, but I can't really remember what the > > > > solution was to this problem - I think it was the ncurses library. > make > > > > sure it's installed, and then retry.... just a guess. > > > > > > > > Regards, > > > > > > > > > > > > > > > > > > > > > > > > Confidentiality Notice > > > > The information contained in this electronic message and any > attachments to this message are intended > > for the exclusive use of the addressee(s) and may contain confidential > or privileged information. If > > you are not the intended recipient, please notify the sender at Wipro > or Mailadmin@REDACTED immediately > > and destroy all copies of this message and any attachments. > > > > > > > Confidentiality Notice > > The information contained in this electronic message and any attachments to this message are intended > for the exclusive use of the addressee(s) and may contain confidential or privileged information. If > you are not the intended recipient, please notify the sender at Wipro or Mailadmin@REDACTED immediately > and destroy all copies of this message and any attachments. From Chandrashekhar.Mullaparthi@REDACTED Thu Jan 20 10:57:56 2005 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Thu, 20 Jan 2005 09:57:56 -0000 Subject: Supervisor hierarchy question Message-ID: Valentin, Our entire customer database is in Mnesia - that's about 18 million records. And it is used by countless number of services for realtime checks. cheers Chandru > -----Original Message----- > From: Valentin Micic [mailto:valentin@REDACTED] > Sent: 19 January 2005 06:29 > To: Eric Merritt; Torbjorn Tornkvist > Cc: erlang-questions@REDACTED > Subject: Re: Supervisor hierarchy question > > > Would it be too crazy to atempt to provide a mnesia access > module that would > use mysql or similar database for storage? > Thus, instead of using ODBC or similar one could use > mnesia:activity.... > > BTW: I've been asked the other day why did I choose a Disney > (a.k.a. Mickey > Mouse) Database for implementation of some serious data > volumes. They said, > Even Ericsson is not using MNESIA... not that we have any > problems, but... > > How does one fight such (IMHO) unjustified argument(s)? Can > anybody tell me > of any comercial application of MNESIA. > > Valentin. > > > ----- Original Message ----- > From: "Eric Merritt" > To: "Torbjorn Tornkvist" > Cc: > Sent: Wednesday, January 19, 2005 12:25 AM > Subject: Re: Supervisor hierarchy question > > > > Torbjorn, > > > > You can always use the ODBC stuff provided with the erlang/OTP > > distribution. I needed something a little closer to the > wire and with > > a few extra options. Thats the main reson I implemented my own. > > Otherwise, the erlang ODBC stuff works just fine. > > > > > > On Tue, 18 Jan 2005 23:19:51 +0100, Torbjorn Tornkvist > > wrote: > > > Eric Merritt wrote: > > > > > > >Parts of it would. The connection pool specific stuff > would work just > > > >fine. However, my connection directly implements > postgresql's version > > > >3 protocol so it wouldn't be able to speak to mysql. However, if > > > >someone is willing to implement the mysql protocol I am more then > > > >happy to work with them to develop a consistant api. > > > > > > > > > > > Ok, I don't know (yet) what that protocol consist of, but > I think it > > > could be of interest to be able to access mysql from Erlang. > > > Any pointers where to look ? I guess I should browse around > > > mysql.com... ;-) > > > > > > Cheers, Tobbe > > > > > > > > > > >On Tue, 19 Apr 2005 00:30:55 +0200, Torbjorn Tornkvist > > > > wrote: > > > > > > > > > > > >>Would this code work with mysql as well ? > > > >> > > > >>Cheers, Tobbe > > > >> > > > >>Eric Merritt wrote: > > > >> > > > >> > > > >> > > > >>>That would actually rock. Its part of a larger > codebase that I havn't > > > >>>decided whether or not to open up. However, I have no > problem at all > > > >>>opening up the postgresql stuff. If you would like I > will grant you > > > >>>access to the subversion repository. If you can't get > a subversion > > > >>>client I will post it on the web somewhere. I don't > actually expect > to > > > >>>get the driver to a usable state before the end of the week. > > > >>> > > > >>> > > > >>>On Tue, 18 Jan 2005 15:48:06 +0000, ernie.makris@REDACTED > > > >>> wrote: > > > >>> > > > >>> > > > >>> > > > >>> > > > >>>>Hi Eric, > > > >>>> > > > >>>>I read the message about creating a client for > postgresql in erlang. > I am interested in helping you out, as I use postgresql from > erlang and > would be interested in such an interface. Can you post the > code? I can help > you test it if you'd like. > > > >>>> > > > >>>>Thanks > > > >>>>Ernie > > > >>>> > > > >>>> > > > >>>> > > > >>>> > > > >>>> > > > >>> > > > >>> > > > >>> > > > >>> > > > >> > > > >> > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > I'm a programmer, I don't have to spell correctly; I just have to > > spell consistently > NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From aruna.jambunathan@REDACTED Wed Jan 19 14:22:41 2005 From: aruna.jambunathan@REDACTED (aruna.jambunathan@REDACTED) Date: Wed, 19 Jan 2005 18:52:41 +0530 Subject: Erlang installation problem Message-ID: Hi, Thanks for your responses. I checked with gcc version. It is as follows: # gcc --version gcc (GCC) 3.3.2 Copyright (C) 2003 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. I also checked if ncursers library are installed as suggested by Henk .They are already installed. Even then the problem is not solved # cd /usr/local/lib/ # ls -l | grep libncurses -rwxr-xr-x 1 bin 127772 May 2 2003 libncurses++.a* -rw-r--r-- 1 bin 464320 May 2 2003 libncurses.a lrwxrwxrwx 1 root 15 Feb 20 2004 libncurses.so -> libncurses.so.5 lrwxrwxrwx 1 root 17 Feb 20 2004 libncurses.so.5 -> libncurses.so.5.3 -rw-r--r-- 1 bin 339008 May 2 2003 libncurses.so.5.3 -rw-r--r-- 1 bin 4255308 May 2 2003 libncurses_g.a The earlier version of Erlang (R8B)on the same system is : "Erlang (BEAM) emulator version 5.1[source] Eshell V5.1" I have attached the /erts/config.log file Please let me know the version of erlang compatible with SunOS 5.8 Generic_108528-29 sun4u sparc SUNW, Ultra-2. It would be of great help. Regards, Aruna -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Raimo Niskanen Sent: Wednesday, January 19, 2005 3:53 PM To: erlang-questions@REDACTED Subject: Re: Erlang installation problem It seems as you are trying to build open source erlang for Solaris 8. Check the file erts/config.log and see what went long. The size of short being 0 is not right - it should be 2 or 4. All others are also wrong. They should be 4 or 8. Maybe your compiler is not correctly installed. It should be gcc. What does "gcc -- version" tell you? In short; this looks as a secondary error, the primary error occurred earlier. -----Original Message----- From: Henk Bijker [mailto:henk@REDACTED] Sent: Wednesday, January 19, 2005 3:24 PM To: Aruna Jambunathan(WT01 - TELECOM SOLUTIONS) Subject: RE: mail to erlang mailing list Hi, I know we had the same problem, but I can't really remember what the solution was to this problem - I think it was the ncurses library. make sure it's installed, and then retry.... just a guess. Regards, Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or Mailadmin@REDACTED immediately and destroy all copies of this message and any attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: config.log Type: application/octet-stream Size: 20969 bytes Desc: config.log URL: From erlang@REDACTED Fri Jan 21 07:31:57 2005 From: erlang@REDACTED (Michael McDaniel) Date: Thu, 20 Jan 2005 22:31:57 -0800 Subject: http:set_options/1, http:request/4 Message-ID: <20050121063157.GJ10649@fangora.autosys.us> BRIEFLY: http:request/4 used directly will properly retrieve URL. http:request/4 through proxy fails. DETAILS: Linux fangora 2.6.4-52-default #1 Wed Apr 7 02:08:30 UTC 2004 i686 i686 i386 GNU/Linux using erl Eshell V5.4.3 (abort with ^G) +----------------+ | www.erlang.org | +----------------+ | INTERNET | +-------+--------+ | www.autosys.us | +-------+--------+ | | +-------+------------+ | fangora.autosys.us | +--------------------+ hd.erl is running on fangora.autosys.us inside private network. Squid proxy is running on www.autosys.us (aka cougora.autosys.us) on port 3128. -module(hd). -export([hd/2]). hd(Port, URL) -> application:start(inets) , http:set_options([{proxy, { {"cougora.autosys.us", Port}, ["www.autosys.us", "autosys.us", "localhost"]} }]) , http:request(get, {URL, [ {"Referer", URL}, {"Host", "fangora.autosys.us"} ]}, [], []). %% end hd.erl 1> hd:hd(3128,"http://www.erlang.org"). {ok,{{"HTTP/1.0",400,"Bad Request"}, ... 2> hd:hd(3128,"http://www.autosys.us"). {ok,{{"HTTP/1.1",200,"OK"}, ... 3> The problem appears to be that the http:request/4 command in both of the above invocations create the following get: GET / HTTP/1.1 This is fine when not using proxy. When using proxy, the proxy server is expecting, for example, "GET http://www.erlang.org HTTP/1.1", so the get request fails. Follows is the headers trace... GET / HTTP/1.1 Host: fangora.autosys.us TE: referer: http://www.erlang.org HTTP/1.0 400 Bad Request Server: squid/3.0-PRE3 Mime-Version: 1.0 Date: Fri, 21 Jan 2005 05:55:23 GMT Content-Type: text/html Content-Length: 1436 Expires: Fri, 21 Jan 2005 05:55:23 GMT X-Squid-Error: ERR_INVALID_URL 0 X-Cache: MISS from cougora.autosys.us X-Cache-Lookup: NONE from cougora.autosys.us:3128 Via: 1.0 cougora.autosys.us (squid/3.0-PRE3) Proxy-Connection: close Follows is headers trace from a succesful browser GET GET http://www.erlang.org/ HTTP/1.1 Host: www.erlang.org User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a4) Gecko/20040927 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Proxy-Connection: keep-alive HTTP/1.0 200 OK Date: Fri, 21 Jan 2005 06:28:51 GMT Server: Apache/1.3.9 (Unix) Last-Modified: Wed, 15 Dec 2004 14:24:04 GMT ETag: "8d715-1efb-41c04904" Accept-Ranges: bytes Content-Length: 7931 Content-Type: text/html X-Cache: MISS from cougora.autosys.us X-Cache-Lookup: MISS from cougora.autosys.us:3128 Via: 1.0 cougora.autosys.us (squid/3.0-PRE3) Proxy-Connection: keep-alive At first I thought the problem was the TE: (transport encoding) header, but it is not. I did the tests with adding the other headers. The problem is the initial "GET". The browser is configured to use the squid proxy on port 3128. I tried the following: 1> hd:hd(3128,"http://www.erlang.org/http://www.erlang.org"). and the GET is "GET /http://www.erlang.org HTTP/1.1" which is still wrong. Any suggestions are welcome. I want to be able to use the commands from my inside machine through proxy on Internet connected machine. Michael McDaniel Portland, Oregon, USA From ingela@REDACTED Fri Jan 21 08:44:41 2005 From: ingela@REDACTED (Ingela Anderton) Date: Fri, 21 Jan 2005 08:44:41 +0100 Subject: http:set_options/1, http:request/4 References: <20050121063157.GJ10649@fangora.autosys.us> Message-ID: <16880.45801.415865.306337@gargle.gargle.HOWL> Michael McDaniel wrote: [...] > 1> hd:hd(3128,"http://www.erlang.org"). > {ok,{{"HTTP/1.0",400,"Bad Request"}, ... > 2> hd:hd(3128,"http://www.autosys.us"). > {ok,{{"HTTP/1.1",200,"OK"}, ... > 3> > > The problem appears to be that the http:request/4 command in both of > the above invocations create the following get: > > GET / HTTP/1.1 > > This is fine when not using proxy. When using proxy, the proxy server > is expecting, for example, "GET http://www.erlang.org HTTP/1.1", > so the get request fails. Humm... you clearly found a bug. Unfortunately the proxy-server that we use for testing does not fail as yours did, it somehow manages to deliver the correct page anyway. I will correct it in time for the next open source release that is planed for the 9 of februari. -- /Ingela - OTP team From mickael.remond@REDACTED Fri Jan 21 15:33:32 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Fri, 21 Jan 2005 15:33:32 +0100 Subject: Supervisor hierarchy question In-Reply-To: <41EE2107.3010500@nortelnetworks.com> References: <011820051548.12465.41ED2FB5000F0819000030B122007623029C079D050E03D20A07029D0A@comcast.net> <4264351F.80609@nortelnetworks.com> <41ED8B87.9070305@nortelnetworks.com> <00e601c4fdf0$251a5e80$0100a8c0@MONEYMAKER2> <41EE2107.3010500@nortelnetworks.com> Message-ID: <41F112BC.3040408@erlang-fr.org> Torbjorn Tornkvist wrote: > Yes, Nortel's SSL-VPN products is using Mnesia in all its glory. Regarding Mnesia, I have a question to all of you that are also using it in production. What do you use for backuping Mnesia ? What function do you call ? From our experience, the Mnesia backup function can eat a lot of memory. This is for sure related to the distributed feature and the fact that a stable checkpoint must be generated. But you need a lot of RAM to do such operation. This is the same for table structure updates. On some hardware, it could be difficult to keep several hundreds of Mo in RAM just to be safe with backups. Could this be related to the number of waiting messages queued before Mnesia ? So, I wanted to have your feedback on how you handle those administration Mnesia process ? Thank you in advance for your feedback. -- Micka?l R?mond http://www.erlang-projects.org/ From kramer@REDACTED Sat Jan 22 07:08:43 2005 From: kramer@REDACTED (Reto Kramer) Date: Fri, 21 Jan 2005 22:08:43 -0800 Subject: soft-upgrade vs failover and back to/from 2nd-ary system Message-ID: <11760DCE-6C3C-11D9-8685-000393B64312@acm.org> I admire the soft-upgrade approach in Erlang and OTP's support for coordination thereof very much, but am puzzled why it had to be invented. It must be due to my ignorance of the context of the problem (and the protocols involved) I'm sure - help me out please! Context: Imagine a system that requires two nodes for fault tolerance. Each node must be able to take over the other node's traffic (and state if protocols are stateful) at any one point to handle the fault of one of them. For such architectures, system upgrade can be performed by artificially evacuating a node, restarting it (VM process) with the new version of the code and rebalancing the traffic. This works really well if the protocols used to talk to these nodes support some form of redirection (either in the sender process, or in an intermediary such as a load balancer for http traffic). Q: When does it not work well? Q: Are there guidelines as to when I should rather invest in writing soft-upgradable code when I can get away with the above brute force approach to system upgrade? Q: Many systems that run Erlang do indeed contain redundant CPU boards (or multiple machines). Is there an easy way to characterize why the brute force upgrade approach did not work in those systems (AXD 301 comes to mind of course) and the soft-upgrade approach had to be invented? I could not find guidelines for when to use brute-force upgrade in a dual node system vs soft-upgrade in the documentation or papers (comparing the two in general terms, or specific examples of pro/cons) - can anyone point me at material? I fear the answer must be obvious or trivial, or left to the reader ;-) In reality I found that live system upgrade is a massive headache (for successful system only ;-) and it's odd that not more is written about how to architect for it from the the beginning, what the limitations and pitfalls are with either approach etc. Thanks, - Reto From ulf@REDACTED Sat Jan 22 18:29:18 2005 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 22 Jan 2005 18:29:18 +0100 Subject: soft-upgrade vs failover and back to/from 2nd-ary system In-Reply-To: <11760DCE-6C3C-11D9-8685-000393B64312@acm.org> References: <11760DCE-6C3C-11D9-8685-000393B64312@acm.org> Message-ID: Den 2005-01-22 07:08:43 skrev Reto Kramer : > Context: Imagine a system that requires two nodes for fault tolerance. > Each node must be able to take over the other node's traffic (and state > if protocols are stateful) at any one point to handle the fault of one > of them. > > For such architectures, system upgrade can be performed by artificially > evacuating a node, restarting it (VM process) with the new version of > the code and rebalancing the traffic. This works really well if the > protocols used to talk to these nodes support some form of redirection > (either in the sender process, or in an intermediary such as a load > balancer for http traffic). > > Q: When does it not work well? There are indeed good reasons to always upgrade a redundant system using the redundancy mechanisms - esp. since that mechanism sometimes is the only reasonable option. For systems that have no redundancy, soft upgrade is a better option than to design for redundancy anyway and then e.g. starting a second node and doing a redundancy upgrade. One could of course argue that if the system has no redundancy, then downtime during upgrade must be acceptable. > Q: Are there guidelines as to when I should rather invest in writing > soft-upgradable code when I can get away with the above brute force > approach to system upgrade? For debugging and patching, soft upgrade is superb. You can fairly easily write code that is soft-upgradeable in Erlang/OTP, and using it, you can swiftly load instrumented code or correct minor software bugs without the users even noticing. I've had occasions where I've developed server applications, and had the server up and running all the time, always correcting errors and adding new features through soft upgrade, and not restarting the server for weeks. Very convenient, even if not perhaps strictly necessary. > Q: Many systems that run Erlang do indeed contain redundant CPU boards > (or multiple machines). Is there an easy way to characterize why the > brute force upgrade approach did not work in those systems (AXD 301 > comes to mind of course) and the soft-upgrade approach had to be > invented? AXD 301 supports a wide range of upgrade techniques, from soft upgrade to system reboot with an upgraded configuration database. One reason for this is that the AXD301 project started roughly at the same time as the first version of OTP was being developed. Our understanding of software upgrade using OTP in a very large system was understandably poor in the beginning (it had never been done before!), so we kept inventing ways to do it, until we eventually had support for almost all techniques you can think of. (: Redundancy upgrade is in there somewhere between the extremes, and is one of the more useful techniques, but soft upgrade is used quite often, esp. for error correction packages. > I could not find guidelines for when to use brute-force upgrade in a > dual node system vs soft-upgrade in the documentation or papers > (comparing the two in general terms, or specific examples of pro/cons) - > can anyone point me at material? I fear the answer must be obvious or > trivial, or left to the reader ;-) In reality I found that live system > upgrade is a massive headache (for successful system only ;-) and it's > odd that not more is written about how to architect for it from the the > beginning, what the limitations and pitfalls are with either approach > etc. I don't think such documentation exists, unfortunately. And I agree - live system upgrade _is_ a massive headache, esp. of large systems. Regards, Uffe -- Anv?nder Operas banbrytande e-postklient: http://www.opera.com/m2/ From matthias@REDACTED Sun Jan 23 21:00:18 2005 From: matthias@REDACTED (Matthias Lang) Date: Sun, 23 Jan 2005 21:00:18 +0100 Subject: soft-upgrade vs failover and back to/from 2nd-ary system In-Reply-To: <11760DCE-6C3C-11D9-8685-000393B64312@acm.org> References: <11760DCE-6C3C-11D9-8685-000393B64312@acm.org> Message-ID: <16884.594.453689.181445@antilipe.corelatus.se> Reto Kramer writes: > Context: Imagine a system that requires two nodes for fault tolerance. > Each node must be able to take over the other node's traffic (and state > if protocols are stateful) at any one point to handle the fault of one > of them. > For such architectures, system upgrade can be performed by artificially > evacuating a node, restarting it (VM process) with the new version of > the code and rebalancing the traffic. This works really well if the > protocols used to talk to these nodes support some form of redirection > (either in the sender process, or in an intermediary such as a load > balancer for http traffic). > Q: When does it not work well? A1) When you only have one node A2) When the state is long lived and difficult, or impossible, to transfer from one node to another. HTTP is pretty much the opposite of A2. In many telco applications, A2 describes the situation perfectly. On one telco voice application I worked on, a typical upgrade/patch meant: 1. Block new calls to the node. 2. Wait until all calls end (i.e. people finish talking). 3. Do the upgrade 4. Unblock Waiting for everyone to finish talking can take a long time. There are two ways to reduce the wait: first, upgrade in the middle of the night. Second, once you've waited (say) an hour, there'll just be a handful of callers left, so you could just disconnect them and let the helpdesk handle the complaints. On that system, we could also insert "small" patches by loading new code into Erlang. That eliminated all the waiting and sprinting down the corridor to escape enraged helpdesk people. --- Hot code loading isn't as general as 'evacuate-upgrade-restart' with isolated, duplicated hardware. You can't upgrade the OS or VM by reloading code. But in many systems it is simpler. In such systems you handle most upgrades without any downtime and then accept a couple of minutes per year of _planned_ downtime to upgrade the OS. In return, you get a simpler (== less unplanned downtime) and cheaper system. Matt From james.hague@REDACTED Mon Jan 24 19:48:35 2005 From: james.hague@REDACTED (James Hague) Date: Mon, 24 Jan 2005 12:48:35 -0600 Subject: BEAM implementation questions Message-ID: Just a couple of questions about the current Erlang implementation: 1. BEAM builds structured constants at runtime, whereas HIPE doesn't. For example, consider nouns() -> ["house", "cat", "tree"]. Each time nouns() is called, four new lists are created with BEAM, whereas HIPE simply returns a pointer to pre-built data. Any chance of this ever being brought over to BEAM? 2. Let's say I have the following code: receive ready -> do_something() end Now suppose I send 100 messages to that process and the last one is the atom "ready". Is there some kind of high-level checking when a message is sent to that process, to see that the process is specifically waiting for a message of a certain format? Or does the process simply get executed periodically, scans the mailbox for "ready," finds that there is none and exits? (I'm hoping that makes sense!) James From mikpe@REDACTED Mon Jan 24 21:52:38 2005 From: mikpe@REDACTED (Mikael Pettersson) Date: Mon, 24 Jan 2005 21:52:38 +0100 Subject: BEAM implementation questions In-Reply-To: References: Message-ID: <16885.24598.420559.848974@alkaid.it.uu.se> James Hague writes: > 1. BEAM builds structured constants at runtime, whereas HIPE doesn't. > For example, consider nouns() -> ["house", "cat", "tree"]. Each time > nouns() is called, four new lists are created with BEAM, whereas HIPE > simply returns a pointer to pre-built data. Any chance of this ever > being brought over to BEAM? This is difficult to do, because of some fundamental and not easily changed aspects of the Erlang/OTP memory management system. Even the HiPE implementation suffers, in that it cannot handle arbitrarily large amounts of constant terms. There are plans to rectify the underlying problem, at which time also BEAM could support constant terms. But don't hold your breath because it's a non-trivial change and developer time is scarce.. /Mikael (one of the HiPE developers) From techieyang@REDACTED Tue Jan 25 02:46:32 2005 From: techieyang@REDACTED (Techie Yang) Date: Tue, 25 Jan 2005 09:46:32 +0800 Subject: Supervisor hierarchy question Message-ID: <200501250147.j0P1l8b04851@hades.cslab.ericsson.net> And is it possible to enable mnesia/SNMP on a board with just 32M RAM, in case without huge bulks of data to be manipulated? Thanks in advance for your hints! Best Regards >Torbjorn Tornkvist wrote: >> Yes, Nortel's SSL-VPN products is using Mnesia in all its glory. > >Regarding Mnesia, I have a question to all of you that are also using it >in production. What do you use for backuping Mnesia ? What function do >you call ? > From our experience, the Mnesia backup function can eat a lot of >memory. This is for sure related to the distributed feature and the fact >that a stable checkpoint must be generated. > >But you need a lot of RAM to do such operation. This is the same for >table structure updates. On some hardware, it could be difficult to keep >several hundreds of Mo in RAM just to be safe with backups. Could this >be related to the number of waiting messages queued before Mnesia ? > >So, I wanted to have your feedback on how you handle those >administration Mnesia process ? > >Thank you in advance for your feedback. > >-- >Micka?l R?mond > http://www.erlang-projects.org/ > = = = = = = = = = = = = = = = = = = = = ?????????????????? ???? ????????????????Techie Yang ????????????????techieyang@REDACTED ????????????????????2005-01-25 From raimo@REDACTED Tue Jan 25 08:28:01 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 25 Jan 2005 08:28:01 +0100 Subject: BEAM implementation questions References: Message-ID: Well, it is only the receiver that knows what it wants, and it executes .beam code to match the received messages, so - yes, the receiver gets scheduled, tries to match from the inqueue, fails and schedules out. The good thing is that it is remembered which message is the next to match (since the receive clauses will not change during the recive no old messages will ever match) so it is only new messages that are tried next time. james.hague@REDACTED (James Hague) writes: > 2. Let's say I have the following code: > > receive ready -> do_something() end > > Now suppose I send 100 messages to that process and the last one is > the atom "ready". Is there some kind of high-level checking when a > message is sent to that process, to see that the process is > specifically waiting for a message of a certain format? Or does the > process simply get executed periodically, scans the mailbox for > "ready," finds that there is none and exits? (I'm hoping that makes > sense!) > > James -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From valentin@REDACTED Tue Jan 25 08:32:16 2005 From: valentin@REDACTED (Valentin Micic) Date: Tue, 25 Jan 2005 09:32:16 +0200 Subject: Supervisor hierarchy question References: <011820051548.12465.41ED2FB5000F0819000030B122007623029C079D050E03D20A07029D0A@comcast.net> <4264351F.80609@nortelnetworks.com> <41ED8B87.9070305@nortelnetworks.com> <00e601c4fdf0$251a5e80$0100a8c0@MONEYMAKER2> <41EE2107.3010500@nortelnetworks.com> <41F112BC.3040408@erlang-fr.org> Message-ID: <02d801c502b0$11c3a020$0100a8c0@MONEYMAKER2> How do we handle MNESIA backup? Hmmmm.... For our latest project, where we use MNESIA for some 90 million records, we did develop a custom replication mechanism, that forwards the replication data near-real time to MNESIA node that is NOT part of the same schema. Whenever we want to do backup we: 1) Stop replication -- originating node keeps queuing changes 2) Stop a hot-stand-by database 3) Take a backup of data files 4) Start the hot-stand-by database 5) Start replication When we need to restore, from scratch, we: 1) Create MNESIA schema 2) Start MNESIA 3) Create Database tables to mirror the original database 4) Stop MNESIA 5) Move backed-up data files 6) Start MNESIA I'd be very interested in seeing similar approach in MNESIA proper, in addition to existing replication mechanisms of course. How complicated would it be to do that? Valentin. PS Has anybody used Polyserve products with MNESIA? Is there any way to keep disk-based schema table information away form the data files? By the same token, is there a way for storing data-files belonging to the same NODE using different disk volumes? I remember trying links a while ago, but wasn't successful. ----- Original Message ----- From: "Mickael Remond" Cc: Sent: Friday, January 21, 2005 4:33 PM Subject: Re: Supervisor hierarchy question Torbjorn Tornkvist wrote: > Yes, Nortel's SSL-VPN products is using Mnesia in all its glory. Regarding Mnesia, I have a question to all of you that are also using it in production. What do you use for backuping Mnesia ? What function do you call ? From our experience, the Mnesia backup function can eat a lot of memory. This is for sure related to the distributed feature and the fact that a stable checkpoint must be generated. But you need a lot of RAM to do such operation. This is the same for table structure updates. On some hardware, it could be difficult to keep several hundreds of Mo in RAM just to be safe with backups. Could this be related to the number of waiting messages queued before Mnesia ? So, I wanted to have your feedback on how you handle those administration Mnesia process ? Thank you in advance for your feedback. -- Micka?l R?mond http://www.erlang-projects.org/ From tobbe@REDACTED Tue Jan 25 09:10:15 2005 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Tue, 25 Jan 2005 09:10:15 +0100 Subject: Supervisor hierarchy question In-Reply-To: <41F112BC.3040408@erlang-fr.org> References: <011820051548.12465.41ED2FB5000F0819000030B122007623029C079D050E03D20A07029D0A@comcast.net> <4264351F.80609@nortelnetworks.com> <41ED8B87.9070305@nortelnetworks.com> <00e601c4fdf0$251a5e80$0100a8c0@MONEYMAKER2> <41EE2107.3010500@nortelnetworks.com> <41F112BC.3040408@erlang-fr.org> Message-ID: <41F5FEE7.6000005@nortelnetworks.com> Mickael Remond wrote: > Torbjorn Tornkvist wrote: > >> Yes, Nortel's SSL-VPN products is using Mnesia in all its glory. > > > Regarding Mnesia, I have a question to all of you that are also using > it in production. What do you use for backuping Mnesia ? What function > do you call ? Perhaps, I was a bit too quick to answer. We don't use Mnesia "in all its glory". For example, we don't do Mnesia backups. We are using Mnesia to store configuration data, spread out over a distributed cluster of machines. The "backup" of the config data is done manually by the operator, and is dumped into an (XML) config file. No traffic generated data is stored on the machine(s) (apart from some volatile statistics). Instead, it is possible to enable Radius Accounting, which logs such info to an external Radius Accounting server. Cheers, Tobbe From thomasl_erlang@REDACTED Tue Jan 25 10:34:30 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 25 Jan 2005 01:34:30 -0800 (PST) Subject: BEAM implementation questions In-Reply-To: Message-ID: <20050125093430.22170.qmail@web41907.mail.yahoo.com> --- James Hague wrote: > Just a couple of questions about the current Erlang > implementation: > > 1. BEAM builds structured constants at runtime, > whereas HIPE doesn't. > For example, consider nouns() -> ["house", "cat", > "tree"]. I'd like support for this, perhaps even moreso if there was some language support for declaring "constant data". > [messaging implementation] As far as I recall, when a message arrives to a waiting process, the process is set to be ready to run. If the message doesn't match the current receive, the process resuspends. (If several messages have arrived, they are scanned in arrival order.) A suspended process thus has already scanned through the existing messages in the mailbox, if any. The whole mailbox will be rescanned at the next receive. However, while this implementation seems reasonable enough, the actual semantics of Erlang (such as they are) permit other implementations than this. Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Mail - You care about security. So do we. http://promotions.yahoo.com/new_mail From richardc@REDACTED Tue Jan 25 13:07:38 2005 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 25 Jan 2005 13:07:38 +0100 (MET) Subject: BEAM implementation questions In-Reply-To: <20050125093430.22170.qmail@web41907.mail.yahoo.com> References: <20050125093430.22170.qmail@web41907.mail.yahoo.com> Message-ID: > However, while this implementation seems reasonable > enough, the actual semantics of Erlang (such as they > are) permit other implementations than this. There is surprisingly little slack in the semantics of receive (sometimes this can be a bit of a problem for implementors). Possibly the most compact and complete description can be found in the Core Erlang specification: http://www.it.uu.se/research/group/hipe/cerl/ (There is no real difference between the receive construct in Core Erlang and in Erlang.) /Richard Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://user.it.uu.se/~richardc/ "Having users is like optimization: the wise course is to delay it." -- Paul Graham From sebastian@REDACTED Tue Jan 25 13:26:10 2005 From: sebastian@REDACTED (Sebastian Bello) Date: Tue, 25 Jan 2005 10:26:10 -0200 Subject: Performance of Erlang data structures Message-ID: <013e01c502d9$0e4244f0$3000a8c0@Inswitch261> Hi, is there a document regarding performance of Erlang data structures? For example, what is the performance (order, o(n), constant, etc) of the insertion in a list, the lookup, etc. Just to know what data structures to use when performance is an issue. Thanks, Sebastian- -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Tue Jan 25 13:33:34 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 25 Jan 2005 13:33:34 +0100 Subject: Performance of Erlang data structures In-Reply-To: <013e01c502d9$0e4244f0$3000a8c0@Inswitch261> References: <013e01c502d9$0e4244f0$3000a8c0@Inswitch261> Message-ID: <41F63C9E.8000101@ericsson.com> Sebastian Bello wrote: > Hi, > > is there a document regarding performance of Erlang data structures? For > example, what is the performance (order, o(n), constant, etc) of the > insertion in a list, the lookup, etc. Just to know what data structures > to use when performance is an issue. > Thanks, > Sebastian- > you can start with this document: http://www.erlang.se/doc/doc-5.4.3/doc/efficiency_guide/part_frame.html bengt From raimo@REDACTED Tue Jan 25 13:55:56 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 25 Jan 2005 13:55:56 +0100 Subject: Performance of Erlang data structures References: <013e01c502d9$0e4244f0$3000a8c0@Inswitch261> Message-ID: You can have a look at: http://otp.ericsson.se:8000/product/info/otp_unix/doc/efficiency_guide/part_frame.html but there might be other documents that more directly answers your question. Regarding the basic types, lists are chains of cons cells and there are no reverse pointers, nor pointers to the end of the list. This means that append, search, insert, indexing, etc. are O(n), while consing or matching from the head is O(1). Tuples are fixed size arrays, but when replacing an element in a tuple, a copy of the whole tuple except for one element has to be made. This means that search, replace, copy is O(n) while indexing is O(1). Often you want to use higher abstraction data organisation, e.g ets, gb_trees, gb_sets. Look at their manpages. They might at least contain a hint of what basic algorithms are used, tree or hash or such, and that might give you indirect information about their performance. sebastian@REDACTED (Sebastian Bello) writes: > Hi, > > is there a document regarding performance of Erlang data structures? For example, what is the performance (order, o(n), constant, etc) of the insertion in a list, the lookup, etc. Just to know what data structures to use when performance is an issue. > Thanks, > Sebastian- > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From sebastian@REDACTED Tue Jan 25 13:58:41 2005 From: sebastian@REDACTED (Sebastian Bello) Date: Tue, 25 Jan 2005 10:58:41 -0200 Subject: Performance of Erlang data structures References: <013e01c502d9$0e4244f0$3000a8c0@Inswitch261> <41F63C9E.8000101@ericsson.com> Message-ID: <016001c502dd$99088eb0$3000a8c0@Inswitch261> Thank you Bengt. Sebastian- ----- Original Message ----- From: "Bengt Kleberg" To: Sent: Tuesday, January 25, 2005 10:33 AM Subject: Re: Performance of Erlang data structures > Sebastian Bello wrote: > > Hi, > > > > is there a document regarding performance of Erlang data structures? For > > example, what is the performance (order, o(n), constant, etc) of the > > insertion in a list, the lookup, etc. Just to know what data structures > > to use when performance is an issue. > > Thanks, > > Sebastian- > > > > you can start with this document: > http://www.erlang.se/doc/doc-5.4.3/doc/efficiency_guide/part_frame.html > > > bengt > From raimo@REDACTED Tue Jan 25 13:58:56 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 25 Jan 2005 13:58:56 +0100 Subject: Performance of Erlang data structures References: <013e01c502d9$0e4244f0$3000a8c0@Inswitch261>, Message-ID: Sorry, broken link, see the other reply instead. Raimo Niskanen writes: > You can have a look at: > http://otp.ericsson.se:8000/product/info/otp_unix/doc/efficiency_guide/part_frame.html > but there might be other documents that more directly answers your > question. > > Regarding the basic types, lists are chains of cons cells and there > are no reverse pointers, nor pointers to the end of the list. This > means that append, search, insert, indexing, etc. are O(n), while consing > or matching from the head is O(1). > > Tuples are fixed size arrays, but when replacing an element in > a tuple, a copy of the whole tuple except for one element > has to be made. This means that search, replace, copy is O(n) while > indexing is O(1). > > Often you want to use higher abstraction data organisation, e.g > ets, gb_trees, gb_sets. Look at their manpages. They might at > least contain a hint of what basic algorithms are used, > tree or hash or such, and that might give you indirect > information about their performance. > > sebastian@REDACTED (Sebastian Bello) writes: > > > Hi, > > > > is there a document regarding performance of Erlang data structures? For example, what is the performance (order, o(n), constant, etc) of the insertion in a list, the lookup, etc. Just to know what data structures to use when performance is an issue. > > Thanks, > > Sebastian- > > > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From thomasl_erlang@REDACTED Tue Jan 25 14:06:32 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 25 Jan 2005 05:06:32 -0800 (PST) Subject: BEAM implementation questions In-Reply-To: Message-ID: <20050125130632.66660.qmail@web41903.mail.yahoo.com> --- Richard Carlsson wrote: > There is surprisingly little slack in the semantics > of receive (sometimes this can be a bit of a problem > for implementors). Yet even if we use the Core Erlang definition, it's still lax enough to permit other implementations with the same functional behaviour, I'm sure you'll agree. Taking a broader view, the semantics you mention in the Core Erlang specification is very operational, but one could also go for more denotational (or at least higher-level) versions. The message passing guarantees I seem to recall seeing in the Erlang documentation are fairly freewheeling about order of delivery of messages sent, for example. (Though I can't seem to find the passage I was thinking about, so I'll have to mumble a bit here ... :-) An Erlang implementation (a perverse one?) could conceivably exploit that, for instance. (Well, this could probably be expressed better, but I'll have to leave it at that.) Best, Thomas __________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo From nm@REDACTED Tue Jan 25 15:20:26 2005 From: nm@REDACTED (Gaspar Chilingarov) Date: Tue, 25 Jan 2005 18:20:26 +0400 Subject: [newbie] Erlangish way of Iterator pattern Message-ID: <41F655AA.5040403@web.am> Hello! I'm beginning to program in erlang and hit the following problem. in mainstream language i will do the following -- create Iterator class to read data from socket or file i.e. class with Open/GetNext functions. Open should just do all work for preparing data source and GetNext will return lines of data or EOF(freeing resources when reaching EOF). what i have in erlang -- i have erlang process, which can accept data messages and eof messages and do processing. another process hangs around, waiting for TCP connection and feeding first process with data read from TCP. in the same time i have shell script which runs once a minute and feeds data from some file(or piped command line) to TCP port. now i want to get rid of shell script, but i wish to have separate module which will do this -- i.e. 1. running periodically external command, 2. feeding to another process. are there any idioms in Erlang for this or it should be implemented in straight way -- i.e. just another process sitting there and doing it's job -- file reading/parsing/feeding to another process ? -- Gaspar Chilingarov System Administrator t +3749 419763 w www.web.am e nm@REDACTED From sebastian@REDACTED Tue Jan 25 15:24:45 2005 From: sebastian@REDACTED (Sebastian Bello) Date: Tue, 25 Jan 2005 12:24:45 -0200 Subject: Performance of Erlang data structures References: <013e01c502d9$0e4244f0$3000a8c0@Inswitch261>, Message-ID: <01b401c502e9$9f428720$3000a8c0@Inswitch261> Ok. Thank you Raimo for your explanation. ----- Original Message ----- From: "Raimo Niskanen" To: Sent: Tuesday, January 25, 2005 10:58 AM Subject: Re: Performance of Erlang data structures > Sorry, broken link, see the other reply instead. > > Raimo Niskanen writes: > > > You can have a look at: > > http://otp.ericsson.se:8000/product/info/otp_unix/doc/efficiency_guide/part_ frame.html > > but there might be other documents that more directly answers your > > question. > > > > Regarding the basic types, lists are chains of cons cells and there > > are no reverse pointers, nor pointers to the end of the list. This > > means that append, search, insert, indexing, etc. are O(n), while consing > > or matching from the head is O(1). > > > > Tuples are fixed size arrays, but when replacing an element in > > a tuple, a copy of the whole tuple except for one element > > has to be made. This means that search, replace, copy is O(n) while > > indexing is O(1). > > > > Often you want to use higher abstraction data organisation, e.g > > ets, gb_trees, gb_sets. Look at their manpages. They might at > > least contain a hint of what basic algorithms are used, > > tree or hash or such, and that might give you indirect > > information about their performance. > > > > sebastian@REDACTED (Sebastian Bello) writes: > > > > > Hi, > > > > > > is there a document regarding performance of Erlang data structures? For example, what is the performance (order, o(n), constant, etc) of the insertion in a list, the lookup, etc. Just to know what data structures to use when performance is an issue. > > > Thanks, > > > Sebastian- > > > > > > > -- > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > From dietmar@REDACTED Tue Jan 25 16:02:42 2005 From: dietmar@REDACTED (Dietmar Schaefer) Date: Tue, 25 Jan 2005 16:02:42 +0100 Subject: problems spawing processes Message-ID: <41F65F92.60503@ast.dfs.de> Hi ! I am trying to spawn 2 processes: -export([startComm/2, getMessages/1, sendMessages/1]). startComm(ListenPort,SendPort) -> io:format("sendport = ~p~n", [SendPort]), io:format("listenport = ~p~n",[ListenPort]), register (getProc,spawn(?MODULE, getMessages, [ListenPort])), register (sendProc,spawn(?MODULE, sendMessages, [SendPort])), %% process_flag(trap_exit, true), %% get informed when server failed io:format("Hello world~n"). where %% @doc %% gets messages from 4DP (mainly AuS) %% messages are received as lists of strings %% getMessages(Port) when integer(Port) -> io:format("get messages from port ~p~n",Port), case gen_tcp:listen(Port, [ {reuseaddr, true}, {packet, 0}, {active, false}]) of {ok, ListenSocket} -> io:format(" I listen to socket ~p~n", [Port]), {ok,Sock} = gen_tcp:accept(ListenSocket), {ok, Bin} = do_recv(Sock), ok = gen_tcp:close(Sock); {error,Reason} -> io:format("an error occured listening on socket reason : ~p~n",[Reason]); Other -> io:format("Can't listen to socket ~p~n", [Other]) end. %% @doc %% this is the receiving routine %% do_recv(Sock) -> case gen_tcp:recv(Sock,0) of {ok,Bin} -> io:format("o.k. I got: ~p~n", [decode(Bin)]), do_recv(Sock); {error,Reason} -> {error,closed}; {EXIT,_} -> {error,exit} end. and another one in the same manner but none will be started. I only get: sendport = 1235 listenport = 1234 Hello world ok can anyone point me to the right direction ? regards Dietmar P.S. The problem arised after an intoduction of a new module where all communication takes place From bengt.kleberg@REDACTED Tue Jan 25 16:26:09 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 25 Jan 2005 16:26:09 +0100 Subject: problems spawing processes In-Reply-To: <41F65F92.60503@ast.dfs.de> References: <41F65F92.60503@ast.dfs.de> Message-ID: <41F66511.7080802@ericsson.com> Dietmar Schaefer wrote: > Hi ! ...deleted > -export([startComm/2, getMessages/1, sendMessages/1]). > > > startComm(ListenPort,SendPort) -> > io:format("sendport = ~p~n", [SendPort]), > io:format("listenport = ~p~n",[ListenPort]), > > register (getProc,spawn(?MODULE, getMessages, [ListenPort])), > register (sendProc,spawn(?MODULE, sendMessages, [SendPort])), > %% process_flag(trap_exit, true), %% get informed > when server failed > > io:format("Hello world~n"). try to use erlang:spawn_link/1 instead of erlang:spawn/3. ie do erlang:register( get_proc, erlang:spawn_link( fun() -> get_messages(Listen_port) end ) ), the link makes it possible to get a trace of errors in the new process. and using the fun() makes it possible not to export get_messages/1. > where > > %% @doc > %% gets messages from 4DP (mainly AuS) > %% messages are received as lists of strings > %% > getMessages(Port) when integer(Port) -> > io:format("get messages from port ~p~n",Port), io:format/2 should have a list as its second argument: io:format("get messages from port ~p~n", [Port]), running with a spawn_link/1 i get: ** exited: {badarg,[{io,format,[<0.21.0>,"get messages from port ~p~n",1234]}, {comm,get_messages,1}]} ** bengt From fredrik.linder@REDACTED Tue Jan 25 16:27:29 2005 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Tue, 25 Jan 2005 16:27:29 +0100 Subject: problems spawing processes Message-ID: Hi The processes probably gets spawned alright, but there is an error in the first io:format/2 in getMessages/1. The second argument must be a list, change it to: io:format("get messages from port ~p~n",[Port]), and you will most likely get the printout. Note: the trap_exists only work if the process you spawn is linked (by either using spawn_link or link it explicitly). /Fredrik > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of > Dietmar Schaefer > Sent: den 25 januari 2005 16:03 > To: erlang-questions@REDACTED > Subject: problems spawing processes > > > Hi ! > > > I am trying to spawn 2 processes: > > > > -export([startComm/2, getMessages/1, sendMessages/1]). > > > startComm(ListenPort,SendPort) -> > io:format("sendport = ~p~n", [SendPort]), > io:format("listenport = ~p~n",[ListenPort]), > > register (getProc,spawn(?MODULE, getMessages, [ListenPort])), > register (sendProc,spawn(?MODULE, sendMessages, [SendPort])), > %% process_flag(trap_exit, true), %% > get informed > when server failed > > io:format("Hello world~n"). > > > > where > > %% @doc > %% gets messages from 4DP (mainly AuS) > %% messages are received as lists of strings > %% > getMessages(Port) when integer(Port) -> > io:format("get messages from port ~p~n",Port), > case gen_tcp:listen(Port, [ {reuseaddr, true}, > {packet, 0}, > {active, false}]) of > {ok, ListenSocket} -> > io:format(" I listen to socket ~p~n", [Port]), > > {ok,Sock} = gen_tcp:accept(ListenSocket), > {ok, Bin} = do_recv(Sock), > ok = gen_tcp:close(Sock); > > {error,Reason} -> io:format("an error occured > listening on > socket reason : ~p~n",[Reason]); > Other -> io:format("Can't listen to > socket ~p~n", > [Other]) > end. > > > %% @doc > %% this is the receiving routine > %% > do_recv(Sock) -> > case gen_tcp:recv(Sock,0) of > {ok,Bin} -> io:format("o.k. I got: ~p~n", > [decode(Bin)]), > do_recv(Sock); > > {error,Reason} -> {error,closed}; > {EXIT,_} -> {error,exit} > end. > > > and another one in the same manner but none will be started. > > > > I only get: > > sendport = 1235 > listenport = 1234 > Hello world > ok > > > > can anyone point me to the right direction ? > > > > regards > > > Dietmar > > > P.S. > > The problem arised after an intoduction of a new module where all > communication > takes place > > > > From bengt.kleberg@REDACTED Tue Jan 25 16:34:47 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 25 Jan 2005 16:34:47 +0100 Subject: [newbie] Erlangish way of Iterator pattern In-Reply-To: <41F655AA.5040403@web.am> References: <41F655AA.5040403@web.am> Message-ID: <41F66717.8090506@ericsson.com> Gaspar Chilingarov wrote: ...deleted > what i have in erlang -- i have erlang process, which can accept data > messages and eof messages and do processing. another process hangs > around, waiting for TCP connection and feeding first process with data > read from TCP. in the same time i have shell script which runs once a > minute and feeds data from some file(or piped command line) to TCP port. please note that it is possible to use active mode (see http://www.corelatus.com/~matthias/modules.html the gen_tcp module). unless you want a permanent process for processing, you could let the process that waits for a tcp connection start a new process and redirect (gen_tcp:controlling_process/2) the incoming messages to the new process. > now i want to get rid of shell script, but i wish to have separate > module which will do this -- i.e. 1. running periodically external > command, 2. feeding to another process. > > are there any idioms in Erlang for this or it should be implemented in > straight way -- i.e. just another process sitting there and doing it's > job -- file reading/parsing/feeding to another process ? i would recommend just another process. look at timer:apply_interval/4 if you want to run something periodically. bengt From nm@REDACTED Tue Jan 25 23:23:47 2005 From: nm@REDACTED (Gaspar Chilingarov) Date: Wed, 26 Jan 2005 02:23:47 +0400 (AMT) Subject: [newbie] Erlangish way of Iterator pattern In-Reply-To: <41F66717.8090506@ericsson.com> References: <41F655AA.5040403@web.am> <41F66717.8090506@ericsson.com> Message-ID: <60907.217.113.1.123.1106691827.squirrel@webmail.web.am> > Gaspar Chilingarov wrote: > ...deleted >> what i have in erlang -- i have erlang process, which can accept data >> messages and eof messages and do processing. another process hangs >> around, waiting for TCP connection and feeding first process with data >> read from TCP. in the same time i have shell script which runs once a >> minute and feeds data from some file(or piped command line) to TCP port. > > please note that it is possible to use active mode (see > http://www.corelatus.com/~matthias/modules.html the gen_tcp module). > unless you want a permanent process for processing, you could let the > process that waits for a tcp connection start a new process and redirect > (gen_tcp:controlling_process/2) the incoming messages to the new process. as far as i can understand, there is no way to implement gen_server behavior when using gen_tcp ? i stuck, because i cannot think of place, where i should put accept() call :) > >> now i want to get rid of shell script, but i wish to have separate >> module which will do this -- i.e. 1. running periodically external >> command, 2. feeding to another process. >> >> are there any idioms in Erlang for this or it should be implemented in >> straight way -- i.e. just another process sitting there and doing it's >> job -- file reading/parsing/feeding to another process ? > > i would recommend just another process. look at timer:apply_interval/4 > if you want to run something periodically. > > > bengt > ok, already done. From olgeni@REDACTED Wed Jan 26 01:30:07 2005 From: olgeni@REDACTED (Jimmy Olgeni) Date: Wed, 26 Jan 2005 01:30:07 +0100 (CET) Subject: [newbie] Erlangish way of Iterator pattern In-Reply-To: <41F66717.8090506@ericsson.com> References: <41F655AA.5040403@web.am> <41F66717.8090506@ericsson.com> Message-ID: <20050126012815.D36278@olgeni.olgeni> On Tue, 25 Jan 2005, Bengt Kleberg wrote: > that waits for a tcp connection start a new process and redirect > (gen_tcp:controlling_process/2) the incoming messages to the new process. What happens in active mode if data comes in after the "accept" and before the "controlling_process/2" call? Is it a race condition to check for? -- jimmy From techieyang@REDACTED Wed Jan 26 03:13:17 2005 From: techieyang@REDACTED (Techie Yang) Date: Wed, 26 Jan 2005 10:13:17 +0800 Subject: Erlang on embedded Vxworks ( Re: Re: Supervisor hierarchy question) Message-ID: <200501260213.j0Q2Dkb17518@hades.cslab.ericsson.net> Thanks for your hint! So if it is correctly handled, there might be no crash due to lack of memory. Right? Then if we extend the memory to 64M, is it possible to be safe? Basically, the crash would not be the result we want. : - ). We are considering to use Erlang/OTP on our next product, the card is PPC860 with vxWorks, memory may be 32M. Best Regards Techie >We did it on a VX WOrks embedded system, but it was back in 1997. The VM >was much smaller back then. Just be very careful with your recursion >(Use only tail recursion so as to avoid memory bursts), and ensure you >have heart enabled for auto restart in case the virtual crashes because >of lack of memory. > >Regards, >Francesco >-- >http://www.erlang-consulting.com > >Techie Yang wrote: >> And is it possible to enable mnesia/SNMP on a board with just 32M RAM, in case without huge bulks of data to be manipulated? >> >> Thanks in advance for your hints! >> >> Best Regards >> >> >> >> >> >>>Torbjorn Tornkvist wrote: >>> >>>>Yes, Nortel's SSL-VPN products is using Mnesia in all its glory. >>> >>>Regarding Mnesia, I have a question to all of you that are also using it >>>in production. What do you use for backuping Mnesia ? What function do >>>you call ? >>>From our experience, the Mnesia backup function can eat a lot of >>>memory. This is for sure related to the distributed feature and the fact >>>that a stable checkpoint must be generated. >>> >>>But you need a lot of RAM to do such operation. This is the same for >>>table structure updates. On some hardware, it could be difficult to keep >>>several hundreds of Mo in RAM just to be safe with backups. Could this >>>be related to the number of waiting messages queued before Mnesia ? >>> >>>So, I wanted to have your feedback on how you handle those >>>administration Mnesia process ? >>> >>>Thank you in advance for your feedback. >>> >>>-- >>>Micka?l R?mond >>> http://www.erlang-projects.org/ >>> >> >> >> = = = = = = = = = = = = = = = = = = = = >> >> >> ?????????????????? >> ???? >> >> >> ????????????????Techie Yang >> ????????????????techieyang@REDACTED >> ????????????????????2005-01-25 >> >> >> >> > > > = = = = = = = = = = = = = = = = = = = = ?????????????????? ???? ????????????????Techie Yang ????????????????techieyang@REDACTED ????????????????????2005-01-26 From cpressey@REDACTED Wed Jan 26 06:39:36 2005 From: cpressey@REDACTED (Chris Pressey) Date: Tue, 25 Jan 2005 21:39:36 -0800 Subject: A Pythonista's Impressions of Erlang In-Reply-To: <41E76F5D.7070503@itsbeen.sent.com> References: <20050112142953.68607.qmail@web41904.mail.yahoo.com> <41E637ED.5040204@ericsson.com> <16870.19809.356294.601249@antilipe.corelatus.se> <200501131445.20017.ft@it.su.se> <20050113151939.04872444.cpressey@catseye.mine.nu> <41E76F5D.7070503@itsbeen.sent.com> Message-ID: <20050125213936.148f64a3.cpressey@catseye.mine.nu> On Thu, 13 Jan 2005 23:06:05 -0800 Rob wrote: > Chris Pressey wrote: > > On Thu, 13 Jan 2005 14:45:19 +0100 > > Fredrik Thulin wrote: > > > > [of links.html] > > > >>Does not resolve : > >> > >>http://www.catseye.mb.ca/erlang/ > > > > > > Wow, that brings back memories... > > > > If you want to change it, I guess the present-day equivalent is > > > > http://catseye.webhop.net/projects/?keyword=erl > > > Or you can just remove it. > > Please, don't remove it - the examples Chris has of esoteric > languages, games and other projects written in erlang are valuable > given the limited number of available erlang programs from different > coders. Creative implementations of small language interpreters are > useful code templates for all kinds of projects. > > Chris, is there a way to get a simplified form of the project pages so > that one could do a recursive wget to easily pull all the files for a > given project (the current pages loop around due to the sorting option > links)? I don't see a way to do it other than one file at a time, am I > missing something obvious? There should be links to tarballs at the top of each project's root page. So for example, on: http://catseye.webhop.net/projects/animals/ there's a link to http://catseye.webhop.net/projects/animals-2004.0919.tgz You should also be able to use a Subversion client to pull down the latest files for a project, like so: svn checkout svn://catseye.mine.nu/animals/current animals But I haven't tested this extensively yet (which is why there's nothing on the site that indicates that it's possible yet...) If you'd like to confirm that it works, that'd be great. Thanks, -Chris From mickael.remond@REDACTED Wed Jan 26 09:57:27 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 26 Jan 2005 09:57:27 +0100 Subject: [newbie] Erlangish way of Iterator pattern In-Reply-To: <60907.217.113.1.123.1106691827.squirrel@webmail.web.am> References: <41F655AA.5040403@web.am> <41F66717.8090506@ericsson.com> <60907.217.113.1.123.1106691827.squirrel@webmail.web.am> Message-ID: <41F75B77.3000707@erlang-fr.org> Gaspar Chilingarov wrote: > as far as i can understand, there is no way to implement gen_server behavior > when using gen_tcp ? i stuck, because i cannot think of place, where i should > put accept() call :) You can. This is one of the example of the French Erlang book (Unfortunately, for which I am still struggling with my editor to have translated in English). Basically, you can use the handle_info callback to get message coming from a socket in active mode. You can use tcp/ip stream regulation by using the socket option active = once, so that after receiving new data on the socket, you need to turn activation on again. I hope this helps, -- Micka?l R?mond http://www.erlang-projects.org/ From bengt.kleberg@REDACTED Wed Jan 26 10:04:46 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 26 Jan 2005 10:04:46 +0100 Subject: [newbie] Erlangish way of Iterator pattern In-Reply-To: <60907.217.113.1.123.1106691827.squirrel@webmail.web.am> References: <60907.217.113.1.123.1106691827.squirrel@webmail.web.am> Message-ID: <41F75D2E.6000002@ericsson.com> Gaspar Chilingarov wrote: ...deleted > as far as i can understand, there is no way to implement gen_server > behavior > when using gen_tcp ? i stuck, because i cannot think of place, where i > should > put accept() call :) i think it can be done, if you want to. one solution would be to put the accept/1 in another process and use cast/2 to send the socket to the gen_server. if you want the accept/1 in the gen_server processs the problem is that accept/1 might block which would cause the gen_server to timeout. but use accept/2 and have the timeout shorter than the timeout for the gen_server. bengt From raimo@REDACTED Wed Jan 26 10:19:20 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 26 Jan 2005 10:19:20 +0100 Subject: [newbie] Erlangish way of Iterator pattern References: <41F66717.8090506@ericsson.com>, <41F66717.8090506@ericsson.com>, <20050126012815.D36278@olgeni.olgeni> Message-ID: That is fixed in the code for controlling_process/2 - it goes through the inqueue for the old controlling process and transfers them to the new, atomically. olgeni@REDACTED (Jimmy Olgeni) writes: > On Tue, 25 Jan 2005, Bengt Kleberg wrote: > > > that waits for a tcp connection start a new process and redirect > > (gen_tcp:controlling_process/2) the incoming messages to the new > > process. > > What happens in active mode if data comes in after the "accept" and > before the "controlling_process/2" call? Is it a race condition to > check for? > > -- > jimmy -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From erlang-list@REDACTED Wed Jan 26 10:45:14 2005 From: erlang-list@REDACTED (Dominic Williams) Date: Wed, 26 Jan 2005 10:45:14 +0100 Subject: BEAM implementation questions In-Reply-To: <20050125093430.22170.qmail@web41907.mail.yahoo.com> References: <20050125093430.22170.qmail@web41907.mail.yahoo.com> Message-ID: <41F766AA.9050907@dominicwilliams.net> Thomas Lindgren wrote: > I'd like support for this, perhaps even moreso if > there was some language support for declaring > "constant data". I'm curious about why you'd want any specific support. What's wrong with a constant function, e.g.: pi() -> 3.1415. max_users() -> 50. Regards, Dominic Williams http://www.dominicwilliams.net ---- From thomasl_erlang@REDACTED Wed Jan 26 11:26:09 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 26 Jan 2005 02:26:09 -0800 (PST) Subject: BEAM implementation questions In-Reply-To: <41F766AA.9050907@dominicwilliams.net> Message-ID: <20050126102609.70216.qmail@web41905.mail.yahoo.com> --- Dominic Williams wrote: > Thomas Lindgren wrote: > > > I'd like support for this, perhaps even moreso if > > there was some language support for declaring > > "constant data". > > I'm curious about why you'd want any specific > support. > What's wrong with a constant function, e.g.: > > pi() -> 3.1415. > max_users() -> 50. There's nothing _really_ wrong with functions returning constant data, I just find it (a bit) clearer to have a separate notation to say "this is a data access, not a computation" and to indicate that I want this data to be cached and shared somewhere. (In some cases you instead want to hide that distinction, of course.) Here's one case where it turns up: when I build a lexer (lex.erl in jungerl), I dynamically generate the lexing table and index into it when driving the lexer. But it would be nicer to instead have a data structure I could emit once and for all, and then index into it with something like: lextable[StateName, Char] (forgive the syntax :-) with lextable/2 thus being a constant 2D array, not a function. Saving the generated table as a loadable module would also be quite useful. The same issue turns up for yecc, incidentally, which generates a huge swathe of code in order to implement what amounts to a table. Cf. erl_parse.erl. Best, Thomas __________________________________ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail From joe.armstrong@REDACTED Wed Jan 26 11:27:31 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Wed, 26 Jan 2005 11:27:31 +0100 Subject: [newbie] Erlangish way of Iterator pattern Message-ID: To solve problems like this I almost always use a module called tcp_server which is available at http://www.sics.se/~joe/tutorials/web_server/tcp_server.erl To use it call: tcp_server:start(Port, Fun, Max) This starts a server which listens to Port up to Max simultaneous connections on Port are allowed. The *first* time a connection is made to Port Then Fun(Socket) is called. Thereafter messages to the socket result in messages to the handler. A typical server is usually written like this: start_server(Port) -> S = self(), process_flag(trap_exit, true), tcp_server:start_raw_server(Port, fun(Socket) -> input_handler(Socket, S) end, 15, 0) loop(). The loop() process is a central controller that all processes can use to synchronize amongst themselves if necessary It ends up as the variable "Controller" in the input_handler A typical server is written like this: input_handler(Socket, Controller) -> receive {tcp, Socket, Bin} -> ... gen_tcp:send(Socket, ...) {tcp_closed, Socket} -> Any -> ... end. tcp_server can be used to build many different things. For example a web server or wiki system. If you want to see how to make a web server using tcp_server read my second "spitting in the dust tutorial" on how to make a web server. This is at http://www.sics.se/~joe/tutorials/web_server/web_server.html This has all the code for a simple web server - the web server itself is split into a http parser (222 lines of code) a server (104 lines) and the tcp_server (175) lines. I'll show you the code for the web server - it's like this: server(Client, Master) -> receive {Client, closed} -> true; {Client, Request} -> Response = generate_response(Request), Client ! {self(), Response}, server(Client, Master) after 5000 -> true end. That's all :-) The structure used in the web server provides a useful model of how to build these type of things. It has - a connection handler (tcp_server) which manages tcp sessions - a device driver that parses HTTP messages and turns them into Erlang messages - a pure Erlang server The general philosophy is "pretend that all things in the outside world are Erlang processes" - thus to program a web server we model the browser as an Erlang process - it sends a {get, File} message to the server. The job of the connection handler and device driver is to take the HTTP protocol message and turn them into Erlang terms. Having done so, writing the server is a doodle. Cheers /Joe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Gaspar > Chilingarov > Sent: den 25 januari 2005 15:20 > To: erlang-questions@REDACTED > Subject: [newbie] Erlangish way of Iterator pattern > > > Hello! > > I'm beginning to program in erlang and hit the following problem. > in mainstream language i will do the following -- create > Iterator class > to read data from socket or file > i.e. class with Open/GetNext functions. Open should just do > all work for > preparing data source and GetNext will return lines of data or > EOF(freeing resources when reaching EOF). > > > what i have in erlang -- i have erlang process, which can accept data > messages and eof messages and do processing. another process hangs > around, waiting for TCP connection and feeding first process > with data > read from TCP. in the same time i have shell script which runs once a > minute and feeds data from some file(or piped command line) > to TCP port. > > now i want to get rid of shell script, but i wish to have separate > module which will do this -- i.e. 1. running periodically external > command, 2. feeding to another process. > > are there any idioms in Erlang for this or it should be > implemented in > straight way -- i.e. just another process sitting there and > doing it's > job -- file reading/parsing/feeding to another process ? > > > > -- > Gaspar Chilingarov > System Administrator > > t +3749 419763 > w www.web.am > e nm@REDACTED > From nm@REDACTED Wed Jan 26 12:06:54 2005 From: nm@REDACTED (Gaspar Chilingarov) Date: Wed, 26 Jan 2005 15:06:54 +0400 Subject: [newbie] accept()-ing process under supervision (was:Erlangish way of Iterator pattern) In-Reply-To: References: Message-ID: <41F779CE.5090605@web.am> Yeah, i know, you have some tasty things on your pages :) but i wish to run process which does gen_tcp:accept under supervision -- just to be sure that it always listening. processes which serve each connections are out of my interest (for now) -- they can crash when they want :) Joe Armstrong (AL/EAB) wrote: > To solve problems like this I almost always use a module called tcp_server which is > available at > > http://www.sics.se/~joe/tutorials/web_server/tcp_server.erl > > To use it call: > > tcp_server:start(Port, Fun, Max) > > This starts a server which listens to Port up to Max simultaneous connections on Port are allowed. > > The *first* time a connection is made to Port Then Fun(Socket) is called. > Thereafter messages to the socket result in messages to the handler. > > A typical server is usually written like this: > > start_server(Port) -> > S = self(), > process_flag(trap_exit, true), > tcp_server:start_raw_server(Port, > fun(Socket) -> input_handler(Socket, S) end, > 15, > 0) > loop(). > > The loop() process is a central controller that all processes can use to synchronize amongst themselves if necessary It ends up as the variable "Controller" in the input_handler > > A typical server is written like this: > > input_handler(Socket, Controller) -> > receive > {tcp, Socket, Bin} -> > ... > gen_tcp:send(Socket, ...) > {tcp_closed, Socket} -> > > Any -> > ... > end. > > tcp_server can be used to build many different things. For example a web server or wiki system. > > If you want to see how to make a web server using tcp_server read my second "spitting in the dust tutorial" on how to > make a web server. > > This is at > > http://www.sics.se/~joe/tutorials/web_server/web_server.html > > This has all the code for a simple web server - the web server itself is split into a http parser (222 lines of code) > a server (104 lines) and the tcp_server (175) lines. > > I'll show you the code for the web server - it's like this: > > server(Client, Master) -> > receive > {Client, closed} -> > true; > {Client, Request} -> > Response = generate_response(Request), > Client ! {self(), Response}, > server(Client, Master) > after 5000 -> > true > end. > > That's all :-) > > The structure used in the web server provides a useful model of how to build these type of things. It has > > - a connection handler (tcp_server) which manages tcp sessions > - a device driver that parses HTTP messages and turns them into Erlang messages > - a pure Erlang server > > The general philosophy is "pretend that all things in the outside world are Erlang processes" - thus to program a web > server we model the browser as an Erlang process - it sends a {get, File} message to the server. The job of the > connection handler and device driver is to take the HTTP protocol message and turn them into Erlang terms. > Having done so, writing the server is a doodle. > > Cheers > > /Joe > > > > >>-----Original Message----- >>From: owner-erlang-questions@REDACTED >>[mailto:owner-erlang-questions@REDACTED]On Behalf Of Gaspar >>Chilingarov >>Sent: den 25 januari 2005 15:20 >>To: erlang-questions@REDACTED >>Subject: [newbie] Erlangish way of Iterator pattern >> >> >>Hello! >> >>I'm beginning to program in erlang and hit the following problem. >>in mainstream language i will do the following -- create >>Iterator class >>to read data from socket or file >>i.e. class with Open/GetNext functions. Open should just do >>all work for >>preparing data source and GetNext will return lines of data or >>EOF(freeing resources when reaching EOF). >> >> >>what i have in erlang -- i have erlang process, which can accept data >>messages and eof messages and do processing. another process hangs >>around, waiting for TCP connection and feeding first process >>with data >>read from TCP. in the same time i have shell script which runs once a >>minute and feeds data from some file(or piped command line) >>to TCP port. >> >>now i want to get rid of shell script, but i wish to have separate >>module which will do this -- i.e. 1. running periodically external >>command, 2. feeding to another process. >> >>are there any idioms in Erlang for this or it should be >>implemented in >>straight way -- i.e. just another process sitting there and >>doing it's >>job -- file reading/parsing/feeding to another process ? >> >> >> >>-- >>Gaspar Chilingarov >>System Administrator >> >>t +3749 419763 >>w www.web.am >>e nm@REDACTED >> > > -- Gaspar Chilingarov System Administrator t +3749 419763 w www.web.am e nm@REDACTED From svg@REDACTED Wed Jan 26 12:24:18 2005 From: svg@REDACTED (Vladimir Sekissov) Date: Wed, 26 Jan 2005 16:24:18 +0500 (YEKT) Subject: BEAM implementation questions In-Reply-To: <20050126102609.70216.qmail@web41905.mail.yahoo.com> References: <41F766AA.9050907@dominicwilliams.net> <20050126102609.70216.qmail@web41905.mail.yahoo.com> Message-ID: <20050126.162418.41658865.svg@surnet.ru> Good day, thomasl_erlang> > > I'd like support for this, perhaps even moreso if thomasl_erlang> > > there was some language support for declaring thomasl_erlang> > > "constant data". But you can use parameterized modules to emulate this. -module(t, [Data]). -export([gv/1]). gv(Idx) -> proplists:get_value(Idx, Data). 1> T=t:new([{a, b}, {c, d}]). {t,[{a,b},{c,d}]} 2> T:gv(a). b 3> file:write_file("T.dump", term_to_binary(T)). ok .... 1> l(t). {module,t} 2> {ok, B} = file:read_file("T.dump"). {ok,<<131,104... 3> T=binary_to_term(B). {t,[{a,b},{c,d}]} 4> T:gv(a). b Best Regards, Vladimir Sekissov From aruna.jambunathan@REDACTED Wed Jan 26 13:00:27 2005 From: aruna.jambunathan@REDACTED (aruna.jambunathan@REDACTED) Date: Wed, 26 Jan 2005 17:30:27 +0530 Subject: Erlang installation problem Message-ID: Thanks Raimo for your immediate responses.. Your instructions were very helpful to solve the installation issue. We have successfully installed erlang version R9C2 on solaris 8 with no errors. Thanks once again. Regards, Aruna -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Raimo Niskanen Sent: Thursday, January 20, 2005 1:12 PM To: erlang-questions@REDACTED Subject: Re: Erlang installation problem Sorry, I gave fuzzy instructions. "conftest.c" does not exist - it is created by "configure" while it runs. To mimic what configure does; create a file "conftest.c" containing: --------------------------------------after-this-line #line 3741 "configure" #include "confdefs.h" #include main() { FILE *f=fopen("conftestval", "w"); if (!f) exit(1); fprintf(f, "%d\n", sizeof(short)); exit(0); } --------------------------------------before-this-line and then compile and link it using the same command as "configure": gcc -o conftest -g -O2 -I/aims_home/sailajar/erlang/otp_src_R9C-2/erts/sparc-sun-solaris2.8 conftest.c -lncurses -lresolv -ldl -lm -lsocket -lnsl That "erts/sparc-sun-solaris2.8" does not exist is strange, because it should be created by "configure". Try creating it yourself if necessary, otherwise try the "gcc" command above without the "-I/aims_home/sailajar/erlang/otp_src_R9C-2/erts/sparc-sun-solaris2.8" switch. I do not think it is important at this point for "configure". The compilation of "conftest.c" should produce an executable named "conftest". Try to run "conftest" - it should write a file named "conftestval" that contains "2" or whatever the size of short is on your machine. Now we'll see where this procedure fails... -- / Raimo Niskanen, Erlang/OTP, Ericsson AB aruna.jambunathan@REDACTED writes: > > I am unable to locate sparc-sun-solaris2.8 and conftest.c in the erts > folder. > > Aruna > > -----Original Message----- > From: Raimo Niskanen [mailto:raimo@REDACTED] > Sent: Wednesday, January 19, 2005 7:16 PM > To: Aruna Jambunathan(WT01 - TELECOM SOLUTIONS) > Subject: Re: Erlang installation problem > > This part is from erts/config.log: > > configure:3733: checking size of short > configure:3752: gcc -o conftest -g -O2 > -I/aims_home/sailajar/erlang/otp_src_R9C-2/erts/sparc-sun-solaris2.8 > conftest.c -lncurses -lresolv -ldl -lm -lsocket -lnsl 1>&5 > configure: failed program was: > #line 3741 "configure" > #include "confdefs.h" > #include > main() > { > FILE *f=fopen("conftestval", "w"); > if (!f) exit(1); > fprintf(f, "%d\n", sizeof(short)); > exit(0); > } > > I see no error printout. Try to paste the failing program from > "#line 3751 ..." to "}" into a file "configure" and then run > that gcc command above on it and see what fails. If it is > linking that fails - check your LD_LIBRARY_PATH. > > And yes, Erlang is compatible with Solaris 8. It is our main internal > platform and our most important license customer platform. They run > on our binary release, though. But compiling open source Erlang for > Solaris 8 should be no problem. You probably have some problem in > your compiler/linker installation. > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > writes: > > > Hi, > > > > Thanks for your responses. I checked with gcc version. It is as > > follows: > > > > > > > > # gcc --version > > > > gcc (GCC) 3.3.2 > > > > Copyright (C) 2003 Free Software Foundation, Inc. > > > > This is free software; see the source for copying conditions. There > is > > NO > > > > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR > > PURPOSE. > > > > > > > > I also checked if ncursers library are installed as suggested by Henk > > .They are already installed. Even then the problem is not solved > > > > > > > > # cd /usr/local/lib/ > > > > # ls -l | grep libncurses > > > > -rwxr-xr-x 1 bin 127772 May 2 2003 libncurses++.a* > > > > -rw-r--r-- 1 bin 464320 May 2 2003 libncurses.a > > > > lrwxrwxrwx 1 root 15 Feb 20 2004 libncurses.so -> > > libncurses.so.5 > > > > lrwxrwxrwx 1 root 17 Feb 20 2004 libncurses.so.5 -> > > libncurses.so.5.3 > > > > -rw-r--r-- 1 bin 339008 May 2 2003 libncurses.so.5.3 > > > > -rw-r--r-- 1 bin 4255308 May 2 2003 libncurses_g.a > > > > > > > > The earlier version of Erlang (R8B)on the same system is : > > > > > > > > "Erlang (BEAM) emulator version 5.1[source] > > > > Eshell V5.1" > > > > > > > > I have attached the /erts/config.log file > > > > > > > > Please let me know the version of erlang compatible with SunOS 5.8 > > Generic_108528-29 sun4u sparc SUNW, Ultra-2. > > > > It would be of great help. > > > > > > > > > > > > Regards, > > > > Aruna > > > > > > > > > > > > > > > > > > > > -----Original Message----- > > From: owner-erlang-questions@REDACTED > > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Raimo Niskanen > > Sent: Wednesday, January 19, 2005 3:53 PM > > To: erlang-questions@REDACTED > > Subject: Re: Erlang installation problem > > > > > > > > It seems as you are trying to build open source erlang for Solaris 8. > > > > > > > > Check the file erts/config.log and see what went long. The size of > > > > short being 0 is not right - it should be 2 or 4. All others are > > > > also wrong. They should be 4 or 8. Maybe your compiler is not > > > > correctly installed. It should be gcc. What does "gcc -- version" > > > > tell you? > > > > > > > > In short; this looks as a secondary error, the primary error > > > > occurred earlier. > > > > > > > > > > > > > > > > -----Original Message----- > > From: Henk Bijker [mailto:henk@REDACTED] > > Sent: Wednesday, January 19, 2005 3:24 PM > > To: Aruna Jambunathan(WT01 - TELECOM SOLUTIONS) > > Subject: RE: mail to erlang mailing list > > > > > > > > Hi, > > > > > > > > I know we had the same problem, but I can't really remember what the > > > > solution was to this problem - I think it was the ncurses library. > make > > > > sure it's installed, and then retry.... just a guess. > > > > > > > > Regards, > > > > > > > > > > > > > > > > > > > > > > > > Confidentiality Notice > > > > The information contained in this electronic message and any > attachments to this message are intended > > for the exclusive use of the addressee(s) and may contain confidential > or privileged information. If > > you are not the intended recipient, please notify the sender at Wipro > or Mailadmin@REDACTED immediately > > and destroy all copies of this message and any attachments. > > > > > > > Confidentiality Notice > > The information contained in this electronic message and any attachments to this message are intended > for the exclusive use of the addressee(s) and may contain confidential or privileged information. If > you are not the intended recipient, please notify the sender at Wipro or Mailadmin@REDACTED immediately > and destroy all copies of this message and any attachments. Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or Mailadmin@REDACTED immediately and destroy all copies of this message and any attachments. From raimo@REDACTED Wed Jan 26 13:33:16 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 26 Jan 2005 13:33:16 +0100 Subject: Erlang installation problem References: Message-ID: Great! What was the problem? -- / Raimo Niskanen, Erlang/OTP, Ericsson AB aruna.jambunathan@REDACTED writes: > Thanks Raimo for your immediate responses.. > Your instructions were very helpful to solve the installation issue. > We have successfully installed erlang version R9C2 on solaris 8 with no > errors. > Thanks once again. > > Regards, > Aruna > > > > > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Raimo Niskanen > Sent: Thursday, January 20, 2005 1:12 PM > To: erlang-questions@REDACTED > Subject: Re: Erlang installation problem > > Sorry, I gave fuzzy instructions. "conftest.c" does not exist - it is > created by "configure" while it runs. To mimic what configure does; > create a file "conftest.c" containing: > --------------------------------------after-this-line > #line 3741 "configure" > #include "confdefs.h" > #include > main() > { > FILE *f=fopen("conftestval", "w"); > if (!f) exit(1); > fprintf(f, "%d\n", sizeof(short)); > exit(0); > } > --------------------------------------before-this-line > and then compile and link it using the same command as "configure": > > gcc -o conftest -g -O2 > -I/aims_home/sailajar/erlang/otp_src_R9C-2/erts/sparc-sun-solaris2.8 > conftest.c -lncurses -lresolv -ldl -lm -lsocket -lnsl > > That "erts/sparc-sun-solaris2.8" does not exist is strange, because > it should be created by "configure". Try creating it yourself if > necessary, otherwise try the "gcc" command above without the > "-I/aims_home/sailajar/erlang/otp_src_R9C-2/erts/sparc-sun-solaris2.8" > switch. I do not think it is important at this point for "configure". > > The compilation of "conftest.c" should produce an executable named > "conftest". Try to run "conftest" - it should write a file named > "conftestval" that contains "2" or whatever the size of short > is on your machine. > > Now we'll see where this procedure fails... > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > aruna.jambunathan@REDACTED writes: > > > > > I am unable to locate sparc-sun-solaris2.8 and conftest.c in the erts > > folder. > > > > Aruna > > > > -----Original Message----- > > From: Raimo Niskanen [mailto:raimo@REDACTED] > > Sent: Wednesday, January 19, 2005 7:16 PM > > To: Aruna Jambunathan(WT01 - TELECOM SOLUTIONS) > > Subject: Re: Erlang installation problem > > > > This part is from erts/config.log: > > > > configure:3733: checking size of short > > configure:3752: gcc -o conftest -g -O2 > > -I/aims_home/sailajar/erlang/otp_src_R9C-2/erts/sparc-sun-solaris2.8 > > conftest.c -lncurses -lresolv -ldl -lm -lsocket -lnsl 1>&5 > > configure: failed program was: > > #line 3741 "configure" > > #include "confdefs.h" > > #include > > main() > > { > > FILE *f=fopen("conftestval", "w"); > > if (!f) exit(1); > > fprintf(f, "%d\n", sizeof(short)); > > exit(0); > > } > > > > I see no error printout. Try to paste the failing program from > > "#line 3751 ..." to "}" into a file "configure" and then run > > that gcc command above on it and see what fails. If it is > > linking that fails - check your LD_LIBRARY_PATH. > > > > And yes, Erlang is compatible with Solaris 8. It is our main internal > > platform and our most important license customer platform. They run > > on our binary release, though. But compiling open source Erlang for > > Solaris 8 should be no problem. You probably have some problem in > > your compiler/linker installation. > > > > -- > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > > > > writes: > > > > > Hi, > > > > > > Thanks for your responses. I checked with gcc version. It is as > > > follows: > > > > > > > > > > > > # gcc --version > > > > > > gcc (GCC) 3.3.2 > > > > > > Copyright (C) 2003 Free Software Foundation, Inc. > > > > > > This is free software; see the source for copying conditions. There > > is > > > NO > > > > > > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR > > > PURPOSE. > > > > > > > > > > > > I also checked if ncursers library are installed as suggested by > Henk > > > .They are already installed. Even then the problem is not solved > > > > > > > > > > > > # cd /usr/local/lib/ > > > > > > # ls -l | grep libncurses > > > > > > -rwxr-xr-x 1 bin 127772 May 2 2003 libncurses++.a* > > > > > > -rw-r--r-- 1 bin 464320 May 2 2003 libncurses.a > > > > > > lrwxrwxrwx 1 root 15 Feb 20 2004 libncurses.so -> > > > libncurses.so.5 > > > > > > lrwxrwxrwx 1 root 17 Feb 20 2004 libncurses.so.5 -> > > > libncurses.so.5.3 > > > > > > -rw-r--r-- 1 bin 339008 May 2 2003 libncurses.so.5.3 > > > > > > -rw-r--r-- 1 bin 4255308 May 2 2003 libncurses_g.a > > > > > > > > > > > > The earlier version of Erlang (R8B)on the same system is : > > > > > > > > > > > > "Erlang (BEAM) emulator version 5.1[source] > > > > > > Eshell V5.1" > > > > > > > > > > > > I have attached the /erts/config.log file > > > > > > > > > > > > Please let me know the version of erlang compatible with SunOS 5.8 > > > Generic_108528-29 sun4u sparc SUNW, Ultra-2. > > > > > > It would be of great help. > > > > > > > > > > > > > > > > > > Regards, > > > > > > Aruna > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -----Original Message----- > > > From: owner-erlang-questions@REDACTED > > > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Raimo > Niskanen > > > Sent: Wednesday, January 19, 2005 3:53 PM > > > To: erlang-questions@REDACTED > > > Subject: Re: Erlang installation problem > > > > > > > > > > > > It seems as you are trying to build open source erlang for Solaris > 8. > > > > > > > > > > > > Check the file erts/config.log and see what went long. The size of > > > > > > short being 0 is not right - it should be 2 or 4. All others are > > > > > > also wrong. They should be 4 or 8. Maybe your compiler is not > > > > > > correctly installed. It should be gcc. What does "gcc -- version" > > > > > > tell you? > > > > > > > > > > > > In short; this looks as a secondary error, the primary error > > > > > > occurred earlier. > > > > > > > > > > > > > > > > > > > > > > > > -----Original Message----- > > > From: Henk Bijker [mailto:henk@REDACTED] > > > Sent: Wednesday, January 19, 2005 3:24 PM > > > To: Aruna Jambunathan(WT01 - TELECOM SOLUTIONS) > > > Subject: RE: mail to erlang mailing list > > > > > > > > > > > > Hi, > > > > > > > > > > > > I know we had the same problem, but I can't really remember what the > > > > > > solution was to this problem - I think it was the ncurses library. > > make > > > > > > sure it's installed, and then retry.... just a guess. > > > > > > > > > > > > Regards, > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Confidentiality Notice > > > > > > The information contained in this electronic message and any > > attachments to this message are intended > > > for the exclusive use of the addressee(s) and may contain > confidential > > or privileged information. If > > > you are not the intended recipient, please notify the sender at > Wipro > > or Mailadmin@REDACTED immediately > > > and destroy all copies of this message and any attachments. > > > > > > > > > > > > > Confidentiality Notice > > > > The information contained in this electronic message and any > attachments to this message are intended > > for the exclusive use of the addressee(s) and may contain confidential > or privileged information. If > > you are not the intended recipient, please notify the sender at Wipro > or Mailadmin@REDACTED immediately > > and destroy all copies of this message and any attachments. > > > > Confidentiality Notice > > The information contained in this electronic message and any attachments to this message are intended > for the exclusive use of the addressee(s) and may contain confidential or privileged information. If > you are not the intended recipient, please notify the sender at Wipro or Mailadmin@REDACTED immediately > and destroy all copies of this message and any attachments. From mickael.remond@REDACTED Wed Jan 26 14:15:19 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 26 Jan 2005 14:15:19 +0100 Subject: [newbie] Erlangish way of Iterator pattern In-Reply-To: <41F75B77.3000707@erlang-fr.org> References: <41F655AA.5040403@web.am> <41F66717.8090506@ericsson.com> <60907.217.113.1.123.1106691827.squirrel@webmail.web.am> <41F75B77.3000707@erlang-fr.org> Message-ID: <41F797E7.1010404@erlang-fr.org> Mickael Remond wrote: > You can. This is one of the example of the French Erlang book > (Unfortunately, for which I am still struggling with my editor to have > translated in English). Note, that the code source for the book is available from: http://www.editions-eyrolles.com/download/9782212110791/sources.tar.gz?xd=4507aeb1140d3fdc4394f6e41a728c93 -- Micka?l R?mond http://www.erlang-projects.org/ From thomasl_erlang@REDACTED Wed Jan 26 14:23:00 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 26 Jan 2005 05:23:00 -0800 (PST) Subject: BEAM implementation questions In-Reply-To: <20050126.162418.41658865.svg@surnet.ru> Message-ID: <20050126132300.35894.qmail@web41904.mail.yahoo.com> --- Vladimir Sekissov wrote: > Good day, > > thomasl_erlang> > > I'd like support for this, > perhaps even moreso if > thomasl_erlang> > > there was some language support > for declaring > thomasl_erlang> > > "constant data". > > But you can use parameterized modules to emulate > this. Well, that solves part of it, at the very least. I'll have a look at using them. Thanks for the tip! Best, Thomas __________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo From kramer@REDACTED Wed Jan 26 07:19:30 2005 From: kramer@REDACTED (Reto Kramer) Date: Tue, 25 Jan 2005 22:19:30 -0800 Subject: soft-upgrade vs failover and back to/from 2nd-ary system In-Reply-To: <16884.594.453689.181445@antilipe.corelatus.se> References: <11760DCE-6C3C-11D9-8685-000393B64312@acm.org> <16884.594.453689.181445@antilipe.corelatus.se> Message-ID: <3CDC6823-6F62-11D9-997B-000393B64312@acm.org> > A1) When you only have one node > > A2) When the state is long lived and difficult, or impossible, to > transfer from one node to another. > > HTTP is pretty much the opposite of A2. In many telco applications, A2 > describes the situation perfectly. Matthias, can you give me an additional clarification w.r.t. to the telco domain. (A2) implies that if the system that owns the state crashes, the state is gone. I assume the telco applications you're referring to use a definition of availability that does not count such crashes as dropped calls? I.e. are there telco applications in which one can loose the call signaling state and as long as the voice trunk remains up the call continues and is not counted as a drop? I.e. as long as one is able to setup new calls (on a fresh backup system that needed none of the lost state transfered at all) life is good (modulo the lost opportunity to charge for a call)? > On one telco voice application I > worked on, a typical upgrade/patch meant: > > 1. Block new calls to the node. > > 2. Wait until all calls end (i.e. people finish talking). > > 3. Do the upgrade > > 4. Unblock > > Waiting for everyone to finish talking can take a long time. There are > two ways to reduce the wait: first, upgrade in the middle of the > night. Second, once you've waited (say) an hour, there'll just be a > handful of callers left, so you could just disconnect them and let the > helpdesk handle the complaints. > > On that system, we could also insert "small" patches by loading new > code into Erlang. That eliminated all the waiting and sprinting down > the corridor to escape enraged helpdesk people. > > --- > > Hot code loading isn't as general as 'evacuate-upgrade-restart' with > isolated, duplicated hardware. You can't upgrade the OS or VM by > reloading code. But in many systems it is simpler. In such systems you > handle most upgrades without any downtime and then accept a couple of > minutes per year of _planned_ downtime to upgrade the OS. In return, > you get a simpler (== less unplanned downtime) and cheaper system. > > Matt > From matthias@REDACTED Wed Jan 26 11:33:59 2005 From: matthias@REDACTED (Matthias Lang) Date: Wed, 26 Jan 2005 11:33:59 +0100 Subject: soft-upgrade vs failover and back to/from 2nd-ary system In-Reply-To: <3CDC6823-6F62-11D9-997B-000393B64312@acm.org> References: <11760DCE-6C3C-11D9-8685-000393B64312@acm.org> <16884.594.453689.181445@antilipe.corelatus.se> <3CDC6823-6F62-11D9-997B-000393B64312@acm.org> Message-ID: <16887.29207.351815.673175@antilipe.corelatus.se> Matthias> > A2) When the state is long lived and difficult, or Matthias> > impossible, to transfer from one node to another. [...] Matthias> > In many telco applications, A2 describes the situation perfectly. Reto> Matthias, can you give me an additional clarification Reto> w.r.t. to the telco domain. (A2) implies that if the system Reto> that owns the state crashes, the state is gone. I assume the Reto> telco applications you're referring to use a definition of Reto> availability that does not count such crashes as dropped Reto> calls? Such events should be (and are) counted as dropped calls. But one dropped call isn't the end of the world. It happens. That's why the requirements specify nonzero limits to the number of dropped calls. The granularity of fault recovery is a design choice you make once you've seen the requirements. Take a voicemail system. Imagine someone pulls out both power plugs while you're listening to one of your messages. Some possible ways the system could appear to the subscriber: 1. You never notice anything, i.e. the message keeps playing without so much as a hiccup. or 2. There's a slight pop in the middle of the message or 3. The whole system hiccups, e.g. the message starts over from the start, or perhaps you go back to the menu. or 4. The call gets dropped, i.e you have to call voicemail again or 5. The call gets dropped. You try and call voicemail again but it's busy. You try again after five minutes and it works. or 6. The call gets dropped and it takes several hours before voicemail works again. or 7. All your messages get erased I think all good voicemail systems settle for #4. Trying to do better than that introduces a lot of complexity to deal with an unlikely event. Cheap systems do #5. #6 and #7 are unacceptable. Maybe I exaggerated the difference to HTTP. If I was on CNN's homepage and the browser was in the middle of downloading the large picture on the front page when someone pulled the power plug(s) on the CNN webserver I happened to be using, I'd be pretty surprised if the load balancer/failover system was smart enough to transfer the HTTP and TCP state so that the image arrived whole anyway. There are people who make voicemail (and IVR) systems _and_ HTTP robustifiers on this list. Maybe they'd care to comment what their systems do. Reto> I.e. are there telco applications in which one can Reto> loose the call signaling state and as long as the voice Reto> trunk remains up the call continues and is not counted as a Reto> drop? I.e. as long as one is able to setup new calls (on a Reto> fresh backup system that needed none of the lost state Reto> transfered at all) life is good (modulo the lost opportunity Reto> to charge for a call)? Keeping the voice connection up when the signalling state has been lost is bad. It leaks connection resources and leaves subscribers stuck in broken calls. Better to keep it simple and just drop the call that triggered the problem. Matthias From nm@REDACTED Wed Jan 26 15:36:10 2005 From: nm@REDACTED (Gaspar Chilingarov) Date: Wed, 26 Jan 2005 18:36:10 +0400 Subject: [newbie] spawn-ed functions always exported? Message-ID: <41F7AADA.6040103@web.am> Hello all! Are there any way not to export functions which are logically internal to the module, but appear in spawn command ? or there are some misdesing issue, and usually in good designed system they are public by design, but not the language limitation? thanks in advance -- Gaspar Chilingarov System Administrator t +3749 419763 w www.web.am e nm@REDACTED From fredrik.linder@REDACTED Wed Jan 26 15:48:33 2005 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Wed, 26 Jan 2005 15:48:33 +0100 Subject: [newbie] spawn-ed functions always exported? Message-ID: > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Gaspar > Chilingarov > Sent: den 26 januari 2005 15:36 > To: erlang-questions@REDACTED > Subject: [newbie] spawn-ed functions always exported? > > > Hello all! > > Are there any way not to export functions which are logically > internal > to the module, but appear in spawn command ? Yes. Use the spawn functions that takes a fun as argument. /Fredrik From joe.armstrong@REDACTED Wed Jan 26 15:57:50 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Wed, 26 Jan 2005 15:57:50 +0100 Subject: [newbie] spawn-ed functions always exported? Message-ID: Yes. Replace spawn(Mod, Func, [Arg1,Arg2,...,Argn]) with spawn(fun() -> Mod:Func(Arg1,Arg2,...,Argn) end) Example: Old way -module(foo). -export([a/0, b/2]). a() -> spawn(?MODULE, b, [1,2]). b(X, Y) -> ... new way -module(foo). -export([a/0, b/2]). a() -> spawn(fun() -> b(1,2) end). b(X, Y) -> ... Cheers /Joe (also for spawn_link) > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Gaspar > Chilingarov > Sent: den 26 januari 2005 15:36 > To: erlang-questions@REDACTED > Subject: [newbie] spawn-ed functions always exported? > > > Hello all! > > Are there any way not to export functions which are logically > internal > to the module, but appear in spawn command ? > > > or there are some misdesing issue, and usually in good > designed system > they are public by design, but not the language limitation? > > > thanks in advance > > > -- > Gaspar Chilingarov > System Administrator > > t +3749 419763 > w www.web.am > e nm@REDACTED > From thomasl_erlang@REDACTED Wed Jan 26 15:57:50 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 26 Jan 2005 06:57:50 -0800 (PST) Subject: [newbie] spawn-ed functions always exported? In-Reply-To: <41F7AADA.6040103@web.am> Message-ID: <20050126145750.36850.qmail@web41906.mail.yahoo.com> --- Gaspar Chilingarov wrote: > Hello all! > > Are there any way not to export functions which are > logically internal > to the module, but appear in spawn command ? Try, for example: spawn(fun() -> unexported_function() end). > or there are some misdesing issue, and usually in > good designed system > they are public by design, but not the language > limitation? I'm not sure what you mean here? Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Mail - You care about security. So do we. http://promotions.yahoo.com/new_mail From nm@REDACTED Wed Jan 26 16:03:25 2005 From: nm@REDACTED (Gaspar Chilingarov) Date: Wed, 26 Jan 2005 19:03:25 +0400 Subject: [newbie] spawn-ed functions always exported? - i got it :) thanks a lot In-Reply-To: <20050126145750.36850.qmail@web41906.mail.yahoo.com> References: <20050126145750.36850.qmail@web41906.mail.yahoo.com> Message-ID: <41F7B13D.7070803@web.am> From carsten@REDACTED Wed Jan 26 16:05:16 2005 From: carsten@REDACTED (Carsten Schultz) Date: Wed, 26 Jan 2005 16:05:16 +0100 Subject: [newbie] spawn-ed functions always exported? In-Reply-To: <41F7AADA.6040103@web.am> References: <41F7AADA.6040103@web.am> Message-ID: <20050126150515.GA4296@penne.localnet> Hi! On Wed, Jan 26, 2005 at 06:36:10PM +0400, Gaspar Chilingarov wrote: > Hello all! > > Are there any way not to export functions which are logically internal > to the module, but appear in spawn command ? This seems simple enough for me to answer, so I will try :-) Instead of spawn(?MODULE, f, [A1, A2, A3]) you can use spawn(fun ()->f(A1, A2, A3) end) Note however that these two will have slightly differing behaviour in the presence of hot code update. Afaik the first one will spawn the function of the newest version of the module, while the second one will spawn the function of the version of the module executing the spawn function. Greetings, Carsten -- Carsten Schultz (2:38, 33:47) http://carsten.codimi.de/ PGP/GPG key on the pgp.net key servers, fingerprint on my home page. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: Digital signature URL: From joe.armstrong@REDACTED Wed Jan 26 16:07:29 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Wed, 26 Jan 2005 16:07:29 +0100 Subject: [newbie] accept()-ing process under supervision (was:Erlangish way of Iterator pattern) Message-ID: Tricky - there is a spectrum of answers here: "make sure that it is always listening" could mean lot's of different things: 1) Is the listening process (ie the process which evaluates tcp_accept) still alive? 2) Is the listening process responsive? ie is it accepting connections and doing what it is supposed to do? In my example tcp_server might happily accept connections and spawn a new handler per connection - but these handlers might deadlock, or go into infinite loops or something and not respond as expected (Now I don't mean here that the handlers *crash* - because crashes will be detected and the socket will be closed) - it's just that they don't work properly. Detecting 1) is trivial (just link to the process). 2) requires some kind of end-to-end confirmation ie a program *outside* Erlang which periodically asks the server to prove that it running. Say ask it what factorial 42 is once every minute. <> An easy solution (somewhere between 1 and 2 here) can be to use "on-exit" defined thus: on_exit(Pid, Fun) -> spawn_fun(fun() -> process_flag(trap_exit, true), link(Pid), receive {'EXIT', Pid, Why} -> Fun(Why) end end). You can use on_exit to restart a function if it fails. [almost] like this: keep_alive(Fun) -> Pid = spawn(fun() -> Fun() end), on_exit(Pid, fun({'Exit', normal} -> true; {'EXIT', Other} -> %% restart it keep_alive(Fun) end). Cheers /Joe [almost] - the code above is incorrect - and is merely to illustrate the idea - why is it incorrect? (ten brownie points for the first correct explanation of the error :-) > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Gaspar > Chilingarov > Sent: den 26 januari 2005 12:07 > To: erlang-questions@REDACTED > Subject: Re: [newbie] accept()-ing process under supervision > (was:Erlangish way of Iterator pattern) > > > Yeah, i know, you have some tasty things on your pages :) > > but i wish to run process which does gen_tcp:accept under > supervision -- > just to be sure that it always listening. processes which serve each > connections are out of my interest (for now) -- they can > crash when they > want :) > > > Joe Armstrong (AL/EAB) wrote: > > To solve problems like this I almost always use a module > called tcp_server which is > > available at > > > > http://www.sics.se/~joe/tutorials/web_server/tcp_server.erl > > > > To use it call: > > > > tcp_server:start(Port, Fun, Max) > > > > This starts a server which listens to Port up to Max > simultaneous connections on Port are allowed. > > > > The *first* time a connection is made to Port Then > Fun(Socket) is called. > > Thereafter messages to the socket result in messages to the handler. > > > > A typical server is usually written like this: > > > > start_server(Port) -> > > S = self(), > > process_flag(trap_exit, true), > > tcp_server:start_raw_server(Port, > > fun(Socket) -> > input_handler(Socket, S) end, > > 15, > > 0) > > loop(). > > > > The loop() process is a central controller that all > processes can use to synchronize amongst themselves if > necessary It ends up as the variable "Controller" in the input_handler > > > > A typical server is written like this: > > > > input_handler(Socket, Controller) -> > > receive > > {tcp, Socket, Bin} -> > > ... > > gen_tcp:send(Socket, ...) > > {tcp_closed, Socket} -> > > > > Any -> > > ... > > end. > > > > tcp_server can be used to build many different things. For > example a web server or wiki system. > > > > If you want to see how to make a web server using > tcp_server read my second "spitting in the dust tutorial" on how to > > make a web server. > > > > This is at > > > > http://www.sics.se/~joe/tutorials/web_server/web_server.html > > > > This has all the code for a simple web server - the web > server itself is split into a http parser (222 lines of code) > > a server (104 lines) and the tcp_server (175) lines. > > > > I'll show you the code for the web server - it's like this: > > > > server(Client, Master) -> > > receive > > {Client, closed} -> > > true; > > {Client, Request} -> > > Response = generate_response(Request), > > Client ! {self(), Response}, > > server(Client, Master) > > after 5000 -> > > true > > end. > > > > That's all :-) > > > > The structure used in the web server provides a useful > model of how to build these type of things. It has > > > > - a connection handler (tcp_server) which manages tcp sessions > > - a device driver that parses HTTP messages and turns > them into Erlang messages > > - a pure Erlang server > > > > The general philosophy is "pretend that all things in the > outside world are Erlang processes" - thus to program a web > > server we model the browser as an Erlang process - it sends > a {get, File} message to the server. The job of the > > connection handler and device driver is to take the HTTP > protocol message and turn them into Erlang terms. > > Having done so, writing the server is a doodle. > > > > Cheers > > > > /Joe > > > > > > > > > >>-----Original Message----- > >>From: owner-erlang-questions@REDACTED > >>[mailto:owner-erlang-questions@REDACTED]On Behalf Of Gaspar > >>Chilingarov > >>Sent: den 25 januari 2005 15:20 > >>To: erlang-questions@REDACTED > >>Subject: [newbie] Erlangish way of Iterator pattern > >> > >> > >>Hello! > >> > >>I'm beginning to program in erlang and hit the following problem. > >>in mainstream language i will do the following -- create > >>Iterator class > >>to read data from socket or file > >>i.e. class with Open/GetNext functions. Open should just do > >>all work for > >>preparing data source and GetNext will return lines of data or > >>EOF(freeing resources when reaching EOF). > >> > >> > >>what i have in erlang -- i have erlang process, which can > accept data > >>messages and eof messages and do processing. another process hangs > >>around, waiting for TCP connection and feeding first process > >>with data > >>read from TCP. in the same time i have shell script which > runs once a > >>minute and feeds data from some file(or piped command line) > >>to TCP port. > >> > >>now i want to get rid of shell script, but i wish to have separate > >>module which will do this -- i.e. 1. running periodically external > >>command, 2. feeding to another process. > >> > >>are there any idioms in Erlang for this or it should be > >>implemented in > >>straight way -- i.e. just another process sitting there and > >>doing it's > >>job -- file reading/parsing/feeding to another process ? > >> > >> > >> > >>-- > >>Gaspar Chilingarov > >>System Administrator > >> > >>t +3749 419763 > >>w www.web.am > >>e nm@REDACTED > >> > > > > > > > -- > Gaspar Chilingarov > System Administrator > > t +3749 419763 > w www.web.am > e nm@REDACTED > From vances@REDACTED Wed Jan 26 15:59:01 2005 From: vances@REDACTED (Vance Shipley) Date: Wed, 26 Jan 2005 09:59:01 -0500 Subject: soft-upgrade vs failover and back to/from 2nd-ary system In-Reply-To: <3CDC6823-6F62-11D9-997B-000393B64312@acm.org> References: <11760DCE-6C3C-11D9-8685-000393B64312@acm.org> <16884.594.453689.181445@antilipe.corelatus.se> <3CDC6823-6F62-11D9-997B-000393B64312@acm.org> Message-ID: <20050126145901.GL58257@frogman.motivity.ca> Reto, I worked on Nortel Meridian 1 PBXs years ago. As I recall the way they handled a core processor crash was to audit the time switch when it returned to service and build state for the connected calls. -Vance On Tue, Jan 25, 2005 at 10:19:30PM -0800, Reto Kramer wrote: } } Matthias, can you give me an additional clarification w.r.t. to the } telco domain. (A2) implies that if the system that owns the state } crashes, the state is gone. I assume the telco applications you're } referring to use a definition of availability that does not count such } crashes as dropped calls? I.e. are there telco applications in which } one can loose the call signaling state and as long as the voice trunk } remains up the call continues and is not counted as a drop? I.e. as } long as one is able to setup new calls (on a fresh backup system that } needed none of the lost state transfered at all) life is good (modulo } the lost opportunity to charge for a call)? From rpettit@REDACTED Wed Jan 26 16:20:08 2005 From: rpettit@REDACTED (Rick Pettit) Date: Wed, 26 Jan 2005 09:20:08 -0600 Subject: [newbie] spawn-ed functions always exported? In-Reply-To: References: Message-ID: <20050126152008.GB1758@vailsys.com> On Wed, Jan 26, 2005 at 03:57:50PM +0100, Joe Armstrong (AL/EAB) wrote: > > Yes. > > Replace > spawn(Mod, Func, [Arg1,Arg2,...,Argn]) > > with > spawn(fun() -> Mod:Func(Arg1,Arg2,...,Argn) end) > > > Example: > > Old way > > -module(foo). > > -export([a/0, b/2]). > > a() -> spawn(?MODULE, b, [1,2]). > > b(X, Y) -> > ... > > new way > > -module(foo). > -export([a/0, b/2]). You shouldn't need the b/2 in export list with the new way. -Rick > a() -> spawn(fun() -> b(1,2) end). > > b(X, Y) -> > ... > > Cheers > > /Joe > > (also for spawn_link) From nm@REDACTED Wed Jan 26 16:20:26 2005 From: nm@REDACTED (Gaspar Chilingarov) Date: Wed, 26 Jan 2005 19:20:26 +0400 Subject: [newbie] accept()-ing process under supervision (was:Erlangish way of Iterator pattern) In-Reply-To: References: Message-ID: <41F7B53A.7010401@web.am> ok, i think that i got idea :) anyway, sorry for making to much noise on the list, but i'm trying to prototype some network management system/console in Erlang and move it away from perl/php/shell/C/etc. because it's easy to programm in that languages, but hard enough to provide stability/scalability/ease of maintenance. hmm . last phrase sounds a little bit ugly, but i'm not a native speaker :) Joe Armstrong (AL/EAB) wrote: > Tricky - there is a spectrum of answers here: > > "make sure that it is always listening" could mean lot's of different things: > > 1) Is the listening process (ie the process which evaluates tcp_accept) > still alive? > 2) Is the listening process responsive? > ie is it accepting connections and doing what it is supposed to do? > > In my example tcp_server might happily accept connections and spawn a new handler > per connection - but these handlers might deadlock, or go into infinite loops or something and not respond as > expected (Now I don't mean here that the handlers *crash* - because crashes will be detected and the > socket will be closed) - it's just that they don't work properly. > > Detecting 1) is trivial (just link to the process). 2) requires some kind of end-to-end confirmation > ie a program *outside* Erlang which periodically asks the server to prove that it running. > Say ask it what factorial 42 is once every minute. > > < because of "Joe's law" > > +------------+ > | Joe's law | > +-----------------------------------------+ > | To do fault-tolerant computations | > | you need at least 2 computers | > +-----------------------------------------+ > > Obviously :-) > > > > > An easy solution (somewhere between 1 and 2 here) can be to use "on-exit" defined thus: > > on_exit(Pid, Fun) -> > spawn_fun(fun() -> > process_flag(trap_exit, true), > link(Pid), > receive > {'EXIT', Pid, Why} -> > Fun(Why) > end > end). > > You can use on_exit to restart a function if it fails. > > [almost] like this: > > keep_alive(Fun) -> > Pid = spawn(fun() -> Fun() end), > on_exit(Pid, > fun({'Exit', normal} -> > true; > {'EXIT', Other} -> > %% restart it > keep_alive(Fun) > end). > > Cheers > > /Joe > > [almost] - the code above is incorrect - and is merely to illustrate the idea - > why is it incorrect? (ten brownie points for the first correct explanation of the error :-) > > > > > > From joe.armstrong@REDACTED Wed Jan 26 16:34:41 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Wed, 26 Jan 2005 16:34:41 +0100 Subject: [newbie] spawn-ed functions always exported? Message-ID: > > new way > > > > -module(foo). > > -export([a/0, b/2]). > > You shouldn't need the b/2 in export list with the new way. > > -Rick Oooooooopppppppppps - the quickness of the hand decieveth the eye /Joe From joe.armstrong@REDACTED Wed Jan 26 16:40:48 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Wed, 26 Jan 2005 16:40:48 +0100 Subject: [newbie] accept()-ing process under supervision (was:Erlangish way of Iterator pattern) Message-ID: No please ask lots of questions - there's no such thing as too much noise. Every question results in (hopefully) a few replies - and in a few weeks the replies end up in Mr. Google's giant brain - and thereafter everybody benefits /Joe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Gaspar > Chilingarov > Sent: den 26 januari 2005 16:20 > Cc: erlang-questions@REDACTED > Subject: Re: [newbie] accept()-ing process under supervision > (was:Erlangish way of Iterator pattern) > > > ok, i think that i got idea :) > > anyway, sorry for making to much noise on the list, but i'm trying to > prototype some network management system/console in Erlang > and move it > away from perl/php/shell/C/etc. because it's easy to programm in that > languages, but hard enough to provide stability/scalability/ease of > maintenance. > > hmm . last phrase sounds a little bit ugly, but i'm not a > native speaker :) > From keymon@REDACTED Wed Jan 26 16:50:36 2005 From: keymon@REDACTED (=?iso-8859-1?q?H=E9ctor_Rivas_G=E1ndara?=) Date: Wed, 26 Jan 2005 16:50:36 +0100 Subject: Reflection in Erlang. Message-ID: <200501261650.36408.keymon@wanadoo.es> Hi, One year ago somebody asked for a way to obtain info on a loaded module. The response were module_info/0 and module_info/1 funtions. My question now is if its posible to dinamicly impersonate an erlang module, in order to create an "stub" module. I want to construct an module from a interface definition, so I can do something like: StubModule = adaptor:getStub("anInterfaceId"); Obj = anInterfaceId:createInstance(); StubModule:method1(Obj); StubModule:method2(Obj, 1, 2); If there is no reflection the aproximation can be: Obj = adaptor:createInstance("anInterfaceId"); adaptor:callMethod(Obj, method1, []); adaptor:callMethod(Obj, method2, [1,2]); -- Greets From casper2000a@REDACTED Wed Jan 26 17:06:15 2005 From: casper2000a@REDACTED (casper2000a@REDACTED) Date: Wed, 26 Jan 2005 22:06:15 +0600 Subject: Erlang Port drivers and Erl_interface In-Reply-To: References: Message-ID: <1106755575.41f7bff7287d0@www.omnibis.com> Hi All, With an Erlang Port driver, is it possible to use Erl_interface functions for message Encoding/Decoding? What's the best method to use? Thanks in advace! Eranga --------------This mail sent through OmniBIS.com-------------- From fredrik.linder@REDACTED Wed Jan 26 17:43:08 2005 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Wed, 26 Jan 2005 17:43:08 +0100 Subject: Reflection in Erlang. Message-ID: > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of H?ctor Rivas > G?ndara > Sent: den 26 januari 2005 16:51 > To: erlang-questions@REDACTED > Subject: Reflection in Erlang. > > > > Hi, > > One year ago somebody asked for a way to obtain info on a > loaded module. > The response were module_info/0 and module_info/1 funtions. > > My question now is if its posible to dinamicly impersonate > an erlang module, > in order to create an "stub" module. I want to construct an > module from a > interface definition, so I can do something like: (a) > StubModule = adaptor:getStub("anInterfaceId"); > Obj = anInterfaceId:createInstance(); > StubModule:method1(Obj); > StubModule:method2(Obj, 1, 2); > > If there is no reflection the aproximation can be: (b) > Obj = adaptor:createInstance("anInterfaceId"); > adaptor:callMethod(Obj, method1, []); > adaptor:callMethod(Obj, method2, [1,2]); I'm not 100% into the earliest development of erlang, but (and perhaps a little more than you asked for): One of my favourite usages of the behaviour feature is to write an behaviour definition module and then write a behaviour implementation in another module. The behaviour definition module *also* implement the exported functions, but with a Module argument as the first argument. [my_behaviour.erl] -module(my_behaviour). -export([behaviour_info/1, my_func1/2, my_func2/3]). behaviour_info(callbacks) -> [{my_func1, 1}, {my_func2, 2}]. my_func1(Mod, A1) -> Mod:my_func(A1). my_func2(Mod, A1, A2) -> Mod:my_func(A2). [my_behaviour_implementation.erl] -module(my_behaviour_implementation). -behaviour(my_behaviour). -export([my_func1/1, my_func2/2]). my_func1(A1) -> something. my_fund2(A2) -> something. The user code can then choose to either call: my_behaviour:my_func1(my_behaviour_implementation, A1) or my_behaviour_implementation:my_func1(A1). Using this design you could have the adaptor:getStub(...) return my_behaviour_implementation and later use that to make the calls. adaptor:createInstance("anInterfaceId") -> my_behaviour_implementation. This scheme works well iff the Obj is a singleton! I can think of two ways to remove the singleton requirement. (1) Add a state. In this case is alternative (a) not possible. To make (b) work; switch the Mod to contain a state. [my_behaviour.erl] -module(my_behaviour). -export([behaviour_info/1, my_func1/2, my_func2/3]). behaviour_info(callbacks) -> [{my_func1, 2}, {my_func2, 3}]. my_func1({Mod, State}, A1) -> Mod:my_func(State, A1). my_func2({Mod, State}, A1, A2) -> Mod:my_func(State, A2). [my_behaviour_implementation.erl] -module(my_behaviour_implementation). -behaviour(my_behaviour). -export([my_func1/2, my_func2/3]). my_func1(State, A1) -> something. my_fund2(State, A2) -> something. (2) Dynamically create a module following these steps: Have the adaptor:createInstance("anInterfaceId") function (exactly how to can be found in the archives of this mailing list): 1 - Write the code of the module relating to the specified interface *with* state information into a file. 2 - Compile that module (file) in run-time using the compile module. 3 - Load that module into the desired node(s). 4 - Initialize the module if necessary (especially if each object also is a process). 5 - Return the module name (as an atom). Each new instance need a unique module name, consider using a descriptive basename and the erlang:node/0 function along with erlang:now/0 to generate this. Also make sure the newly compiled code exports the desired functions. This enables the (a) alternative. Good luck /Fredrik From vances@REDACTED Wed Jan 26 18:16:51 2005 From: vances@REDACTED (Vance Shipley) Date: Wed, 26 Jan 2005 12:16:51 -0500 Subject: [newbie] accept()-ing process under supervision (was:Erlangish way of Iterator pattern) In-Reply-To: References: Message-ID: <20050126171651.GO58257@frogman.motivity.ca> On Wed, Jan 26, 2005 at 04:07:29PM +0100, Joe Armstrong (AL/EAB) wrote: } } [almost] - the code above is incorrect - and is merely to illustrate the idea - } why is it incorrect? (ten brownie points for the first correct explanation of the error :-) I'm not sure what you're looking for. Mainly the fun to handle the exit reason is being called with Reason only but expects the full {'EXIT', Pid, Reason} message. Other wise, with some syntax corrections, it seems to work: 1> brownie:keep_alive(fun() -> receive abort -> exit(abort) end end). <0.32.0> 2> i(). ... <0.31.0> erlang:apply/2 233 15 0 erl_eval:receive_clauses/6 8 <0.32.0> erlang:apply/2 233 4 0 brownie:'-on_exit/2-fun-0-'/2 3 3> P = list_to_pid("<0.31.0>"). <0.31.0> 4> P ! abort. abort 5> i(). ... <0.36.0> erlang:apply/2 233 15 0 erl_eval:receive_clauses/6 8 <0.37.0> erlang:apply/2 233 4 0 brownie:'-on_exit/2-fun-0-'/2 3 Although I'd say the main problem is that since it doesn't spawn_link it is possible for the process to exit before the link takes place. -Vance -------------- next part -------------- -module(brownie). -export([keep_alive/1]). on_exit(Pid, Fun) -> spawn(fun() -> process_flag(trap_exit, true), link(Pid), receive {'EXIT', Pid, Why} -> Fun(Why) end end). keep_alive(Fun) -> Pid = spawn(Fun), on_exit(Pid, fun(normal) -> true; (_Other) -> %% restart it keep_alive(Fun) end). From mscandar@REDACTED Wed Jan 26 19:39:29 2005 From: mscandar@REDACTED (Mark Scandariato) Date: Wed, 26 Jan 2005 13:39:29 -0500 Subject: [newbie] accept()-ing process under supervision (was:Erlangish way of Iterator pattern) In-Reply-To: <20050126171651.GO58257@frogman.motivity.ca> References: <20050126171651.GO58257@frogman.motivity.ca> Message-ID: <41F7E3E1.9010505@cisco.com> Vance Shipley wrote: > On Wed, Jan 26, 2005 at 04:07:29PM +0100, Joe Armstrong (AL/EAB) wrote: > } > } [almost] - the code above is incorrect - and is merely to illustrate the idea - > } why is it incorrect? (ten brownie points for the first correct explanation of the error :-) > > I'm not sure what you're looking for. Mainly the fun to handle > the exit reason is being called with Reason only but expects the > full {'EXIT', Pid, Reason} message. Other wise, with some syntax > corrections, it seems to work: My take on it was: keep_alive(Fun) -> on_exit(spawn(Fun), fun (normal) -> true; (_) -> keep_alive(Fun) end). > > Although I'd say the main problem is that since it doesn't spawn_link > it is possible for the process to exit before the link takes place. > > -Vance > If Pid exits before the link, then the linking process will receive {'EXIT', Pid, noproc}. (And will call Fun(noproc)). From david.nospam.hopwood@REDACTED Wed Jan 26 22:50:47 2005 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Wed, 26 Jan 2005 21:50:47 +0000 Subject: [newbie] accept()-ing process under supervision (was:Erlangish way of Iterator pattern) In-Reply-To: References: Message-ID: <41F810B7.7080905@blueyonder.co.uk> Joe Armstrong (AL/EAB) wrote: > Tricky - there is a spectrum of answers here: > > "make sure that it is always listening" could mean lot's of different things: > > 1) Is the listening process (ie the process which evaluates tcp_accept) > still alive? > 2) Is the listening process responsive? > ie is it accepting connections and doing what it is supposed to do? > > In my example tcp_server might happily accept connections and spawn a new handler > per connection - but these handlers might deadlock, or go into infinite loops or something and not respond as > expected (Now I don't mean here that the handlers *crash* - because crashes will be detected and the > socket will be closed) - it's just that they don't work properly. > > Detecting 1) is trivial (just link to the process). 2) requires some kind of end-to-end confirmation > ie a program *outside* Erlang which periodically asks the server to prove that it running. > Say ask it what factorial 42 is once every minute. Or better still, run the unit test for the server. > < because of "Joe's law" > > +------------+ > | Joe's law | > +-----------------------------------------+ > | To do fault-tolerant computations | > | you need at least 2 computers | > +-----------------------------------------+ > > Obviously :-) I would have thought you could separate the problems of testing whether the processor is working (must be done from a different processor), and testing whether each program on it is working (can be done from the same processor, provided it is from a different language runtime). Processors and programs don't tend to fail in ways that could defeat this approach. -- David Hopwood From keymon@REDACTED Thu Jan 27 00:01:05 2005 From: keymon@REDACTED (=?iso-8859-1?q?H=E9ctor_Rivas_G=E1ndara?=) Date: Thu, 27 Jan 2005 00:01:05 +0100 Subject: Reflection in Erlang. In-Reply-To: References: Message-ID: <200501270001.05703.keymon@wanadoo.es> El Mi?rcoles, 26 de Enero de 2005 17:43, Fredrik Linder escribi?: > One of my favourite usages of the behaviour feature is to write an > behaviour definition module and then write a behaviour implementation in > another module. The behaviour definition module *also* implement the > exported functions, but with a Module argument as the first argument. > Using this design you could have the adaptor:getStub(...) return > my_behaviour_implementation and later use that to make the calls. I wan't to wrap objects from other language, so the problem is how to dinamicly impersonate an object with an arbitrary interface in Erlang. I can solve this using the simple call: adaptor:callMethod(Obj, "method1", Args). but I was looking for some "Sugar Syntax". The ideal was something like: Obj:method1(arg1, arg2). But I known, Erlang is not an OO language :) > (2) Dynamically create a module following these steps: > Have the adaptor:createInstance("anInterfaceId") function (exactly how to > can be found in the archives of this mailing list): > 1 - Write the code of the module relating to the specified interface *with* > state information into a file. 2 - Compile that module (file) in run-time > using the compile module. 3 - Load that module into the desired node(s). > 4 - Initialize the module if necessary (especially if each object also is a > process). 5 - Return the module name (as an atom). I think that this produces excessive overhead. I'll have a lot of objects. -- Greets From Bob.Smart@REDACTED Thu Jan 27 00:30:42 2005 From: Bob.Smart@REDACTED (Bob.Smart@REDACTED) Date: Thu, 27 Jan 2005 10:30:42 +1100 Subject: [newbie] accept()-ing process under supervision (was:Erlangish way of Iterator pattern) Message-ID: I was excited when I found UBF since it seemed to be the right answer to client server. And Erlang is ideal for servers and I can write the clients as Java applets. As I wrote to a friend: One of the things I like about UBF is that clients to server is RPC, but the server can send extra messages to the client. This is ideal. If you just have an RPC system (like the web) then the client only sees new info when it makes a call. If you have a message based system then the clients can flood the server. The ubf combination is fine. When a server action might take a while the server can respond immediately to the rpc, then send the answer later. However I wonder what the state of it is. I just got version 0.12 and the irc_server and Erlang irc-client seem to work together ok (though error recovery is not ideal). However the Java irc-client gives a contract error. There is also a report of an alternative Java implementation. And indeed other languages would be good: there is mention of a TCL version but I haven't found it. I'm sure I'll be able to use UBF even if these issues aren't addressed. Congratulations on a great idea and a useable implementation. Bob From jay@REDACTED Thu Jan 27 07:28:39 2005 From: jay@REDACTED (Jay Nelson) Date: Wed, 26 Jan 2005 22:28:39 -0800 Subject: Anyone looked at a uClinux VM for erlang? Message-ID: <41F88A17.3060706@duomark.com> Samsung has a digital minicam, mp3, voice, still photo device based around their own SOC. It runs uClinux (downloadable from Samsung's site) optimized for their platform. They also have a whitepaper describing the performance gains of MMU-less uClinux vs MMU Linux. The kernel can boot to a shell in 80 milliseconds, while the camera takes 0.8 seconds to finish boot up. http://linuxdevices.com/articles/AT7933085076.html jay From francesco@REDACTED Wed Jan 26 16:49:01 2005 From: francesco@REDACTED (Francesco Cesarini (Erlang Training & Consulting)) Date: Wed, 26 Jan 2005 15:49:01 +0000 Subject: Erlang on embedded Vxworks ( Re: Re: Supervisor hierarchy question) In-Reply-To: <200501260213.j0Q2Dkb17518@hades.cslab.ericsson.net> References: <200501260213.j0Q2Dkb17518@hades.cslab.ericsson.net> Message-ID: <41F7BBED.2080102@erlang-consulting.com> In response to your comments, memory usage is obviously application dependent. Not knowing anything on your memory requirements and not knowing anything about your application, it is very hard to judge. The "Erlang answer" to these questions is to prototype your application and get a proof of concept, taking measurements of memory usage when stressing the system. Keep in mind that when using VxWorks, you have no memory protection from other threads, so corrupting Erlang's memory space is a huge risk. If it happens, there will be little information to help you in your post mortem debugging. Also to keep in mind is that there is no commercial port for VxWorks at the moment. Erlang and VxWorks has been discussed on the list in the past, so I would suggest you look at the archives as well. Regards, Francesco -- http://www.erlang-consulting.com Techie Yang wrote: > Thanks for your hint! > > So if it is correctly handled, there might be no crash due to lack of memory. Right? Then if we extend the memory to 64M, is it possible to be safe? > > Basically, the crash would not be the result we want. : - ). > > We are considering to use Erlang/OTP on our next product, the card is PPC860 with vxWorks, memory may be 32M. > > Best Regards > Techie > > > > > >>We did it on a VX WOrks embedded system, but it was back in 1997. The VM >>was much smaller back then. Just be very careful with your recursion >>(Use only tail recursion so as to avoid memory bursts), and ensure you >>have heart enabled for auto restart in case the virtual crashes because >>of lack of memory. >> >>Regards, >>Francesco >>-- >>http://www.erlang-consulting.com >> >>Techie Yang wrote: >> >>>And is it possible to enable mnesia/SNMP on a board with just 32M RAM, in case without huge bulks of data to be manipulated? >>> >>>Thanks in advance for your hints! >>> >>>Best Regards >>> >>> >>> >>> >>> >>> >>>>Torbjorn Tornkvist wrote: >>>> >>>> >>>>>Yes, Nortel's SSL-VPN products is using Mnesia in all its glory. >>>> >>>>Regarding Mnesia, I have a question to all of you that are also using it >>>>in production. What do you use for backuping Mnesia ? What function do >>>>you call ? >>> >>>>From our experience, the Mnesia backup function can eat a lot of >>> >>>>memory. This is for sure related to the distributed feature and the fact >>>>that a stable checkpoint must be generated. >>>> >>>>But you need a lot of RAM to do such operation. This is the same for >>>>table structure updates. On some hardware, it could be difficult to keep >>>>several hundreds of Mo in RAM just to be safe with backups. Could this >>>>be related to the number of waiting messages queued before Mnesia ? >>>> >>>>So, I wanted to have your feedback on how you handle those >>>>administration Mnesia process ? >>>> >>>>Thank you in advance for your feedback. >>>> >>>>-- >>>>Micka?l R?mond >>>>http://www.erlang-projects.org/ >>>> >>> >>> >>>= = = = = = = = = = = = = = = = = = = = >>> >>> >>>?????????????????? >>>???? >>> >>> >>>????????????????Techie Yang >>>????????????????techieyang@REDACTED >>>????????????????????2005-01-25 >>> >>> >>> >>> >> >> >> > > = = = = = = = = = = = = = = = = = = = = > > > ?????????????????? > ???? > > > ????????????????Techie Yang > ????????????????techieyang@REDACTED > ????????????????????2005-01-26 > > > > From csanto@REDACTED Thu Jan 27 08:06:13 2005 From: csanto@REDACTED (Corrado Santoro) Date: Thu, 27 Jan 2005 08:06:13 +0100 Subject: Reflection in Erlang. In-Reply-To: <200501270001.05703.keymon@wanadoo.es> References: <200501270001.05703.keymon@wanadoo.es> Message-ID: <41F892E5.5010106@diit.unict.it> H?ctor Rivas G?ndara wrote: > I wan't to wrap objects from other language, so the problem is how to > dinamicly impersonate an object with an arbitrary interface in Erlang. I > can solve this using the simple call: > > adaptor:callMethod(Obj, "method1", Args). See http://www.diit.unict.it/users/csanto/exat/ It is an Erlang agent platform, but it includes a module for writing objects in Erlang. Maybe this could help you. --Corrado -- ====================================================== Eng. Corrado Santoro, Ph.D. University of Catania - Engineering Faculty Department of Computer Science and Telecommunications Engineering Viale A. Doria, 6 - 95125 CATANIA (ITALY) Tel: +39 095 7382380 Fax: +39 095 7382397 +39 095 7382365 +39 095 7382364 EMail: csanto@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.iit.unict.it ====================================================== From matthias@REDACTED Thu Jan 27 08:10:33 2005 From: matthias@REDACTED (Matthias Lang) Date: Thu, 27 Jan 2005 08:10:33 +0100 Subject: Anyone looked at a uClinux VM for erlang? In-Reply-To: <41F88A17.3060706@duomark.com> References: <41F88A17.3060706@duomark.com> Message-ID: <16888.37865.759732.606289@antilipe.corelatus.se> I don't know of anyone who has gotten linux to run on uClinux, but the lack of an MMU isn't a show-stopper: Erlang runs on VxWorks, and that's MMU-less too. At least it was five years ago, and Erlang ran on it then. It's probably quite a bit of work to get it all to compile. I couldn't figure out from the referenced article whether the SoC had DRAM on chip or externally. There's a link to a GDB session which shows a system with just 4M of DRAM. Erlang needs way more than that. 16 or 32M would be much better. But maybe the DRAM is external and you can connect much more. Matt From matthias@REDACTED Thu Jan 27 08:47:04 2005 From: matthias@REDACTED (Matthias Lang) Date: Thu, 27 Jan 2005 08:47:04 +0100 Subject: Erlang on embedded Vxworks ( Re: Re: Supervisor hierarchy question) In-Reply-To: <41F7BBED.2080102@erlang-consulting.com> References: <200501260213.j0Q2Dkb17518@hades.cslab.ericsson.net> <41F7BBED.2080102@erlang-consulting.com> Message-ID: <16888.40056.76121.730893@antilipe.corelatus.se> Francesco Cesarini (Erlang Training & Consulting) writes: > Keep in mind that when using VxWorks, you have no memory protection > from other threads, so corrupting Erlang's memory space is a huge > risk. WindRiver finally left the DOS era and added support for MMUs sometime in the past few years. I'm not sure when exactly, but it's definitely in the 5.5 version which is currently selling. It looks like you have to do some fiddling to enable it. Matt From tobbe@REDACTED Thu Jan 27 08:56:59 2005 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Thu, 27 Jan 2005 08:56:59 +0100 Subject: [newbie] accept()-ing process under supervision (was:Erlangish way of Iterator pattern) In-Reply-To: References: Message-ID: <41F89ECB.20205@nortelnetworks.com> Bob.Smart@REDACTED wrote: > I was excited when I found UBF since it seemed to > be the right answer to client server.....snip... > > > However I wonder what the state of it is. > Well, one problem, I think, is that Joe never puts his stuff in Jungerl. This means that all nice projects of his never will take off (sorry Joe ;-) Cheers, Tobbe (Btw: Joe, I'm still waiting for your blog stuff.... :-) From richardc@REDACTED Thu Jan 27 09:07:34 2005 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 27 Jan 2005 09:07:34 +0100 Subject: [newbie] spawn-ed functions always exported? In-Reply-To: <20050126150515.GA4296@penne.localnet> References: <41F7AADA.6040103@web.am> <20050126150515.GA4296@penne.localnet> Message-ID: <41F8A146.8050906@csd.uu.se> (Seems I forgot to cc the list on my first attempt to answer. Darned gooey reply-buttons.) Carsten Schultz wrote: > Instead of > > spawn(?MODULE, f, [A1, A2, A3]) > > you can use > > spawn(fun ()->f(A1, A2, A3) end) > > Note however that these two will have slightly differing behaviour in > the presence of hot code update. Afaik the first one will spawn the > function of the newest version of the module, while the second one > will spawn the function of the version of the module executing the > spawn function. True. The following will behave like the first version: spawn(fun () -> ?MODULE:f(A1, A2, A3) end) This might also be a good time to point out that the fun-object that is created and passed to spawn/1 will become garbage as soon as the process is spawned, since the body of the fun is a tail call. Replacing the code of the module that the fun belongs to will *not* affect the created process. (I've sometimes heard people worry about code change when using spawn/1.) /Richard From joe.armstrong@REDACTED Thu Jan 27 09:30:42 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Thu, 27 Jan 2005 09:30:42 +0100 Subject: [newbie] accept()-ing process under supervision (was:Erlangish way of Iterator pattern) Message-ID: David Hopwood wrote > > I would have thought you could separate the problems of > testing whether the > processor is working (must be done from a different > processor), and testing > whether each program on it is working (can be done from the > same processor, > provided it is from a different language runtime). > > Processors and programs don't tend to fail in ways that could > defeat this > approach. The first problem is difficult. Suppose you have three machines A B and C A thinks C is dead B thinks C is alive A can talk to B ... Byzantine generals and all that stuff ... I have experience several situations where the machines appear to work, and the programs on the individual machines appear to work - all test case etc. have been passed and yet the systems manifestly do not work. This occurs because we can't formally prove our systems to be correct and our test cases only cover a small fraction of the problem space - so we easily get deluded that are programs are correct. The only thing that I have confidence in is end-to-end testing. /Joe > > -- > David Hopwood > From luke@REDACTED Thu Jan 27 09:50:40 2005 From: luke@REDACTED (Luke Gorrie) Date: 27 Jan 2005 09:50:40 +0100 Subject: [newbie] accept()-ing process under supervision (was:Erlangish way of Iterator pattern) References: <41F810B7.7080905@blueyonder.co.uk> Message-ID: David Hopwood writes: > Or better still, run the unit test for the server. C'mon, this is the Erlang list! There're no static typing guys around here, no need to keep up the pretense that we write test suites. ;-) From thomasl_erlang@REDACTED Thu Jan 27 10:31:07 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 27 Jan 2005 01:31:07 -0800 (PST) Subject: [newbie] accept()-ing process under supervision (was:Erlangish way of Iterator pattern) In-Reply-To: Message-ID: <20050127093107.48446.qmail@web41908.mail.yahoo.com> --- Luke Gorrie wrote: > David Hopwood > writes: > > > Or better still, run the unit test for the server. > > C'mon, this is the Erlang list! There're no static > typing guys around > here, no need to keep up the pretense that we write > test suites. ;-) The Erlang motto is "let it crash". Need I say more? Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Mail - 250MB free storage. Do more. Manage less. http://info.mail.yahoo.com/mail_250 From ulf.wiger@REDACTED Thu Jan 27 10:59:15 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Thu, 27 Jan 2005 10:59:15 +0100 Subject: [newbie] accept()-ing process under supervision (was:Erlangish way of Iterator pattern) Message-ID: (Note: Joe wrote UBF. I don't speak for Joe. These are my thoughts.) I think the state of UBF is that it needs some rethinking in order to get further, but what is there is already very good. I have a ubf application that has been slightly modified to fit better into the OTP framework (it's easier to configure, and uses supervisors etc. as you would expect. It also contains a small program that generates record definitions from a UBF spec (for all types that look like tagged tuples.) I've been using it with the 'builder' contrib (see Jungerl) I've been meaning to put it up on SourceForge for a year or so, but never got around to it. Example of a sys.config file where ubf_server is parameterized: [{cath,[]}, {mnesia,[{dir,"/home/etxuwig/work/temp/cathroot/mnesia"}]}, {ubf_server,[{services,[{8800, [{"file_server",file_plugin,[]}, {"irc_server",irc_plugin,[]}, {"test_server",test_plugin,[]}, {"cath_server", 'cath.server.ubf_plugin', administrator}]}, {8888, [{"cath_server",'cath.server.ubf_plugin',viewer}]}]}]} ]. The compressed tar file is 116 KB, so I thought I'd refrain from posting it on the list. If anyone wants a (completely unsupported) copy, please contact me. /Uffe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of > Bob.Smart@REDACTED > Sent: den 27 januari 2005 00:31 > To: Joe Armstrong (AL/EAB) > Cc: erlang-questions@REDACTED > Subject: RE: [newbie] accept()-ing process under supervision > (was:Erlangish way of Iterator pattern) > > > I was excited when I found UBF since it seemed to > be the right answer to client server. And Erlang is > ideal for servers and I can write the clients as > Java applets. As I wrote to a friend: > > One of the things I like about UBF is that clients > to server is RPC, but the server can send extra > messages to the client. This is ideal. If you just > have an RPC system (like the web) then the client > only sees new info when it makes a call. If you have > a message based system then the clients can flood > the server. The ubf combination is fine. When a server > action might take a while the server can respond > immediately to the rpc, then send the answer later. > > However I wonder what the state of it is. I just got > version 0.12 and the irc_server and Erlang irc-client > seem to work together ok (though error recovery is > not ideal). However the Java irc-client gives a > contract error. > > There is also a report of an alternative Java > implementation. And indeed other languages would be > good: there is mention of a TCL version but I haven't > found it. > > I'm sure I'll be able to use UBF even if these issues > aren't addressed. Congratulations on a great idea and > a useable implementation. > > Bob > From massimo.cesaro@REDACTED Fri Jan 7 11:01:54 2005 From: massimo.cesaro@REDACTED (Massimo Cesaro) Date: 07 Jan 2005 11:01:54 +0100 Subject: soft-upgrade vs failover and back to/from 2nd-ary system In-Reply-To: <16887.29207.351815.673175@antilipe.corelatus.se> References: <11760DCE-6C3C-11D9-8685-000393B64312@acm.org> <16884.594.453689.181445@antilipe.corelatus.se> <3CDC6823-6F62-11D9-997B-000393B64312@acm.org> <16887.29207.351815.673175@antilipe.corelatus.se> Message-ID: <1105092115.1506.5882.camel@xam> On Wed, 2005-01-26 at 11:33, Matthias Lang wrote: > > Keeping the voice connection up when the signalling state has been > lost is bad. It leaks connection resources and leaves subscribers > stuck in broken calls. Better to keep it simple and just drop the call > that triggered the problem. > > Matthias On the other hand, for IP telephony keeping connections up even when the signalling state is lost is acceptable. Given that the job of the (stateless) call agent is mainly to setup calls between intelligent gateways (i.e. telephones), a redundant system can take care of the hangup at the end of the call, if the primary system crashes after establishing the same call. The two endpoints have an HTTP-like approach to the signalling server, thus the failover/failback mechanism fits pretty well. Massimo From erlang@REDACTED Thu Jan 27 11:52:26 2005 From: erlang@REDACTED (Peter-Henry Mander) Date: Thu, 27 Jan 2005 10:52:26 +0000 Subject: Compiler crash report Message-ID: <20050127105226.50657699.erlang@manderp.freeserve.co.uk> Hi Gurus, I managed to isolate a non-critical compilation crash report. When compiling the following code: ---- BEGIN ---- -module(compiler_error). -export([test/0]). test() -> URI_Before = {absoluteURI, {scheme,fun() -> nil end}, {'hier-part', {'net-path', {srvr, {userinfo,nil}, fun() -> nil end}, nil}, {'query',nil}}}, {absoluteURI, {scheme,_}, {'hier-part', {'net-path', {srvr, {userinfo,nil}, HostportBefore}, nil}, {'query',nil}}} = URI_Before, %% ... some funky code ommitted, not relevant ... {absoluteURI, {scheme,_}, {'hier-part', {'net-path', {srvr, {userinfo,nil}, HostportAfter}, nil}, {'query',nil}}} = URI_Before, %% NOTE: I intended to write URI_After instead of URI_Before %% but the accident revealed that when you add the line below, %% it causes internal error in v3_codegen on compilation {hostport,{hostname,"HostName"},{port,nil}} = HostportAfter, ok. ---- END ---- I get this output: 12> c(compiler_error). ./compiler_error.erl:none: internal error in v3_codegen; crash reason: {{case_clause,{'EXIT',{function_clause, [{v3_codegen, fetch_reg, ['HostportAfter',[]]}, {v3_codegen,move_unsaved,4}, {v3_codegen,cg_call_args,4}, {v3_codegen,cg_setup_call,4}, {v3_codegen,bif_cg,7}, {v3_codegen, '-cg_list/5-anonymous-0-', 3}, {v3_codegen,flatmapfoldl,3}, {v3_codegen,flatmapfoldl,3}, {v3_codegen,cg_list,5}, {v3_codegen,cg_block,5}]}}}, [{compile,'-select_passes/2-anonymous-2-',2}, {compile,'-internal_comp/4-anonymous-1-',2}, {compile,fold_comp,3}, {compile,internal_comp,4}, {compile,internal,3}]} ./compiler_error.erl:23: Warning: variable 'HostportBefore' is unused error Pete. -- "The Tao of Programming flows far away and returns on the wind of morning." From klacke@REDACTED Thu Jan 27 11:35:59 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Thu, 27 Jan 2005 11:35:59 +0100 Subject: Erlang Port drivers and Erl_interface In-Reply-To: <1106755575.41f7bff7287d0@www.omnibis.com> References: <1106755575.41f7bff7287d0@www.omnibis.com> Message-ID: <20050127103559.GB18607@hyber.org> On Wed, Jan 26, 2005 at 10:06:15PM +0600, casper2000a@REDACTED wrote: > Hi All, > > With an Erlang Port driver, is it possible to use > Erl_interface functions for message > Encoding/Decoding? What's the best method to use? > It depends on the complexity/structure of the messages between the driver and erlang-code. If you want to send structured tuples back and forth, using erl_interface is a very good option. On the other hand, if the messages are simple such as: <> or some such, it may be a lot easier (and more efficent) to roll your own. Write all code first so that it works nice and fine through the spawn driver, i.e, don't link in the driver until the program works. Once it works, you make a driver out of it. I've used both methods. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From casper2000a@REDACTED Thu Jan 27 13:26:11 2005 From: casper2000a@REDACTED (Casper) Date: Thu, 27 Jan 2005 18:26:11 +0600 Subject: Erlang Port drivers and Erl_interface In-Reply-To: <20050127103559.GB18607@hyber.org> Message-ID: Klacke, Thanks for your advice. Let's say I want to pass a complex structure back and forth. And I opened the linked-in driver port using binary. Then can I use term_to_binary and binary_to_term in the Erlang side and erl_decode, erl_encode and other erl interface functions in the C side? - Eranga -----Original Message----- From: klacke@REDACTED [mailto:klacke@REDACTED] Sent: Thursday, January 27, 2005 4:36 PM To: casper2000a@REDACTED Cc: erlang-questions@REDACTED Subject: Re: Erlang Port drivers and Erl_interface On Wed, Jan 26, 2005 at 10:06:15PM +0600, casper2000a@REDACTED wrote: > Hi All, > > With an Erlang Port driver, is it possible to use > Erl_interface functions for message > Encoding/Decoding? What's the best method to use? > It depends on the complexity/structure of the messages between the driver and erlang-code. If you want to send structured tuples back and forth, using erl_interface is a very good option. On the other hand, if the messages are simple such as: <> or some such, it may be a lot easier (and more efficent) to roll your own. Write all code first so that it works nice and fine through the spawn driver, i.e, don't link in the driver until the program works. Once it works, you make a driver out of it. I've used both methods. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From nm@REDACTED Thu Jan 27 14:19:33 2005 From: nm@REDACTED (Gaspar Chilingarov) Date: Thu, 27 Jan 2005 17:19:33 +0400 Subject: set TCP PUSH option on socket? Message-ID: <41F8EA65.5050909@web.am> Hello! are there any way to set PUSH option on socket ? it's needed in telnet-like applications to get bytes as they typed by user From fredrik.linder@REDACTED Thu Jan 27 14:43:42 2005 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Thu, 27 Jan 2005 14:43:42 +0100 Subject: Reflection in Erlang. Message-ID: > > Using this design you could have the adaptor:getStub(...) return > > my_behaviour_implementation and later use that to make the calls. > > I wan't to wrap objects from other language, so the problem > is how to > dinamicly impersonate an object with an arbitrary interface > in Erlang. I > can solve this using the simple call: > > adaptor:callMethod(Obj, "method1", Args). > > but I was looking for some "Sugar Syntax". The ideal was > something like: > > Obj:method1(arg1, arg2). > > But I known, Erlang is not an OO language :) The easiest fit is probably what you suggest yourself: Type:Method(Obj, Arg1, Arg2) -> {Result, Obj} | exit(Reason) or Type:Method(Obj, Arg1, Arg2) -> {ok, Result, Obj} | {error, Reason, Obj} Another approach could be to use funs to wrap in the specific object: initObj(InitArgs) -> fun(method1, CallArgs) -> something(InitArgs, CallArgs); (method2, CallArgs) -> somethingelse(InitArgs, CallArgs); (Method, CallArgs) -> parent:initObj(InitArgs) end. Obj = initObj(InitArgs), {Result, Obj2} = Obj(method1, [arg1, arg2]), {Result, Obj3} = Obj2(method2, [arg]). Play around have fun! /Fredrik From matthias@REDACTED Thu Jan 27 14:44:45 2005 From: matthias@REDACTED (Matthias Lang) Date: Thu, 27 Jan 2005 14:44:45 +0100 Subject: set TCP PUSH option on socket? In-Reply-To: <41F8EA65.5050909@web.am> References: <41F8EA65.5050909@web.am> Message-ID: <16888.61517.948860.777183@antilipe.corelatus.se> Gaspar Chilingarov writes: > are there any way to set PUSH option on socket ? > it's needed in telnet-like applications to get bytes > as they typed by user I'm not sure what the "PUSH option" is. Maybe you mean TCP_NODELAY, which Erlang maps to {nodelay, Boolean}. Maybe you missed this option when you were carefully reading the man pages, or maybe there really is some PUSH option I don't know about. See also: http://www.erlang.se/doc/doc-5.4.3/lib/kernel-2.10.3/doc/html/inet.html http://www.erlang.se/doc/doc-5.4.3/lib/kernel-2.10.3/doc/html/gen_tcp.html Matthias From richardc@REDACTED Thu Jan 27 15:04:04 2005 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 27 Jan 2005 15:04:04 +0100 Subject: Reflection in Erlang. In-Reply-To: <200501270001.05703.keymon@wanadoo.es> References: <200501270001.05703.keymon@wanadoo.es> Message-ID: <41F8F4D4.5060503@csd.uu.se> H?ctor Rivas G?ndara wrote: > I wan't to wrap objects from other language, so the problem is how to > dinamicly impersonate an object with an arbitrary interface in Erlang. I > can solve this using the simple call: > > adaptor:callMethod(Obj, "method1", Args). > > but I was looking for some "Sugar Syntax". The ideal was something like: > > Obj:method1(arg1, arg2). > > But I known, Erlang is not an OO language :) You might want to play around with abstract modules (an experimental feature, available in R10). http://www.erlang.org/ml-archive/erlang-questions/200411/msg00048.html /Richard From rrerlang@REDACTED Thu Jan 27 15:09:47 2005 From: rrerlang@REDACTED (Robert Raschke) Date: Thu, 27 Jan 2005 14:09:47 0000 Subject: Erlang Port drivers and Erl_interface In-Reply-To: Message-ID: <898abf3450a12f1032a5057f6813860f@tombob.com> Hi Eranga, you wrote: > Let's say I want to pass a complex structure back and forth. And I opened > the linked-in driver port using binary. Then can I use term_to_binary and > binary_to_term in the Erlang side and erl_decode, erl_encode and other erl > interface functions in the C side? I have been using the term_to_binary and binary_to_term functions as well. In my C port program I use the ei_decode...() and ei_encode...() functions. It took me a little bit to get used to the way these functions handle the message buffer, but with a little bit of experimentation you will get up and running quickly. For example I send my requests from erlang in a predefined format (obviously), and then I unpack it in my C program like this, with the x_in buffer holding a message. It is very verbose, as I was learning how the ei functions work while writing it. static void handle_regular_message(ei_x_buff *x_in, ei_x_buff *x_out) { int valid = 1; int version; int arity; char call_atom[MAXATOMLEN]; erlang_pid from; char fn_atom[MAXATOMLEN]; /* Incoming message has to be {call, Caller_Pid, Fn, [Params]} with call - the atom 'call' Caller_Pid - erlang pid of process that sent the message Fn - name as atom of the function to invoke Params - parameters to pass to Fn For an invalid request message the return message has the form {error, badmsg} For a valid request message the return message has the form {Caller_Pid, Result} with Result = ok | {ok, Value} | {error, internal, error} | {error, badarg, args} */ if (valid && ei_decode_version(x_in->buff, &x_in->index, &version) != 0) { fprintf(stderr, "Warning: Ignoring received malformed message (bad version).\n"); valid = 0; } if (valid && ei_decode_tuple_header(x_in->buff, &x_in->index, &arity) != 0) { fprintf(stderr, "Warning: Ignoring received malformed message (not tuple).\n"); valid = 0; } if (valid && arity != 4) { fprintf(stderr, "Warning: Ignoring received malformed message (not 4-arity tuple).\n"); valid = 0; } if (valid && ei_decode_atom(x_in->buff, &x_in->index, call_atom) != 0) { fprintf(stderr, "Warning: Ignoring received malformed message (first tuple element not atom).\n"); valid = 0; } if (valid && strcmp(call_atom, "call") != 0) { fprintf(stderr, "Warning: Ignoring received malformed message" " (first tuple element not atom 'call').\n"); valid = 0; } if (valid && ei_decode_pid(x_in->buff, &x_in->index, &from) != 0) { fprintf(stderr, "Warning: Ignoring received malformed message (Second tuple element not pid).\n"); valid = 0; } if (valid && ei_decode_atom(x_in->buff, &x_in->index, fn_atom) != 0) { fprintf(stderr, "Warning: Ignoring received malformed message (Third tuple element not atom).\n"); valid = 0; } if (valid) { x_out->index = 0; ei_x_encode_version(x_out); ei_x_encode_tuple_header(x_out, 2); ei_x_encode_pid(x_out, &from); fprintf(stderr, "Attempting to call e_%s().\n", fn_atom); if (strcmp(fn_atom, "my_fun_1") == 0) my_fun_1(x_in, x_out); else if (strcmp(fn_atom, "my_fun_2") == 0) my_fun_2(x_in, x_out); else if (strcmp(fn_atom, "my_fun_3") == 0) my_fun_3(x_in, x_out); else { fprintf(stderr, "Warning: Ignoring received malformed message" " (Third tuple element not recognised function).\n"); valid = 0; } if (valid) { fprintf(stderr, "Returned from my_fun().\n"); } } if (! valid) { x_out->index = 0; ei_x_encode_version(x_out); ei_x_encode_tuple_header(x_out, 2); ei_x_encode_atom(x_out, "error"); ei_x_encode_atom(x_out, "badmsg"); } } Each function I invoke (my_fun()) takes apart the rest of the x_in buffer, and completes the result buffer x_out (which gets sent back to Erlang). I hope this gets you further along, Robby From nm@REDACTED Thu Jan 27 15:17:38 2005 From: nm@REDACTED (Gaspar Chilingarov) Date: Thu, 27 Jan 2005 18:17:38 +0400 Subject: set TCP PUSH option on socket? In-Reply-To: <16888.61517.948860.777183@antilipe.corelatus.se> References: <41F8EA65.5050909@web.am> <16888.61517.948860.777183@antilipe.corelatus.se> Message-ID: <41F8F802.4040109@web.am> Matthias Lang wrote: > Gaspar Chilingarov writes: > > > are there any way to set PUSH option on socket ? > > it's needed in telnet-like applications to get bytes > > as they typed by user > > I'm not sure what the "PUSH option" is. > > Maybe you mean TCP_NODELAY, which Erlang maps to {nodelay, > Boolean}. Maybe you missed this option when you were carefully reading > the man pages, or maybe there really is some PUSH option I don't know > about. > > See also: > > http://www.erlang.se/doc/doc-5.4.3/lib/kernel-2.10.3/doc/html/inet.html > http://www.erlang.se/doc/doc-5.4.3/lib/kernel-2.10.3/doc/html/gen_tcp.html > > Matthias > there is PUSH option in tcp which forces OS write packet to network as fast as possible after user called write function -- this is not the same as TCP_NODELAY -- which ... well , this is a quote from RFC :) A sending TCP is allowed to collect data from the sending user and to send that data in segments at its own convenience, until the push function is signaled, then it must send all unsent data. When a receiving TCP sees the PUSH flag, it must not wait for more data from the sending TCP before passing the data to the receiving process. so, it effectively disables any os buffering of packets -- which is very well suited for telnet applications -- every symbol typed by user goes to server in separate packet(or several chars it you type very fast, btw ;). it seems that TCP_PUSH not implemented in Erlang options. From dietmar@REDACTED Thu Jan 27 15:50:08 2005 From: dietmar@REDACTED (Dietmar Schaefer) Date: Thu, 27 Jan 2005 15:50:08 +0100 Subject: [newbie] accept()-ing process under supervision Message-ID: <41F8FFA0.9030705@ast.dfs.de> OOPS ! Sorry Joe -> this message was not only for you ! Sorry Folks I don 't get it I am having the same problem : keeping the server running(accecpting connections) even when my client (written in C) dies. I found this in btt_srv.erl and slightly adapted it : getMessages(Port) when integer(Port) -> case gen_tcp:listen(Port, [ {reuseaddr, true}, {packet, 0}, {active, false}]) of {ok, ListenSocket} -> io:format(" I listen to socket ~p~n", [Port]), process_flag(trap_exit, true), %% get informed when server failed acceptLS(ListenSocket); Error -> exit(error) end. acceptLS(Socket) -> Pid = erlang:spawn_link( fun() -> rec(Socket,self()) end), waitForAcceptLS(Socket,Pid). waitForAcceptLS(Socket,Pid) -> receive {Pid,ok} -> ok; %% ?MODULE:acceptLS(Socket); {'EXIT',From,_} -> ?MODULE:acceptLS(Socket); _Error -> waitForAcceptLS(Socket,Pid) end. rec(Socket,Pid) -> case gen_tcp:accept(Socket) of {ok,Sock} -> Pid ! {self(),ok}, doRecv(Sock); Error -> exit(Error) end. %% @doc %% this is the receiving routine %% doRecv(Sock) -> case gen_tcp:recv(Sock,0) of {ok,Bin} -> io:format("o.k. I got: ~p~n", [decode(Bin)]), doRecv(Sock); {'EXIT',From,_} -> ?MODULE:acceptLS(Sock); _Other -> other end. When I kill the client I get: exited: {undef,[{cmmc_com,acceptLS,[#Port<0.620>]}, {cmmc_com,startComm,2}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} Any hints ?? regards Dietmar From matthias@REDACTED Thu Jan 27 15:56:25 2005 From: matthias@REDACTED (Matthias Lang) Date: Thu, 27 Jan 2005 15:56:25 +0100 Subject: set TCP PUSH option on socket? In-Reply-To: <41F8F802.4040109@web.am> References: <41F8EA65.5050909@web.am> <16888.61517.948860.777183@antilipe.corelatus.se> <41F8F802.4040109@web.am> Message-ID: <16889.281.902286.583141@antilipe.corelatus.se> Gaspar Chilingarov writes: > there is PUSH option in tcp which forces OS write packet to network as > fast as possible after user called write function -- this is not the > same as TCP_NODELAY -- which ... well , this is a quote from RFC :) Do you have some C code which demonstrates your TCP_PUSH option? Which operating system(s) does it compile on? (You quoted some text which appears in RFC793. But RFC793 specifies a protocol, it doesn't specify the names of the options and functions in the C library. There's some historical flotsam and jetsam floating about with BSD/TRU64/Linux/RFC793 using different names for closely related things---TCP_CORK, TCP_UNCORK, TCP_NODELAY, TCP_PUSH and TCP_NOPUSH. Linux, for instance, doesn't have a TCP_PUSH option in the C interface to sockets. But I can't see anything that you can accomplish with TCP_PUSH which you can't accomplish with TCP_NODELAY, possibly in combination with TCP_CORK.) Matthias From csanto@REDACTED Thu Jan 27 16:11:47 2005 From: csanto@REDACTED (Corrado Santoro) Date: Thu, 27 Jan 2005 16:11:47 +0100 Subject: set TCP PUSH option on socket? In-Reply-To: <41F8F802.4040109@web.am> References: <41F8EA65.5050909@web.am> <16888.61517.948860.777183@antilipe.corelatus.se> <41F8F802.4040109@web.am> Message-ID: <41F904B3.90203@diit.unict.it> Gaspar Chilingarov wrote: > there is PUSH option in tcp which forces OS write packet to network as > fast as possible after user called write function -- this is not the > same as TCP_NODELAY -- which ... well , this is a quote from RFC :) > > A sending TCP is allowed to collect data from the sending user and to > send that data in segments at its own convenience, until the push > function is signaled, then it must send all unsent data. When a > receiving TCP sees the PUSH flag, it must not wait for more data from > the sending TCP before passing the data to the receiving process. In the BSD socket library the PUSH flag is not an option but it is automatically handled by the kernels of sender and receiver machines. Why do you want to control it? --Corrado -- ====================================================== Eng. Corrado Santoro, Ph.D. University of Catania - Engineering Faculty Department of Computer Science and Telecommunications Engineering Viale A. Doria, 6 - 95125 CATANIA (ITALY) Tel: +39 095 7382380 Fax: +39 095 7382397 +39 095 7382365 +39 095 7382364 EMail: csanto@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.iit.unict.it ====================================================== From bjorn@REDACTED Thu Jan 27 16:32:29 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 27 Jan 2005 16:32:29 +0100 Subject: Compiler crash report In-Reply-To: <20050127105226.50657699.erlang@manderp.freeserve.co.uk> References: <20050127105226.50657699.erlang@manderp.freeserve.co.uk> Message-ID: Thanks! We'll try to fix in R10B-3. /Bjorn Peter-Henry Mander writes: > Hi Gurus, > > I managed to isolate a non-critical compilation crash report. > When compiling the following code: > > ---- BEGIN ---- > > -module(compiler_error). > > -export([test/0]). > > test() -> > URI_Before = > {absoluteURI, > {scheme,fun() -> nil end}, > {'hier-part', > {'net-path', > {srvr, > {userinfo,nil}, > fun() -> nil end}, > nil}, > {'query',nil}}}, > > {absoluteURI, > {scheme,_}, > {'hier-part', > {'net-path', > {srvr, > {userinfo,nil}, > HostportBefore}, > nil}, > {'query',nil}}} = URI_Before, > > %% ... some funky code ommitted, not relevant ... > > {absoluteURI, > {scheme,_}, > {'hier-part', > {'net-path', > {srvr, > {userinfo,nil}, > HostportAfter}, > nil}, > {'query',nil}}} = URI_Before, > %% NOTE: I intended to write URI_After instead of URI_Before > %% but the accident revealed that when you add the line below, > %% it causes internal error in v3_codegen on compilation > {hostport,{hostname,"HostName"},{port,nil}} = HostportAfter, > > ok. > > > ---- END ---- > > I get this output: > > 12> c(compiler_error). > ./compiler_error.erl:none: internal error in v3_codegen; > crash reason: {{case_clause,{'EXIT',{function_clause, > [{v3_codegen, > fetch_reg, > ['HostportAfter',[]]}, > {v3_codegen,move_unsaved,4}, > {v3_codegen,cg_call_args,4}, > {v3_codegen,cg_setup_call,4}, > {v3_codegen,bif_cg,7}, > {v3_codegen, > '-cg_list/5-anonymous-0-', > 3}, > {v3_codegen,flatmapfoldl,3}, > {v3_codegen,flatmapfoldl,3}, > {v3_codegen,cg_list,5}, > {v3_codegen,cg_block,5}]}}}, > [{compile,'-select_passes/2-anonymous-2-',2}, > {compile,'-internal_comp/4-anonymous-1-',2}, > {compile,fold_comp,3}, > {compile,internal_comp,4}, > {compile,internal,3}]} > ./compiler_error.erl:23: Warning: variable 'HostportBefore' is unused > error > > > Pete. > > -- > "The Tao of Programming > flows far away > and returns > on the wind of morning." > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From nm@REDACTED Thu Jan 27 17:01:52 2005 From: nm@REDACTED (Gaspar Chilingarov) Date: Thu, 27 Jan 2005 20:01:52 +0400 Subject: set TCP PUSH option on socket? In-Reply-To: <41F904B3.90203@diit.unict.it> References: <41F8EA65.5050909@web.am> <16888.61517.948860.777183@antilipe.corelatus.se> <41F8F802.4040109@web.am> <41F904B3.90203@diit.unict.it> Message-ID: <41F91070.7010201@web.am> Corrado Santoro wrote: > Gaspar Chilingarov wrote: > >> there is PUSH option in tcp which forces OS write packet to network as >> fast as possible after user called write function -- this is not the >> same as TCP_NODELAY -- which ... well , this is a quote from RFC :) >> >> A sending TCP is allowed to collect data from the sending user and to >> send that data in segments at its own convenience, until the push >> function is signaled, then it must send all unsent data. When a >> receiving TCP sees the PUSH flag, it must not wait for more data from >> the sending TCP before passing the data to the receiving process. > > > In the BSD socket library the PUSH flag is not an option but it is > automatically handled by the kernels of sender and receiver machines. > Why do you want to control it? > > --Corrado > ok, ok. finally i got what i want -- if i respond to telnet client with right set of options -- it will send characters one by one, but anyway -- tcpdump shows that packets have PUSH(not an URGENT) and ACK options set... equal to 0x0018 in hex -- Gaspar Chilingarov System Administrator t +3749 419763 w www.web.am e nm@REDACTED From casper2000a@REDACTED Thu Jan 27 16:49:49 2005 From: casper2000a@REDACTED (casper2000a@REDACTED) Date: Thu, 27 Jan 2005 21:49:49 +0600 Subject: Erlang Port drivers and Erl_interface In-Reply-To: <898abf3450a12f1032a5057f6813860f@tombob.com> References: <898abf3450a12f1032a5057f6813860f@tombob.com> Message-ID: <1106840989.41f90d9d8e18a@www.omnibis.com> Hi Robert, This is really good information. Thanks a lot. Have you used Port Driver call back functions outputv, event, etc. I have 2 concerns about them. Unfortunately the documentation I found on them are not enough to absorb the full working scenario of them. 1) In outputv, the erlang emulator sends the message as a ErlIOVec. I wonder how I can use ei_decode to extract the message. 2) I didn't find a good document on event call back function. What're the information pass in as ErlDrvEvent and ErlDrvEventData? 3) Have you used anync or enq/deq functions in Port Driver? If you can give me some help or sample would be excellent. 4) Please confirm you are discussing above a Port driver, but not a C Node or Erl_Interface based port. 5) In your below example, in which call back functions can you call handle_regular_message to decode the function? Could you provide an example call back function. Thanks in advance! Eranga Quoting Robert Raschke : > Quoting Robert Raschke : > Hi Eranga, > > you wrote: > > Let\'s say I want to pass a complex structure back and forth. And I opened > > the linked-in driver port using binary. Then can I use term_to_binary and > > binary_to_term in the Erlang side and erl_decode, erl_encode and other erl > > interface functions in the C side? > > I have been using the term_to_binary and binary_to_term functions as > well. In my C port program I use the ei_decode...() and > ei_encode...() functions. It took me a little bit to get used to the > way these functions handle the message buffer, but with a little bit > of experimentation you will get up and running quickly. > > For example I send my requests from erlang in a predefined format > (obviously), and then I unpack it in my C program like this, with the > x_in buffer holding a message. It is very verbose, as I was learning > how the ei functions work while writing it. > > static void > handle_regular_message(ei_x_buff *x_in, ei_x_buff *x_out) > { > int valid = 1; > int version; > int arity; > char call_atom[MAXATOMLEN]; > erlang_pid from; > char fn_atom[MAXATOMLEN]; > > /* > Incoming message has to be > {call, Caller_Pid, Fn, [Params]} > with > call - the atom \'call\' > Caller_Pid - erlang pid of process that sent the message > Fn - name as atom of the function to invoke > Params - parameters to pass to Fn > > For an invalid request message the return message has the form > {error, badmsg} > > For a valid request message the return message has the form > {Caller_Pid, Result} > with > Result = ok | {ok, Value} | {error, internal, error} | {error, badarg, > args} > */ > > if (valid && ei_decode_version(x_in->buff, &x_in->index, &version) != 0) { > fprintf(stderr, \"Warning: Ignoring received malformed message (bad > version).\\n\"); > valid = 0; > } > > if (valid && ei_decode_tuple_header(x_in->buff, &x_in->index, &arity) != 0) > { > fprintf(stderr, \"Warning: Ignoring received malformed message (not > tuple).\\n\"); > valid = 0; > } > if (valid && arity != 4) { > fprintf(stderr, \"Warning: Ignoring received malformed message (not 4-arity > tuple).\\n\"); > valid = 0; > } > > if (valid && ei_decode_atom(x_in->buff, &x_in->index, call_atom) != 0) { > fprintf(stderr, \"Warning: Ignoring received malformed message (first tuple > element not atom).\\n\"); > valid = 0; > } > if (valid && strcmp(call_atom, \"call\") != 0) { > fprintf(stderr, \"Warning: Ignoring received malformed message\" > \" (first tuple element not atom \'call\').\\n\"); > valid = 0; > } > > if (valid && ei_decode_pid(x_in->buff, &x_in->index, &from) != 0) { > fprintf(stderr, \"Warning: Ignoring received malformed message (Second tuple > element not pid).\\n\"); > valid = 0; > } > > if (valid && ei_decode_atom(x_in->buff, &x_in->index, fn_atom) != 0) { > fprintf(stderr, \"Warning: Ignoring received malformed message (Third tuple > element not atom).\\n\"); > valid = 0; > } > > if (valid) { > x_out->index = 0; > ei_x_encode_version(x_out); > ei_x_encode_tuple_header(x_out, 2); > ei_x_encode_pid(x_out, &from); > > fprintf(stderr, \"Attempting to call e_%s().\\n\", fn_atom); > > if (strcmp(fn_atom, \"my_fun_1\") == 0) my_fun_1(x_in, x_out); > else if (strcmp(fn_atom, \"my_fun_2\") == 0) my_fun_2(x_in, x_out); > else if (strcmp(fn_atom, \"my_fun_3\") == 0) my_fun_3(x_in, x_out); > else { > fprintf(stderr, \"Warning: Ignoring received malformed message\" > \" (Third tuple element not recognised function).\\n\"); > valid = 0; > } > if (valid) { > fprintf(stderr, \"Returned from my_fun().\\n\"); > } > } > > if (! valid) { > x_out->index = 0; > ei_x_encode_version(x_out); > ei_x_encode_tuple_header(x_out, 2); > ei_x_encode_atom(x_out, \"error\"); > ei_x_encode_atom(x_out, \"badmsg\"); > } > } > > Each function I invoke (my_fun()) takes apart the rest of the x_in > buffer, and completes the result buffer x_out (which gets sent back to > Erlang). > > I hope this gets you further along, > Robby > > --------------This mail sent through OmniBIS.com-------------- From mccratch@REDACTED Thu Jan 27 21:43:33 2005 From: mccratch@REDACTED (Matthias Kretschmer) Date: Thu, 27 Jan 2005 21:43:33 +0100 Subject: Windows, io:fwrite, halt, buffer flushing problems, R10B-2 Message-ID: <41F95275.1000501@gmx.net> Hello everyone I encountered a little problem on Windows: I have code like the following: -module(test). -export([test/0]). test() -> io:fwrite("test~n"), halt(1). which behaves strangely: sometimes nothing is printed on screen. I assume it is some problem with flushing a buffer. Using init:stop/0 instead of halt/1 solves the problem, but I wanted to return explicitly another error code than 0. In the code I encountered this problem first, the problem occured more often. I searched for a function flushing the standard output, but didn't found such in the kernel and stdlib manuals to solve this problem. After putting "receive after N -> ok end" between the fwrite and halt the problem seemed to vanish (depending on N ...). The interesting thing is, that there is no such problem on Mac OS X and NetBSD. I first thought, that this may be caused by the slower cpus/hardware. The win32-box has no other system installed, so I tried coLinux to test if it is caused by the faster cpu, but in coLinux it worked (but I don't know if and how big the speed loss is ...). I browsed the mailing list archive, but didn't found something about this. Hope that I am not blind :) I never looked at the implementation of Erlang to track down the problem, but for me it seems to be a Windows specific problem. Ok here the technical details: Windows XP SP 2, Erlang/OTP R10B-2 installed from the binary installer found at www.erlang.org (the working setups - Mac OS X, ... - are self-compiled R10B-2 from source) -- Matthias Kretschmer From klacke@REDACTED Thu Jan 27 22:21:56 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Thu, 27 Jan 2005 22:21:56 +0100 Subject: Erlang Port drivers and Erl_interface In-Reply-To: References: <20050127103559.GB18607@hyber.org> Message-ID: <20050127212156.GA21590@hyber.org> On Thu, Jan 27, 2005 at 06:26:11PM +0600, Casper wrote: > Klacke, > > Thanks for your advice. > > Let's say I want to pass a complex structure back and forth. And I opened > the linked-in driver port using binary. Then can I use term_to_binary and > binary_to_term in the Erlang side and erl_decode, erl_encode and other erl > interface functions in the C side? Exactly /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From Bob.Smart@REDACTED Thu Jan 27 23:32:19 2005 From: Bob.Smart@REDACTED (Bob.Smart@REDACTED) Date: Fri, 28 Jan 2005 09:32:19 +1100 Subject: UBF: getting client-server interaction right. Message-ID: When I saw the author of UBF on this list I hit reply but forgot to change the subject. I've done so now, but a bit late. > The compressed tar file is 116 KB, so I thought I'd refrain from > posting it on the list. If anyone wants a (completely unsupported) > copy, please contact me. I'd like to accept your kind offer, thanks. Bob P.S. people attracted to the Subject line can look for inspiration in some of the messages in the thread "RE: [newbie] accept()-ing process under supervision" and also at http://www.erlang-projects.org/Public/projects/services/ubf/view. From techieyang@REDACTED Fri Jan 28 03:11:57 2005 From: techieyang@REDACTED (Techie Yang) Date: Fri, 28 Jan 2005 10:11:57 +0800 Subject: Erlang on embedded Vxworks ( Re: Re: Supervisor hierarchy question) Message-ID: <200501280212.j0S2Cab42277@hades.cslab.ericsson.net> Thanks for the hints! I can find the two references from the erlang-faq, 1) One for Linux-PPC860, fancy work from you - matthias? I guess. http://www.corelatus.com/~matthias/erlang_on_860.html 2) One for vxWorks-cross-compilation, http://www.erlang.org/ml-archive/erlang-questions/200003/msg00013.html At least, for R6B on vxWorks, and R7B on LINUX, it seems that erlang works, from the points outlined. Actually i am a newbie to Erlang, still struggling to learn as much as possible. After this stage, i will try to make the Erlang running on my board, PPC860, hope both for vxWorks and Linux. BTW, nowadays, looks more and more projects are being launched on uClinux/Arm-Linux/PPC-Linux, if the Erlang could also run on those platforms, maybe more and more people will begin to know this stuff and love it. : - ) Best Regards Techie = = = = = = = = = = = = = = = = = = = = >Francesco Cesarini (Erlang Training & Consulting) writes: > > > Keep in mind that when using VxWorks, you have no memory protection > > from other threads, so corrupting Erlang's memory space is a huge > > risk. > >WindRiver finally left the DOS era and added support for MMUs sometime >in the past few years. I'm not sure when exactly, but it's definitely >in the 5.5 version which is currently selling. It looks like you have >to do some fiddling to enable it. > >Matt = = = = = = = = = = = = = = = = = = = = From cyberlync@REDACTED Fri Jan 28 03:49:42 2005 From: cyberlync@REDACTED (Eric Merritt) Date: Thu, 27 Jan 2005 18:49:42 -0800 Subject: ieee 754 Floats Message-ID: Guys, I need to convert ieee 754 (32 and 64 bit) floats to and from binaries for a network protocol. I was wondaring if anyone had some code they wouldn't mind sharing. There are a lot of ways to do this, but there are some caveats as well (such as nan values, etc). -- I'm a programmer, I don't have to spell correctly; I just have to spell consistently From serge@REDACTED Fri Jan 28 05:04:35 2005 From: serge@REDACTED (Serge Aleynikov) Date: Thu, 27 Jan 2005 23:04:35 -0500 Subject: spread erlang driver Message-ID: <41F9B9D3.90704@hq.idt.net> Hi, I recently downloaded a spread_drv project from jungerl and tried to build a small app using this library. http://cvs.sourceforge.net/viewcvs.py/jungerl/jungerl/lib/spread_drv/ I would appreciate it if you could clarify one issue related to the design of the driver. It appears that the gen_server (spread.erl) maintains a list of subscriber PIDs to messages received by a spread group in its internal state (using ets storage). I have the following implementation. A server process subscribes itself to a group "test" using spread:subscribe(), and when the group receives a message, it gets dispatched to the server in handle_info() callback. The server processes the message and sends a response back to the client's private group: {ok, Pid} = spread:start_link("4803@REDACTED", "test", 0, 1), {ok, _} = spread:subscribe(Pid, "test"), ... handle_info(..., Sender, ..., Msg) -> % when a regular message is received, process it and reply to sender Reply = process_message(Msg), spread:multicast(SpreadPid, binary_to_list(Sender), 1, Reply). ... A client process needs to send a message to the "test" group in order to get a response from the server, and waits for a response in the following way: {ok, Pid} = spread:start_link("4803@REDACTED", "client", 0, 0), spread:multicast(Pid, "test", 1, <<"Some message">>), receive Response -> do_something(Response); after ?Timeout -> timeout end. I encountered the problem that the client's receive always times out. It looks like any message unicasted to a private group of a process (in this case "client" is the private group identifying the client) doesn't get dispatched to the process's mailbox, and can only be retrieved from spread by using the spread:rec() function. So the following implementation works correctly: {ok, Pid} = spread:start_link("4803@REDACTED", "client", 0, 0), spread:multicast(Pid, "test", 1, <<"Some message">>), Reply = spread:rec(Pid, "#client#localhost"). I traced this problem to the fact that a process always needs to subscribe itself to a spread group (using spread:subscribe(Pid, Group)) in order to receive messages through receive ... end. However, it is not possible for the process to subscribe to its own private group. An attempt to do so will be rejected by spread, and therefore its Pid will not get added to the spread gen_server's internal state ets. As a result the process will never receive a message in its mailbox, and the message will always need to be fetched using a synchronous spread:rec() call. I wonder if this was an oversight or a design decision. Also, a side note is that the private group's name (returned by spread_drv:sp_connect()) is not exported by any function, and therefore the client's call above: spread:rec(Pid, PrivateGroup) Needs to figure out its own PrivateGroup. I ended up extending spread.erl by adding get_private_group/1 to accomplish this task. Is anybody using this spread_drv interface in any active project? Thank you, Serge From raimo@REDACTED Fri Jan 28 09:02:13 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 28 Jan 2005 09:02:13 +0100 Subject: Erlang Port drivers and Erl_interface References: <898abf3450a12f1032a5057f6813860f@tombob.com>, <1106840989.41f90d9d8e18a@www.omnibis.com> Message-ID: casper2000a@REDACTED writes: > Hi Robert, > > This is really good information. Thanks a lot. > > Have you used Port Driver call back functions outputv, event, etc. I have 2 concerns about them. > Unfortunately the documentation I found on them are not enough to absorb the full working scenario > of them. > > 1) In outputv, the erlang emulator sends the message as a ErlIOVec. I wonder how I can use > ei_decode to extract the message. > You can probably not. If the driver has got an outputv callback, it will be used, and then the emulator does not have to copy binaries that are sent to the port. If you send a list of binaries mixed with bytes, one binary will be created to store the bytes, then an ErlIOVec is created that contains pointers into the binaries - either to the common binary for the odd bytes, or to the original binaries sent to the port. This is a way to minimize copying of large amounts of data between the erlang process and the driver. > 2) I didn't find a good document on event call back function. What're the information pass in as > ErlDrvEvent and ErlDrvEventData? > Have a look at the Erts reference manual, there is some documentation there. http://www.erlang.se/doc/doc-5.4.3/erts-5.4.3/doc/html/part_frame.html sections 3 and 6. > 3) Have you used anync or enq/deq functions in Port Driver? If you can give me some help or sample > would be excellent. > > 4) Please confirm you are discussing above a Port driver, but not a C Node or Erl_Interface based > port. > > 5) In your below example, in which call back functions can you call handle_regular_message to > decode the function? Could you provide an example call back function. > > Thanks in advance! > Eranga > > > > > Quoting Robert Raschke : > Quoting Robert Raschke : > > > Hi Eranga, > > > > you wrote: > > > Let\'s say I want to pass a complex structure back and forth. And I opened > > > the linked-in driver port using binary. Then can I use term_to_binary and > > > binary_to_term in the Erlang side and erl_decode, erl_encode and other erl > > > interface functions in the C side? > > > > I have been using the term_to_binary and binary_to_term functions as > > well. In my C port program I use the ei_decode...() and > > ei_encode...() functions. It took me a little bit to get used to the > > way these functions handle the message buffer, but with a little bit > > of experimentation you will get up and running quickly. > > > > For example I send my requests from erlang in a predefined format > > (obviously), and then I unpack it in my C program like this, with the > > x_in buffer holding a message. It is very verbose, as I was learning > > how the ei functions work while writing it. > > > > static void > > handle_regular_message(ei_x_buff *x_in, ei_x_buff *x_out) > > { > > int valid = 1; > > int version; > > int arity; > > char call_atom[MAXATOMLEN]; > > erlang_pid from; > > char fn_atom[MAXATOMLEN]; > > > > /* > > Incoming message has to be > > {call, Caller_Pid, Fn, [Params]} > > with > > call - the atom \'call\' > > Caller_Pid - erlang pid of process that sent the message > > Fn - name as atom of the function to invoke > > Params - parameters to pass to Fn > > > > For an invalid request message the return message has the form > > {error, badmsg} > > > > For a valid request message the return message has the form > > {Caller_Pid, Result} > > with > > Result = ok | {ok, Value} | {error, internal, error} | {error, badarg, > > args} > > */ > > > > if (valid && ei_decode_version(x_in->buff, &x_in->index, &version) != 0) { > > fprintf(stderr, \"Warning: Ignoring received malformed message (bad > > version).\\n\"); > > valid = 0; > > } > > > > if (valid && ei_decode_tuple_header(x_in->buff, &x_in->index, &arity) != 0) > > { > > fprintf(stderr, \"Warning: Ignoring received malformed message (not > > tuple).\\n\"); > > valid = 0; > > } > > if (valid && arity != 4) { > > fprintf(stderr, \"Warning: Ignoring received malformed message (not 4-arity > > tuple).\\n\"); > > valid = 0; > > } > > > > if (valid && ei_decode_atom(x_in->buff, &x_in->index, call_atom) != 0) { > > fprintf(stderr, \"Warning: Ignoring received malformed message (first tuple > > element not atom).\\n\"); > > valid = 0; > > } > > if (valid && strcmp(call_atom, \"call\") != 0) { > > fprintf(stderr, \"Warning: Ignoring received malformed message\" > > \" (first tuple element not atom \'call\').\\n\"); > > valid = 0; > > } > > > > if (valid && ei_decode_pid(x_in->buff, &x_in->index, &from) != 0) { > > fprintf(stderr, \"Warning: Ignoring received malformed message (Second tuple > > element not pid).\\n\"); > > valid = 0; > > } > > > > if (valid && ei_decode_atom(x_in->buff, &x_in->index, fn_atom) != 0) { > > fprintf(stderr, \"Warning: Ignoring received malformed message (Third tuple > > element not atom).\\n\"); > > valid = 0; > > } > > > > if (valid) { > > x_out->index = 0; > > ei_x_encode_version(x_out); > > ei_x_encode_tuple_header(x_out, 2); > > ei_x_encode_pid(x_out, &from); > > > > fprintf(stderr, \"Attempting to call e_%s().\\n\", fn_atom); > > > > if (strcmp(fn_atom, \"my_fun_1\") == 0) my_fun_1(x_in, x_out); > > else if (strcmp(fn_atom, \"my_fun_2\") == 0) my_fun_2(x_in, x_out); > > else if (strcmp(fn_atom, \"my_fun_3\") == 0) my_fun_3(x_in, x_out); > > else { > > fprintf(stderr, \"Warning: Ignoring received malformed message\" > > \" (Third tuple element not recognised function).\\n\"); > > valid = 0; > > } > > if (valid) { > > fprintf(stderr, \"Returned from my_fun().\\n\"); > > } > > } > > > > if (! valid) { > > x_out->index = 0; > > ei_x_encode_version(x_out); > > ei_x_encode_tuple_header(x_out, 2); > > ei_x_encode_atom(x_out, \"error\"); > > ei_x_encode_atom(x_out, \"badmsg\"); > > } > > } > > > > Each function I invoke (my_fun()) takes apart the rest of the x_in > > buffer, and completes the result buffer x_out (which gets sent back to > > Erlang). > > > > I hope this gets you further along, > > Robby > > > > > > --------------This mail sent through OmniBIS.com-------------- > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From casper2000a@REDACTED Fri Jan 28 10:15:04 2005 From: casper2000a@REDACTED (Casper) Date: Fri, 28 Jan 2005 15:15:04 +0600 Subject: Erlang Port drivers and Erl_interface In-Reply-To: Message-ID: Hi Robert, Thanks for the advice. Let's say I sent the {Binary1, Atom1, {Atom2, Atom3, Binary2}, List1, Atom4} tuple to the Port driver. The emulator call outputv callback function. How will be the ErlIOVec vector I receive in the C side? I went through the document you mentioned below. But still I'm not satisfied with the info I got regarding event callback function and how I can use ErlIOVec. I would like to know if I can use ei_encode/ei_decode to handle ErlIOVec and when using other callback functions. - Eranga -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Raimo Niskanen Sent: Friday, January 28, 2005 2:02 PM To: erlang-questions@REDACTED Subject: Re: Erlang Port drivers and Erl_interface casper2000a@REDACTED writes: > Hi Robert, > > This is really good information. Thanks a lot. > > Have you used Port Driver call back functions outputv, event, etc. I have 2 concerns about them. > Unfortunately the documentation I found on them are not enough to absorb the full working scenario > of them. > > 1) In outputv, the erlang emulator sends the message as a ErlIOVec. I wonder how I can use > ei_decode to extract the message. > You can probably not. If the driver has got an outputv callback, it will be used, and then the emulator does not have to copy binaries that are sent to the port. If you send a list of binaries mixed with bytes, one binary will be created to store the bytes, then an ErlIOVec is created that contains pointers into the binaries - either to the common binary for the odd bytes, or to the original binaries sent to the port. This is a way to minimize copying of large amounts of data between the erlang process and the driver. > 2) I didn't find a good document on event call back function. What're the information pass in as > ErlDrvEvent and ErlDrvEventData? > Have a look at the Erts reference manual, there is some documentation there. http://www.erlang.se/doc/doc-5.4.3/erts-5.4.3/doc/html/part_frame.html sections 3 and 6. > 3) Have you used anync or enq/deq functions in Port Driver? If you can give me some help or sample > would be excellent. > > 4) Please confirm you are discussing above a Port driver, but not a C Node or Erl_Interface based > port. > > 5) In your below example, in which call back functions can you call handle_regular_message to > decode the function? Could you provide an example call back function. > > Thanks in advance! > Eranga > > > > > Quoting Robert Raschke : > Quoting Robert Raschke : > > > Hi Eranga, > > > > you wrote: > > > Let\'s say I want to pass a complex structure back and forth. And I opened > > > the linked-in driver port using binary. Then can I use term_to_binary and > > > binary_to_term in the Erlang side and erl_decode, erl_encode and other erl > > > interface functions in the C side? > > > > I have been using the term_to_binary and binary_to_term functions as > > well. In my C port program I use the ei_decode...() and > > ei_encode...() functions. It took me a little bit to get used to the > > way these functions handle the message buffer, but with a little bit > > of experimentation you will get up and running quickly. > > > > For example I send my requests from erlang in a predefined format > > (obviously), and then I unpack it in my C program like this, with the > > x_in buffer holding a message. It is very verbose, as I was learning > > how the ei functions work while writing it. > > > > static void > > handle_regular_message(ei_x_buff *x_in, ei_x_buff *x_out) > > { > > int valid = 1; > > int version; > > int arity; > > char call_atom[MAXATOMLEN]; > > erlang_pid from; > > char fn_atom[MAXATOMLEN]; > > > > /* > > Incoming message has to be > > {call, Caller_Pid, Fn, [Params]} > > with > > call - the atom \'call\' > > Caller_Pid - erlang pid of process that sent the message > > Fn - name as atom of the function to invoke > > Params - parameters to pass to Fn > > > > For an invalid request message the return message has the form > > {error, badmsg} > > > > For a valid request message the return message has the form > > {Caller_Pid, Result} > > with > > Result = ok | {ok, Value} | {error, internal, error} | {error, badarg, > > args} > > */ > > > > if (valid && ei_decode_version(x_in->buff, &x_in->index, &version) != 0) { > > fprintf(stderr, \"Warning: Ignoring received malformed message (bad > > version).\\n\"); > > valid = 0; > > } > > > > if (valid && ei_decode_tuple_header(x_in->buff, &x_in->index, &arity) != 0) > > { > > fprintf(stderr, \"Warning: Ignoring received malformed message (not > > tuple).\\n\"); > > valid = 0; > > } > > if (valid && arity != 4) { > > fprintf(stderr, \"Warning: Ignoring received malformed message (not 4-arity > > tuple).\\n\"); > > valid = 0; > > } > > > > if (valid && ei_decode_atom(x_in->buff, &x_in->index, call_atom) != 0) { > > fprintf(stderr, \"Warning: Ignoring received malformed message (first tuple > > element not atom).\\n\"); > > valid = 0; > > } > > if (valid && strcmp(call_atom, \"call\") != 0) { > > fprintf(stderr, \"Warning: Ignoring received malformed message\" > > \" (first tuple element not atom \'call\').\\n\"); > > valid = 0; > > } > > > > if (valid && ei_decode_pid(x_in->buff, &x_in->index, &from) != 0) { > > fprintf(stderr, \"Warning: Ignoring received malformed message (Second tuple > > element not pid).\\n\"); > > valid = 0; > > } > > > > if (valid && ei_decode_atom(x_in->buff, &x_in->index, fn_atom) != 0) { > > fprintf(stderr, \"Warning: Ignoring received malformed message (Third tuple > > element not atom).\\n\"); > > valid = 0; > > } > > > > if (valid) { > > x_out->index = 0; > > ei_x_encode_version(x_out); > > ei_x_encode_tuple_header(x_out, 2); > > ei_x_encode_pid(x_out, &from); > > > > fprintf(stderr, \"Attempting to call e_%s().\\n\", fn_atom); > > > > if (strcmp(fn_atom, \"my_fun_1\") == 0) my_fun_1(x_in, x_out); > > else if (strcmp(fn_atom, \"my_fun_2\") == 0) my_fun_2(x_in, x_out); > > else if (strcmp(fn_atom, \"my_fun_3\") == 0) my_fun_3(x_in, x_out); > > else { > > fprintf(stderr, \"Warning: Ignoring received malformed message\" > > \" (Third tuple element not recognised function).\\n\"); > > valid = 0; > > } > > if (valid) { > > fprintf(stderr, \"Returned from my_fun().\\n\"); > > } > > } > > > > if (! valid) { > > x_out->index = 0; > > ei_x_encode_version(x_out); > > ei_x_encode_tuple_header(x_out, 2); > > ei_x_encode_atom(x_out, \"error\"); > > ei_x_encode_atom(x_out, \"badmsg\"); > > } > > } > > > > Each function I invoke (my_fun()) takes apart the rest of the x_in > > buffer, and completes the result buffer x_out (which gets sent back to > > Erlang). > > > > I hope this gets you further along, > > Robby > > > > > > --------------This mail sent through OmniBIS.com-------------- > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From raimo@REDACTED Fri Jan 28 10:27:41 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 28 Jan 2005 10:27:41 +0100 Subject: Erlang Port drivers and Erl_interface References: , Message-ID: I quite understand that you are not satisfied with the documentation, especially concerning ErlIOVec. You can of course read the source code e.g for the efile_drv.c ($ERL_TOP/erts/emulator/drivers/common/efile_drv.c), but it is not very readable. You can not send anything else than I/O lists to a port from an Erlang process. An I/O list is a binary or a (possibly deep) list of integers (0..255) or binaries where the last tail may be a binary. You can use erlang:term_to_binary/1 to pack arbitrary terms into binaries, and then use some erl_interface functions in the driver to decode the data (this I know little about). Here are the typedefs involved: typedef struct { char* iov_base; size_t iov_len; } SysIOVec; typedef struct erl_drv_binary { long orig_size; /* total length of binary */ long refc; /* number of references to this binary */ char orig_bytes[1]; /* the data (char instead of byte!) */ } ErlDrvBinary; typedef struct erl_io_vec { int vsize; /* length of vectors */ int size; /* total size in bytes */ SysIOVec* iov; ErlDrvBinary** binv; } ErlIOVec; ErlIOVec:vsize gives the size of ErlIOVec:iov and ErlIOVec:binv. SysIOVec defines one chunk of data. The corresponding ErlDrvBinary defines the binary the data is stored in. If you want to hang on to the binaries in the driver after returning from ->ouputv you will have to increment ErlDrvBinary:refc and decrement it later when you do not need it. But basically, if you just want to decode the data within the ->outputv callback, just look at the ErlIOVec:vsize to find the number of chunks, and then decode ErlIOVec:iov[0..N-1] data chunks. -- / Raimo Niskanen, Erlang/OTP, Ericsson AB casper2000a@REDACTED (Casper) writes: > Hi Robert, > > Thanks for the advice. > > Let's say I sent the {Binary1, Atom1, {Atom2, Atom3, Binary2}, List1, Atom4} > tuple to the Port driver. The emulator call outputv callback function. How > will be the ErlIOVec vector I receive in the C side? > > I went through the document you mentioned below. But still I'm not satisfied > with the info I got regarding event callback function and how I can use > ErlIOVec. I would like to know if I can use ei_encode/ei_decode to handle > ErlIOVec and when using other callback functions. > > - Eranga > > > > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Raimo Niskanen > Sent: Friday, January 28, 2005 2:02 PM > To: erlang-questions@REDACTED > Subject: Re: Erlang Port drivers and Erl_interface > > casper2000a@REDACTED writes: > > > Hi Robert, > > > > This is really good information. Thanks a lot. > > > > Have you used Port Driver call back functions outputv, event, etc. I have > 2 concerns about them. > > Unfortunately the documentation I found on them are not enough to absorb > the full working scenario > > of them. > > > > 1) In outputv, the erlang emulator sends the message as a ErlIOVec. I > wonder how I can use > > ei_decode to extract the message. > > > > You can probably not. If the driver has got an outputv callback, it will > be used, and then the emulator does not have to copy binaries that are > sent to the port. If you send a list of binaries mixed with bytes, one > binary will be created to store the bytes, then an ErlIOVec is created > that contains pointers into the binaries - either to the common binary > for the odd bytes, or to the original binaries sent to the port. This > is a way to minimize copying of large amounts of data between the > erlang process and the driver. > > > 2) I didn't find a good document on event call back function. What're the > information pass in as > > ErlDrvEvent and ErlDrvEventData? > > > > Have a look at the Erts reference manual, there is some documentation > there. > http://www.erlang.se/doc/doc-5.4.3/erts-5.4.3/doc/html/part_frame.html > sections 3 and 6. > > > 3) Have you used anync or enq/deq functions in Port Driver? If you can > give me some help or sample > > would be excellent. > > > > 4) Please confirm you are discussing above a Port driver, but not a C Node > or Erl_Interface based > > port. > > > > 5) In your below example, in which call back functions can you call > handle_regular_message to > > decode the function? Could you provide an example call back function. > > > > Thanks in advance! > > Eranga > > > > > > > > > > Quoting Robert Raschke : > Quoting Robert Raschke : > > > > > Hi Eranga, > > > > > > you wrote: > > > > Let\'s say I want to pass a complex structure back and forth. And I > opened > > > > the linked-in driver port using binary. Then can I use term_to_binary > and > > > > binary_to_term in the Erlang side and erl_decode, erl_encode and other > erl > > > > interface functions in the C side? > > > > > > I have been using the term_to_binary and binary_to_term functions as > > > well. In my C port program I use the ei_decode...() and > > > ei_encode...() functions. It took me a little bit to get used to the > > > way these functions handle the message buffer, but with a little bit > > > of experimentation you will get up and running quickly. > > > > > > For example I send my requests from erlang in a predefined format > > > (obviously), and then I unpack it in my C program like this, with the > > > x_in buffer holding a message. It is very verbose, as I was learning > > > how the ei functions work while writing it. > > > > > > static void > > > handle_regular_message(ei_x_buff *x_in, ei_x_buff *x_out) > > > { > > > int valid = 1; > > > int version; > > > int arity; > > > char call_atom[MAXATOMLEN]; > > > erlang_pid from; > > > char fn_atom[MAXATOMLEN]; > > > > > > /* > > > Incoming message has to be > > > {call, Caller_Pid, Fn, [Params]} > > > with > > > call - the atom \'call\' > > > Caller_Pid - erlang pid of process that sent the message > > > Fn - name as atom of the function to invoke > > > Params - parameters to pass to Fn > > > > > > For an invalid request message the return message has the form > > > {error, badmsg} > > > > > > For a valid request message the return message has the form > > > {Caller_Pid, Result} > > > with > > > Result = ok | {ok, Value} | {error, internal, error} | {error, badarg, > > > args} > > > */ > > > > > > if (valid && ei_decode_version(x_in->buff, &x_in->index, &version) != 0) > { > > > fprintf(stderr, \"Warning: Ignoring received malformed message (bad > > > version).\\n\"); > > > valid = 0; > > > } > > > > > > if (valid && ei_decode_tuple_header(x_in->buff, &x_in->index, &arity) != > 0) > > > { > > > fprintf(stderr, \"Warning: Ignoring received malformed message (not > > > tuple).\\n\"); > > > valid = 0; > > > } > > > if (valid && arity != 4) { > > > fprintf(stderr, \"Warning: Ignoring received malformed message (not > 4-arity > > > tuple).\\n\"); > > > valid = 0; > > > } > > > > > > if (valid && ei_decode_atom(x_in->buff, &x_in->index, call_atom) != 0) { > > > fprintf(stderr, \"Warning: Ignoring received malformed message (first > tuple > > > element not atom).\\n\"); > > > valid = 0; > > > } > > > if (valid && strcmp(call_atom, \"call\") != 0) { > > > fprintf(stderr, \"Warning: Ignoring received malformed message\" > > > \" (first tuple element not atom \'call\').\\n\"); > > > valid = 0; > > > } > > > > > > if (valid && ei_decode_pid(x_in->buff, &x_in->index, &from) != 0) { > > > fprintf(stderr, \"Warning: Ignoring received malformed message (Second > tuple > > > element not pid).\\n\"); > > > valid = 0; > > > } > > > > > > if (valid && ei_decode_atom(x_in->buff, &x_in->index, fn_atom) != 0) { > > > fprintf(stderr, \"Warning: Ignoring received malformed message (Third > tuple > > > element not atom).\\n\"); > > > valid = 0; > > > } > > > > > > if (valid) { > > > x_out->index = 0; > > > ei_x_encode_version(x_out); > > > ei_x_encode_tuple_header(x_out, 2); > > > ei_x_encode_pid(x_out, &from); > > > > > > fprintf(stderr, \"Attempting to call e_%s().\\n\", fn_atom); > > > > > > if (strcmp(fn_atom, \"my_fun_1\") == 0) my_fun_1(x_in, x_out); > > > else if (strcmp(fn_atom, \"my_fun_2\") == 0) my_fun_2(x_in, x_out); > > > else if (strcmp(fn_atom, \"my_fun_3\") == 0) my_fun_3(x_in, x_out); > > > else { > > > fprintf(stderr, \"Warning: Ignoring received malformed message\" > > > \" (Third tuple element not recognised function).\\n\"); > > > valid = 0; > > > } > > > if (valid) { > > > fprintf(stderr, \"Returned from my_fun().\\n\"); > > > } > > > } > > > > > > if (! valid) { > > > x_out->index = 0; > > > ei_x_encode_version(x_out); > > > ei_x_encode_tuple_header(x_out, 2); > > > ei_x_encode_atom(x_out, \"error\"); > > > ei_x_encode_atom(x_out, \"badmsg\"); > > > } > > > } > > > > > > Each function I invoke (my_fun()) takes apart the rest of the x_in > > > buffer, and completes the result buffer x_out (which gets sent back to > > > Erlang). > > > > > > I hope this gets you further along, > > > Robby > > > > > > > > > > --------------This mail sent through OmniBIS.com-------------- > > > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > From casper2000a@REDACTED Fri Jan 28 11:49:26 2005 From: casper2000a@REDACTED (Casper) Date: Fri, 28 Jan 2005 16:49:26 +0600 Subject: Erlang Port drivers and Erl_interface In-Reply-To: Message-ID: Raimo, Thanks for the valuable information. I will try those methods you advised. - Eranga -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Raimo Niskanen Sent: Friday, January 28, 2005 3:28 PM To: erlang-questions@REDACTED Subject: Re: Erlang Port drivers and Erl_interface I quite understand that you are not satisfied with the documentation, especially concerning ErlIOVec. You can of course read the source code e.g for the efile_drv.c ($ERL_TOP/erts/emulator/drivers/common/efile_drv.c), but it is not very readable. You can not send anything else than I/O lists to a port from an Erlang process. An I/O list is a binary or a (possibly deep) list of integers (0..255) or binaries where the last tail may be a binary. You can use erlang:term_to_binary/1 to pack arbitrary terms into binaries, and then use some erl_interface functions in the driver to decode the data (this I know little about). Here are the typedefs involved: typedef struct { char* iov_base; size_t iov_len; } SysIOVec; typedef struct erl_drv_binary { long orig_size; /* total length of binary */ long refc; /* number of references to this binary */ char orig_bytes[1]; /* the data (char instead of byte!) */ } ErlDrvBinary; typedef struct erl_io_vec { int vsize; /* length of vectors */ int size; /* total size in bytes */ SysIOVec* iov; ErlDrvBinary** binv; } ErlIOVec; ErlIOVec:vsize gives the size of ErlIOVec:iov and ErlIOVec:binv. SysIOVec defines one chunk of data. The corresponding ErlDrvBinary defines the binary the data is stored in. If you want to hang on to the binaries in the driver after returning from ->ouputv you will have to increment ErlDrvBinary:refc and decrement it later when you do not need it. But basically, if you just want to decode the data within the ->outputv callback, just look at the ErlIOVec:vsize to find the number of chunks, and then decode ErlIOVec:iov[0..N-1] data chunks. -- / Raimo Niskanen, Erlang/OTP, Ericsson AB casper2000a@REDACTED (Casper) writes: > Hi Robert, > > Thanks for the advice. > > Let's say I sent the {Binary1, Atom1, {Atom2, Atom3, Binary2}, List1, Atom4} > tuple to the Port driver. The emulator call outputv callback function. How > will be the ErlIOVec vector I receive in the C side? > > I went through the document you mentioned below. But still I'm not satisfied > with the info I got regarding event callback function and how I can use > ErlIOVec. I would like to know if I can use ei_encode/ei_decode to handle > ErlIOVec and when using other callback functions. > > - Eranga > > > > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Raimo Niskanen > Sent: Friday, January 28, 2005 2:02 PM > To: erlang-questions@REDACTED > Subject: Re: Erlang Port drivers and Erl_interface > > casper2000a@REDACTED writes: > > > Hi Robert, > > > > This is really good information. Thanks a lot. > > > > Have you used Port Driver call back functions outputv, event, etc. I have > 2 concerns about them. > > Unfortunately the documentation I found on them are not enough to absorb > the full working scenario > > of them. > > > > 1) In outputv, the erlang emulator sends the message as a ErlIOVec. I > wonder how I can use > > ei_decode to extract the message. > > > > You can probably not. If the driver has got an outputv callback, it will > be used, and then the emulator does not have to copy binaries that are > sent to the port. If you send a list of binaries mixed with bytes, one > binary will be created to store the bytes, then an ErlIOVec is created > that contains pointers into the binaries - either to the common binary > for the odd bytes, or to the original binaries sent to the port. This > is a way to minimize copying of large amounts of data between the > erlang process and the driver. > > > 2) I didn't find a good document on event call back function. What're the > information pass in as > > ErlDrvEvent and ErlDrvEventData? > > > > Have a look at the Erts reference manual, there is some documentation > there. > http://www.erlang.se/doc/doc-5.4.3/erts-5.4.3/doc/html/part_frame.html > sections 3 and 6. > > > 3) Have you used anync or enq/deq functions in Port Driver? If you can > give me some help or sample > > would be excellent. > > > > 4) Please confirm you are discussing above a Port driver, but not a C Node > or Erl_Interface based > > port. > > > > 5) In your below example, in which call back functions can you call > handle_regular_message to > > decode the function? Could you provide an example call back function. > > > > Thanks in advance! > > Eranga > > > > > > > > > > Quoting Robert Raschke : > Quoting Robert Raschke : > > > > > Hi Eranga, > > > > > > you wrote: > > > > Let\'s say I want to pass a complex structure back and forth. And I > opened > > > > the linked-in driver port using binary. Then can I use term_to_binary > and > > > > binary_to_term in the Erlang side and erl_decode, erl_encode and other > erl > > > > interface functions in the C side? > > > > > > I have been using the term_to_binary and binary_to_term functions as > > > well. In my C port program I use the ei_decode...() and > > > ei_encode...() functions. It took me a little bit to get used to the > > > way these functions handle the message buffer, but with a little bit > > > of experimentation you will get up and running quickly. > > > > > > For example I send my requests from erlang in a predefined format > > > (obviously), and then I unpack it in my C program like this, with the > > > x_in buffer holding a message. It is very verbose, as I was learning > > > how the ei functions work while writing it. > > > > > > static void > > > handle_regular_message(ei_x_buff *x_in, ei_x_buff *x_out) > > > { > > > int valid = 1; > > > int version; > > > int arity; > > > char call_atom[MAXATOMLEN]; > > > erlang_pid from; > > > char fn_atom[MAXATOMLEN]; > > > > > > /* > > > Incoming message has to be > > > {call, Caller_Pid, Fn, [Params]} > > > with > > > call - the atom \'call\' > > > Caller_Pid - erlang pid of process that sent the message > > > Fn - name as atom of the function to invoke > > > Params - parameters to pass to Fn > > > > > > For an invalid request message the return message has the form > > > {error, badmsg} > > > > > > For a valid request message the return message has the form > > > {Caller_Pid, Result} > > > with > > > Result = ok | {ok, Value} | {error, internal, error} | {error, badarg, > > > args} > > > */ > > > > > > if (valid && ei_decode_version(x_in->buff, &x_in->index, &version) != 0) > { > > > fprintf(stderr, \"Warning: Ignoring received malformed message (bad > > > version).\\n\"); > > > valid = 0; > > > } > > > > > > if (valid && ei_decode_tuple_header(x_in->buff, &x_in->index, &arity) != > 0) > > > { > > > fprintf(stderr, \"Warning: Ignoring received malformed message (not > > > tuple).\\n\"); > > > valid = 0; > > > } > > > if (valid && arity != 4) { > > > fprintf(stderr, \"Warning: Ignoring received malformed message (not > 4-arity > > > tuple).\\n\"); > > > valid = 0; > > > } > > > > > > if (valid && ei_decode_atom(x_in->buff, &x_in->index, call_atom) != 0) { > > > fprintf(stderr, \"Warning: Ignoring received malformed message (first > tuple > > > element not atom).\\n\"); > > > valid = 0; > > > } > > > if (valid && strcmp(call_atom, \"call\") != 0) { > > > fprintf(stderr, \"Warning: Ignoring received malformed message\" > > > \" (first tuple element not atom \'call\').\\n\"); > > > valid = 0; > > > } > > > > > > if (valid && ei_decode_pid(x_in->buff, &x_in->index, &from) != 0) { > > > fprintf(stderr, \"Warning: Ignoring received malformed message (Second > tuple > > > element not pid).\\n\"); > > > valid = 0; > > > } > > > > > > if (valid && ei_decode_atom(x_in->buff, &x_in->index, fn_atom) != 0) { > > > fprintf(stderr, \"Warning: Ignoring received malformed message (Third > tuple > > > element not atom).\\n\"); > > > valid = 0; > > > } > > > > > > if (valid) { > > > x_out->index = 0; > > > ei_x_encode_version(x_out); > > > ei_x_encode_tuple_header(x_out, 2); > > > ei_x_encode_pid(x_out, &from); > > > > > > fprintf(stderr, \"Attempting to call e_%s().\\n\", fn_atom); > > > > > > if (strcmp(fn_atom, \"my_fun_1\") == 0) my_fun_1(x_in, x_out); > > > else if (strcmp(fn_atom, \"my_fun_2\") == 0) my_fun_2(x_in, x_out); > > > else if (strcmp(fn_atom, \"my_fun_3\") == 0) my_fun_3(x_in, x_out); > > > else { > > > fprintf(stderr, \"Warning: Ignoring received malformed message\" > > > \" (Third tuple element not recognised function).\\n\"); > > > valid = 0; > > > } > > > if (valid) { > > > fprintf(stderr, \"Returned from my_fun().\\n\"); > > > } > > > } > > > > > > if (! valid) { > > > x_out->index = 0; > > > ei_x_encode_version(x_out); > > > ei_x_encode_tuple_header(x_out, 2); > > > ei_x_encode_atom(x_out, \"error\"); > > > ei_x_encode_atom(x_out, \"badmsg\"); > > > } > > > } > > > > > > Each function I invoke (my_fun()) takes apart the rest of the x_in > > > buffer, and completes the result buffer x_out (which gets sent back to > > > Erlang). > > > > > > I hope this gets you further along, > > > Robby > > > > > > > > > > --------------This mail sent through OmniBIS.com-------------- > > > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > From casper2000a@REDACTED Fri Jan 28 13:44:43 2005 From: casper2000a@REDACTED (Casper) Date: Fri, 28 Jan 2005 18:44:43 +0600 Subject: Erlang PDU decoding or use Port driver library call In-Reply-To: Message-ID: Hi All, I have a concern to whether a PDU I received from a C Port Driver to decode in the Erlang side to get the full PDU or call a C Library Port Driver to extract the only required information. For example in a SS7 ISUP C library, the structure I receive for ISUP IAM message is as below. As you can see all those variables are again structures. The PDU size is about 7820 bytes. If I have to decode that PDU in the Erlang side, I may have to define a vast amount of Records and will have to do very tedious binary processing. I receive this over a C port driver, which interface the SS7 boards. From the structure I get, I may only need to extract the Calling/Called party numbers, Circuit ID, etc like limited number of information. Now my concern is whether I should decode this structure in Erlang or I use another C Port Driver library to get the required information then and there required, by passing the binary PDU I received from the earlier Port? If any of you have some working experience with above kind of work, please advice me. Thanks in advance! - Eranga ---------------------- Structure start ----------------------------------- typedef struct _siConEvnt /* ISUP Connect Event */ { SiNatConInd natConInd; /* Nature of connection indicators */ SiFwdCallInd fwdCallInd; /* forward call indicators */ SiCgPtyCat cgPtyCat; /* calling party category */ SiTxMedReq txMedReq; /* transmission medium requirement */ SiTxMedReq txMedReqPr; /* transmission medium requirement prime */ SiCdPtyNum cdPtyNum; /* called party number */ SiTranNetSel tranNetSel; /* transit network selection */ SiCallRef callRef; /* call reference */ SiCgPtyNum cgPtyNum; /* calling party number */ SiOpFwdCalInd opFwdCalInd; /* optional forward call indicators */ SiRedirgNum redirgNum; /* redirecting number */ SiRedirInfo redirInfo; /* redirection information */ SiCugIntCode cugIntCode; /* closed group interlock code */ SiConnReq connReq; /* connection request */ SiOrigCdNum origCdNum; /* original called number */ SiUsr2UsrInfo usr2UsrInfo; /* user to user information */ SiAccTrnspt accTrnspt; /* access transport */ SiChargeNum chargeNum; /* charge number */ SiOrigLineInf origLineInf; /* originating line information */ SiUsrServInfo usrServInfo; /* user service infiormation */ SiUsr2UsrInd usr2UsrInd; /* user to user indicators */ SiPropDly propDly; /* propagation delay counter */ SiUsrServInfo usrServInfo1; /* user service info prime */ SiNetSpecFacil netFac; /* network specific facility */ SiSigPointCode orgPteCde; /* originating ISC point code */ SiGenDigits genDigits; /* generic digits */ SiGenNum genNmb; /* generic number */ SiRemotOper remotOper; /* remote operations */ SiParmCompInfo parmCom; /* parameter compatibility information */ SiNotifInd notifInd; /* notification indicator */ SiInfoInd infoInd; /* information indicator */ SiServiceAct serviceAct; /* service activation */ SiMlppPrec mlppPrec; /* MLPP precedence */ SiTxMedReq txMedUsed; /* transmission medium used */ SiBckCalInd bckCallInd; /* backward call indicators */ SiOptBckCalInd optBckCalInd; /* optional backward call indicators */ SiConnectedNum connNum; /* connected number */ SiAccDelInfo accDelInfo; /* access delivery information */ SiPropDly cllHstry; /* call history information */ SiRedirNum redirNum; /* redirection number */ SiRedirRestr redirRstr; /* redirection restriction */ SiBusinessGrp businessGrp; /* business group */ SiCarrierId carrierId; /* carrier identification */ SiCarrierSelInf carSelInf; /* carrier selection information */ SiEgress egress; /* ergress service */ SiGenAddr genAddr; /* generic address */ SiInfoReqInd infoReqInd; /* information request indicators */ SiJurisInf jurisInf; /* jurisdiction information */ SiNetTransport netTransport; /* network transport */ SiSpecProcReq specProcReq; /* special processing request */ SiTransReq transReq; /* transaction request */ SiEchoCtl echoControl; /* echo control */ SiCirAssignMap cirAssignMap; /* circuit assignment map */ SiGenName genName; /* generic name */ SiHopCount hopCount; /* hop counter */ SiOpServInfo opServInfo; /* operator services information */ SiServiceCode serviceCode; /* service code */ SiLocNum locNum; /* location number */ SiMsgAreaInfo msgAreaInfo; /* message area information */ SiContractorNum contractorNum; /* conttractor number */ SiCgNumNonNotRsn cgNumNonNotRsn; /* calling number non-notification reason */ SiAddUsrId addUsrId; /* additional user identification */ SiCarrierInfoTrans carrierInfoTrans; /* carrier information transfer */ SiCCSS cCSS; SiNetMngmtCtrls netMngmtCtrls; SiCirAssMap cirAssMap; SiCallDivTrtmnt callDivTrtmnt; SiCdINNum cdINNum; SiCallOffTrtmnt callOffTrtmnt; SiConfTrtmnt confTrtmnt; SiUIDCapInd uIDCapInd; SiCollCallReq collCallReq; SiBckGVNS bckGVNS; SiFreePhnInd freePhone; SiScfID scfId; SiCorrelationID corrId; SiElementExt elementExt[NUM_EXT_ELMTS]; /* extended elements */ } SiConEvnt; ---------------------- Structure start ----------------------------------- From mccratch@REDACTED Fri Jan 28 14:00:35 2005 From: mccratch@REDACTED (Matthias Kretschmer) Date: Fri, 28 Jan 2005 14:00:35 +0100 Subject: Windows, io:fwrite, halt, buffer flushing problems, R10B-2 In-Reply-To: <41F95275.1000501@gmx.net> References: <41F95275.1000501@gmx.net> Message-ID: <41FA3773.40401@gmx.net> I browsed through the source-code and I think now I have a patch which solves this problem cleanly. Well at least I hope because I can't build win32 Erlang myself. The VC 2003 Toolkit is missing several libraries that seem to be required to build Erlang. I don't have a commercial version of VC/VC++, so I don't have these libraries (.LIB-files like MSVCRT.LIB) and so I was unable to compile it myself. Basically I want to wait for the console thread itself before quitting. This is done in the case of a crash-dump in erl_exit in erts/emulator/beam/erl_init.c. I just want to do the same when aborting otherwise. I included this little patch in the e-mail, maybe someone has the same problem and is able to compile Erlang on win32 and may try it? But of course there is no guarantee that this patch doesn't burn your computer :) -- Matthias Kretschmer -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: test-win32-conhaltprob.patch URL: From david.nospam.hopwood@REDACTED Fri Jan 28 18:05:51 2005 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Fri, 28 Jan 2005 17:05:51 +0000 Subject: Windows, io:fwrite, halt, buffer flushing problems, R10B-2 In-Reply-To: <41FA3773.40401@gmx.net> References: <41F95275.1000501@gmx.net> <41FA3773.40401@gmx.net> Message-ID: <41FA70EF.8070906@blueyonder.co.uk> Matthias Kretschmer wrote: > I browsed through the source-code and I think now I have a patch which > solves this problem cleanly. Well at least I hope because I can't build > win32 Erlang myself. The VC 2003 Toolkit is missing several libraries > that seem to be required to build Erlang. I don't have a commercial > version of VC/VC++, so I don't have these libraries (.LIB-files like > MSVCRT.LIB) and so I was unable to compile it myself. (using MSIE) -- David Hopwood From chas@REDACTED Fri Jan 28 18:09:56 2005 From: chas@REDACTED (Charles Blair) Date: Fri, 28 Jan 2005 11:09:56 -0600 Subject: minor documentation typo In-Reply-To: <20050125213936.148f64a3.cpressey@catseye.mine.nu> References: <20050112142953.68607.qmail@web41904.mail.yahoo.com> <41E637ED.5040204@ericsson.com> <16870.19809.356294.601249@antilipe.corelatus.se> <200501131445.20017.ft@it.su.se> <20050113151939.04872444.cpressey@catseye.mine.nu> <41E76F5D.7070503@itsbeen.sent.com> <20050125213936.148f64a3.cpressey@catseye.mine.nu> Message-ID: <20050128170956.GR1893@jump.lib.uchicago.edu> lists(3): splitwith behaves as if it had been defined as fol- lows: splitwidth(Pred, List) -> ^ From Bob.Smart@REDACTED Sat Jan 29 06:50:05 2005 From: Bob.Smart@REDACTED (Bob.Smart@REDACTED) Date: Sat, 29 Jan 2005 16:50:05 +1100 Subject: proposed erlang/ubf application: SOW Open Workflow system Message-ID: > I think the state of UBF is that it needs some > rethinking in order to get further Well maybe I'll explain what I want to do and that might inspire some of the required rethinking. I had this idea for a Bridge bidding practice thing. Then I saw how it could be generalized. Then I saw that the generalization was a workflow system. So let me explain the particular case, then the general. If you do a simple minded bridge bidding practice system then the two partners take turns (as they would when playing) and each has nothing to do when the other thinks. So what you want to do is have multiple practice hands being bid at once so that each can think on some, while the partner is thinking on others. So imagine we have 16 at a time. Our user interface will have 16 tabs. The visible part of the tab will be green if it is our turn to bid, and red if it is partner's turn to bid. When partner goes off to attend to more important matters, we make a bid where it is our turn and all the tabs go red. So now we want to go up a level and select a different activity. When we go up we see that the simultaneous chess tournament has turned green. That means that it is our move in at least one match. We enter the tournament and see that most of the tabs are red but a couple are green, and we go to those matches and make moves. While this description has been about playing asynchronous games, it is really about having a workflow system. From the point of view of the individual that means: 1. We don't have to remember what are the activities we have to work on. All activities where we must/may/might act are in front of us. 2. We don't have to go checking on activities to see if they are waiting for our action. The system leads us to the actions where we can act. People use e-mail as a primitive workflow system. It would make sense to have a workflow based interface to e-mail. Using e-mail as a workflow system is horrible. Computers get better at multi-tasking. We take human multitasking too much for granted. It is time we gave it more support. Well I certainly feel the need for more support! A few brief comments on my workflow system before getting to the implementation issues. (A) There is a hierarchy: a tournament has matches, a match has sets, a set has games, a game has points, etc. (B) Colours don't usually alternate, e.g. in the game Diplomacy everyone starts a round green, then when everyone has moved we go to the next round. The only rule is that at least one player must be green in a live game. There can be other colours to indicate invitations to make non-essential moves. (C) In any particular game the players have roles and the game has state and what the player sees is entirely determined by knowing the players role and the game's state. However new roles can be invented as the game goes along and players come and go, and the state can include components which are effectively bits of code so that the rules of the game can be made up as we go along. Not that I'm planning games/activities like that yet. (D) In the discussion above the players have been people. In actual application they would often be computer software systems. Indeed I envisage that a large subset of modern network software should interface through a workflow system instead of demanding that the user pay attention to them or come back periodically to check them. -------------------------------------------------------- Well I originally created my bidding practice system using a html interface that was generated on the fly in Erlang. But of course that doesn't have the right level of interactivity for a workflow system. It was important that the client connected to the server, but the server needed to send messages to the client that weren't responses to client requests. Beep is one answer but it was a bit too tricky for me, and also lacked an Erlang implementation. I guess I knew that the right answer is to just do a tcp connection and exchange XML messages, but I'm not very fond of XML. [Actually I've been investigating the idea of using the jabber protocol, and that is still a good option: ejabberd is in Erlang, there are jabber client libraries for various languages and the XML messages can be made to hold the sort of info I need.] A key feature that I want to eventually have in my workflow system is automation. For example in my bidding practice system I should be able to say "the next time it is my bid, if partner has bid 1H or 1S then I'll bid 1NT". Or if I'm using the interface to install software on one machine then I can reuse my responses to install on other machines if the computer asks the same questions to within a specified margin of error. So I want to be able to interpose a "software secretary" into the interface. Different games/activities will have very specific user interfaces. However we want to have a high level description of the interface. Various options can then be provided for turning that interface into something the user sees (or hears), or the secretary can understand it and try to deal with it. --------------------------------------------------------------- by the way the project will be called SOW (for Smart Open Workflow). It was originally COW but my employer didn't want it. Anyway a sow with multiple little piglets is a better logo for a workflow system. Well there is a lot more to the design. It could be the Erlang killer app. It could fit in well with the existing major erlang apps: ejabberd, yaws, btt, not to mention telecommunications stuff. If other people want to contribute then I'll be happy to start a sourceforge project. Let me know what you think. Bob From carsten@REDACTED Sat Jan 29 17:58:27 2005 From: carsten@REDACTED (Carsten Schultz) Date: Sat, 29 Jan 2005 17:58:27 +0100 Subject: partial binary_to_term? Message-ID: <20050129165827.GB4852@penne.localnet> Hi, I think it would be useful to have a function that interprets only the top level of a term in external term format. For example with T1 = {S0, S1, S2}, T2 = [S3, S4, S5], B1 = term_to_binary(T1), B2 = term_to_binary(T2) one head_binary_to_term(B1) would yield the same result as {term_to_binary(S0), term_to_binary(S1), term_to_binary(S2)}, of course without un- and repacking. Similarly, head_binary_to_term(T2) would yield [term_to_binary(S3) | term_to_binary([S4, S5])]. For example imagine that you are receiving a list of large terms from an external process and want to distribute its contents to several other processes. You could keep the parts packed when passing them on. Just a thought, Carsten -- Carsten Schultz (2:38, 33:47) http://carsten.codimi.de/ PGP/GPG key on the pgp.net key servers, fingerprint on my home page. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: Digital signature URL: From hakan.stenholm@REDACTED Sat Jan 29 22:14:55 2005 From: hakan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Sat, 29 Jan 2005 22:14:55 +0100 Subject: erlang time handling (in calendar.erl and erlang.erl) Message-ID: I have recently been working a lot with date and time oriented problems - implementing CPL time-switches (RFC 3880 - Call Processing Language (CPL): A Language for User Control of Internet Telephony Services). This involved, among other things, processing iCalendar (RFC 2445 - Internet Calendaring and Scheduling Core Object Specification) date and time data types, which allow for times containing leap seconds - this lead me to wonder how exactly erlang deals with this issues. Looking at the code in calendar.erl I would assume that the seconds retrieved with erlang:now() are in Unix time (http://en.wikipedia.org/wiki/Unix_time) - i.e. all days are treated as if they are 24*60*60 seconds long and leap seconds[1] are handled by extending certain seconds, i.e. reporting 23:59:59 twice instead of 23:59:59 followed by 23:59:60. Is this a correct assumption ? I assume that ERTS uses something like ctime() or gmtime() internally ? [1]: assuming that time is measured with sufficient precision (e.g. by syncing against atom clocks with ntp) for leap seconds to matter. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1101 bytes Desc: not available URL: From mickael.remond@REDACTED Sun Jan 30 02:00:53 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Sun, 30 Jan 2005 02:00:53 +0100 Subject: Size of function and memory management Message-ID: <41FC31C5.40306@erlang-fr.org> Hello, I have a question regarding memory management: What is the impact of the size of function on memory management and consumtion ? What is the impact of very big function (I mean printed page long or more) on Erlang memory consumtion ? How does the garbage collector react to that ? Is the end a execution of a function a way to trigger some memory house keeping that would not be triggered otherwise ? Thank you in advance for your feedback :-) -- Micka?l R?mond http://www.erlang-projects.org/ From tony@REDACTED Sun Jan 30 11:45:13 2005 From: tony@REDACTED (Tony Rogvall) Date: Sun, 30 Jan 2005 11:45:13 +0100 Subject: partial binary_to_term? In-Reply-To: <20050129165827.GB4852@penne.localnet> References: <20050129165827.GB4852@penne.localnet> Message-ID: On Jan 29, 2005, at 5:58 PM, Carsten Schultz wrote: > Hi, > > I think it would be useful to have a function that interprets only the > top level of a term in external term format. For example with > > T1 = {S0, S1, S2}, > T2 = [S3, S4, S5], > B1 = term_to_binary(T1), > B2 = term_to_binary(T2) > > one head_binary_to_term(B1) would yield the same result as > {term_to_binary(S0), term_to_binary(S1), term_to_binary(S2)}, of > course without un- and repacking. Similarly, head_binary_to_term(T2) > would yield [term_to_binary(S3) | term_to_binary([S4, S5])]. > If I understand you correctly this is actually possible (easy) to implement in erlang! You need to find the spec's of the external format and write a library. > For example imagine that you are receiving a list of large terms from > an external process and want to distribute its contents to several > other processes. You could keep the parts packed when passing them > on. > If you accept io-lists to be passed on. Then you can add "version-magic" to the parts without constructing new binaries. Hint: look in the erts/emulator/beam/external.[c,h] Someone may perhaps already written this code ? > Just a thought, > > Carsten > > -- > Carsten Schultz (2:38, 33:47) > http://carsten.codimi.de/ > PGP/GPG key on the pgp.net key servers, > fingerprint on my home page. From carsten@REDACTED Sun Jan 30 12:19:37 2005 From: carsten@REDACTED (Carsten Schultz) Date: Sun, 30 Jan 2005 12:19:37 +0100 Subject: partial binary_to_term? In-Reply-To: References: <20050129165827.GB4852@penne.localnet> Message-ID: <20050130111936.GB5126@penne.localnet> On Sun, Jan 30, 2005 at 11:45:13AM +0100, Tony Rogvall wrote: > On Jan 29, 2005, at 5:58 PM, Carsten Schultz wrote: > >I think it would be useful to have a function that interprets only the > >top level of a term in external term format. For example with > > > > T1 = {S0, S1, S2}, > > T2 = [S3, S4, S5], > > B1 = term_to_binary(T1), > > B2 = term_to_binary(T2) > > > >one head_binary_to_term(B1) would yield the same result as > >{term_to_binary(S0), term_to_binary(S1), term_to_binary(S2)}, of > >course without un- and repacking. Similarly, head_binary_to_term(T2) > >would yield [term_to_binary(S3) | term_to_binary([S4, S5])]. > > > > If I understand you correctly this is actually possible (easy) to > implement in erlang! > You need to find the spec's of the external format and write a library. Yes, you are right. Having thought about it for a minute, it seems slightly less attractive to me, because to get for example the head of a cons cell you have to parse it completely to determine its length. Thanks for the input, Carsten P.S.: If anyone is interested in my Haskell library that deals wirth Erlang terms end external term format... -- Carsten Schultz (2:38, 33:47) http://carsten.codimi.de/ PGP/GPG key on the pgp.net key servers, fingerprint on my home page. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: Digital signature URL: From ulf@REDACTED Sun Jan 30 23:11:48 2005 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 30 Jan 2005 23:11:48 +0100 Subject: erlang time handling (in calendar.erl and erlang.erl) In-Reply-To: References: Message-ID: Den 2005-01-29 22:14:55 skrev H?kan Stenholm : > Looking at the code in calendar.erl I would assume that the seconds > retrieved with erlang:now() are in Unix time > (http://en.wikipedia.org/wiki/Unix_time) - i.e. all days are treated as > if they are 24*60*60 seconds long and leap seconds[1] are handled by > extending certain seconds, i.e. reporting 23:59:59 twice instead of > 23:59:59 followed by 23:59:60. The calendar module doesn't rely on erlang:now() for time. Instead, it uses erlang:localtime(), erlang:universaltime(), and the conversion functions localtime_to_universaltime/1 and universaltime_to_localtime/1. erlang:now() is to be considered as an internal real-time clock which is loosely coupled to the system clock. It will periodically sample the system clock and can adjust its own "speed" by +/- 1% (if memory serves me) if the "now time" differs from the system time. This can happen e.g. if the system clock is adjusted, either manually or through an rdate() call. Since timeouts are coupled to the erlang:now() clock, big jumps can have rather unpleasant consequences. Some functions, e.g. in snmp, use a combination of localtime() and now in order to get sub-second precision. This is because there is no time function in Erlang that reports the actual system time with high enough precision. /Uffe -- Anv?nder Operas banbrytande e-postklient: http://www.opera.com/m2/ From hakan.stenholm@REDACTED Mon Jan 31 00:42:49 2005 From: hakan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Mon, 31 Jan 2005 00:42:49 +0100 Subject: erlang time handling (in calendar.erl and erlang.erl) In-Reply-To: References: Message-ID: On 30 jan 2005, at 23.11, Ulf Wiger wrote: > Den 2005-01-29 22:14:55 skrev H?kan Stenholm > : > >> Looking at the code in calendar.erl I would assume that the seconds >> retrieved with erlang:now() are in Unix time >> (http://en.wikipedia.org/wiki/Unix_time) - i.e. all days are treated >> as >> if they are 24*60*60 seconds long and leap seconds[1] are handled by >> extending certain seconds, i.e. reporting 23:59:59 twice instead of >> 23:59:59 followed by 23:59:60. > > The calendar module doesn't rely on erlang:now() for time. > Instead, it uses erlang:localtime(), erlang:universaltime(), > and the conversion functions localtime_to_universaltime/1 > and universaltime_to_localtime/1. The function now_to_datetime/1 and now_to_universal_time/1 pretty much appear to be designed to take erlang:now/0 as input, I at least can't find any other function that returns {MegaSecs,Secs,Microsecs} as output. See calendar.erl source (R10B-2): ..... %% now_to_universal_time(Now) %% now_to_datetime(Now) %% %% Convert from now() to UTC. %% %% Args: Now = now(); now() = {MegaSec, Sec, MilliSec}, MegaSec = Sec %% = MilliSec = integer() %% Returns: {date(), time()}, date() = {Y, M, D}, time() = {H, M, S}. %% now_to_datetime({MSec, Sec, _uSec}) -> Sec0 = MSec*1000000 + Sec + ?DAYS_FROM_0_TO_1970*?SECONDS_PER_DAY, gregorian_seconds_to_datetime(Sec0). now_to_universal_time(Now) -> now_to_datetime(Now). ..... I know that the remaining functions use erlang:localtime() and erlang:universaltime() and similar functions, which all pass time information as {Date, Time} tuples (or date-time converted to gregorian seconds). But this still poses the problem what kind of seconds now_to_datetime/1 and now_to_universal_time/1 receive as they don't appear to handle leap seconds. > > erlang:now() is to be considered as an internal real-time clock > which is loosely coupled to the system clock. It will periodically > sample the system clock and can adjust its own "speed" by +/- 1% > (if memory serves me) if the "now time" differs from the system > time. This can happen e.g. if the system clock is adjusted, either > manually or through an rdate() call. Since timeouts are coupled to > the erlang:now() clock, big jumps can have rather unpleasant > consequences. > > Some functions, e.g. in snmp, use a combination of localtime() > and now in order to get sub-second precision. This is because > there is no time function in Erlang that reports the actual > system time with high enough precision. > > /Uffe > -- > Anv?nder Operas banbrytande e-postklient: http://www.opera.com/m2/ > From ulf@REDACTED Mon Jan 31 07:38:56 2005 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 31 Jan 2005 07:38:56 +0100 Subject: erlang time handling (in calendar.erl and erlang.erl) In-Reply-To: References: Message-ID: Den 2005-01-31 00:42:49 skrev H?kan Stenholm : > The function now_to_datetime/1 and now_to_universal_time/1 pretty much > appear to be designed to take erlang:now/0 as input, I at least can't > find any other function that returns {MegaSecs,Secs,Microsecs} as output. > See calendar.erl source (R10B-2): True, and it doesn't appear as if these functions handle leap seconds. But OTOH, since erlang:now() periodically samples the system clock and adjusts itself accordingly, there should be no need to insert leap seconds. Event though erlang:now() normally follows the system clock quite closely, there is no guarantee that it will shows accurate time at any given sample. A one-second deviation should take erlang:now() at least 100 seconds to compensate for, since the adjustments stay within 1%. If you change the date on your system while erlang is running, erlang:now() will be way off the mark for a loong time. In AXD 301, we have a little monitor utility that will raise an alarm if the time returned by now_to_datetime/1 differs significantly from the system clock. While this doesn't threaten system operation, it may lead to confusing log entries, where some time values are derived from erlang:now() and others from the system clock. Restarting one processor at a time will reset erlang:now() in the whole system without calls being lost. /Uffe From thomasl_erlang@REDACTED Mon Jan 31 09:47:58 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 31 Jan 2005 00:47:58 -0800 (PST) Subject: Size of function and memory management In-Reply-To: <41FC31C5.40306@erlang-fr.org> Message-ID: <20050131084758.13646.qmail@web41904.mail.yahoo.com> --- Mickael Remond wrote: > Hello, > > I have a question regarding memory management: What > is the impact of the > size of function on memory management and consumtion > ? > What is the impact of very big function (I mean > printed page long or > more) on Erlang memory consumtion ? > > How does the garbage collector react to that ? > Is the end a execution of a function a way to > trigger some memory house > keeping that would not be triggered otherwise ? It depends on what the function looks like. In essence, the compiler has to conceptually check for sufficient memory at every point where a (big) term is allocated. As a simple optimization, one generally merges as many of these checks as possible into a single one (without overallocating). Your message hints at stack allocation of data. As far as I know, there is no stack allocation of data at this time. Garbage is reclaimed by the ordinary GC only. (It might be interesting to investigate the impact of stack allocation, which need not be *too* difficult. You need to modify the GC to handle it, implement an analysis to decide what data can go on the stack, and generate code to do this well. Though it should also be said that the idea has never really caught on despite some attempts in the general functional arena.) If you want to trigger memory housekeeping at the end of a function, insert an erlang:garbage_collect(). But as the manual says, "improper use may seriously degrade performance". Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Mail - 250MB free storage. Do more. Manage less. http://info.mail.yahoo.com/mail_250 From thomasl_erlang@REDACTED Mon Jan 31 10:22:58 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 31 Jan 2005 01:22:58 -0800 (PST) Subject: Size of function and memory management In-Reply-To: <20050131084758.13646.qmail@web41904.mail.yahoo.com> Message-ID: <20050131092258.23806.qmail@web41902.mail.yahoo.com> --- Thomas Lindgren wrote: > As far > as I know, there is no stack allocation of data at > this time. Garbage is reclaimed by the ordinary GC > only. I oversimplified things a bit, actually. If a term is small enough to fit in a VM register, then it can be saved on the stack. Such terms include small integers (fixnums) and atoms, and perhaps others. (Allocating a fresh atom may cause memory management activity elsewhere, though: in the atom table.) This case is usually not considered when one speaks of "stack allocating data", though. Usually the intention is to stack allocate data that would normally end up on the heap. Best, Thomas __________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo From bjorn@REDACTED Mon Jan 31 10:59:06 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 31 Jan 2005 10:59:06 +0100 Subject: Size of function and memory management In-Reply-To: <41FC31C5.40306@erlang-fr.org> References: <41FC31C5.40306@erlang-fr.org> Message-ID: I would say that large functions have more impact on readability than memory consumption. Mickael Remond writes: [...] > How does the garbage collector react to that ? > Is the end a execution of a function a way to trigger some memory > house keeping that would not be triggered otherwise ? No. Not in current Beam versions (R7B and later). Variables that will no longer be used in a function will be reclaimed when the next garbage collection occurs. Older versions of Beam (and Jam) would retain dead values until the end of the function. /Bj?rn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From matthias@REDACTED Mon Jan 31 11:27:35 2005 From: matthias@REDACTED (Matthias Lang) Date: Mon, 31 Jan 2005 11:27:35 +0100 Subject: erlang time handling (in calendar.erl and erlang.erl) In-Reply-To: References: Message-ID: <16894.2071.332374.390292@antilipe.corelatus.se> Ulf Wiger writes: > erlang:now() periodically samples the > system clock and adjusts itself accordingly, there should be > no need to insert leap seconds. Event though erlang:now() > normally follows the system clock quite closely, there is no > guarantee that it will shows accurate time at any given sample. Rant Mode On. This clock fudging is my #2 pet peeve about Erlang. In Erlang, now() tries to solve all timing problems---it promises to track real time while still preserving intervals. For good measure, it also promises to return "continuously increasing" values (more commonly called "strictly increasing"). The result is that nothing behaves when the user makes a dramatic adjustment to the time (1). Timeouts and intervals are off by 1% (2) and timestamps can be off by an arbitrarily large amount for an arbitrarily long time (3). Solutions? It's probably too late to fix now() since there's a lot of code out there depending on various, mutually incompatible aspects of its behaviour. But if you don't have any old code to break, it's not too hard to disable the clock-fudging. It's in erts/emulator/beam/erl_time_sup.c A less intrusive alternative is to use a C port program to measure time intervals (4). Matt (1) This is not as unreasonable as it sounds. For instance, you usually have to configure the clock on a brand new system. It seems a bit too Microsoft to say "You have altered the time. Applications may now behave strangely. Click OK to reboot". (2) This is particularly annoying when your system enters "Spinal Tap Emulation Mode" during a customer's stress testing, e.g. claiming that the load on a signalling link is 101% (3) This is particularly annoying when timestamps in logfiles don't agree with reality. erlang:universaltime() partially solves this, but only to low resolution. (4) Puzzle for C/POSIX/Unix wizards: how do you measure elapsed time in C, to millisecond resolution, in such a way that it doesn't lie when the user adjusts the clock. There is a portable solution. Rant Mode Off. From dietmar@REDACTED Mon Jan 31 12:21:43 2005 From: dietmar@REDACTED (Dietmar Schaefer) Date: Mon, 31 Jan 2005 12:21:43 +0100 Subject: unable to reconnect to server Message-ID: <41FE14C7.2030706@ast.dfs.de> Hi ! I am trying to establish a connection to a client via gen_tcp: -module(test3). -define (PORT,1234). -export([start/0]). start() -> start(?PORT). start(Port) -> Pid = spawn_link(fun() -> server(Port) end). server(Port) -> Opts = [{reuseaddr, true},{packet, 0}, {active, false}], {ok,Socket} = gen_tcp:listen(Port,Opts), loop(Socket). loop(Socket) -> {ok,Sock} = gen_tcp:accept(Socket), register(test,spawn_link(fun() -> do_send(Sock) end)), process_flag(trap_exit, true), %% get informed when server failed loop(Socket). reqHandler(Sock) -> do_send(Sock), gen_tcp:close(Sock). do_send(Socket) -> receive {msg,Msg} -> io:format("message received ~n"), case fill(integer_to_list(string:len(Msg)),3) of {ok,String} -> gen_tcp:send(Socket,String), cmmc_util:msleep(100), gen_tcp:send(Socket,Msg), do_send(Socket); {error,_} -> ok end; {action,Action} -> ok; {'EXIT',From,What} -> io:format("Bingo ~n"), gen_tcp:close(Socket) end. When I terminate the client and try to start it again I get Error in process <0.322.0> on node 'cmmc@REDACTED' with exit value: {badarg,[{erlang,register,[test,<0.325.0>]},{test3,loop,1}]} What has erlang:register to do with that ? What's wrong anyway ? Any hint ? Regards Dietmar From matthias@REDACTED Mon Jan 31 12:58:14 2005 From: matthias@REDACTED (Matthias Lang) Date: Mon, 31 Jan 2005 12:58:14 +0100 Subject: unable to reconnect to server In-Reply-To: <41FE14C7.2030706@ast.dfs.de> References: <41FE14C7.2030706@ast.dfs.de> Message-ID: <16894.7510.47301.948939@antilipe.corelatus.se> Dietmar Schaefer writes: > I am trying to establish a connection to a client via gen_tcp: [...] > When I terminate the client and try to start it again I get > > Error in process <0.322.0> on node 'cmmc@REDACTED' with exit value: > {badarg,[{erlang,register,[test,<0.325.0>]},{test3,loop,1}]} > > What has erlang:register to do with that ? > > What's wrong anyway ? > > Any hint ? The program you posted isn't complete (it calls fill/2, but you haven't provided fill/2), so I'll just take a guess. register/2 is failing because you try to register the spawned process every time a client connects. Here's the manual: | register(Name, P) | | Associates the name Name with the port or process identity P. Name, | which must be an atom, can be used instead of a port or pid in the | send operator (Name ! Message). | | Returns true. | | Failure: badarg if P is not an active port or process, or if P is on | another node, or if the name Name is already in use, or if the port or | process is already registered (it already has a name), or if the name | Name is not an atom, or if Name is the atom undefined. So, if you do this, it's going to fail the second time around: loop() -> register(test, spawn(fun() -> timer:sleep(10000) end)), loop(). Matthias From bengt.kleberg@REDACTED Mon Jan 31 13:04:36 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 31 Jan 2005 13:04:36 +0100 Subject: unable to reconnect to server In-Reply-To: <41FE14C7.2030706@ast.dfs.de> References: <41FE14C7.2030706@ast.dfs.de> Message-ID: <41FE1ED4.5000702@ericsson.com> Dietmar Schaefer wrote: ...deleted > When I terminate the client and try to start it again I get > > Error in process <0.322.0> on node 'cmmc@REDACTED' with exit value: > {badarg,[{erlang,register,[test,<0.325.0>]},{test3,loop,1}]} > > What has erlang:register to do with that ? your code tries to reuse/re-register test. this is what the manual says (look for Failure): ''register(Name, P) Associates the name Name with the port or pid P. Name, which must be an atom, can be used instead of a port or pid in the send operator (Name ! Message). Returns true. Failure: badarg if P is not an active port or process, if P is on another node, if Name is already in use, if the port or process is already registered (already has a name), if Name is not an atom, or if Name is the atom undefined.'' in your code test is already in use. do a erlang:unregister(Name), before registering. note that it is an error if Name is not the name of a process. bengt From ulf.wiger@REDACTED Mon Jan 31 13:46:11 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Mon, 31 Jan 2005 13:46:11 +0100 Subject: erlang time handling (in calendar.erl and erlang.erl) Message-ID: On January 31 2005 11:28, Matthias Lang wrote: > > Rant Mode On. > > This clock fudging is my #2 pet peeve about Erlang. What's #1? > In Erlang, now() tries to solve all timing problems---it promises to > track real time while still preserving intervals. For good measure, it > also promises to return "continuously increasing" values (more > commonly called "strictly increasing"). > > The result is that nothing behaves when the user makes a dramatic > adjustment to the time (1). Timeouts and intervals are off by 1% (2) > and timestamps can be off by an arbitrarily large amount for an > arbitrarily long time (3). > > Solutions? It's probably too late to fix now() since there's a lot of > code out there depending on various, mutually incompatible aspects of > its behaviour. One thing that could be done, AFAIKT, is to fix the obvious dilemma that erlang:now() is the _only_ time function available that offers sub-second precision. I don't think presenting time down to millisecond level creates any portability problems. After that, I'm not aware of any good reasons to use erlang:now(), perhaps apart from the nice feature that it is guaranteed to produce increasing values. OTOH, this guarantee is offered by ets:update_counter() as well. > (2) This is particularly annoying when your system enters "Spinal > Tap Emulation Mode" during a customer's stress testing, e.g. > claiming that the load on a signalling link is 101% So you mean that without this 1% adjustment made by erlang:now(), you could measure the load on a signalling link with a margin of error of less than 1%? > Rant Mode Off. /Uffe From mccratch@REDACTED Mon Jan 31 17:00:37 2005 From: mccratch@REDACTED (Matthias Kretschmer) Date: Mon, 31 Jan 2005 17:00:37 +0100 Subject: Windows, io:fwrite, halt, buffer flushing problems, R10B-2 In-Reply-To: <41FA70EF.8070906@blueyonder.co.uk> References: <41F95275.1000501@gmx.net> <41FA3773.40401@gmx.net> <41FA70EF.8070906@blueyonder.co.uk> Message-ID: <41FE5625.90406@gmx.net> David Hopwood wrote: > Matthias Kretschmer wrote: > >> I browsed through the source-code and I think now I have a patch which >> solves this problem cleanly. Well at least I hope because I can't build >> win32 Erlang myself. The VC 2003 Toolkit is missing several libraries >> that seem to be required to build Erlang. I don't have a commercial >> version of VC/VC++, so I don't have these libraries (.LIB-files like >> MSVCRT.LIB) and so I was unable to compile it myself. > > > > (using MSIE) > thanks well I compiled it now, my idea was wrong. Don't really understand what's going wrong. but a io:fwrite("") before the halt(N) solves the problem, so I stick to this workaround ... -- Matthias Kretschmer From ulf.wiger@REDACTED Mon Jan 31 17:16:51 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Mon, 31 Jan 2005 17:16:51 +0100 Subject: erlang time handling (in calendar.erl and erlang.erl) Message-ID: On January 31 2005 11:28, Matthias Lang wrote: > Solutions? It's probably too late to fix now() since there's a lot of > code out there depending on various, mutually incompatible aspects of > its behaviour. But if you don't have any old code to break, it's not > too hard to disable the clock-fudging. It's in > > erts/emulator/beam/erl_time_sup.c Or, one could do what's suggested in the ERTS release notes (erts-5.3.6): "The '+c' switch has been added to disable time correction in the runtime system, this should be used on systems where one is certain no dramatic wall clock time changes will occur and the time correction algorithm is too costly (namely very fast Linux systems where loads of erlang:now() are executed). " /Uffe From matthias@REDACTED Mon Jan 31 17:26:47 2005 From: matthias@REDACTED (Matthias Lang) Date: Mon, 31 Jan 2005 17:26:47 +0100 Subject: erlang time handling (in calendar.erl and erlang.erl) In-Reply-To: References: Message-ID: <16894.23623.405440.201488@antilipe.corelatus.se> Ulf Wiger (AL/EAB) writes: mml> > (2) This is particularly annoying when your system enters "Spinal mml> > Tap Emulation Mode" during a customer's stress testing, e.g. mml> > claiming that the load on a signalling link is 101% etxuwig> So you mean that without this 1% adjustment made by erlang:now(), etxuwig> you could measure the load on a signalling link with a margin of etxuwig> error of less than 1%? Yes. We currently do that, though in C, not Erlang. Whether it's useful or not is another question. But it sure is lame to display 101%. It's also lame when you have two identical test systems listening to the same link from a test generator and one consistently says 56% and the other consistently 57%. Gets people asking "why can't they agree, they're the same, aren't they?". Matthias From ulf.wiger@REDACTED Mon Jan 31 17:37:26 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Mon, 31 Jan 2005 17:37:26 +0100 Subject: erl boot flags Message-ID: I was trying to match the following printout from OTP R10B-2 against the documentation: Usage: erl [-version] [-sname NAME | -name NAME] [-noshell] [-noinput] [-env VAR VALUE] [-compile file ...] [-make] [-man [manopts] MANPAGE] [-x] [-emu_args] [+i BOOT_MODULE] [+b BOOT_FUN] [+s STACK_SIZE] [+h HEAP_SIZE] [+# ITEMS] [+P MAX_PROCS] [+A THREADS] [+R COMPAT_REL] [+K BOOLEAN] [+M ] [args ...] The flags above that I don't find documentation for are: -x +i BOOT_MODULE +b BOOT_FUN +s STACK_SIZE +# ITEMS (Does that mean that they are not supported?) The following flags are, I guess, understood to be part of [args ...], as they all appear in the erl(3) manual as supported: -AppName Key Value -boot File -boot_var Var Directory [Var Directory] -config Config -connect_all false -cookie -detached -eval Expr -extra -heart -hidden -hosts Hosts -id Id -instr -loader Loader -mode Mode -nostick -oldShell -pa Directories -pz Directories -remsh Node -rsh Program -run Mod [Fun [Args]] -s Mod [Fun [Args]] -setcookie Cookie +B [i] +l +v +V Were the five options (-x, +i, +b, +s, +#) left out on purpose? Are there other flags supported by erl that were listed neither in the help message nor in the manual? I admit I haven't searched the erts source for answers. I maintain that there should be a section in the documentation briefly listing unsupported functions and options. /Uffe From matthias@REDACTED Mon Jan 31 18:12:44 2005 From: matthias@REDACTED (Matthias Lang) Date: Mon, 31 Jan 2005 18:12:44 +0100 Subject: erlang time handling (in calendar.erl and erlang.erl) In-Reply-To: References: Message-ID: <16894.26380.637087.621979@antilipe.corelatus.se> mml> > Solutions? It's probably too late to fix now() since there's a lot of etxuwig> Or, one could do what's suggested in the ERTS release etxuwig> notes (erts-5.3.6): etxuwig> "The '+c' switch has been added to disable time correction in the etxuwig> runtime system, Great. I completely missed that when we switched to R9C (from R8B). mml> > This clock fudging is my #2 pet peeve about Erlang. etxuwig> What's #1? That you can blow out VM memory use doing fairly ordinary things with binaries. I have no ideas how to fix that, though it's only really a problem for machines with tight memory bounds. Matthias