From dawsdesign@REDACTED Mon Sep 1 02:03:52 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Sun, 31 Aug 2008 20:03:52 -0400 Subject: [erlang-questions] NYC CouchDB meetup / talk In-Reply-To: References: Message-ID: I'm interested. On Sun, Aug 31, 2008 at 3:39 PM, Chris Anderson wrote: > New York Couchers / Erlangers, > > (Pardon the cross-post) > > I'll be in Brooklyn from September 14th to the 20th, so if anyone > would like to meetup for a beer to talk about CouchDB, I'd be > thrilled. I'd also be happy to give a talk about CouchDB from a user's > perspective, or to talk about the CouchDB internals. (I'm still > learning Erlang in depth, but I know the CouchDB codebase pretty well > at this point.) > > In any case, I'd love to meet with some NYC Erlangers / CouchDB users. > I've seen some talk about getting an NYC Erlounge off the ground, I'd > be really excited to attend that if it happens when I'm in town. > > Chris > > -- > Chris Anderson > http://jchris.mfdz.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.rafkind@REDACTED Mon Sep 1 03:59:59 2008 From: dave.rafkind@REDACTED (Dave Rafkind) Date: Sun, 31 Aug 2008 21:59:59 -0400 Subject: [erlang-questions] Erlang and DICOM In-Reply-To: <6107556d0808270336w6cdae75dnd75b4102783c34fd@mail.gmail.com> References: <6107556d0808270336w6cdae75dnd75b4102783c34fd@mail.gmail.com> Message-ID: <2ae2b2da0808311859l549b3854xb051f2b9d0b093e2@mail.gmail.com> I've used DICOM in the past, it is an unruly beast. In terms of erlang I'd say: watch out for the large image binary data, especially image compression/decompression. Other than that it should be smooth sailing. A good resource is Mr Clunie, he's very responsive and a nice guy too. http://www.dclunie.com/ 2008/8/27 eduardo f > Hi, > > I'm evaluating Digital imaging server's implementations and the chance to > develop a DICOM server in Erlang. Does someone in the community have > experience in this field with Erlang? > > Thanks, Eduardo Figoli > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eranga.erl@REDACTED Mon Sep 1 04:41:20 2008 From: eranga.erl@REDACTED (Eranga Udesh) Date: Mon, 1 Sep 2008 08:11:20 +0530 Subject: [erlang-questions] Erl getting stuck in SMP with 8 cores In-Reply-To: <6c2563b20808311308u4db39997jae41c107195c449c@mail.gmail.com> References: <912a3c160808311222uec8bed1qd63f5f594465769e@mail.gmail.com> <6c2563b20808311308u4db39997jae41c107195c449c@mail.gmail.com> Message-ID: <912a3c160808311941l37cda5c7pc116fb250c02b607@mail.gmail.com> Edwin, Yes, it's built from source. Tried by doing "make clean" as well. I enabled smp, threads, etc. The compiler is gcc. The node is started with smp enabled, 196 OS threads and hipe. I tried Kernal poll enabled and disabled, but both the times same issue. Platform is 32bit. Latest firmware for the machine and OS patches are installed. There're 3 same config machines and every machine gives the same Erlang issue. Like I said, it's not all the Erlang nodes getting the issue at the same time. I wonder if it's a Erl scheduler blockage or something. Also there's no any real time process running that I could think if causing this. The CPUs are almost 98% free. Like I said earlier, the Erl node is not totall stucked. Single RPC commands work but recursive functions getting stuck. Running processes halts and "Reductions" don't increase. The Erl prompt is not responding when doing "to_erl" If you or anyboby run or tested Erlang with 8 or more Intel cores, pls let me know. I want to first narrow down the problem to identify if it's a problem only in my instalation or an Erl smp problem. If it's the former,much releaved. Thanks, - Eranga On Mon, Sep 1, 2008 at 1:38 AM, Edwin Fine wrote: > Eranga, > > You didn't say whether or not you had built the Erlang releases from > source. If not, it might be a good idea to try that on the target system > (./configure; make clean; make). If so, which compiler are you using? > > I won't ask all the obvious non-Erlang questions like, do you have the > latest firmware for the machine, latest patches for RH 5.1, have you run a > full hardware/memory test suite (maybe the machine is flaky), have you > stopped all other non-critical processes and applications (maybe there's a > rogue real-time process?) etc. > > You also didn't say if you were running 32-bit or 64-bit Linux. > > 2008/8/31 Eranga Udesh > >> Hi, >> >> I recently installed a new Erlang release 12B-3 on a 8 core (2 x 4 core >> Intel Zeon) HP DL 580 G5 machine running RH Linux 5.1. However this gives >> misterious errors in process handling. The observations are as below. >> >> 1. The Erlang node occassionally getting killed by heart. Reason for >> termination "heart-beat time-out". Sometimes after a couple of hours but >> sometimes in few minutes. Pls note this is without any workload on this Erl >> node. All the server cores are 98% free. >> >> 2. I started without heart and ran 2 recursive functons, 1 spawned and 1 >> in the Emulator prompt. This function outputs time every 1 second. When this >> issue occurs,the output stops. Which means the recursive functions stop >> working. Since heart is not started, Erl node is not getting restarted. >> >> 2.1. If I leave the Erl node for sometime, the sometimes things comes back >> to normal (tested for after 15-20 mins. othertimes never recovered). The >> outputs starts again. >> >> 2.2. I can do net:ping/1 from another Erl node. If I do a RPC call from >> another Erl node, it works. However if I run a recursive function, it runs >> once and getting stuck. The RPC call waits till timeout. >> >> 2.3 When this occurs, the connections from other Erl nodes are getting >> connection timeout and connection removes. However, like said above I can >> still do net:ping/1 and connect. If no activity done, again timeouts a >> little later. >> >> 2.4 I used etop to check whats going on. I hav a SCTP based application >> running and if a SCTP message comes, it's getting handled without any >> problem. I can see the recursive functions running and waiting and >> timer:sleep(1000) clause, but there's no increment in "Reductions" counter >> or no time output. >> >> 3. I have multiple Erlang releases running in this server. All of them >> face this issue, but not all at once. Their issue comes in different times >> and no pattern could observe. Even pure Mnesia DB Erl nodes face the same >> issue. >> >> 4. I tried with SMP enabled/disabled, different +S , but nothing >> works. >> >> 5. I tried with RH Linux 5.0/5.1, Erlang 12B-2/12B-3 but still the same. >> >> 6. The same Erl release in a different HP 4 core machine in same RH Linux >> works fine. >> >> Is there anybody who faced/face similar issues? What could be the cause >> for this? If there's any other debug dumps I should take, let me know. I >> tried everything and spent about a week, without any luck. I urgently need >> to find and fix the issue. >> >> Any advice is valuable. >> >> Thanks, >> - Eranga >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > For every expert there is an equal and opposite expert - Arthur C. Clarke > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dizzyd@REDACTED Mon Sep 1 05:45:20 2008 From: dizzyd@REDACTED (Dave Smith) Date: Sun, 31 Aug 2008 21:45:20 -0600 Subject: [erlang-questions] Erl getting stuck in SMP with 8 cores In-Reply-To: <912a3c160808311941l37cda5c7pc116fb250c02b607@mail.gmail.com> References: <912a3c160808311222uec8bed1qd63f5f594465769e@mail.gmail.com> <6c2563b20808311308u4db39997jae41c107195c449c@mail.gmail.com> <912a3c160808311941l37cda5c7pc116fb250c02b607@mail.gmail.com> Message-ID: 2008/8/31 Eranga Udesh : > Like I said earlier, the Erl node is not totall stucked. Single RPC commands > work but recursive functions getting stuck. Running processes halts and > "Reductions" don't increase. The Erl prompt is not responding when doing > "to_erl" > If you or anyboby run or tested Erlang with 8 or more Intel cores, pls let > me know. I want to first narrow down the problem to identify if it's a > problem only in my instalation or an Erl smp problem. If it's the > former,much releaved. FWIW, I use 8+ cores with hundreds of thousands of processes on Erlang SMP on a daily basis and have not seen any of the problems you've described. Do you have a minimal set of code that produces these symptoms? D. From erlang-questions_efine@REDACTED Mon Sep 1 05:58:59 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sun, 31 Aug 2008 23:58:59 -0400 Subject: [erlang-questions] Erl getting stuck in SMP with 8 cores In-Reply-To: <912a3c160808311941l37cda5c7pc116fb250c02b607@mail.gmail.com> References: <912a3c160808311222uec8bed1qd63f5f594465769e@mail.gmail.com> <6c2563b20808311308u4db39997jae41c107195c449c@mail.gmail.com> <912a3c160808311941l37cda5c7pc116fb250c02b607@mail.gmail.com> Message-ID: <6c2563b20808312058i269e90abpf063692c351a450b@mail.gmail.com> Sorry, I only have a 4-core Q6600. Some friendly suggestions. When looking for help, you should post as much *relevant* information as you can, such as the exact versions of your gcc compiler, glibc, Linux kernel (cat /proc/sys/kernel/osrelease), and if possible, *some simple Erlang code to reproduce the problem*. Show the command line you use to start Erlang and the first line of the shell response containing the Erlang version info. Maybe even attach your Linux system configuration to the post if it's not too big (sysctl -a > somefile.txt). Then the Erlang folks or someone else might be able to help you effectively. These are some general tips that may or may not help. - Have you compared the system configuration on the 4-core box (sysctl -a) with the one on the 8-core box? Maybe there is some silly limit that's too low. - Are you really running a 32 bit OS on a dual 4-core Xeon? How much memory is installed? If it's more than 3 - 4 GB it's being wasted. - Is the OS running under Xen or some other hypervisor? If so, could there be some interaction there? I have run Erlang R12B-2 under Xen 3.1.0 on top of OpenSuse 2.6.22 x86_64 with no problems, so it's unlikely, but if Xen is in the picture you should try booting on the raw OS anyway. - Are there any strange entries in the system log that might provide a clue? I regret that I have no further ideas on what the issue could be. The fact that things run fine on the 4-core HP box with the same version of Linux is troubling, but there are so many variables involved I can't draw any conclusions from this. One last thing: I did notice in the R12B-3 release notes that there is a known bug in gcc 4.3.0, but your build would have failed if you had that compiler version. Unless you fiddled with the configure script... ;-) OTP-7397 The configure script now tests for an serious optimization bug in gcc-4.3.0. If the bug is present, the configure script will abort (if this happens, the only way to build Erlang/OTP is to change to another version of gcc). (Thanks to Mikael Pettersson.) On Sun, Aug 31, 2008 at 10:41 PM, Eranga Udesh wrote: > Edwin, > > Yes, it's built from source. Tried by doing "make clean" as well. I enabled > smp, threads, etc. The compiler is gcc. The node is started with smp > enabled, 196 OS threads and hipe. I tried Kernal poll enabled and disabled, > but both the times same issue. Platform is 32bit. > > Latest firmware for the machine and OS patches are installed. There're 3 > same config machines and every machine gives the same Erlang issue. Like I > said, it's not all the Erlang nodes getting the issue at the same time. I > wonder if it's a Erl scheduler blockage or something. Also there's no any > real time process running that I could think if causing this. The CPUs are > almost 98% free. > > Like I said earlier, the Erl node is not totall stucked. Single RPC > commands work but recursive functions getting stuck. Running processes halts > and "Reductions" don't increase. The Erl prompt is not responding when doing > "to_erl" > If you or anyboby run or tested Erlang with 8 or more Intel cores, pls > let me know. I want to first narrow down the problem to identify if it's a > problem only in my instalation or an Erl smp problem. If it's the > former,much releaved. > > Thanks, > - Eranga > > > > On Mon, Sep 1, 2008 at 1:38 AM, Edwin Fine > wrote: > >> Eranga, >> >> You didn't say whether or not you had built the Erlang releases from >> source. If not, it might be a good idea to try that on the target system >> (./configure; make clean; make). If so, which compiler are you using? >> >> I won't ask all the obvious non-Erlang questions like, do you have the >> latest firmware for the machine, latest patches for RH 5.1, have you run a >> full hardware/memory test suite (maybe the machine is flaky), have you >> stopped all other non-critical processes and applications (maybe there's a >> rogue real-time process?) etc. >> >> You also didn't say if you were running 32-bit or 64-bit Linux. >> >> 2008/8/31 Eranga Udesh >> >>> Hi, >>> >>> I recently installed a new Erlang release 12B-3 on a 8 core (2 x 4 core >>> Intel Zeon) HP DL 580 G5 machine running RH Linux 5.1. However this gives >>> misterious errors in process handling. The observations are as below. >>> >>> 1. The Erlang node occassionally getting killed by heart. Reason for >>> termination "heart-beat time-out". Sometimes after a couple of hours but >>> sometimes in few minutes. Pls note this is without any workload on this Erl >>> node. All the server cores are 98% free. >>> >>> 2. I started without heart and ran 2 recursive functons, 1 spawned and 1 >>> in the Emulator prompt. This function outputs time every 1 second. When this >>> issue occurs,the output stops. Which means the recursive functions stop >>> working. Since heart is not started, Erl node is not getting restarted. >>> >>> 2.1. If I leave the Erl node for sometime, the sometimes things comes >>> back to normal (tested for after 15-20 mins. othertimes never recovered). >>> The outputs starts again. >>> >>> 2.2. I can do net:ping/1 from another Erl node. If I do a RPC call from >>> another Erl node, it works. However if I run a recursive function, it runs >>> once and getting stuck. The RPC call waits till timeout. >>> >>> 2.3 When this occurs, the connections from other Erl nodes are getting >>> connection timeout and connection removes. However, like said above I can >>> still do net:ping/1 and connect. If no activity done, again timeouts a >>> little later. >>> >>> 2.4 I used etop to check whats going on. I hav a SCTP based application >>> running and if a SCTP message comes, it's getting handled without any >>> problem. I can see the recursive functions running and waiting and >>> timer:sleep(1000) clause, but there's no increment in "Reductions" counter >>> or no time output. >>> >>> 3. I have multiple Erlang releases running in this server. All of them >>> face this issue, but not all at once. Their issue comes in different times >>> and no pattern could observe. Even pure Mnesia DB Erl nodes face the same >>> issue. >>> >>> 4. I tried with SMP enabled/disabled, different +S , but nothing >>> works. >>> >>> 5. I tried with RH Linux 5.0/5.1, Erlang 12B-2/12B-3 but still the same. >>> >>> 6. The same Erl release in a different HP 4 core machine in same RH Linux >>> works fine. >>> >>> Is there anybody who faced/face similar issues? What could be the cause >>> for this? If there's any other debug dumps I should take, let me know. I >>> tried everything and spent about a week, without any luck. I urgently need >>> to find and fix the issue. >>> >>> Any advice is valuable. >>> >>> Thanks, >>> - Eranga >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >> >> >> >> -- >> For every expert there is an equal and opposite expert - Arthur C. Clarke >> > > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From vik@REDACTED Mon Sep 1 06:32:43 2008 From: vik@REDACTED (Vik Olliver) Date: Mon, 01 Sep 2008 16:32:43 +1200 Subject: [erlang-questions] Making rpc calls from escript Message-ID: <1220243563.7440.47.camel@localhost> Having great fun here. There is an Erlang function I wish to call on the local machine. If I remsh into the current process and look at the prompt, I see it is called: erms@REDACTED That's the IP address of the local machine, so I know I've got the right one - and my magic cookie seems to be correct or I wouldn't get this far. So, I put in my escript: #!/usr/bin/env escript main([Blah]) -> io:format("RPC does ~p~n",[ rpc:call('erms@REDACTED', erms_reports, repopulate, [Blah] )]) . (Some parameters and names omitted to protect the guilty, but trust me: erms_reports:repopulate is there alright) Basically, I see: RPC does {badrpc,nodedown} Now the node is not down, 'cos I can remsh into the bally thing with: erl -name con2@REDACTED -remsh erms@REDACTED So why, in its infinite wisdom, does escript not connect? Does it require white mice, mystic runes and a moonlit night, or what? Vik :v) From dizzyd@REDACTED Mon Sep 1 06:53:19 2008 From: dizzyd@REDACTED (Dave Smith) Date: Sun, 31 Aug 2008 22:53:19 -0600 Subject: [erlang-questions] Making rpc calls from escript In-Reply-To: <1220243563.7440.47.camel@localhost> References: <1220243563.7440.47.camel@localhost> Message-ID: I believe you probably need to start net_kernel in order to make that rpc call. Without net_kernel running, there is no distributed Erlang. You should be able to do something like: net_kernel:start([foobar, longnames]). (Assuming your hostname is properly configured). Hope that helps, D. On Sun, Aug 31, 2008 at 10:32 PM, Vik Olliver wrote: > Having great fun here. There is an Erlang function I wish to call on the > local machine. If I remsh into the current process and look at the > prompt, I see it is called: erms@REDACTED > > That's the IP address of the local machine, so I know I've got the right > one - and my magic cookie seems to be correct or I wouldn't get this > far. > > So, I put in my escript: > > #!/usr/bin/env escript > main([Blah]) -> > io:format("RPC does ~p~n",[ > rpc:call('erms@REDACTED', erms_reports, > repopulate, [Blah] )]) . > > (Some parameters and names omitted to protect the guilty, but trust me: > erms_reports:repopulate is there alright) > > Basically, I see: > RPC does {badrpc,nodedown} > > Now the node is not down, 'cos I can remsh into the bally thing with: > erl -name con2@REDACTED -remsh erms@REDACTED > > So why, in its infinite wisdom, does escript not connect? Does it > require white mice, mystic runes and a moonlit night, or what? > > Vik :v) > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From vik@REDACTED Mon Sep 1 07:15:11 2008 From: vik@REDACTED (Vik Olliver) Date: Mon, 01 Sep 2008 17:15:11 +1200 Subject: [erlang-questions] Making rpc calls from escript In-Reply-To: References: <1220243563.7440.47.camel@localhost> Message-ID: <1220246111.7440.51.camel@localhost> On Sun, 2008-08-31 at 22:53 -0600, Dave Smith wrote: > I believe you probably need to start net_kernel in order to make that > rpc call. Without net_kernel running, there is no distributed Erlang. > > You should be able to do something like: > > net_kernel:start([foobar, longnames]). > > (Assuming your hostname is properly configured). Heh, that got: ** System NOT running to use fully qualified hostnames ** ** Hostname 192.168.150.129 is illegal ** The actual Linux hostname is erms1, /etc/hostname is fully qualified, but hostname -s gives: hostname: Unknown host This doesn't sound too good... Vik :v) From raimo+erlang-questions@REDACTED Mon Sep 1 09:26:39 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 1 Sep 2008 09:26:39 +0200 Subject: [erlang-questions] fprof.dump: what is CP? In-Reply-To: References: Message-ID: <20080901072639.GA16747@erix.ericsson.se> On Sat, Aug 30, 2008 at 11:47:05PM +0100, Joel Reymont wrote: > What does CP stand for in the following fprof dump? > > {trace_ts,<7839.37.0>,in, > {fprof,apply_start_stop,4}, > {1220,133658,589577}} > {trace_ts,<7839.37.0>,call, > {mb,test,3}, > {cp,{fprof,apply_start_stop,4}}, > {1220,133658,589592}} > > Is it Swedish for caller function or is it an abbreviation for > something else? It is the Continuation Pointer, that is the return address - where execution should contiue when a function returns. When a function does a tail recursive call the CP does not change. If the call is non-tail recursive (deep, nested, ...), the CP is first pushed on the stack and then set to the current (next) Program Counter before the call, so CP changes. It is chiefly this information Fprof uses to deduce the true call stack from the execution trace. > > Thanks, Joel > > -- > wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From raimo+erlang-questions@REDACTED Mon Sep 1 09:30:25 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 1 Sep 2008 09:30:25 +0200 Subject: [erlang-questions] : Making rpc calls from escript In-Reply-To: <1220246111.7440.51.camel@localhost> References: <1220243563.7440.47.camel@localhost> <1220246111.7440.51.camel@localhost> Message-ID: <20080901073025.GB16747@erix.ericsson.se> On Mon, Sep 01, 2008 at 05:15:11PM +1200, Vik Olliver wrote: > On Sun, 2008-08-31 at 22:53 -0600, Dave Smith wrote: > > I believe you probably need to start net_kernel in order to make that > > rpc call. Without net_kernel running, there is no distributed Erlang. > > > > You should be able to do something like: > > > > net_kernel:start([foobar, longnames]). > > > > (Assuming your hostname is properly configured). > > Heh, that got: > > ** System NOT running to use fully qualified hostnames ** > ** Hostname 192.168.150.129 is illegal ** > > The actual Linux hostname is erms1, /etc/hostname is fully qualified, > but hostname -s > gives: > hostname: Unknown host > > This doesn't sound too good... You have a network configuration problem (as if you did not know). Try shortnames instead of longnames since apparently you will connect over a LAN. > > Vik :v) > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From anders@REDACTED Mon Sep 1 09:53:46 2008 From: anders@REDACTED (Anders Ramsell) Date: Mon, 01 Sep 2008 09:53:46 +0200 Subject: [erlang-questions] Selective receive issue In-Reply-To: <95be1d3b0808042359s2a93676eqf3fc0afbb2087f94@mail.gmail.com> References: <95be1d3b0808042359s2a93676eqf3fc0afbb2087f94@mail.gmail.com> Message-ID: <48BB9F8A.3010506@theheartofgold.org> Hi! Sorry for jumping in to an old thread like this but I believe there is one way to approach this that hasn't been tried. Let's start with a slight rewrite of Vlad's example: loop(Running) -> receive start -> loop(true); stop -> loop(false) after 0 -> if Running -> process_one_step(), loop(Running); true -> loop(Running) end end. process_one_step() -> receive {input, Data} -> Data end. The problem was that with two separate receive clauses you can't add an anonymous "catch all" to clean up unwanted messages in either of them because you might then throw away wanted messages too. And since we don't know how the unwanted messages look we can't easily pattern match on them. But we do know how the unwanted messages *doesn't* look. Let's add some clauses to loop throwing away messages. loop(Running) -> receive start -> loop(true); stop -> loop(false); X when not is_tuple(X) -> loop(Running); X when tuple_size /= 2 -> loop(Running); {X, _} when X /= input -> loop(Running) after 0 -> if Running -> process_one_step(), loop(Running); true -> loop(Running) end end. process_one_step() -> receive {input, Data} -> Data end. Now loop should throw away all junk in the inbox. However in the "real world" our messages may be quite a bit more complex and doing this could then obscure what we really want to do. Lets move the cleaning code to it's own function with a separate receive. loop(Running) -> my_flush(), receive start -> loop(true); stop -> loop(false) after 0 -> if Running -> process_one_step(), loop(Running); true -> loop(Running) end end. process_one_step() -> receive {input, Data} -> Data end. my_flush() -> receive X when is_atom(X), X /= start, X/= stop -> my_flush(); X when not is_tuple(X) -> my_flush(); X when tuple_size /= 2 -> my_flush(); {X, _} when X /= input -> my_flush() after 0 -> ok end. This forced us to add another clause or we would have flushed the start and stop messages too. In return we have a separate function for flushing unwanted messages which is easier to keep up-to-date and can be called from more than one place in our program. As our program grows keeping my_flush correct may be hard unless we keep wanted messages easy to identify. In my "final" version I have changed all wanted messages to be 2-tuples starting with a known tag. loop(Running) -> my_flush(), receive {my_tag, start} -> loop(true); {my_tag, stop} -> loop(false) after 0 -> if Running -> process_one_step(), loop(Running); true -> loop(Running) end end. process_one_step() -> receive {my_tag, {input, Data}} -> Data end. my_flush() -> receive X when not is_tuple(X) -> my_flush(); X when tuple_size /= 2 -> my_flush(); {X, _} when X /= my_tag -> my_flush() after 0 -> ok end. If all wanted messages follow a simple principle like this then my_flush should never have to be updated. So just because we don't know what the junk looks like does not have to mean we can't throw it away. /Anders Ramsell From john.hughes@REDACTED Mon Sep 1 10:36:59 2008 From: john.hughes@REDACTED (John Hughes) Date: Mon, 1 Sep 2008 10:36:59 +0200 Subject: [erlang-questions] QuickCheck course in British Columbia References: Message-ID: <00a501c90c0d$e6bf61a0$8bc51081@JTablet2007> This is for North American Erlangers who are interested in learning about QuickCheck. We're planning to run a two-and-a-half day "QuickCheck for Erlang Users" course after the ICFP/DEFUN conferences in Victoria, BC. The course will run from September 29th-1st October, either in Victoria or in Vancouver--the location is yet to be determined. The course content is available here: http://quviq.com/documents/QC-designers.pdf Participation is limited to a dozen to guarantee personal attention for each participant. The course also includes a one-month QuickCheck licence, so you can try QuickCheck out on your own code afterwards. The price will be US$2,000 per participant. If you're interested, let us know via sales@REDACTED -- the sooner the better, since knowing the level of interest will help us with our planning. John Hughes From jefcrane@REDACTED Mon Sep 1 09:39:51 2008 From: jefcrane@REDACTED (Jeff Crane) Date: Mon, 1 Sep 2008 00:39:51 -0700 (PDT) Subject: [erlang-questions] Learning OTP - Application, Supervisor, FSM, Server Message-ID: <900327.18283.qm@web31607.mail.mud.yahoo.com> This code is modified from: http://www.trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles -module(tcp_server_app). -author('saleyn@REDACTED'). -behaviour(application). %% Internal API -export([start_client/0]). %% Application and Supervisor callbacks -export([start/2, stop/1, init/1]). -define(MAX_RESTART, 5). -define(MAX_TIME, 60). -define(DEF_PORT, 6123). %% A startup function for spawning new client connection handling FSM. %% To be called by the TCP listener process. start_client() -> supervisor:start_child(tcp_client_sup, []). %%---------------------------------------------------------------------- %% Application behaviour callbacks %%---------------------------------------------------------------------- start(_Type, _Args) -> ListenPort = get_app_env(listen_port, ?DEF_PORT), supervisor:start_link({local, ?MODULE}, ?MODULE, [ListenPort, prechat_fsm]). stop(_S) -> ok. %%---------------------------------------------------------------------- %% Supervisor behaviour callbacks %%---------------------------------------------------------------------- init([Port, Module]) -> {ok, { _SupFlags = {one_for_one, ?MAX_RESTART, ?MAX_TIME}, [ % TCP Listener { tcp_server_sup, % Id = internal id {tcp_listener,start_link,[Port,Module]}, % StartFun = {M, F, A} permanent, % Restart = permanent | transient | temporary 2000, % Shutdown = brutal_kill | int() >= 0 | infinity worker, % Type = worker | supervisor [tcp_listener] % Modules = [Module] | dynamic }, % Client instance supervisor { tcp_client_sup, % Id = internal id {supervisor,start_link,[{local, tcp_client_sup}, ?MODULE, [Module]]}, % StartFun = {M, F, A} permanent, % Restart = permanent | transient | temporary infinity, % Shutdown = brutal_kill | int() >= 0 | infinity supervisor, % Type = worker | supervisor [] % Modules = [Module] | dynamic }, % Chat Server instance { chat_server_sup, % Id = internal id {chat_server,start_link, []}, % StartFun = {M, F, A} permanent, % Restart = permanent | transient | temporary 2000, % Shutdown = brutal_kill | int() >= 0 | infinity worker, % Type = worker | supervisor [chat_server] % Modules = [Module] | dynamic } ] } }; init([Module]) -> {ok, { _SupFlags = {simple_one_for_one, ?MAX_RESTART, ?MAX_TIME}, [ % TCP Client { undefined, % Id = internal id {Module,start_link,[]}, % StartFun = {M, F, A} temporary, % Restart = permanent | transient | temporary 2000, % Shutdown = brutal_kill | int() >= 0 | infinity worker, % Type = worker | supervisor [] % Modules = [Module] | dynamic } ] } }. %%---------------------------------------------------------------------- %% Internal functions %%---------------------------------------------------------------------- get_app_env(Opt, Default) -> case application:get_env(application:get_application(), Opt) of {ok, Val} -> Val; _ -> case init:get_argument(Opt) of [[Val | _]] -> Val; error -> Default end end. This doesn't run, but what's worse is that I don't understand why. Let me walk through what I think I know. In shell, I type: application:start(tcp_server). The OTP framework looks for and at the .app file for the argument specified. It sees tcp_server.app and finds the line: {mod, {tcp_server_app, []}}, This tells what args (happen to be [] in this case) to send the module tcp_server_app and the Type defaults to the atom "normal" somehow. start is always the default initial function according to the OTP framework. Putting this altogether, we get the initial function call of: tcp_server_app:start(normal,[]) Next it pulls the ListenPort out of the define directives. According to what I've observed, behaviours are equivalent to java interfaces. Unlike java interfaces, you don't need to declare that you implement the interface for another module to call them, another module will simply do a "blind" call, assuming it's there. tcp_server_app implements both application and supervisor behaviours, even though it only declares 1 of them (application). The supervisor behaviour allows the supervisor module to start up a supervisor node via an init/1 fun. The following line: supervisor:start_link({local, ?MODULE}, ?MODULE, [ListenPort, prechat_fsm]), ...says, spawn module tcp_server_app, function init/1, register the process locally as tcp_server_app, passing the args [ListenPort, prechat_fsm] to the init/1. This results in a spawned process: tcp_server_app:init([ListenPort, prechat_fsm]) The first init([Port,Module]) matches so it is used. Next, I had no idea what was going on: {ok,{_SupFlags,[Arg1,Arg2]}}; until I ran into: http://www.erlang.org/doc/design_principles/part_frame.html (look for child specifications) % Child specification consists of... Arg = { % unique c.spec identifier tcp_server_sup, % spawn a process of tcp_listener:init([Port,Module]), {tcp_listener,start_link,[Port,Module]}, % Restart always permanent, % How long to die after getting a "die" message from supervisor 2000, % Is this child a sub-supervisor, otherwise: worker worker, % No idea what this bad boy is for. [tcp_listener] } My chat_server.erl is a gen_server, and I think that if someone can explain this last bit of the child specification, I might understand why I'm getting this at runtime (startup): =INFO REPORT==== 1-Sep-2008::00:39:12 === application: tcp_server exited: {shutdown,{tcp_server_app,start,[normal,[]]}} type: temporary {error,{shutdown,{tcp_server_app,start,[normal,[]]}}} Apologies for the inability to read specs, but I just don't understand. From bgustavsson@REDACTED Mon Sep 1 12:00:24 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Mon, 1 Sep 2008 12:00:24 +0200 Subject: [erlang-questions] emulator crash when using fprof in verbose mode In-Reply-To: <16A109F7-CE7C-417B-A2A2-CDD2533221DC@gmail.com> References: <16A109F7-CE7C-417B-A2A2-CDD2533221DC@gmail.com> Message-ID: <6672d0160809010300n5eb2cd82lc511fb0fbf3012d5@mail.gmail.com> On Sun, Aug 31, 2008 at 1:33 AM, Joel Reymont wrote: > How do I troubleshoot and fix this? > The bug will be fixed in the upcoming R12B-4 release. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimo+erlang-questions@REDACTED Mon Sep 1 12:29:58 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 1 Sep 2008 12:29:58 +0200 Subject: [erlang-questions] printing of Eterm's from gdb In-Reply-To: References: Message-ID: <20080901102958.GA18425@erix.ericsson.se> On Sun, Aug 31, 2008 at 09:48:09AM +0100, Joel Reymont wrote: > How can I print out Eterm's from within gdb? > > (gdb) where > #0 size_object (obj=4380267240) at beam/copy.c:157 > > (gdb) p obj > $8 = 4380267240 > > (gdb) p erts_printf_eterm_func > $6 = (int (*)(fmtfn_t, void *, long unsigned int, long int)) > 0x100059760 > > (gdb) p erts_printf > $7 = {int (const char *)} 0x100132d90 > > Thanks, Joel There is a utility we (the ERTS group) use ourselves. erts/etc/unix/etp-commands aka Emulator Toolbox for Pathologists. It is a horrible/amazing set of GDB macros that print erlang terms rather successfully. If you start the emulator from another ERTS utility bin/cerl it will with the right arguments load etp-commands for you: $ $ERL_TOP/bin/cerl -gdb ...new emacs GDB window pops up... Current directory is /ldisk/raimo/r12b_dev/ set args -- -root /clearcase/otp/erts -progname /clearcase/otp/erts/bin/cerl -- -home /home/raimo source /clearcase/otp/erts/erts/etc/unix/etp-commands GNU gdb 6.6 Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-suse-linux"... Using host libthread_db library "/lib64/libthread_db.so.1". (gdb) (gdb) %--------------------------------------------------------------------------- % Use etp-help for a command overview and general help. % % To use the Erlang support module, the environment variable ROOTDIR % must be set to the toplevel installation directory of Erlang/OTP, % so the etp-commands file becomes: % $ROOTDIR/erts/etc/unix/etp-commands % Also, erl and erlc must be in the path. %--------------------------------------------------------------------------- etp-set-max-depth 20 etp-set-max-string-length 100 (gdb) break nodes_1 Breakpoint 1 at 0x47de60: file beam/dist.c, line 2069. (gdb) run Starting program: /clearcase/otp/erts/bin/x86_64-unknown-linux-gnu/beam -- -root /clearcase/otp/erts -progname /clearcase/otp/erts/bin/cerl -- -home /home/raimo [Thread debugging using libthread_db enabled] [New Thread 47984520497888 (LWP 20163)] [New Thread 1073813824 (LWP 20166)] Eshell V5.6.4 (abort with ^G) 1> erlang:nodes({wrong,0,argument}). [Switching to Thread 47984520497888 (LWP 20163)] Breakpoint 1, nodes_1 (A__p=0x2ba4446a9198, A_1=47984522740722) at beam/dist.c:2069 (gdb) etp 47984522740722 {wrong,0,argument}. (gdb) cont Continuing. ** exception error: bad argument in function nodes/1 called as nodes({wrong,0,argument}) 2> The line: (gdb) etp 47984522740722 is what you want. The number is really an Erlang term in this case a tagged pointer to the tuple header word on the heap. (gdb) x/4xg 47984522740722 & ~3 0x2ba4446ec3f0: 0x00000000000000c0 0x000000000004e2cb 0x2ba4446ec400: 0x000000000000000f 0x000000000004e34b (gdb) etp 0x000000000004e2cb wrong. (gdb) etp 0x000000000000000f 0. (gdb) etp 0x000000000004e34b argument. (gdb) Try also etp-help, and read the source if you dare. Have fun! > > -- > wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From ulf.wiger@REDACTED Mon Sep 1 12:37:22 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Mon, 01 Sep 2008 12:37:22 +0200 Subject: [erlang-questions] Learning OTP - Application, Supervisor, FSM, Server In-Reply-To: <900327.18283.qm@web31607.mail.mud.yahoo.com> References: <900327.18283.qm@web31607.mail.mud.yahoo.com> Message-ID: <48BBC5E2.60907@ericsson.com> Jeff Crane skrev: > My chat_server.erl is a gen_server, and I think that if > someone can explain this last bit of the child > specification, I might understand why I'm getting > this at runtime (startup): > =INFO REPORT==== 1-Sep-2008::00:39:12 === application: tcp_server > exited: {shutdown,{tcp_server_app,start,[normal,[]]}} type: temporary > {error,{shutdown,{tcp_server_app,start,[normal,[]]}}} > > Apologies for the inability to read specs, but I just don't > understand.> That particular error message is one of the most annoying messages produced by Erlang/OTP IMHO. It really doesn't tell you anything except which application failed to start. I believe it's due to an error caught in supervisor:do_start_child(). The error reason isn't propagated, but if you want to see it, you should make sure that the 'sasl' application is started. That should give you an error report from the supervisor, telling you what went wrong. So instead of just typing application:start(tcp_server), try: application:start(sasl). application:start(tcp_server). (or start erlang with erl -boot start_sasl) > % No idea what this bad boy is for. > [tcp_listener] It's for in-service upgrade. It tells the release handler that the process in question needs to be suspended before new versions of the modules in the list are loaded into the system. The release handler gets this info by querying the supervisors during execution of an upgrade script. It has no bearing on your current problem. BR, Ulf W > This code is modified from: > http://www.trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles > > > -module(tcp_server_app). > -author('saleyn@REDACTED'). > > -behaviour(application). > > %% Internal API > -export([start_client/0]). > > %% Application and Supervisor callbacks > -export([start/2, stop/1, init/1]). > > -define(MAX_RESTART, 5). > -define(MAX_TIME, 60). > -define(DEF_PORT, 6123). > > %% A startup function for spawning new client connection handling FSM. > %% To be called by the TCP listener process. > start_client() -> > supervisor:start_child(tcp_client_sup, []). > > %%---------------------------------------------------------------------- > %% Application behaviour callbacks > %%---------------------------------------------------------------------- > start(_Type, _Args) -> > ListenPort = get_app_env(listen_port, ?DEF_PORT), > supervisor:start_link({local, ?MODULE}, ?MODULE, [ListenPort, prechat_fsm]). > > stop(_S) -> > ok. > > %%---------------------------------------------------------------------- > %% Supervisor behaviour callbacks > %%---------------------------------------------------------------------- > init([Port, Module]) -> > {ok, > { > _SupFlags = {one_for_one, ?MAX_RESTART, ?MAX_TIME}, > [ > % TCP Listener > { > tcp_server_sup, % Id = internal id > {tcp_listener,start_link,[Port,Module]}, % StartFun = {M, F, A} > permanent, % Restart = permanent | transient | temporary > 2000, % Shutdown = brutal_kill | int() >= 0 | infinity > worker, % Type = worker | supervisor > [tcp_listener] % Modules = [Module] | dynamic > }, > % Client instance supervisor > { > tcp_client_sup, % Id = internal id > {supervisor,start_link,[{local, tcp_client_sup}, ?MODULE, [Module]]}, % StartFun = {M, F, A} > permanent, % Restart = permanent | transient | temporary > infinity, % Shutdown = brutal_kill | int() >= 0 | infinity > supervisor, % Type = worker | supervisor > [] % Modules = [Module] | dynamic > }, > % Chat Server instance > { > chat_server_sup, % Id = internal id > {chat_server,start_link, []}, % StartFun = {M, F, A} > permanent, % Restart = permanent | transient | temporary > 2000, % Shutdown = brutal_kill | int() >= 0 | infinity > worker, % Type = worker | supervisor > [chat_server] % Modules = [Module] | dynamic > } > ] > } > }; > > init([Module]) -> > {ok, > { > _SupFlags = {simple_one_for_one, ?MAX_RESTART, ?MAX_TIME}, > [ > % TCP Client > { > undefined, % Id = internal id > {Module,start_link,[]}, % StartFun = {M, F, A} > temporary, % Restart = permanent | transient | temporary > 2000, % Shutdown = brutal_kill | int() >= 0 | infinity > worker, % Type = worker | supervisor > [] % Modules = [Module] | dynamic > } > ] > } > }. > > %%---------------------------------------------------------------------- > %% Internal functions > %%---------------------------------------------------------------------- > get_app_env(Opt, Default) -> > case application:get_env(application:get_application(), Opt) of > {ok, Val} -> > Val; > _ -> > case init:get_argument(Opt) of > [[Val | _]] -> > Val; > error -> > Default > end > end. > > > This doesn't run, but what's worse is that I don't understand why. Let me walk through what I think I know. > > In shell, I type: > application:start(tcp_server). > > The OTP framework looks for and at the .app file for the argument specified. > It sees tcp_server.app and finds the line: > {mod, {tcp_server_app, []}}, > > This tells what args (happen to be [] in this case) to send the module tcp_server_app and the Type defaults to the atom "normal" somehow. start is always the default initial function according to the OTP framework. > > Putting this altogether, we get the initial function call of: > tcp_server_app:start(normal,[]) > > Next it pulls the ListenPort out of the define directives. > > According to what I've observed, behaviours are equivalent to java interfaces. Unlike java interfaces, you don't need to declare that you implement the interface for another module to call them, another module will simply do a "blind" call, assuming it's there. tcp_server_app implements both application and supervisor behaviours, even though it only declares 1 of them (application). The supervisor behaviour allows the supervisor module to start up a supervisor node via an init/1 fun. The following line: > supervisor:start_link({local, ?MODULE}, ?MODULE, [ListenPort, prechat_fsm]), > > ...says, spawn module tcp_server_app, function init/1, register the process locally as tcp_server_app, passing the args [ListenPort, prechat_fsm] to the init/1. This results in a spawned process: > tcp_server_app:init([ListenPort, prechat_fsm]) > > The first init([Port,Module]) matches so it is used. > Next, I had no idea what was going on: > {ok,{_SupFlags,[Arg1,Arg2]}}; > until I ran into: > http://www.erlang.org/doc/design_principles/part_frame.html (look for child specifications) > > % Child specification consists of... > Arg = > { > % unique c.spec identifier > tcp_server_sup, > > % spawn a process of tcp_listener:init([Port,Module]), > {tcp_listener,start_link,[Port,Module]}, > > % Restart always > permanent, > > % How long to die after getting a "die" message from supervisor > 2000, > > % Is this child a sub-supervisor, otherwise: worker > worker, > > % No idea what this bad boy is for. > [tcp_listener] > > } > > My chat_server.erl is a gen_server, and I think that if someone can explain this last bit of the child specification, I might understand why I'm getting this at runtime (startup): > =INFO REPORT==== 1-Sep-2008::00:39:12 === application: tcp_server > exited: {shutdown,{tcp_server_app,start,[normal,[]]}} type: temporary > {error,{shutdown,{tcp_server_app,start,[normal,[]]}}} > > Apologies for the inability to read specs, but I just don't > understand. > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From saleyn@REDACTED Mon Sep 1 14:38:28 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Mon, 01 Sep 2008 08:38:28 -0400 Subject: [erlang-questions] Learning OTP - Application, Supervisor, FSM, Server In-Reply-To: <900327.18283.qm@web31607.mail.mud.yahoo.com> References: <900327.18283.qm@web31607.mail.mud.yahoo.com> Message-ID: <48BBE244.9030208@gmail.com> In your supervision tree you added one more child specification: % TCP Listener % Client instance supervisor % Chat Server instance <---- With the addition of this chat server the supervisor will attempt to start chat_server instance immediately and prechat_fsm lazily (when a client socket connection is detected, since it's a simple_one_for_one supervisor). I suspect there's a problem in your chat_server.erl's init/1 function, which errors out and prevents the supervisor from starting up. After enabling SASL (as Ulf suggested) try to start that server instance on it's own just to make sure it's not crashing immediately: chat_server:start_link(...). Can't say anything more specific without looking at code. Serge Jeff Crane wrote: > This code is modified from: > http://www.trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles > > > -module(tcp_server_app). > -author('saleyn@REDACTED'). > > -behaviour(application). > > %% Internal API > -export([start_client/0]). > > %% Application and Supervisor callbacks > -export([start/2, stop/1, init/1]). > > -define(MAX_RESTART, 5). > -define(MAX_TIME, 60). > -define(DEF_PORT, 6123). > > %% A startup function for spawning new client connection handling FSM. > %% To be called by the TCP listener process. > start_client() -> > supervisor:start_child(tcp_client_sup, []). > > %%---------------------------------------------------------------------- > %% Application behaviour callbacks > %%---------------------------------------------------------------------- > start(_Type, _Args) -> > ListenPort = get_app_env(listen_port, ?DEF_PORT), > supervisor:start_link({local, ?MODULE}, ?MODULE, [ListenPort, prechat_fsm]). > > stop(_S) -> > ok. > > %%---------------------------------------------------------------------- > %% Supervisor behaviour callbacks > %%---------------------------------------------------------------------- > init([Port, Module]) -> > {ok, > { > _SupFlags = {one_for_one, ?MAX_RESTART, ?MAX_TIME}, > [ > % TCP Listener > { > tcp_server_sup, % Id = internal id > {tcp_listener,start_link,[Port,Module]}, % StartFun = {M, F, A} > permanent, % Restart = permanent | transient | temporary > 2000, % Shutdown = brutal_kill | int() >= 0 | infinity > worker, % Type = worker | supervisor > [tcp_listener] % Modules = [Module] | dynamic > }, > % Client instance supervisor > { > tcp_client_sup, % Id = internal id > {supervisor,start_link,[{local, tcp_client_sup}, ?MODULE, [Module]]}, % StartFun = {M, F, A} > permanent, % Restart = permanent | transient | temporary > infinity, % Shutdown = brutal_kill | int() >= 0 | infinity > supervisor, % Type = worker | supervisor > [] % Modules = [Module] | dynamic > }, > % Chat Server instance > { > chat_server_sup, % Id = internal id > {chat_server,start_link, []}, % StartFun = {M, F, A} > permanent, % Restart = permanent | transient | temporary > 2000, % Shutdown = brutal_kill | int() >= 0 | infinity > worker, % Type = worker | supervisor > [chat_server] % Modules = [Module] | dynamic > } > ] > } > }; > > init([Module]) -> > {ok, > { > _SupFlags = {simple_one_for_one, ?MAX_RESTART, ?MAX_TIME}, > [ > % TCP Client > { > undefined, % Id = internal id > {Module,start_link,[]}, % StartFun = {M, F, A} > temporary, % Restart = permanent | transient | temporary > 2000, % Shutdown = brutal_kill | int() >= 0 | infinity > worker, % Type = worker | supervisor > [] % Modules = [Module] | dynamic > } > ] > } > }. > > %%---------------------------------------------------------------------- > %% Internal functions > %%---------------------------------------------------------------------- > get_app_env(Opt, Default) -> > case application:get_env(application:get_application(), Opt) of > {ok, Val} -> > Val; > _ -> > case init:get_argument(Opt) of > [[Val | _]] -> > Val; > error -> > Default > end > end. > > > This doesn't run, but what's worse is that I don't understand why. Let me walk through what I think I know. > > In shell, I type: > application:start(tcp_server). > > The OTP framework looks for and at the .app file for the argument specified. > It sees tcp_server.app and finds the line: > {mod, {tcp_server_app, []}}, > > This tells what args (happen to be [] in this case) to send the module tcp_server_app and the Type defaults to the atom "normal" somehow. start is always the default initial function according to the OTP framework. > > Putting this altogether, we get the initial function call of: > tcp_server_app:start(normal,[]) > > Next it pulls the ListenPort out of the define directives. > > According to what I've observed, behaviours are equivalent to java interfaces. Unlike java interfaces, you don't need to declare that you implement the interface for another module to call them, another module will simply do a "blind" call, assuming it's there. tcp_server_app implements both application and supervisor behaviours, even though it only declares 1 of them (application). The supervisor behaviour allows the supervisor module to start up a supervisor node via an init/1 fun. The following line: > supervisor:start_link({local, ?MODULE}, ?MODULE, [ListenPort, prechat_fsm]), > > ...says, spawn module tcp_server_app, function init/1, register the process locally as tcp_server_app, passing the args [ListenPort, prechat_fsm] to the init/1. This results in a spawned process: > tcp_server_app:init([ListenPort, prechat_fsm]) > > The first init([Port,Module]) matches so it is used. > Next, I had no idea what was going on: > {ok,{_SupFlags,[Arg1,Arg2]}}; > until I ran into: > http://www.erlang.org/doc/design_principles/part_frame.html (look for child specifications) > > % Child specification consists of... > Arg = > { > % unique c.spec identifier > tcp_server_sup, > > % spawn a process of tcp_listener:init([Port,Module]), > {tcp_listener,start_link,[Port,Module]}, > > % Restart always > permanent, > > % How long to die after getting a "die" message from supervisor > 2000, > > % Is this child a sub-supervisor, otherwise: worker > worker, > > % No idea what this bad boy is for. > [tcp_listener] > > } > > My chat_server.erl is a gen_server, and I think that if someone can explain this last bit of the child specification, I might understand why I'm getting this at runtime (startup): > =INFO REPORT==== 1-Sep-2008::00:39:12 === > application: tcp_server > exited: {shutdown,{tcp_server_app,start,[normal,[]]}} > type: temporary > {error,{shutdown,{tcp_server_app,start,[normal,[]]}}} > > Apologies for the inability to read specs, but I just don't understand. > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From phvander@REDACTED Mon Sep 1 16:30:33 2008 From: phvander@REDACTED (philippe vanderstraeten) Date: Mon, 1 Sep 2008 16:30:33 +0200 Subject: [erlang-questions] make error on Erlang otp_src_R12B-3 Message-ID: <12d458770809010730x79a2b8b7r2cf79d9d65203ac4@mail.gmail.com> I am trying to compile/link Erlang on Red Hat Enterprise Linux Client release 5.2 (Tikanga) I got this error (I do not put all the lines just some after the gcc call) gcc -g -O2 -I/home/pvander/neededpackages/otp_src_R12B-3/erts/i686-pc-linux-gnu -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -o ../priv/bin/i686-pc-linux-gnu/ssl_esock ../priv/obj/i686-pc-linux-gnu/esock.o ../priv/obj/i686-pc-linux-gnu/debuglog.o ../priv/obj/i686-pc-linux-gnu/esock_poll.o ../priv/obj/i686-pc-linux-gnu/esock_osio.o ../priv/obj/i686-pc-linux-gnu/esock_utils.o ../priv/obj/i686-pc-linux-gnu/esock_posix_str.o ../priv/obj/i686-pc-linux-gnu/esock_openssl.o -lutil -ldl -lm /usr/lib/libssl.a /usr/lib/libcrypto.a /usr/lib/libkrb5.a /usr/lib/libkrb5support.a /usr/lib/libk5crypto.a /usr/lib/libresolv.a /usr/lib/libcom_err.a /usr/lib/libz.a /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_next_cred': (.text+0x738): undefined reference to `keyctl_read_alloc' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_get_principal': (.text+0xf2b): undefined reference to `keyctl_read_alloc' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_getkeycount': (.text+0x1196): undefined reference to `keyctl_read' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_clearcache': (.text+0x1237): undefined reference to `keyctl_clear' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_clearcache': (.text+0x1269): undefined reference to `keyctl_clear' ..... .... more lines likes above Thanks for your help -------------- next part -------------- An HTML attachment was scrubbed... URL: From tuncer.ayaz@REDACTED Mon Sep 1 18:23:32 2008 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Mon, 1 Sep 2008 18:23:32 +0200 Subject: [erlang-questions] make error on Erlang otp_src_R12B-3 In-Reply-To: <12d458770809010730x79a2b8b7r2cf79d9d65203ac4@mail.gmail.com> References: <12d458770809010730x79a2b8b7r2cf79d9d65203ac4@mail.gmail.com> Message-ID: <4ac8254d0809010923y4886ade6u5e773ccff4e78bd8@mail.gmail.com> 2008/9/1 philippe vanderstraeten > > I am trying to compile/link Erlang on Red Hat Enterprise Linux Client release 5.2 (Tikanga) > I got this error (I do not put all the lines just some after the gcc call) Hi Philippe, this has been discussed twice recently: http://www.erlang.org/pipermail/erlang-questions/2008-July/036345.html http://www.erlang.org/pipermail/erlang-questions/2008-August/037206.html Hope that helps. From eranga.erl@REDACTED Mon Sep 1 18:51:58 2008 From: eranga.erl@REDACTED (Eranga Udesh) Date: Mon, 1 Sep 2008 22:21:58 +0530 Subject: [erlang-questions] Erl getting stuck in SMP with 8 cores In-Reply-To: References: <912a3c160808311222uec8bed1qd63f5f594465769e@mail.gmail.com> <6c2563b20808311308u4db39997jae41c107195c449c@mail.gmail.com> <912a3c160808311941l37cda5c7pc116fb250c02b607@mail.gmail.com> Message-ID: <912a3c160809010951x7abbdd2bna67b301fa3bd61bc@mail.gmail.com> Good to know that Erl works successfully wh 8 or more intel cores. Do you use 8 schedulers with threads/hipe enabled? I run below test:run/0 to output time every sec. But even that's getting stuck when the Erl node is experiencing this issue. -module(test). -compile(export_all). run() -> spawn(?MODULE, run2, [1]), run2(2). run2(Id) -> io:fwrite("Tick [~p]: ~p~n", [Id, time()]), timer:sleep(1000), run2(Id). On Mon, Sep 1, 2008 at 9:15 AM, Dave Smith wrote: > 2008/8/31 Eranga Udesh : > > Like I said earlier, the Erl node is not totall stucked. Single RPC > commands > > work but recursive functions getting stuck. Running processes halts and > > "Reductions" don't increase. The Erl prompt is not responding when doing > > "to_erl" > > If you or anyboby run or tested Erlang with 8 or more Intel cores, pls > let > > me know. I want to first narrow down the problem to identify if it's a > > problem only in my instalation or an Erl smp problem. If it's the > > former,much releaved. > > FWIW, I use 8+ cores with hundreds of thousands of processes on Erlang > SMP on a daily basis and have not seen any of the problems you've > described. Do you have a minimal set of code that produces these > symptoms? > > D. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Mon Sep 1 19:09:06 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 01 Sep 2008 20:09:06 +0300 Subject: [erlang-questions] Erl getting stuck in SMP with 8 cores In-Reply-To: <912a3c160809010951x7abbdd2bna67b301fa3bd61bc@mail.gmail.com> References: <912a3c160808311222uec8bed1qd63f5f594465769e@mail.gmail.com> <6c2563b20808311308u4db39997jae41c107195c449c@mail.gmail.com> <912a3c160808311941l37cda5c7pc116fb250c02b607@mail.gmail.com> <912a3c160809010951x7abbdd2bna67b301fa3bd61bc@mail.gmail.com> Message-ID: <48BC21B2.7050900@cs.ntua.gr> Eranga Udesh wrote: > Good to know that Erl works successfully wh 8 or more intel cores. Do > you use 8 schedulers with threads/hipe enabled? I've routinely used Erlang with SMP & HiPE (in fact running native code) with both 8 and 16 x86_64 cores for more than 6 months now without any problems. No threads enabled though. The 'application' is running the native code compiler & dialyzer in parallel with as many schedulers as cores in the machine. Kostis From xbmodder@REDACTED Mon Sep 1 20:57:16 2008 From: xbmodder@REDACTED (Sargun Dhillon) Date: Mon, 1 Sep 2008 11:57:16 -0700 Subject: [erlang-questions] Erl getting stuck in SMP with 8 cores In-Reply-To: <48BC21B2.7050900@cs.ntua.gr> References: <912a3c160808311222uec8bed1qd63f5f594465769e@mail.gmail.com> <6c2563b20808311308u4db39997jae41c107195c449c@mail.gmail.com> <912a3c160808311941l37cda5c7pc116fb250c02b607@mail.gmail.com> <912a3c160809010951x7abbdd2bna67b301fa3bd61bc@mail.gmail.com> <48BC21B2.7050900@cs.ntua.gr> Message-ID: <7c9d57ea0809011157t43ec70d0pd6958eab118bd6e4@mail.gmail.com> This sounds almost like a hardware/kernel issue. I've run erlang on 8-CPU machines (32 & 64) without any "thread jamming." I was using yaws & my own erlang code, both of which use recursive functions. The difference was that I was running it under a fairly optimized Gentoo system, and not CentOS. If you enable core dumps, do you get anything from beam? When it locks up try SIGSEVC and get a core dump to analyze. You can try (l/s)trace also in order to find system calls which can be crashing on your box. On Mon, Sep 1, 2008 at 10:09 AM, Kostis Sagonas wrote: > Eranga Udesh wrote: >> Good to know that Erl works successfully wh 8 or more intel cores. Do >> you use 8 schedulers with threads/hipe enabled? > > I've routinely used Erlang with SMP & HiPE (in fact running native code) > with both 8 and 16 x86_64 cores for more than 6 months now without any > problems. No threads enabled though. > > The 'application' is running the native code compiler & dialyzer in > parallel with as many schedulers as cores in the machine. > > Kostis > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From jefcrane@REDACTED Mon Sep 1 22:14:11 2008 From: jefcrane@REDACTED (Jeff Crane) Date: Mon, 1 Sep 2008 13:14:11 -0700 (PDT) Subject: [erlang-questions] Learning OTP - Application, Supervisor, FSM, Server In-Reply-To: <48BBC5E2.60907@ericsson.com> Message-ID: <387103.2860.qm@web31603.mail.mud.yahoo.com> The chat_server source follows: -module(chat_server). -import(lists, [delete/2,foreach/2,map/2,member/2,reverse/2]). -behaviour(gen_server). -export([start_link/0]). -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). init([]) -> process_flag(trap_exit, true), server_loop([]). %% This chat_server routes and SENDS these messages to chat_channel modules %% Message Formats: %% {join, Connection, Nick} %% {Connection, {chat, Nick, Msg}} %% {Connection, {whisper, Nick, TargetNick, Msg}} %% {Connection, {emote, Nick, Msg}} %% {Connection, {part}} %% {Connection, {quit}} server_loop(ChanList) -> receive {client, Connection, {Type, Args}} -> case Type of join -> {Nick,Channel,Args} = list_to_tuple(Args), case lookupChannel(Channel, ChanList) of {ok, Pid, _UserList} -> Pid ! {join, Connection, Nick}; channel_full -> io:format("Chat Server received Join for Channel:~p at Capacity.~n",[Channel]), self() ! {client, Connection, {join,[Nick|[Channel++"-"]]}}; channel_not_found -> % Create a new channel Pid = spawn_link(fun() -> chat_channel:start(Connection, Nick, Channel) end), server_loop([{Channel,Pid,{[{Nick,Connection}]}}|ChanList]); Any -> io:format("lookupChannel:join received unexpected case:~p~n",[Any]) end; chat -> {Nick,Channel,Msg,Args} = list_to_tuple(Args), case lookupChannel(Channel,ChanList) of {ok, Pid} -> Pid ! {Connection, {chat, Nick, Msg}}; channel_not_found -> self() ! {client, Connection, {join,[Nick|[Channel]]}}, self() ! {client, Connection, {chat,Args}}; Any -> io:format("lookupChannel:chat received unexpected case:~p~n",[Any]) end; whisper -> {Nick,TargetNick,Msg,Args} = list_to_tuple(Args), case lookupNickInChannel(Nick,ChanList) of {ok, Pid} -> Pid ! {Connection, {whisper, Nick, TargetNick, Msg}}; user_cannot_be_found -> send(Connection,{whisper_target_not_found, TargetNick}); Any -> io:format("lookupNickInChannel:whisper received unexpected case:~p~n",[Any]) end; emote -> {Nick,Channel,Msg,Args} = list_to_tuple(Args), case lookupChannel(Channel,ChanList) of {ok, Pid} -> Pid ! {Connection, {emote, Nick, Msg}}; channel_not_found -> self() ! {client, Connection, {join,[Nick|[Channel]]}}, self() ! {client, Connection, {emote,[Nick,Channel|[Msg]]}}; Any -> io:format("lookupChannel:emote received unexpected case:~p~n",[Any]) end; part -> % find connection return a channel UserChanList = lookupConnectionInChannel(Connection,ChanList,[]), case length(UserChanList) > 1 of {ok,Pid} -> % send message to channel Pid ! {Connection,{part}}; _Any -> send(Connection, {denied_part, "To leave this channel, you must quit."}), io:format("lookupConnectionInChannel:quit could not find a Connection that was supposed to be dropped~n",[]) end; quit -> % find connection return a channel case lookupConnectionInChannel(Connection,ChanList,[]) of {ok,Pid} -> Pid ! {Connection,{quit}}; _Any -> io:format("lookupConnectionInChannel:quit could not find a Connection that was supposed to be dropped~n",[]) end end, server_loop([ChanList]); {client_closed, _Connection, _Why} -> server_loop(ChanList); {channel_empty, Pid} -> ChanList1 = remove_channel(Pid,ChanList), server_loop(ChanList1); Msg -> io:format("Chat Server received unexpected Msg=~p~n",[Msg]), server_loop(ChanList) end. % If Channel matched the head term in the list, return {ok, Pid, UserList} if not full. lookupChannel(Channel,[{Channel,Pid,UserList}|_]) -> case UserList > 50 of true -> channel_full; false -> {ok,Pid} end; % If Channel does not match the head term in the list, go to next chunk lookupChannel(Channel,[_|ChanList]) -> lookupChannel(Channel,ChanList); % If lookup is called on an empty list, regardless of the pattern to match, return error lookupChannel(_,[]) -> channel_not_found. remove_channel(Pid,[{G,Pid,_UserList}|T]) -> io:format("~p removed~n",[G]), T; remove_channel(Pid,[H|T]) -> [H|remove_channel(Pid,T)]; remove_channel(_,[]) -> []. % If Nick matched the head term in the list, return {ok, Pid, UserList} lookupNickInChannel(Nick,[{Channel,Pid,UserList}|T]) -> case lookupNick(Nick, UserList) of nick_found -> {ok,Pid,Channel}; % If Nick is not in the head term in the list, go to next chunk (what's left is called the Tail or T) nick_not_found -> lookupNickInChannel(Nick,T) end; % If lookup is called on an empty list, regardless of the pattern to match, return error lookupNickInChannel(_,[]) -> user_cannot_be_found. lookupNick(Nick,[{Nick,_Connection}|_UserList]) -> nick_found; lookupNick(Nick,[_|UserList]) -> lookupNick(Nick,UserList); lookupNick(_,[]) -> nick_not_found. % If Connection matched the head term in the list, return {ok, Pid, UserList} lookupConnectionInChannel(Connection,[{_Channel,Pid,UserList}|T],UserChannelPids) -> case lookupConnection(Connection, UserList) of % If Connection is in the head term in the list, add to aggregate and go to next chunk (what's left is called the Tail or T) connection_found -> lookupConnectionInChannel(Connection,T,[Pid|UserChannelPids]); % If Connection is not in the head term in the list, go to next chunk (what's left is called the Tail or T) connection_not_found -> lookupConnectionInChannel(Connection,T,UserChannelPids) end; % If lookup is called on an empty list, regardless of the pattern to match, return error lookupConnectionInChannel(_,[],UserChannelPids) -> UserChannelPids. lookupConnection(Connection,[{_Nick,Connection}|_UserList]) -> connection_found; lookupConnection(Connection,[_|UserList]) -> lookupNick(Connection,UserList); lookupConnection(_,[]) -> connection_not_found. send(_Connection, _OutgoingMessage) -> ok. %%------------------------------------------------------------------------- %% @spec (Request, From, State) -> {reply, Reply, State} | %% {reply, Reply, State, Timeout} | %% {noreply, State} | %% {noreply, State, Timeout} | %% {stop, Reason, Reply, State} | %% {stop, Reason, State} %% @doc Callback for synchronous server calls. If `{stop, ...}' tuple %% is returned, the server is stopped and `terminate/2' is called. %% @end %% @private %%------------------------------------------------------------------------- handle_call(Request, _From, State) -> {stop, {unknown_call, Request}, State}. %%------------------------------------------------------------------------- %% @spec (Msg, State) ->{noreply, State} | %% {noreply, State, Timeout} | %% {stop, Reason, State} %% @doc Callback for asyncrous server calls. If `{stop, ...}' tuple %% is returned, the server is stopped and `terminate/2' is called. %% @end %% @private %%------------------------------------------------------------------------- handle_cast(_Msg, State) -> {noreply, State}. %%------------------------------------------------------------------------- %% @spec (Reason, State) -> any %% @doc Callback executed on server shutdown. It is only invoked if %% `process_flag(trap_exit, true)' is set by the server process. %% The return value is ignored. %% @end %% @private %%------------------------------------------------------------------------- terminate(Reason, State) -> io:format("Terminated~nReason:~p~nState:~p~n",[Reason,State]), ok. %%------------------------------------------------------------------------- %% @spec (OldVsn, State, Extra) -> {ok, NewState} %% @doc Convert process state when code is changed. %% @end %% @private %%------------------------------------------------------------------------- code_change(_OldVsn, State, _Extra) -> {ok, State}. handle_info(_Info, State) -> {noreply, State}. The problem was that I had no start_link method at all. After adding it, the application just hangs. Normally I would see the supervisor tree in appmon, but currently it doesn't appear and I only have access to the sub-console (cntrl-g) until I kill the job. Trying to connect to the tcp_server results in a crash that I don't understand. =ERROR REPORT==== 1-Sep-2008::13:08:01 === ** Generic server tcp_listener terminating ** Last message in was {inet_async,#Port<0.127>,1,{ok,#Port<0.140>}} ** When Server state == {state,#Port<0.127>,1,prechat_fsm} ** Reason for termination == ** {{badmatch, {error, {undef, [{tcp_server_app,start_chat_server,[]}, {prechat_fsm,init,1}, {gen_fsm,init_it,6}, {proc_lib,init_p,5}]}}}, [{tcp_listener,handle_info,2}, {gen_server,handle_msg,5}, {proc_lib,init_p,5}]} --- On Mon, 9/1/08, Ulf Wiger (TN/EAB) wrote: > From: Ulf Wiger (TN/EAB) > Subject: Re: [erlang-questions] Learning OTP - Application, Supervisor, FSM, Server > To: jefcrane@REDACTED > Cc: erlang-questions@REDACTED > Date: Monday, September 1, 2008, 3:37 AM > Jeff Crane skrev: > > > My chat_server.erl is a gen_server, and I think that > if > > someone can explain this last bit of the child > > specification, I might understand why I'm getting > > this at runtime (startup): > > =INFO REPORT==== 1-Sep-2008::00:39:12 === > application: tcp_server > > exited: {shutdown,{tcp_server_app,start,[normal,[]]}} > type: temporary > > > {error,{shutdown,{tcp_server_app,start,[normal,[]]}}} > > > > Apologies for the inability to read specs, but I just > don't > > understand.> > > That particular error message is one of the most annoying > messages produced by Erlang/OTP IMHO. It really doesn't > tell you anything except which application failed to start. > > I believe it's due to an error caught in > supervisor:do_start_child(). The error reason isn't > propagated, > but if you want to see it, you should make sure that the > 'sasl' > application is started. That should give you an error > report > from the supervisor, telling you what went wrong. > > So instead of just typing application:start(tcp_server), > try: > > application:start(sasl). > application:start(tcp_server). > > (or start erlang with erl -boot start_sasl) From ulf.wiger@REDACTED Mon Sep 1 23:27:04 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Mon, 01 Sep 2008 23:27:04 +0200 Subject: [erlang-questions] Learning OTP - Application, Supervisor, FSM, Server In-Reply-To: <387103.2860.qm@web31603.mail.mud.yahoo.com> References: <387103.2860.qm@web31603.mail.mud.yahoo.com> Message-ID: <48BC5E28.7060903@ericsson.com> This code doesn't follow the guidelines for generic servers. The easiest way to fix this is probably to: - remove the -behaviour(gen_server). - change the start_link/0 function to start_link() -> proc_lib:spawn_link( fun() -> process_flag(trap_exit, true), server_loop([]) end). I haven't really checked the rest of the code, but I did see one fishy line in server_loop/1: > server_loop([ChanList]); I assume that you intended to add an item to the list? BR, Ulf W Jeff Crane skrev: > The chat_server source follows: > > -module(chat_server). > -import(lists, [delete/2,foreach/2,map/2,member/2,reverse/2]). > > -behaviour(gen_server). > > -export([start_link/0]). > > -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, > code_change/3]). > > start_link() -> > gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). > > init([]) -> > process_flag(trap_exit, true), > server_loop([]). > > %% This chat_server routes and SENDS these messages to chat_channel modules > %% Message Formats: > %% {join, Connection, Nick} > %% {Connection, {chat, Nick, Msg}} > %% {Connection, {whisper, Nick, TargetNick, Msg}} > %% {Connection, {emote, Nick, Msg}} > %% {Connection, {part}} > %% {Connection, {quit}} > > server_loop(ChanList) -> > receive > {client, Connection, {Type, Args}} -> > case Type of > join -> > {Nick,Channel,Args} = list_to_tuple(Args), > case lookupChannel(Channel, ChanList) of > {ok, Pid, _UserList} -> > Pid ! {join, Connection, Nick}; > channel_full -> > io:format("Chat Server received Join for Channel:~p at Capacity.~n",[Channel]), > self() ! {client, Connection, {join,[Nick|[Channel++"-"]]}}; > channel_not_found -> > % Create a new channel > Pid = spawn_link(fun() -> chat_channel:start(Connection, Nick, Channel) end), > server_loop([{Channel,Pid,{[{Nick,Connection}]}}|ChanList]); > Any -> > io:format("lookupChannel:join received unexpected case:~p~n",[Any]) > end; > chat -> > {Nick,Channel,Msg,Args} = list_to_tuple(Args), > case lookupChannel(Channel,ChanList) of > {ok, Pid} -> > Pid ! {Connection, {chat, Nick, Msg}}; > channel_not_found -> > self() ! {client, Connection, {join,[Nick|[Channel]]}}, > self() ! {client, Connection, {chat,Args}}; > Any -> > io:format("lookupChannel:chat received unexpected case:~p~n",[Any]) > end; > whisper -> > {Nick,TargetNick,Msg,Args} = list_to_tuple(Args), > case lookupNickInChannel(Nick,ChanList) of > {ok, Pid} -> > Pid ! {Connection, {whisper, Nick, TargetNick, Msg}}; > user_cannot_be_found -> > send(Connection,{whisper_target_not_found, TargetNick}); > Any -> > io:format("lookupNickInChannel:whisper received unexpected case:~p~n",[Any]) > end; > emote -> > {Nick,Channel,Msg,Args} = list_to_tuple(Args), > case lookupChannel(Channel,ChanList) of > {ok, Pid} -> > Pid ! {Connection, {emote, Nick, Msg}}; > channel_not_found -> > self() ! {client, Connection, {join,[Nick|[Channel]]}}, > self() ! {client, Connection, {emote,[Nick,Channel|[Msg]]}}; > Any -> > io:format("lookupChannel:emote received unexpected case:~p~n",[Any]) > end; > part -> > % find connection return a channel > UserChanList = lookupConnectionInChannel(Connection,ChanList,[]), > case length(UserChanList) > 1 of > {ok,Pid} -> > % send message to channel > Pid ! {Connection,{part}}; > _Any -> > send(Connection, {denied_part, "To leave this channel, you must quit."}), > io:format("lookupConnectionInChannel:quit could not find a Connection that was supposed to be dropped~n",[]) > end; > quit -> > % find connection return a channel > case lookupConnectionInChannel(Connection,ChanList,[]) of > {ok,Pid} -> > Pid ! {Connection,{quit}}; > _Any -> > io:format("lookupConnectionInChannel:quit could not find a Connection that was supposed to be dropped~n",[]) > end > end, > server_loop([ChanList]); > > {client_closed, _Connection, _Why} -> > server_loop(ChanList); > > {channel_empty, Pid} -> > ChanList1 = remove_channel(Pid,ChanList), > server_loop(ChanList1); > > Msg -> > io:format("Chat Server received unexpected Msg=~p~n",[Msg]), > server_loop(ChanList) > end. > > % If Channel matched the head term in the list, return {ok, Pid, UserList} if not full. > lookupChannel(Channel,[{Channel,Pid,UserList}|_]) -> > case UserList > 50 of > true -> > channel_full; > false -> > {ok,Pid} > end; > % If Channel does not match the head term in the list, go to next chunk > lookupChannel(Channel,[_|ChanList]) -> > lookupChannel(Channel,ChanList); > % If lookup is called on an empty list, regardless of the pattern to match, return error > lookupChannel(_,[]) -> > channel_not_found. > > remove_channel(Pid,[{G,Pid,_UserList}|T]) -> > io:format("~p removed~n",[G]), > T; > remove_channel(Pid,[H|T]) -> > [H|remove_channel(Pid,T)]; > remove_channel(_,[]) -> > []. > > % If Nick matched the head term in the list, return {ok, Pid, UserList} > lookupNickInChannel(Nick,[{Channel,Pid,UserList}|T]) -> > case lookupNick(Nick, UserList) of > nick_found -> > {ok,Pid,Channel}; > % If Nick is not in the head term in the list, go to next chunk (what's left is called the Tail or T) > nick_not_found -> > lookupNickInChannel(Nick,T) > end; > % If lookup is called on an empty list, regardless of the pattern to match, return error > lookupNickInChannel(_,[]) -> > user_cannot_be_found. > > lookupNick(Nick,[{Nick,_Connection}|_UserList]) -> > nick_found; > lookupNick(Nick,[_|UserList]) -> > lookupNick(Nick,UserList); > lookupNick(_,[]) -> > nick_not_found. > > % If Connection matched the head term in the list, return {ok, Pid, UserList} > lookupConnectionInChannel(Connection,[{_Channel,Pid,UserList}|T],UserChannelPids) -> > case lookupConnection(Connection, UserList) of > % If Connection is in the head term in the list, add to aggregate and go to next chunk (what's left is called the Tail or T) > connection_found -> > lookupConnectionInChannel(Connection,T,[Pid|UserChannelPids]); > % If Connection is not in the head term in the list, go to next chunk (what's left is called the Tail or T) > connection_not_found -> > lookupConnectionInChannel(Connection,T,UserChannelPids) > end; > % If lookup is called on an empty list, regardless of the pattern to match, return error > lookupConnectionInChannel(_,[],UserChannelPids) -> > UserChannelPids. > > lookupConnection(Connection,[{_Nick,Connection}|_UserList]) -> > connection_found; > lookupConnection(Connection,[_|UserList]) -> > lookupNick(Connection,UserList); > lookupConnection(_,[]) -> > connection_not_found. > > send(_Connection, _OutgoingMessage) -> > ok. > > %%------------------------------------------------------------------------- > %% @spec (Request, From, State) -> {reply, Reply, State} | > %% {reply, Reply, State, Timeout} | > %% {noreply, State} | > %% {noreply, State, Timeout} | > %% {stop, Reason, Reply, State} | > %% {stop, Reason, State} > %% @doc Callback for synchronous server calls. If `{stop, ...}' tuple > %% is returned, the server is stopped and `terminate/2' is called. > %% @end > %% @private > %%------------------------------------------------------------------------- > handle_call(Request, _From, State) -> > {stop, {unknown_call, Request}, State}. > > %%------------------------------------------------------------------------- > %% @spec (Msg, State) ->{noreply, State} | > %% {noreply, State, Timeout} | > %% {stop, Reason, State} > %% @doc Callback for asyncrous server calls. If `{stop, ...}' tuple > %% is returned, the server is stopped and `terminate/2' is called. > %% @end > %% @private > %%------------------------------------------------------------------------- > handle_cast(_Msg, State) -> > {noreply, State}. > > %%------------------------------------------------------------------------- > %% @spec (Reason, State) -> any > %% @doc Callback executed on server shutdown. It is only invoked if > %% `process_flag(trap_exit, true)' is set by the server process. > %% The return value is ignored. > %% @end > %% @private > %%------------------------------------------------------------------------- > terminate(Reason, State) -> > io:format("Terminated~nReason:~p~nState:~p~n",[Reason,State]), > ok. > > %%------------------------------------------------------------------------- > %% @spec (OldVsn, State, Extra) -> {ok, NewState} > %% @doc Convert process state when code is changed. > %% @end > %% @private > %%------------------------------------------------------------------------- > code_change(_OldVsn, State, _Extra) -> > {ok, State}. > > handle_info(_Info, State) -> > {noreply, State}. > > > The problem was that I had no start_link method at all. After adding it, the application just hangs. Normally I would see the supervisor tree in appmon, but currently it doesn't appear and I only have access to the sub-console (cntrl-g) until I kill the job. Trying to connect to the tcp_server results in a crash that I don't understand. > > =ERROR REPORT==== 1-Sep-2008::13:08:01 === > ** Generic server tcp_listener terminating > ** Last message in was {inet_async,#Port<0.127>,1,{ok,#Port<0.140>}} > ** When Server state == {state,#Port<0.127>,1,prechat_fsm} > ** Reason for termination == > ** {{badmatch, > {error, > {undef, > [{tcp_server_app,start_chat_server,[]}, > {prechat_fsm,init,1}, > {gen_fsm,init_it,6}, > {proc_lib,init_p,5}]}}}, > [{tcp_listener,handle_info,2}, > {gen_server,handle_msg,5}, > {proc_lib,init_p,5}]} > > --- On Mon, 9/1/08, Ulf Wiger (TN/EAB) wrote: > >> From: Ulf Wiger (TN/EAB) >> Subject: Re: [erlang-questions] Learning OTP - Application, Supervisor, FSM, Server >> To: jefcrane@REDACTED >> Cc: erlang-questions@REDACTED >> Date: Monday, September 1, 2008, 3:37 AM >> Jeff Crane skrev: >> >> > My chat_server.erl is a gen_server, and I think that >> if >> > someone can explain this last bit of the child >> > specification, I might understand why I'm getting >> > this at runtime (startup): >> > =INFO REPORT==== 1-Sep-2008::00:39:12 === >> application: tcp_server >> > exited: {shutdown,{tcp_server_app,start,[normal,[]]}} >> type: temporary >> > >> {error,{shutdown,{tcp_server_app,start,[normal,[]]}}} >> > >> > Apologies for the inability to read specs, but I just >> don't >> > understand.> >> >> That particular error message is one of the most annoying >> messages produced by Erlang/OTP IMHO. It really doesn't >> tell you anything except which application failed to start. >> >> I believe it's due to an error caught in >> supervisor:do_start_child(). The error reason isn't >> propagated, >> but if you want to see it, you should make sure that the >> 'sasl' >> application is started. That should give you an error >> report >> from the supervisor, telling you what went wrong. >> >> So instead of just typing application:start(tcp_server), >> try: >> >> application:start(sasl). >> application:start(tcp_server). >> >> (or start erlang with erl -boot start_sasl) > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From saleyn@REDACTED Mon Sep 1 23:36:27 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Mon, 01 Sep 2008 17:36:27 -0400 Subject: [erlang-questions] Learning OTP - Application, Supervisor, FSM, Server In-Reply-To: <387103.2860.qm@web31603.mail.mud.yahoo.com> References: <387103.2860.qm@web31603.mail.mud.yahoo.com> Message-ID: <48BC605B.2010109@gmail.com> It rightfully hangs. If you read documentation of gen_server more closely, you'll find that the init/1 function is supposed to return: {ok, State} | {stop, Reason}. Your implementation blocks in the receive call without sending any response to the caller, and therefore the caller (i.e. the supervisor) is infinitely blocked. gen_* behaviors' callbacks are not supposed to execute blocking calls or else the entire server instance (not to be confused with the virtual machine) will block and be unable to serve other clients' requests. The error you are getting upon trying to connect a client is because the tcp_server_app:start_chat_server/0 function that's being called by the listener process is not exported or misnamed. Serge Jeff Crane wrote: > The chat_server source follows: > > -module(chat_server). > -import(lists, [delete/2,foreach/2,map/2,member/2,reverse/2]). > > -behaviour(gen_server). > > -export([start_link/0]). > > -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, > code_change/3]). > > start_link() -> > gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). > > init([]) -> > process_flag(trap_exit, true), > server_loop([]). > > %% This chat_server routes and SENDS these messages to chat_channel modules > %% Message Formats: > %% {join, Connection, Nick} > %% {Connection, {chat, Nick, Msg}} > %% {Connection, {whisper, Nick, TargetNick, Msg}} > %% {Connection, {emote, Nick, Msg}} > %% {Connection, {part}} > %% {Connection, {quit}} > > server_loop(ChanList) -> > receive > {client, Connection, {Type, Args}} -> > case Type of > join -> > {Nick,Channel,Args} = list_to_tuple(Args), > case lookupChannel(Channel, ChanList) of > {ok, Pid, _UserList} -> > Pid ! {join, Connection, Nick}; > channel_full -> > io:format("Chat Server received Join for Channel:~p at Capacity.~n",[Channel]), > self() ! {client, Connection, {join,[Nick|[Channel++"-"]]}}; > channel_not_found -> > % Create a new channel > Pid = spawn_link(fun() -> chat_channel:start(Connection, Nick, Channel) end), > server_loop([{Channel,Pid,{[{Nick,Connection}]}}|ChanList]); > Any -> > io:format("lookupChannel:join received unexpected case:~p~n",[Any]) > end; > chat -> > {Nick,Channel,Msg,Args} = list_to_tuple(Args), > case lookupChannel(Channel,ChanList) of > {ok, Pid} -> > Pid ! {Connection, {chat, Nick, Msg}}; > channel_not_found -> > self() ! {client, Connection, {join,[Nick|[Channel]]}}, > self() ! {client, Connection, {chat,Args}}; > Any -> > io:format("lookupChannel:chat received unexpected case:~p~n",[Any]) > end; > whisper -> > {Nick,TargetNick,Msg,Args} = list_to_tuple(Args), > case lookupNickInChannel(Nick,ChanList) of > {ok, Pid} -> > Pid ! {Connection, {whisper, Nick, TargetNick, Msg}}; > user_cannot_be_found -> > send(Connection,{whisper_target_not_found, TargetNick}); > Any -> > io:format("lookupNickInChannel:whisper received unexpected case:~p~n",[Any]) > end; > emote -> > {Nick,Channel,Msg,Args} = list_to_tuple(Args), > case lookupChannel(Channel,ChanList) of > {ok, Pid} -> > Pid ! {Connection, {emote, Nick, Msg}}; > channel_not_found -> > self() ! {client, Connection, {join,[Nick|[Channel]]}}, > self() ! {client, Connection, {emote,[Nick,Channel|[Msg]]}}; > Any -> > io:format("lookupChannel:emote received unexpected case:~p~n",[Any]) > end; > part -> > % find connection return a channel > UserChanList = lookupConnectionInChannel(Connection,ChanList,[]), > case length(UserChanList) > 1 of > {ok,Pid} -> > % send message to channel > Pid ! {Connection,{part}}; > _Any -> > send(Connection, {denied_part, "To leave this channel, you must quit."}), > io:format("lookupConnectionInChannel:quit could not find a Connection that was supposed to be dropped~n",[]) > end; > quit -> > % find connection return a channel > case lookupConnectionInChannel(Connection,ChanList,[]) of > {ok,Pid} -> > Pid ! {Connection,{quit}}; > _Any -> > io:format("lookupConnectionInChannel:quit could not find a Connection that was supposed to be dropped~n",[]) > end > end, > server_loop([ChanList]); > > {client_closed, _Connection, _Why} -> > server_loop(ChanList); > > {channel_empty, Pid} -> > ChanList1 = remove_channel(Pid,ChanList), > server_loop(ChanList1); > > Msg -> > io:format("Chat Server received unexpected Msg=~p~n",[Msg]), > server_loop(ChanList) > end. > > % If Channel matched the head term in the list, return {ok, Pid, UserList} if not full. > lookupChannel(Channel,[{Channel,Pid,UserList}|_]) -> > case UserList > 50 of > true -> > channel_full; > false -> > {ok,Pid} > end; > % If Channel does not match the head term in the list, go to next chunk > lookupChannel(Channel,[_|ChanList]) -> > lookupChannel(Channel,ChanList); > % If lookup is called on an empty list, regardless of the pattern to match, return error > lookupChannel(_,[]) -> > channel_not_found. > > remove_channel(Pid,[{G,Pid,_UserList}|T]) -> > io:format("~p removed~n",[G]), > T; > remove_channel(Pid,[H|T]) -> > [H|remove_channel(Pid,T)]; > remove_channel(_,[]) -> > []. > > % If Nick matched the head term in the list, return {ok, Pid, UserList} > lookupNickInChannel(Nick,[{Channel,Pid,UserList}|T]) -> > case lookupNick(Nick, UserList) of > nick_found -> > {ok,Pid,Channel}; > % If Nick is not in the head term in the list, go to next chunk (what's left is called the Tail or T) > nick_not_found -> > lookupNickInChannel(Nick,T) > end; > % If lookup is called on an empty list, regardless of the pattern to match, return error > lookupNickInChannel(_,[]) -> > user_cannot_be_found. > > lookupNick(Nick,[{Nick,_Connection}|_UserList]) -> > nick_found; > lookupNick(Nick,[_|UserList]) -> > lookupNick(Nick,UserList); > lookupNick(_,[]) -> > nick_not_found. > > % If Connection matched the head term in the list, return {ok, Pid, UserList} > lookupConnectionInChannel(Connection,[{_Channel,Pid,UserList}|T],UserChannelPids) -> > case lookupConnection(Connection, UserList) of > % If Connection is in the head term in the list, add to aggregate and go to next chunk (what's left is called the Tail or T) > connection_found -> > lookupConnectionInChannel(Connection,T,[Pid|UserChannelPids]); > % If Connection is not in the head term in the list, go to next chunk (what's left is called the Tail or T) > connection_not_found -> > lookupConnectionInChannel(Connection,T,UserChannelPids) > end; > % If lookup is called on an empty list, regardless of the pattern to match, return error > lookupConnectionInChannel(_,[],UserChannelPids) -> > UserChannelPids. > > lookupConnection(Connection,[{_Nick,Connection}|_UserList]) -> > connection_found; > lookupConnection(Connection,[_|UserList]) -> > lookupNick(Connection,UserList); > lookupConnection(_,[]) -> > connection_not_found. > > send(_Connection, _OutgoingMessage) -> > ok. > > %%------------------------------------------------------------------------- > %% @spec (Request, From, State) -> {reply, Reply, State} | > %% {reply, Reply, State, Timeout} | > %% {noreply, State} | > %% {noreply, State, Timeout} | > %% {stop, Reason, Reply, State} | > %% {stop, Reason, State} > %% @doc Callback for synchronous server calls. If `{stop, ...}' tuple > %% is returned, the server is stopped and `terminate/2' is called. > %% @end > %% @private > %%------------------------------------------------------------------------- > handle_call(Request, _From, State) -> > {stop, {unknown_call, Request}, State}. > > %%------------------------------------------------------------------------- > %% @spec (Msg, State) ->{noreply, State} | > %% {noreply, State, Timeout} | > %% {stop, Reason, State} > %% @doc Callback for asyncrous server calls. If `{stop, ...}' tuple > %% is returned, the server is stopped and `terminate/2' is called. > %% @end > %% @private > %%------------------------------------------------------------------------- > handle_cast(_Msg, State) -> > {noreply, State}. > > %%------------------------------------------------------------------------- > %% @spec (Reason, State) -> any > %% @doc Callback executed on server shutdown. It is only invoked if > %% `process_flag(trap_exit, true)' is set by the server process. > %% The return value is ignored. > %% @end > %% @private > %%------------------------------------------------------------------------- > terminate(Reason, State) -> > io:format("Terminated~nReason:~p~nState:~p~n",[Reason,State]), > ok. > > %%------------------------------------------------------------------------- > %% @spec (OldVsn, State, Extra) -> {ok, NewState} > %% @doc Convert process state when code is changed. > %% @end > %% @private > %%------------------------------------------------------------------------- > code_change(_OldVsn, State, _Extra) -> > {ok, State}. > > handle_info(_Info, State) -> > {noreply, State}. > > > The problem was that I had no start_link method at all. After adding it, the application just hangs. Normally I would see the supervisor tree in appmon, but currently it doesn't appear and I only have access to the sub-console (cntrl-g) until I kill the job. Trying to connect to the tcp_server results in a crash that I don't understand. > > =ERROR REPORT==== 1-Sep-2008::13:08:01 === > ** Generic server tcp_listener terminating > ** Last message in was {inet_async,#Port<0.127>,1,{ok,#Port<0.140>}} > ** When Server state == {state,#Port<0.127>,1,prechat_fsm} > ** Reason for termination == > ** {{badmatch, > {error, > {undef, > [{tcp_server_app,start_chat_server,[]}, > {prechat_fsm,init,1}, > {gen_fsm,init_it,6}, > {proc_lib,init_p,5}]}}}, > [{tcp_listener,handle_info,2}, > {gen_server,handle_msg,5}, > {proc_lib,init_p,5}]} > > --- On Mon, 9/1/08, Ulf Wiger (TN/EAB) wrote: > >> From: Ulf Wiger (TN/EAB) >> Subject: Re: [erlang-questions] Learning OTP - Application, Supervisor, FSM, Server >> To: jefcrane@REDACTED >> Cc: erlang-questions@REDACTED >> Date: Monday, September 1, 2008, 3:37 AM >> Jeff Crane skrev: >> >> > My chat_server.erl is a gen_server, and I think that >> if >> > someone can explain this last bit of the child >> > specification, I might understand why I'm getting >> > this at runtime (startup): >> > =INFO REPORT==== 1-Sep-2008::00:39:12 === >> application: tcp_server >> > exited: {shutdown,{tcp_server_app,start,[normal,[]]}} >> type: temporary >> > >> {error,{shutdown,{tcp_server_app,start,[normal,[]]}}} >> > >> > Apologies for the inability to read specs, but I just >> don't >> > understand.> >> >> That particular error message is one of the most annoying >> messages produced by Erlang/OTP IMHO. It really doesn't >> tell you anything except which application failed to start. >> >> I believe it's due to an error caught in >> supervisor:do_start_child(). The error reason isn't >> propagated, >> but if you want to see it, you should make sure that the >> 'sasl' >> application is started. That should give you an error >> report >> from the supervisor, telling you what went wrong. >> >> So instead of just typing application:start(tcp_server), >> try: >> >> application:start(sasl). >> application:start(tcp_server). >> >> (or start erlang with erl -boot start_sasl) > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From v-shtok@REDACTED Tue Sep 2 01:11:58 2008 From: v-shtok@REDACTED (Shigeru Tokubo (Mindsource)) Date: Mon, 1 Sep 2008 16:11:58 -0700 Subject: [erlang-questions] ./configure Message-ID: In running ./configure I keep running into checking for ld.sh... no checking for ld... no What are these routines and where are they located. Shi g Tokubo checking for a BSD-compatible install... priv/auxdir/install-sh -c checking for an ANSI C-conforming const... yes checking for egrep... egrep checking for ANSI C header files... yes checking for appropriate compile flags... -g -O2 -fPIC checking for ld.sh... no checking for ld... no configure: error: ld required but not found! -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin@REDACTED Tue Sep 2 02:33:47 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Mon, 1 Sep 2008 17:33:47 -0700 Subject: [erlang-questions] Parallel Shootout & a style question Message-ID: First, I don't think it's been mentioned here, but the language benchmarks shootout finally got some multi-core hardware! http://shootout.alioth.debian.org/u64q/ At the moment, though, there are almost no submissions of parallelized code, so the results are about the same as the existing hardware. I figured (slightly spurred on by the Haskell community) that we should try to submit some modified versions that actually use the multiple cores. So, for example, I made a slight change to the binary trees code and got a nearly 2x speedup on my 2-core machine. In doing so, I did run into one of those little things that I've never really known the preferred approach for. My modified function looks like this: depthLoop(D,M) when D > M -> ok; depthLoop(D,M) -> Self = self(), spawn(fun() -> N = 1 bsl (M-D + ?Min), io:fwrite("~w\t trees of depth ~w\t check: ~w~n", [ 2*N, D, sumLoop(N,D,0) ]), Self ! done end), depthLoop (D+2,M), receive done -> done end. parallelizing would only require the addition of the spawn, except that if I do that, the function finishes executing and the program exits before most of the processes run at all. So, I need to add the call to self(), the send, and the receive in order to prevent premature termination. So, what I'm wondering is, is there a better idiom for achieving this goal? Thanks, -kevin From tom@REDACTED Tue Sep 2 02:32:51 2008 From: tom@REDACTED (Tom Samplonius) Date: Mon, 1 Sep 2008 17:32:51 -0700 (PDT) Subject: [erlang-questions] ./configure In-Reply-To: Message-ID: <2579549.8331220315571545.JavaMail.root@ly.sdf.com> ----- "Shigeru Tokubo (Mindsource)" wrote: In running ./configure I keep running into checking for ld.sh... no checking for ld... no What are these routines and where are they located. --- Well, on your system, they probably do not exist, which is probably why they can't be found. "ld" is the linker. If you don't have a linker, it probably means you do not have a compiler installed on your system. You will not be able to compile Erlang from source without a compiler and linker. You do not mention what OS you are using, so I don't know what you need to download. Tom From erlang-questions_efine@REDACTED Tue Sep 2 04:16:45 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Mon, 1 Sep 2008 22:16:45 -0400 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: References: Message-ID: <6c2563b20809011916n56e88cf9ld6398e247cd59de7@mail.gmail.com> Um, dunno if this helps, but have you looked at rpc:pmap/3? On Mon, Sep 1, 2008 at 8:33 PM, Kevin Scaldeferri wrote: > First, I don't think it's been mentioned here, but the language > benchmarks shootout finally got some multi-core hardware! > > http://shootout.alioth.debian.org/u64q/ > > At the moment, though, there are almost no submissions of parallelized > code, so the results are about the same as the existing hardware. > > I figured (slightly spurred on by the Haskell community) that we > should try to submit some modified versions that actually use the > multiple cores. So, for example, I made a slight change to the binary > trees code and got a nearly 2x speedup on my 2-core machine. In doing > so, I did run into one of those little things that I've never really > known the preferred approach for. My modified function looks like this: > > depthLoop(D,M) when D > M -> ok; > depthLoop(D,M) -> > Self = self(), > spawn(fun() -> > N = 1 bsl (M-D + ?Min), > io:fwrite("~w\t trees of depth ~w\t check: ~w~n", > [ 2*N, D, sumLoop(N,D,0) ]), > Self ! done > end), > depthLoop (D+2,M), > receive done -> done end. > > > parallelizing would only require the addition of the spawn, except > that if I do that, the function finishes executing and the program > exits before most of the processes run at all. So, I need to add the > call to self(), the send, and the receive in order to prevent > premature termination. So, what I'm wondering is, is there a better > idiom for achieving this goal? > > > Thanks, > > -kevin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From qrilka@REDACTED Tue Sep 2 08:11:56 2008 From: qrilka@REDACTED (Kirill Zaborski) Date: Tue, 2 Sep 2008 10:11:56 +0400 Subject: [erlang-questions] erlang-questions Digest, Vol 16, Issue 6 In-Reply-To: References: Message-ID: <337538cb0809012311j4fcc4229j2e95c31c244bc115@mail.gmail.com> BTW It looks like docs for rpc:pmap/3 have List1 and List2 in reversed places: the signature should look like pmap({Module, Function}, ExtraArgs, List1) -> List2 and not like pmap({Module, Function}, ExtraArgs, List2) -> List1 (from http://erlang.org/doc/man/rpc.html) Best regards, Kirill > > ------------------------------ > > Message: 5 > Date: Mon, 1 Sep 2008 22:16:45 -0400 > From: "Edwin Fine" > Subject: Re: [erlang-questions] Parallel Shootout & a style question > To: "Kevin Scaldeferri" > Cc: erlang-questions > Message-ID: > <6c2563b20809011916n56e88cf9ld6398e247cd59de7@REDACTED> > Content-Type: text/plain; charset="utf-8" > > Um, dunno if this helps, but have you looked at rpc:pmap/3? > From kevin@REDACTED Tue Sep 2 04:42:37 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Mon, 1 Sep 2008 19:42:37 -0700 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <6c2563b20809011916n56e88cf9ld6398e247cd59de7@mail.gmail.com> References: <6c2563b20809011916n56e88cf9ld6398e247cd59de7@mail.gmail.com> Message-ID: <11E35754-DEF6-4B7D-8783-C9B8CD1EC80D@scaldeferri.com> Yeah, actually it does. I rewrote it as: depthLoop(D,M) -> Results = rpc:pmap({?MODULE, depth}, [M], lists:seq(D, M, 2)), lists:foreach(fun(Result) -> io:fwrite("~w\t trees of depth ~w\t check: ~w~n", Result) end, Results). depth(D,M) -> N = 1 bsl (M-D + ?Min), [ 2*N, D, sumLoop(N,D,0) ]. which is cleaner, just as fast, and preserves the original order of the output. -kevin On Sep 1, 2008, at 7:16 PM, Edwin Fine wrote: > Um, dunno if this helps, but have you looked at rpc:pmap/3? > > On Mon, Sep 1, 2008 at 8:33 PM, Kevin Scaldeferri > wrote: > First, I don't think it's been mentioned here, but the language > benchmarks shootout finally got some multi-core hardware! > > http://shootout.alioth.debian.org/u64q/ > > At the moment, though, there are almost no submissions of parallelized > code, so the results are about the same as the existing hardware. > > I figured (slightly spurred on by the Haskell community) that we > should try to submit some modified versions that actually use the > multiple cores. So, for example, I made a slight change to the binary > trees code and got a nearly 2x speedup on my 2-core machine. In doing > so, I did run into one of those little things that I've never really > known the preferred approach for. My modified function looks like > this: > > depthLoop(D,M) when D > M -> ok; > depthLoop(D,M) -> > Self = self(), > spawn(fun() -> > N = 1 bsl (M-D + ?Min), > io:fwrite("~w\t trees of depth ~w\t check: ~w~n", > [ 2*N, D, sumLoop(N,D,0) ]), > Self ! done > end), > depthLoop (D+2,M), > receive done -> done end. > > > parallelizing would only require the addition of the spawn, except > that if I do that, the function finishes executing and the program > exits before most of the processes run at all. So, I need to add the > call to self(), the send, and the receive in order to prevent > premature termination. So, what I'm wondering is, is there a better > idiom for achieving this goal? > > > Thanks, > > -kevin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > -- > For every expert there is an equal and opposite expert - Arthur C. > Clarke From ulf.wiger@REDACTED Tue Sep 2 09:22:11 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 02 Sep 2008 09:22:11 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: References: Message-ID: <48BCE9A3.5070508@ericsson.com> I guess there should be a utility library with some different ways of parallelizing a computation... Does the shootout maintain different source trees for the single-core and multicore programs? Otherwise, we'll incur a slight penalty on the sequential benchmarks. If it's noticeable, we can always split the sequential and parallel parts using a cheap test: case erlang:system_info(schedulers) of 1 -> seq(...); _ -> par(...) end. I don't think rpc:pmap() does quite the right thing. It tries to spread the computations across erlang nodes. We want a much simpler pmap. depthLoop(D, M) -> L = lists:seq(D,M,2), F = fun(D1) -> check(D1,M) end, Results = pmap(F, lists:seq(D,M,2)), lists:foreach( fun(Res) -> io:fwrite("~w\t trees of depth ~w\t check: ~w~n", Res) end, Results). check(D, M) -> N = 1 bsl (M-D + ?Min), [2*N, D, sumLoop(N,D,0)]. pmap(F, L) -> Me = self(), Pids = [spawn(fun() -> Me ! {self(),catch F(X)} end || X <- L], [receive {P,Res} -> Res end || P <- Pids]. (I haven't tried the above, or thought too much about whether it's exactly the right solution. See it as an implementation sketch.) BR, Ulf W Kevin Scaldeferri skrev: > First, I don't think it's been mentioned here, but the language > benchmarks shootout finally got some multi-core hardware! > > http://shootout.alioth.debian.org/u64q/ > > At the moment, though, there are almost no submissions of parallelized > code, so the results are about the same as the existing hardware. > > I figured (slightly spurred on by the Haskell community) that we > should try to submit some modified versions that actually use the > multiple cores. So, for example, I made a slight change to the binary > trees code and got a nearly 2x speedup on my 2-core machine. In doing > so, I did run into one of those little things that I've never really > known the preferred approach for. My modified function looks like this: > > depthLoop(D,M) when D > M -> ok; > depthLoop(D,M) -> > Self = self(), > spawn(fun() -> > N = 1 bsl (M-D + ?Min), > io:fwrite("~w\t trees of depth ~w\t check: ~w~n", > [ 2*N, D, sumLoop(N,D,0) ]), > Self ! done > end), > depthLoop (D+2,M), > receive done -> done end. > > > parallelizing would only require the addition of the spawn, except > that if I do that, the function finishes executing and the program > exits before most of the processes run at all. So, I need to add the > call to self(), the send, and the receive in order to prevent > premature termination. So, what I'm wondering is, is there a better > idiom for achieving this goal? > > > Thanks, > > -kevin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From mats.cronqvist@REDACTED Tue Sep 2 09:42:55 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 02 Sep 2008 09:42:55 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: References: Message-ID: <48BCEE7F.7080104@gmail.com> Kevin Scaldeferri wrote: > First, I don't think it's been mentioned here, but the language > benchmarks shootout finally got some multi-core hardware! > > http://shootout.alioth.debian.org/u64q/ > > At the moment, though, there are almost no submissions of parallelized > code, so the results are about the same as the existing hardware. > > I figured (slightly spurred on by the Haskell community) that we > should try to submit some modified versions that actually use the > multiple cores. So, for example, I made a slight change to the binary > trees code and got a nearly 2x speedup on my 2-core machine. In doing > so, I did run into one of those little things that I've never really > known the preferred approach for. My modified function looks like this: > > depthLoop(D,M) when D > M -> ok; > depthLoop(D,M) -> > Self = self(), > spawn(fun() -> > N = 1 bsl (M-D + ?Min), > io:fwrite("~w\t trees of depth ~w\t check: ~w~n", > [ 2*N, D, sumLoop(N,D,0) ]), > Self ! done > end), > depthLoop (D+2,M), > receive done -> done end. > > > i'm partial to the monitor-exit idiom. gets rid of the Self for one thing. mats depthLoop(D,M) when D > M -> ok; depthLoop(D,M) -> erlang:spawn_monitor(fun()-> slave(D, M) end), depthLoop (D+2,M), receive {'DOWN',_,_,_,done} -> done end. slave(D, M) -> N = 1 bsl (M-D + ?Min), io:fwrite("~w\t trees of depth ~w\t check: ~w~n", [ 2*N, D, sumLoop(N,D,0) ]), exit(done). From ulf.wiger@REDACTED Tue Sep 2 09:49:44 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 02 Sep 2008 09:49:44 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BCEE7F.7080104@gmail.com> References: <48BCEE7F.7080104@gmail.com> Message-ID: <48BCF018.10101@ericsson.com> Mats Cronqvist skrev: > > i'm partial to the monitor-exit idiom. > gets rid of the Self for one thing. > > mats > > depthLoop(D,M) when D > M -> ok; > depthLoop(D,M) -> > erlang:spawn_monitor(fun()-> slave(D, M) end), > depthLoop (D+2,M), > receive {'DOWN',_,_,_,done} -> done end. > > slave(D, M) -> > N = 1 bsl (M-D + ?Min), > io:fwrite("~w\t trees of depth ~w\t check: ~w~n", > [ 2*N, D, sumLoop(N,D,0) ]), > exit(done). Of course, as pioneered by Robert Virding, we can still catch the results this way, if we want to, and we probably do want to, to make sure that printouts appear in the expected order: The slave does exit(Result), and the collector does receive {'DOWN',_,_,_,Result}. Since Robert used this trick in the shell REPL code, and he was one of the inventors of the language, it has to be Good Style. (: BR, Ulf W From gleber.p@REDACTED Tue Sep 2 09:52:41 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 2 Sep 2008 09:52:41 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BCEE7F.7080104@gmail.com> References: <48BCEE7F.7080104@gmail.com> Message-ID: <14f0e3620809020052x5c05b9a5s6a3f8ab5177e0a89@mail.gmail.com> Maybe it is good idea to include something like http://code.google.com/p/plists/ into Erlang/OTP? It will probably introduce more less tuned software created by developers, but it will make programming multi-core systems much more easier and fun for beginners. On Tue, Sep 2, 2008 at 9:42 AM, Mats Cronqvist wrote: > Kevin Scaldeferri wrote: >> First, I don't think it's been mentioned here, but the language >> benchmarks shootout finally got some multi-core hardware! >> >> http://shootout.alioth.debian.org/u64q/ >> >> At the moment, though, there are almost no submissions of parallelized >> code, so the results are about the same as the existing hardware. >> >> I figured (slightly spurred on by the Haskell community) that we >> should try to submit some modified versions that actually use the >> multiple cores. So, for example, I made a slight change to the binary >> trees code and got a nearly 2x speedup on my 2-core machine. In doing >> so, I did run into one of those little things that I've never really >> known the preferred approach for. My modified function looks like this: >> >> depthLoop(D,M) when D > M -> ok; >> depthLoop(D,M) -> >> Self = self(), >> spawn(fun() -> >> N = 1 bsl (M-D + ?Min), >> io:fwrite("~w\t trees of depth ~w\t check: ~w~n", >> [ 2*N, D, sumLoop(N,D,0) ]), >> Self ! done >> end), >> depthLoop (D+2,M), >> receive done -> done end. >> >> >> > i'm partial to the monitor-exit idiom. gets rid of the Self for one thing. > > mats > > depthLoop(D,M) when D > M -> ok; > depthLoop(D,M) -> > erlang:spawn_monitor(fun()-> slave(D, M) end), > depthLoop (D+2,M), > receive {'DOWN',_,_,_,done} -> done end. > > slave(D, M) -> > N = 1 bsl (M-D + ?Min), > io:fwrite("~w\t trees of depth ~w\t check: ~w~n", > [ 2*N, D, sumLoop(N,D,0) ]), > exit(done). > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From mats.cronqvist@REDACTED Tue Sep 2 10:05:16 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 02 Sep 2008 10:05:16 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BCF018.10101@ericsson.com> References: <48BCEE7F.7080104@gmail.com> <48BCF018.10101@ericsson.com> Message-ID: <48BCF3BC.4080101@gmail.com> Ulf Wiger (TN/EAB) wrote: > Mats Cronqvist skrev: >> >> i'm partial to the monitor-exit idiom. > > gets rid of the Self for one thing. >> >> mats >> >> depthLoop(D,M) when D > M -> ok; >> depthLoop(D,M) -> >> erlang:spawn_monitor(fun()-> slave(D, M) end), >> depthLoop (D+2,M), >> receive {'DOWN',_,_,_,done} -> done end. >> >> slave(D, M) -> >> N = 1 bsl (M-D + ?Min), >> io:fwrite("~w\t trees of depth ~w\t check: ~w~n", >> [ 2*N, D, sumLoop(N,D,0) ]), >> exit(done). > > Of course, as pioneered by Robert Virding, we can still > catch the results this way, if we want to, and we > probably do want to, to make sure that printouts appear > in the expected order: > The slave does exit(Result), and the collector does > receive {'DOWN',_,_,_,Result}. being an Aspiring Architecture Astronaut i didn't actually look at the problem spec... i guess you mean that the main/1 function should be rewritten as a collector? > Since Robert used this trick in the shell REPL code, > and he was one of the inventors of the language, it > has to be Good Style. (: "trick"? how disparaging :> i thought the REPL was older than monitor? it uses trap_exit/link/catch? that, otoh, is pretty bad. mats From mats.cronqvist@REDACTED Tue Sep 2 10:08:32 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 02 Sep 2008 10:08:32 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <14f0e3620809020052x5c05b9a5s6a3f8ab5177e0a89@mail.gmail.com> References: <48BCEE7F.7080104@gmail.com> <14f0e3620809020052x5c05b9a5s6a3f8ab5177e0a89@mail.gmail.com> Message-ID: <48BCF480.4010105@gmail.com> Gleb Peregud wrote: > Maybe it is good idea to include something like > http://code.google.com/p/plists/ into Erlang/OTP? It will probably > introduce more less tuned software created by developers, but it will > make programming multi-core systems much more easier and fun for > beginners. in an ideal world, all the basic OTP libs should be rewritten to be parallel. who gives an expletive if it's 10% slower on a single core machine? From ulf.wiger@REDACTED Tue Sep 2 10:11:28 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 02 Sep 2008 10:11:28 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BCF3BC.4080101@gmail.com> References: <48BCEE7F.7080104@gmail.com> <48BCF018.10101@ericsson.com> <48BCF3BC.4080101@gmail.com> Message-ID: <48BCF530.6040102@ericsson.com> Mats Cronqvist skrev: > being an Aspiring Architecture Astronaut i didn't actually look at > the problem spec... i guess you mean that the main/1 function should > be rewritten as a collector? Well... I vaguely recall some experiments back in school, where the peculiarities of parallel programming were illustrated precisely with tty output from several processes running in parallel. (: (I'm glad to see that education finally paying off. :) I assume that the shootout harness tries to verify that the total output conforms with the template, so yes, I think a collector is needed. The computations should be parallelized - not the printouts. BR, Ulf W From ulf.wiger@REDACTED Tue Sep 2 10:21:25 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 02 Sep 2008 10:21:25 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BCF480.4010105@gmail.com> References: <48BCEE7F.7080104@gmail.com> <14f0e3620809020052x5c05b9a5s6a3f8ab5177e0a89@mail.gmail.com> <48BCF480.4010105@gmail.com> Message-ID: <48BCF785.60804@ericsson.com> Mats Cronqvist skrev: > Gleb Peregud wrote: >> Maybe it is good idea to include something like >> http://code.google.com/p/plists/ into Erlang/OTP? It will probably >> introduce more less tuned software created by developers, but it >> will make programming multi-core systems much more easier and fun >> for beginners. > > in an ideal world, all the basic OTP libs should be rewritten to be > parallel. who gives an expletive if it's 10% slower on a single core > machine? Radical, but you have a point. Before Robert reminds me, I might as well admit that I scolded him severely for rewriting lists:map/2 as a list comprehension, back in those days when LCs were slower. Sorry Robert (but I was right ;-) I am pretty sure that 10% means a lot to some people out there. However, if the library functions perform a lightweight check and pick the parallel version only if SMP is enabled, we're not talking 10%. erlang:system_info(smp_support) -> boolean() seems to hit the spot. Perhaps an alias, like smp() -> boolean() could ease the strain on our eyes and prevent carpal-tunnel syndrome: map(F, L) when smp() -> pmap(F, L); map(F, L) -> [F(X) || X <- L]. BR, Ulf W From raimo+erlang-questions@REDACTED Tue Sep 2 10:25:28 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Tue, 2 Sep 2008 10:25:28 +0200 Subject: [erlang-questions] : ./configure In-Reply-To: <2579549.8331220315571545.JavaMail.root@ly.sdf.com> References: <2579549.8331220315571545.JavaMail.root@ly.sdf.com> Message-ID: <20080902082528.GA5561@erix.ericsson.se> On Mon, Sep 01, 2008 at 05:32:51PM -0700, Tom Samplonius wrote: > > ----- "Shigeru Tokubo (Mindsource)" wrote: > In running ./configure > > > > I keep running into > > checking for ld.sh... no > > checking for ld... no > > > > What are these routines and where are they located. > --- > > > Well, on your system, they probably do not exist, which is probably why they can't be found. > > "ld" is the linker. If you don't have a linker, it probably means you do not have a compiler installed on your system. You will not be able to compile Erlang from source without a compiler and linker. You do not mention what OS you are using, so I don't know what you need to download. Just to tell us what system you have and the basics of your setup, can you report the results of the following commands? uname -a cat '/etc/*release*' echo $PATH echo $LD_LIBRARY_PATH env > > > Tom > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From gleber.p@REDACTED Tue Sep 2 10:43:14 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 2 Sep 2008 10:43:14 +0200 Subject: [erlang-questions] : ./configure In-Reply-To: <20080902082528.GA5561@erix.ericsson.se> References: <2579549.8331220315571545.JavaMail.root@ly.sdf.com> <20080902082528.GA5561@erix.ericsson.se> Message-ID: <14f0e3620809020143p58bcb245ma27b513b1f61d591@mail.gmail.com> On Tue, Sep 2, 2008 at 10:25 AM, Raimo Niskanen wrote: > On Mon, Sep 01, 2008 at 05:32:51PM -0700, Tom Samplonius wrote: >> >> ----- "Shigeru Tokubo (Mindsource)" wrote: >> In running ./configure >> >> >> >> I keep running into >> >> checking for ld.sh... no >> >> checking for ld... no >> >> >> >> What are these routines and where are they located. >> --- >> >> >> Well, on your system, they probably do not exist, which is probably why they can't be found. >> >> "ld" is the linker. If you don't have a linker, it probably means you do not have a compiler installed on your system. You will not be able to compile Erlang from source without a compiler and linker. You do not mention what OS you are using, so I don't know what you need to download. > > Just to tell us what system you have and the basics of > your setup, can you report the results of the following commands? > > uname -a > cat '/etc/*release*' cat '/etc/*release*' does not work on my system, if it is the same for you, try this (the same but without quotes): cat /etc/*release* > echo $PATH > echo $LD_LIBRARY_PATH > env > >> >> >> Tom >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From vychodil.hynek@REDACTED Tue Sep 2 11:08:21 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Tue, 2 Sep 2008 11:08:21 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BCF785.60804@ericsson.com> References: <48BCEE7F.7080104@gmail.com> <14f0e3620809020052x5c05b9a5s6a3f8ab5177e0a89@mail.gmail.com> <48BCF480.4010105@gmail.com> <48BCF785.60804@ericsson.com> Message-ID: <4d08db370809020208l33e6180an597de5004d4a1395@mail.gmail.com> I'm not sure if it is good idea at all. If F function is very cheap and result or parameter is large (copy of it is more expensive in comparison to F expense) parallel version of pmap can be slower than serial version even many cores is used. Developer should be able control size of parallelized bunch and switch off parallel process fully. For example pmap(fun(X) -> [0|X] end, [lists:seq(1,1000000)]) is really bad idea and I will not be happy if lists:map will be changed to pmap automatically at default ;-) On Tue, Sep 2, 2008 at 10:21 AM, Ulf Wiger (TN/EAB) wrote: > Mats Cronqvist skrev: > > Gleb Peregud wrote: > >> Maybe it is good idea to include something like > >> http://code.google.com/p/plists/ into Erlang/OTP? It will probably > >> introduce more less tuned software created by developers, but it > >> will make programming multi-core systems much more easier and fun > >> for beginners. > > > > in an ideal world, all the basic OTP libs should be rewritten to be > > parallel. who gives an expletive if it's 10% slower on a single core > > machine? > > Radical, but you have a point. > > Before Robert reminds me, I might as well admit that I > scolded him severely for rewriting lists:map/2 as a > list comprehension, back in those days when LCs were > slower. Sorry Robert (but I was right ;-) > > I am pretty sure that 10% means a lot to some people > out there. > > However, if the library functions perform a lightweight > check and pick the parallel version only if SMP is enabled, > we're not talking 10%. > > erlang:system_info(smp_support) -> boolean() > > seems to hit the spot. > > Perhaps an alias, like smp() -> boolean() could ease > the strain on our eyes and prevent carpal-tunnel > syndrome: > > map(F, L) when smp() -> pmap(F, L); > map(F, L) -> > [F(X) || X <- L]. > > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From vychodil.hynek@REDACTED Tue Sep 2 11:13:37 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Tue, 2 Sep 2008 11:13:37 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BCEE7F.7080104@gmail.com> References: <48BCEE7F.7080104@gmail.com> Message-ID: <4d08db370809020213y6efe6f73uee011360b59abfa2@mail.gmail.com> I argue to check monitor reference in receive every time. It is not good practice omitting it. You don't know which depthLoop's 'DOWN' message you received. In some particular case it can doesn't matter (as in this concrete do!) but do it is safer and good practice. On Tue, Sep 2, 2008 at 9:42 AM, Mats Cronqvist wrote: > Kevin Scaldeferri wrote: > > First, I don't think it's been mentioned here, but the language > > benchmarks shootout finally got some multi-core hardware! > > > > http://shootout.alioth.debian.org/u64q/ > > > > At the moment, though, there are almost no submissions of parallelized > > code, so the results are about the same as the existing hardware. > > > > I figured (slightly spurred on by the Haskell community) that we > > should try to submit some modified versions that actually use the > > multiple cores. So, for example, I made a slight change to the binary > > trees code and got a nearly 2x speedup on my 2-core machine. In doing > > so, I did run into one of those little things that I've never really > > known the preferred approach for. My modified function looks like this: > > > > depthLoop(D,M) when D > M -> ok; > > depthLoop(D,M) -> > > Self = self(), > > spawn(fun() -> > > N = 1 bsl (M-D + ?Min), > > io:fwrite("~w\t trees of depth ~w\t check: ~w~n", > > [ 2*N, D, sumLoop(N,D,0) ]), > > Self ! done > > end), > > depthLoop (D+2,M), > > receive done -> done end. > > > > > > > i'm partial to the monitor-exit idiom. gets rid of the Self for one > thing. > > mats > > depthLoop(D,M) when D > M -> ok; > depthLoop(D,M) -> > erlang:spawn_monitor(fun()-> slave(D, M) end), > depthLoop (D+2,M), > receive {'DOWN',_,_,_,done} -> done end. > > slave(D, M) -> > N = 1 bsl (M-D + ?Min), > io:fwrite("~w\t trees of depth ~w\t check: ~w~n", > [ 2*N, D, sumLoop(N,D,0) ]), > exit(done). > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From mats.cronqvist@REDACTED Tue Sep 2 12:09:49 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 02 Sep 2008 12:09:49 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BCF785.60804@ericsson.com> References: <48BCEE7F.7080104@gmail.com> <14f0e3620809020052x5c05b9a5s6a3f8ab5177e0a89@mail.gmail.com> <48BCF480.4010105@gmail.com> <48BCF785.60804@ericsson.com> Message-ID: <48BD10ED.7000809@gmail.com> Ulf Wiger (TN/EAB) wrote: > Mats Cronqvist skrev: >> Gleb Peregud wrote: >>> Maybe it is good idea to include something like >>> http://code.google.com/p/plists/ into Erlang/OTP? It will probably >>> introduce more less tuned software created by developers, but it >>> will make programming multi-core systems much more easier and fun >>> for beginners. > > >> in an ideal world, all the basic OTP libs should be rewritten to be >> parallel. who gives an expletive if it's 10% slower on a single core >> machine? > > Radical, but you have a point. > > Before Robert reminds me, I might as well admit that I > scolded him severely for rewriting lists:map/2 as a > list comprehension, back in those days when LCs were > slower. Sorry Robert (but I was right ;-) > > I am pretty sure that 10% means a lot to some people > out there. people that care about 10% performance have no business running on a single core. mats From mats.cronqvist@REDACTED Tue Sep 2 12:14:58 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 02 Sep 2008 12:14:58 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <4d08db370809020213y6efe6f73uee011360b59abfa2@mail.gmail.com> References: <48BCEE7F.7080104@gmail.com> <4d08db370809020213y6efe6f73uee011360b59abfa2@mail.gmail.com> Message-ID: <48BD1222.2030304@gmail.com> Hynek Vychodil wrote: > I argue to check monitor reference in receive every time. It is not > good practice omitting it. You don't know which depthLoop's 'DOWN' > message you received. In some particular case it can doesn't matter > (as in this concrete do!) but do it is safer and good practice. i'd say that a receive should normally have either an {'EXIT',..}, a {'DOWN',...} or an 'after' clause. mats From mats.cronqvist@REDACTED Tue Sep 2 12:21:48 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 02 Sep 2008 12:21:48 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <4d08db370809020208l33e6180an597de5004d4a1395@mail.gmail.com> References: <48BCEE7F.7080104@gmail.com> <14f0e3620809020052x5c05b9a5s6a3f8ab5177e0a89@mail.gmail.com> <48BCF480.4010105@gmail.com> <48BCF785.60804@ericsson.com> <4d08db370809020208l33e6180an597de5004d4a1395@mail.gmail.com> Message-ID: <48BD13BC.2040005@gmail.com> Hynek Vychodil wrote: > I'm not sure if it is good idea at all. If F function is very cheap > and result or parameter is large (copy of it is more expensive in > comparison to F expense) parallel version of pmap can be slower than > serial version even many cores is used. Developer should be able > control size of parallelized bunch and switch off parallel process > fully. For example pmap(fun(X) -> [0|X] end, [lists:seq(1,1000000)]) > is really bad idea and I will not be happy if lists:map will be > changed to pmap automatically at default ;-) regardless of how the OTP libs behaves, it will always be possible to find some case for which it performs badly. the question is what the *default* behavior should be. it seems obvious to me that the target for the OTP libs should be non-trivial calculations on multi-core machines. motivation; * it's where the interesting stuff happens * it's difficult to get right if you want to run trivial calculations in parallel you can easily write your own code. mats From mats.cronqvist@REDACTED Tue Sep 2 12:22:43 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 02 Sep 2008 12:22:43 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BCF530.6040102@ericsson.com> References: <48BCEE7F.7080104@gmail.com> <48BCF018.10101@ericsson.com> <48BCF3BC.4080101@gmail.com> <48BCF530.6040102@ericsson.com> Message-ID: <48BD13F3.8050802@gmail.com> Ulf Wiger (TN/EAB) wrote: > Mats Cronqvist skrev: >> being an Aspiring Architecture Astronaut i didn't actually look at >> the problem spec... i guess you mean that the main/1 function should >> be rewritten as a collector? > > Well... I vaguely recall some experiments back in school, > where the peculiarities of parallel programming were > illustrated precisely with tty output from several > processes running in parallel. (: > > (I'm glad to see that education finally paying off. :) > > I assume that the shootout harness tries to verify that > the total output conforms with the template, so yes, > I think a collector is needed. The computations should > be parallelized - not the printouts. agreed. From 0x6e6562@REDACTED Tue Sep 2 14:33:12 2008 From: 0x6e6562@REDACTED (Ben Hood) Date: Tue, 2 Sep 2008 13:33:12 +0100 Subject: [erlang-questions] Erlang STOMP client In-Reply-To: <1c3be50f0808271019n3a09d7aelc059ba2f1ae817b5@mail.gmail.com> References: <1c3be50f0808261544p1fee1f4fs1789d082ddabac3a@mail.gmail.com> <8aff81590808262301s5b40a90dyeaa84d0be25c5dbe@mail.gmail.com> <1c3be50f0808271019n3a09d7aelc059ba2f1ae817b5@mail.gmail.com> Message-ID: <269388e30809020533i574d8858v9b44b6893617ad54@mail.gmail.com> Juan, 2008/8/27 Juan Jose Comellas : > Yes, but there's nothing in it. I also checked its launchpad.net project and > it was also empty. The only project I've found with actual code in it is > Stomperl, on: > > http://code.google.com/p/stomperl/ > > The problem is that is a bit lacking in example code and/or documentation. Do need to use the STOMP protocol specifically or could you get away AMQP? If that is the case, then you could look at the RabbitMQ Erlang client. Ben From juanjo@REDACTED Tue Sep 2 14:47:06 2008 From: juanjo@REDACTED (Juan Jose Comellas) Date: Tue, 2 Sep 2008 09:47:06 -0300 Subject: [erlang-questions] Erlang STOMP client In-Reply-To: <269388e30809020533i574d8858v9b44b6893617ad54@mail.gmail.com> References: <1c3be50f0808261544p1fee1f4fs1789d082ddabac3a@mail.gmail.com> <8aff81590808262301s5b40a90dyeaa84d0be25c5dbe@mail.gmail.com> <1c3be50f0808271019n3a09d7aelc059ba2f1ae817b5@mail.gmail.com> <269388e30809020533i574d8858v9b44b6893617ad54@mail.gmail.com> Message-ID: <1c3be50f0809020547j6d7a296r361408d12c5ee1f5@mail.gmail.com> We plan to migrate to RabbitMQ in a few months, but in the meantime I need to speak to ActiveMQ, and STOMP is the easiest way to achieve that. I haven't found any STOMP clients that I could use, so I'm writing one using gen_fsm as we speak. On Tue, Sep 2, 2008 at 9:33 AM, Ben Hood <0x6e6562@REDACTED> wrote: > Juan, > > 2008/8/27 Juan Jose Comellas : > > Yes, but there's nothing in it. I also checked its launchpad.net project > and > > it was also empty. The only project I've found with actual code in it is > > Stomperl, on: > > > > http://code.google.com/p/stomperl/ > > > > The problem is that is a bit lacking in example code and/or > documentation. > > Do need to use the STOMP protocol specifically or could you get away > AMQP? If that is the case, then you could look at the RabbitMQ Erlang > client. > > Ben > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vychodil.hynek@REDACTED Tue Sep 2 14:47:50 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Tue, 2 Sep 2008 14:47:50 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BD13BC.2040005@gmail.com> References: <48BCEE7F.7080104@gmail.com> <14f0e3620809020052x5c05b9a5s6a3f8ab5177e0a89@mail.gmail.com> <48BCF480.4010105@gmail.com> <48BCF785.60804@ericsson.com> <4d08db370809020208l33e6180an597de5004d4a1395@mail.gmail.com> <48BD13BC.2040005@gmail.com> Message-ID: <4d08db370809020547s9f1ed2ao35b39d9e8e28eac9@mail.gmail.com> On Tue, Sep 2, 2008 at 12:21 PM, Mats Cronqvist wrote: > Hynek Vychodil wrote: > >> I'm not sure if it is good idea at all. If F function is very cheap and >> result or parameter is large (copy of it is more expensive in comparison to >> F expense) parallel version of pmap can be slower than serial version even >> many cores is used. Developer should be able control size of parallelized >> bunch and switch off parallel process fully. For example pmap(fun(X) -> >> [0|X] end, [lists:seq(1,1000000)]) is really bad idea and I will not be >> happy if lists:map will be changed to pmap automatically at default ;-) >> > regardless of how the OTP libs behaves, it will always be possible to find > some case for which it performs badly. the question is what the *default* > behavior should be. > it seems obvious to me that the target for the OTP libs should be > non-trivial calculations on multi-core machines. motivation; Lists module is component of stdlibs which is OTP library/aplication so I can't be agree with you. Lists is often used and lists should behave nice in normal usage. Change lists:map to anything other than current is bad. There are OTP libs which could not be performace beaters as gen_server, gen_fsm and other, but there are OTP libraries which should be. For example stlib! I guess you forgot that stdlib is OTP library too. > > > * it's where the interesting stuff happens > * it's difficult to get right > > if you want to run trivial calculations in parallel you can easily write > your own code. > > mats > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From 0x6e6562@REDACTED Tue Sep 2 15:08:14 2008 From: 0x6e6562@REDACTED (Ben Hood) Date: Tue, 2 Sep 2008 14:08:14 +0100 Subject: [erlang-questions] Erlang STOMP client In-Reply-To: <1c3be50f0809020547j6d7a296r361408d12c5ee1f5@mail.gmail.com> References: <1c3be50f0808261544p1fee1f4fs1789d082ddabac3a@mail.gmail.com> <8aff81590808262301s5b40a90dyeaa84d0be25c5dbe@mail.gmail.com> <1c3be50f0808271019n3a09d7aelc059ba2f1ae817b5@mail.gmail.com> <269388e30809020533i574d8858v9b44b6893617ad54@mail.gmail.com> <1c3be50f0809020547j6d7a296r361408d12c5ee1f5@mail.gmail.com> Message-ID: <269388e30809020608s4a8e9957m97715c681611969c@mail.gmail.com> Juan, 2008/9/2 Juan Jose Comellas : > We plan to migrate to RabbitMQ in a few months, but in the meantime I need > to speak to ActiveMQ, and STOMP is the easiest way to achieve that. > > I haven't found any STOMP clients that I could use, so I'm writing one using > gen_fsm as we speak. I see. To save yourself some time, you might want to re-use the wiring from the server side adapter ( http://hg.rabbitmq.com/rabbitmq-stomp/ ). This would be a case of inverting the server into a client by re-using the stomp_frame module. Just a thought, Ben From icfp.publicity@REDACTED Tue Sep 2 16:07:05 2008 From: icfp.publicity@REDACTED (Matthew Fluet (ICFP Publicity Chair)) Date: Tue, 2 Sep 2008 09:07:05 -0500 Subject: [erlang-questions] ICFP09 Announcement Message-ID: <53ff55480809020707o2f5b095dh8fb3fed3778ca1e8@mail.gmail.com> +--------------------------------------------------------------------+ ANNOUNCEMENT The 14th ACM SIGPLAN International Conference on Functional Programming ICFP 2009 31st August - 2nd September 2009 Edinburgh, United Kingdom ICFP provides a forum for researchers and developers to hear about the latest work on the design, implementations, principles, and uses of functional programming. ICFP 2009 will be held in Scotland's historic capital city of Edinburgh, during the final week of the Edinburgh International Festival. Further information is available from: http://www.cs.nott.ac.uk/~gmh/icfp09.html Graham Hutton General Chair, ICFP 2009 +--------------------------------------------------------------------+ | Dr Graham Hutton Email : gmh@REDACTED | | Functional Programming Lab | | School of Computer Science Web : www.cs.nott.ac.uk/~gmh | | University of Nottingham | | Jubilee Campus, Wollaton Road Phone : +44 (0)115 951 4220 | | Nottingham NG8 1BB, UK | +--------------------------------------------------------------------+ From mats.cronqvist@REDACTED Tue Sep 2 16:30:17 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 02 Sep 2008 16:30:17 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <4d08db370809020547s9f1ed2ao35b39d9e8e28eac9@mail.gmail.com> References: <48BCEE7F.7080104@gmail.com> <14f0e3620809020052x5c05b9a5s6a3f8ab5177e0a89@mail.gmail.com> <48BCF480.4010105@gmail.com> <48BCF785.60804@ericsson.com> <4d08db370809020208l33e6180an597de5004d4a1395@mail.gmail.com> <48BD13BC.2040005@gmail.com> <4d08db370809020547s9f1ed2ao35b39d9e8e28eac9@mail.gmail.com> Message-ID: <48BD4DF9.50903@gmail.com> Hynek Vychodil wrote: > > > On Tue, Sep 2, 2008 at 12:21 PM, Mats Cronqvist > > wrote: > > Hynek Vychodil wrote: > > I'm not sure if it is good idea at all. If F function is very > cheap and result or parameter is large (copy of it is more > expensive in comparison to F expense) parallel version of pmap > can be slower than serial version even many cores is used. > Developer should be able control size of parallelized bunch > and switch off parallel process fully. For example pmap(fun(X) > -> [0|X] end, [lists:seq(1,1000000)]) is really bad idea and I > will not be happy if lists:map will be changed to pmap > automatically at default ;-) > > regardless of how the OTP libs behaves, it will always be > possible to find some case for which it performs badly. the > question is what the *default* behavior should be. > it seems obvious to me that the target for the OTP libs should be > non-trivial calculations on multi-core machines. motivation; > > > Lists module is component of stdlibs which is OTP library/aplication > so I can't be agree with you. Lists is often used and lists should > behave nice in normal usage. define "normal." > Change lists:map to anything other than current is bad. There are OTP > libs which could not be performace beaters as gen_server, gen_fsm and > other, but there are OTP libraries which should be. For example stlib! > I guess you forgot that stdlib is OTP library too. well, now that you mention it, stdlib being part of OTP does sound vaguely familiar. alas, i still think the normal case should be optimized for multicore. mats From kenneth.lundin@REDACTED Tue Sep 2 17:07:03 2008 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Tue, 2 Sep 2008 17:07:03 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BD4DF9.50903@gmail.com> References: <48BCEE7F.7080104@gmail.com> <14f0e3620809020052x5c05b9a5s6a3f8ab5177e0a89@mail.gmail.com> <48BCF480.4010105@gmail.com> <48BCF785.60804@ericsson.com> <4d08db370809020208l33e6180an597de5004d4a1395@mail.gmail.com> <48BD13BC.2040005@gmail.com> <4d08db370809020547s9f1ed2ao35b39d9e8e28eac9@mail.gmail.com> <48BD4DF9.50903@gmail.com> Message-ID: We have no plan to change the lists functions to be automatically parallell under the hood by spawning of the execution into several Erlang processes. We can not detect in runtime by automatic if it pays off to be parallell for e.g. a lists:map. If it pays off depend on many factors such as size of input list, current number of processes in the system etc. For example if we have a telecom system where each "call" is represented as one or several Erlang processes and the system supports 10 000 simultaneous calls then there would be no point trying to parallellize a lists:map which possibly might be performed by many of these "call" processes at the same time. Therefore we intend to leave it to the programmer to be explicit about parallellism. We can do this by adding new functions in lists or in a new module, functions like pmap, psort etc. /Kenneth Erlang/OTP team, Ericsson On Tue, Sep 2, 2008 at 4:30 PM, Mats Cronqvist wrote: > Hynek Vychodil wrote: >> >> >> On Tue, Sep 2, 2008 at 12:21 PM, Mats Cronqvist >> > wrote: >> >> Hynek Vychodil wrote: >> >> I'm not sure if it is good idea at all. If F function is very >> cheap and result or parameter is large (copy of it is more >> expensive in comparison to F expense) parallel version of pmap >> can be slower than serial version even many cores is used. >> Developer should be able control size of parallelized bunch >> and switch off parallel process fully. For example pmap(fun(X) >> -> [0|X] end, [lists:seq(1,1000000)]) is really bad idea and I >> will not be happy if lists:map will be changed to pmap >> automatically at default ;-) >> >> regardless of how the OTP libs behaves, it will always be >> possible to find some case for which it performs badly. the >> question is what the *default* behavior should be. >> it seems obvious to me that the target for the OTP libs should be >> non-trivial calculations on multi-core machines. motivation; >> >> >> Lists module is component of stdlibs which is OTP library/aplication >> so I can't be agree with you. Lists is often used and lists should >> behave nice in normal usage. > > define "normal." > >> Change lists:map to anything other than current is bad. There are OTP >> libs which could not be performace beaters as gen_server, gen_fsm and >> other, but there are OTP libraries which should be. For example stlib! >> I guess you forgot that stdlib is OTP library too. > > well, now that you mention it, stdlib being part of OTP does sound > vaguely familiar. > alas, i still think the normal case should be optimized for multicore. > > mats > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From toby@REDACTED Tue Sep 2 17:31:29 2008 From: toby@REDACTED (Toby Thain) Date: Tue, 2 Sep 2008 12:31:29 -0300 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BCF480.4010105@gmail.com> References: <48BCEE7F.7080104@gmail.com> <14f0e3620809020052x5c05b9a5s6a3f8ab5177e0a89@mail.gmail.com> <48BCF480.4010105@gmail.com> Message-ID: <2B8E837F-99E6-45B0-8F1B-24E65665A5E7@telegraphics.com.au> On 2-Sep-08, at 5:08 AM, Mats Cronqvist wrote: > Gleb Peregud wrote: >> Maybe it is good idea to include something like >> http://code.google.com/p/plists/ into Erlang/OTP? It will probably >> introduce more less tuned software created by developers, but it will >> make programming multi-core systems much more easier and fun for >> beginners. > in an ideal world, all the basic OTP libs should be rewritten to be > parallel. who gives an expletive if it's 10% slower on a single core > machine? Well said! --Toby From bekesa@REDACTED Tue Sep 2 17:41:48 2008 From: bekesa@REDACTED (Andras Georgy Bekes) Date: Tue, 02 Sep 2008 17:41:48 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: References: <48BD4DF9.50903@gmail.com> Message-ID: <200809021741.48654.bekesa@sch.bme.hu> > We can not detect in runtime by automatic if it pays off to be > parallell for e.g. a lists:map. To conclude what you've said: With Erlang, better efficiency is often not shorter execution time of a function call, but less additional CPU load generated by the function call, i.e. the total CPU time spent. Therefore, I think making for example lists:map parallel by default is a bad idea. Georgy From erlang-questions_efine@REDACTED Tue Sep 2 19:09:56 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Tue, 2 Sep 2008 13:09:56 -0400 Subject: [erlang-questions] Parallelism, SMP, and multicore question Message-ID: <6c2563b20809021009n3f9619d9h4c439a3a64393c84@mail.gmail.com> Since the cognoscenti are talking about parallelism, maybe someone can answer something that has been perplexing me. Sometimes it has been measurably faster on a multicore system to run one VM per core, each with SMP disabled (or +S 1), than it is to run one or more SMP VMs. This is true even when running code that is innately parallel. On the other hand, I have seen benchmarks that show near-linear speedups using SMP. I don't have code to support this; it's just something I, along with a couple of other people -- for whom I don't want to speak -- have noticed in passing. Does anyone have any insight into the internals of SMP who can tell me when SMP might be an asset, and when a liability? I know this is a "how long is a piece of string" question, but even though it's pretty general, someone somewhere who really knows Erlang inside out (i.e. not me) must surely have encountered this phenomenon. Are there conditions where contention between the threads of the SMP processes (e.g. mutexes) becomes significant enough that multiple separate non-SMP VMs perform better? If so, what would those conditions be? Could it have anything to do with the mix of CPU-bound processes and inter-process messaging or network I/O? If so, please could someone explain the mechanism? Anyone? -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin@REDACTED Tue Sep 2 18:19:35 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Tue, 2 Sep 2008 09:19:35 -0700 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BCF3BC.4080101@gmail.com> References: <48BCEE7F.7080104@gmail.com> <48BCF018.10101@ericsson.com> <48BCF3BC.4080101@gmail.com> Message-ID: On Sep 2, 2008, at 1:05 AM, Mats Cronqvist wrote: >> >> Of course, as pioneered by Robert Virding, we can still >> catch the results this way, if we want to, and we >> probably do want to, to make sure that printouts appear >> in the expected order: >> The slave does exit(Result), and the collector does >> receive {'DOWN',_,_,_,Result}. > > being an Aspiring Architecture Astronaut i didn't actually look at > the problem spec... > i guess you mean that the main/1 function should be rewritten as a > collector? The problem spec doesn't actually require a specific output, or ordering of that output. But, the shootout maintainers have a history of changing the rules retroactively, so it does seem like a good idea to try to keep the same order. -kevin From igouy2@REDACTED Tue Sep 2 21:14:21 2008 From: igouy2@REDACTED (Isaac Gouy) Date: Tue, 2 Sep 2008 12:14:21 -0700 (PDT) Subject: [erlang-questions] Parallel Shootout & a style question Message-ID: <572771.27464.qm@web65411.mail.ac4.yahoo.com> On Tue, Sep 2, 2008 at 6:19 PM, Kevin Scaldeferri wrote: > The problem spec doesn't actually require a specific output, or > ordering of that output. Every problem spec begins with an explicit demand that you diff program output with a provided expected output file - which does seem awfully like requiring a specific output. > But, the shootout maintainers have a history > of changing the rules retroactively, so it does seem like a good idea > to try to keep the same order. The maintainers have a proud history of changing the rules retroactively - some people like to characterise that kind of behaviour as learning from your mistakes. From kevin@REDACTED Tue Sep 2 22:50:26 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Tue, 2 Sep 2008 13:50:26 -0700 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <572771.27464.qm@web65411.mail.ac4.yahoo.com> References: <572771.27464.qm@web65411.mail.ac4.yahoo.com> Message-ID: <733CDC94-6D06-47CE-8576-1AD012243AC1@scaldeferri.com> On Sep 2, 2008, at 12:14 PM, Isaac Gouy wrote: > On Tue, Sep 2, 2008 at 6:19 PM, Kevin Scaldeferri wrote: > >> The problem spec doesn't actually require a specific output, or >> ordering of that output. > > Every problem spec begins with an explicit demand that you diff > program > output with a provided expected output file - which does seem awfully > like requiring a specific output. Kinda, although the wording makes it sounds more like "don't submit broken code" than "you must output this exactly" to me. Anyway, my latest version keeps the same ordering, so it's a moot point. > > > >> But, the shootout maintainers have a history >> of changing the rules retroactively, so it does seem like a good idea > >> to try to keep the same order. > > The maintainers have a proud history of changing the rules > retroactively - some people like to characterise that kind of > behaviour > as learning from your mistakes. And some people have other opinions ;-) -kevin From barrye@REDACTED Wed Sep 3 00:18:53 2008 From: barrye@REDACTED (Barry Ezell) Date: Tue, 2 Sep 2008 18:18:53 -0400 Subject: [erlang-questions] Request for comment or contributions Message-ID: <4b7f3e3c0809021518u2eb45458rbf1190e4cb3d2586@mail.gmail.com> Hello all, I'm new to this list and language and am trying to get up to speed fast. My goal is to give a talk on concurrent processing in Erlang to BarCamp Tampa (an "unconference") in about six weeks. I've chosen as an example the problem of cracking MD5 passwords. My initial program appears to be running correctly but I'm sure it could be more efficient. I would welcome any and all comments or contributions to the code. The source is publicly available on GitHub at: git clone git://github.com/btedev/erlang_md5crack.git Thank you for your time, Barry From igouy2@REDACTED Wed Sep 3 00:27:37 2008 From: igouy2@REDACTED (Isaac Gouy) Date: Tue, 2 Sep 2008 15:27:37 -0700 (PDT) Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <733CDC94-6D06-47CE-8576-1AD012243AC1@scaldeferri.com> Message-ID: <238276.8203.qm@web65414.mail.ac4.yahoo.com> --- Kevin Scaldeferri wrote: > > On Sep 2, 2008, at 12:14 PM, Isaac Gouy wrote: > > > On Tue, Sep 2, 2008 at 6:19 PM, Kevin Scaldeferri wrote: > > > >> The problem spec doesn't actually require a specific output, or > >> ordering of that output. > > > > Every problem spec begins with an explicit demand that you diff > > program > > output with a provided expected output file - which does seem > awfully > > like requiring a specific output. > > Kinda, although the wording makes it sounds more like "don't submit > broken code" than "you must output this exactly" to me. Anyway, my > latest version keeps the same ordering, so it's a moot point. How can diff tell us that there is broken code if it isn't the case that "you must output this exactly"? > >> But, the shootout maintainers have a history > >> of changing the rules retroactively, so it does seem like a good > idea > > > >> to try to keep the same order. > > > > The maintainers have a proud history of changing the rules > > retroactively - some people like to characterise that kind of > > behaviour > > as learning from your mistakes. > > And some people have other opinions ;-) People tend to have opinions, some justifiable some less so. The alternatives seem to be: - never make a mistake - make mistakes but don't fix them - make mistakes and fix them. Would you really prefer that we simply didn't fix the mistakes we make with the rules? From ok@REDACTED Wed Sep 3 01:49:17 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 3 Sep 2008 11:49:17 +1200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <19488_1220344252_m828Ukmp000870_48BCF785.60804@ericsson.com> References: <48BCEE7F.7080104@gmail.com> <14f0e3620809020052x5c05b9a5s6a3f8ab5177e0a89@mail.gmail.com> <48BCF480.4010105@gmail.com> <19488_1220344252_m828Ukmp000870_48BCF785.60804@ericsson.com> Message-ID: <4865F5F4-047A-4E4A-8ABF-28152A9CC614@cs.otago.ac.nz> On 2 Sep 2008, at 8:21 pm, Ulf Wiger (TN/EAB) wrote: > However, if the library functions perform a lightweight > check and pick the parallel version only if SMP is enabled, > we're not talking 10%. Seems to me that the "lightest weight" way to do this is at load time. Suppose there is a directory D where the loader looks for BEAM files. Then give it two subdirectories D/SMP/ for SMP-optimised versions D/UNI/ for uniprocessor-optimised versions D/ for code that doesn't care. An SMP-enabled loader looking for x.beam first looks for D/SMP/x.beam then D/x.beam; an SML-disabled one looks first for D/UNI/x.beam then D/x.beam. Come to think of it, this is pretty much how Solaris handles the 64-bit -vs- 32-bit libraries issue, use the same name but look in different directories. However, I must say that I have a hard time believing in any of this for Erlang. We should not be looking for ways to cope with an overhead of 10% but for ways to reduce it to the point where it isn't worth our time fussing about it. > > > erlang:system_info(smp_support) -> boolean() > > seems to hit the spot. But what does "SMP" mean? Do we really expect that the performance tradeoffs will be *exactly* the same for dual-core Pentiums, dual quad-core Pentiums, SPARC T3s, Tilera processors, ... all sorts of machines with varying inter-cpu costs and above all different memory subsystems? > Perhaps an alias, like smp() -> boolean() could ease > the strain on our eyes and prevent carpal-tunnel > syndrome: > > map(F, L) when smp() -> pmap(F, L); > map(F, L) -> > [F(X) || X <- L]. But if - F sends or receives messages, or - F reads or writes the process dictionary, or - other things I'm sure you can imagine these two have DIFFERENT SEMANTICS. The decision between them is not a matter of whether SMP is supported or not, but of what the programmer *means*. In cases where the two compute the same result, the right choice might well depend on what *other* parallelism is happening. From ok@REDACTED Wed Sep 3 01:52:16 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 3 Sep 2008 11:52:16 +1200 Subject: [erlang-questions] : ./configure In-Reply-To: <5285_1220344588_m828aMoB006066_20080902082528.GA5561@erix.ericsson.se> References: <2579549.8331220315571545.JavaMail.root@ly.sdf.com> <5285_1220344588_m828aMoB006066_20080902082528.GA5561@erix.ericsson.se> Message-ID: <7C6DC9C3-E7E9-499E-BBE7-0DF8E56A0384@cs.otago.ac.nz> On 2 Sep 2008, at 8:25 pm, Raimo Niskanen wrote: > uname -a > cat '/etc/*release*' > echo $PATH > echo $LD_LIBRARY_PATH > env My SPARC has an /etc/release. I have an account on a Linux box which has an /etc/redhat-release. My Mac does not have any "release" file at all in /etc. But on all of them, '/etc/*release*' finds nothing because of the single quotes. Use cat /etc/*release* without the quotes. From kevin@REDACTED Wed Sep 3 02:20:13 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Tue, 2 Sep 2008 17:20:13 -0700 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <238276.8203.qm@web65414.mail.ac4.yahoo.com> References: <238276.8203.qm@web65414.mail.ac4.yahoo.com> Message-ID: <74249D31-E021-456D-82F0-BE7C68B02BD7@scaldeferri.com> On Sep 2, 2008, at 3:27 PM, Isaac Gouy wrote: > > --- Kevin Scaldeferri wrote: > >> >> On Sep 2, 2008, at 12:14 PM, Isaac Gouy wrote: >> >>> On Tue, Sep 2, 2008 at 6:19 PM, Kevin Scaldeferri wrote: >>> >>>> The problem spec doesn't actually require a specific output, or >>>> ordering of that output. >>> >>> Every problem spec begins with an explicit demand that you diff >>> program >>> output with a provided expected output file - which does seem >> awfully >>> like requiring a specific output. >> >> Kinda, although the wording makes it sounds more like "don't submit >> broken code" than "you must output this exactly" to me. Anyway, my >> latest version keeps the same ordering, so it's a moot point. > > How can diff tell us that there is broken code if it isn't the case > that "you must output this exactly"? Imagine a human, who is smarter than a computer, and can recognize the same lines of output rearranged. Seriously. If the rules are "must output this exactly" then say that. In general, the benchmark rules are underspecified. But, as I said before, moot point. The current submission maintains the same order of output. -kevin From peterdanielsmith@REDACTED Wed Sep 3 03:27:30 2008 From: peterdanielsmith@REDACTED (Peter Smith) Date: Tue, 2 Sep 2008 18:27:30 -0700 Subject: [erlang-questions] Getting 'ei' based driver programs to run in Windows? Message-ID: Help! I'm trying to write a simple driver program to communicate from Erlang to my own program. I've read the web page at http://www.trapexit.org/How_to_use_ei_to_marshal_binary_terms_in_port_programs and can pretty much follow the code (I'm very new to Erlang). After the obligatory compile, link, and "add a dot to the end of your line or 'erl' won't do anything" problems, I managed to get: 1. erlang to start my program 2. my program picks up the parameters (all seventeen bytes, plus length!) 3. my program makes the return object 4. my program writes the return object (all ten bytes, plus length!) The erlang sample program, though, doesn't ever seem to "get" the return object, and consequently just sits there. Any ideas? Is this supposed to work in windows? Is there a way, in the 'receive', to print out the actual bytes receieved? I'm using VS2005 and the most recent 5.6.3 Erlang binaries for windows. I've done other IPC-type programming before (for the old RS/1 statistical program and others), but this just stumps me: I hardly know where to begin. Thanks, Peter -------------- next part -------------- An HTML attachment was scrubbed... URL: From saleyn@REDACTED Wed Sep 3 04:28:31 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Tue, 02 Sep 2008 22:28:31 -0400 Subject: [erlang-questions] Getting 'ei' based driver programs to run in Windows? In-Reply-To: References: Message-ID: <48BDF64F.9080807@gmail.com> One very common cause of this in Windows programming is that you are not setting the binary mode on stdin/stdout file descriptors (this step is not necessary on UNIX). setmode(fileno(stdin), O_BINARY); setmode(fileno(stdout), O_BINARY); Serge Peter Smith wrote: > Help! > I'm trying to write a simple driver program to communicate from Erlang to my > own program. I've read the web page at > > http://www.trapexit.org/How_to_use_ei_to_marshal_binary_terms_in_port_programs > > and can pretty much follow the code (I'm very new to Erlang). After the > obligatory compile, link, and "add a dot to the end of your line or 'erl' > won't do anything" problems, I managed to get: > > 1. erlang to start my program > 2. my program picks up the parameters (all seventeen bytes, plus length!) > 3. my program makes the return object > 4. my program writes the return object (all ten bytes, plus length!) > > The erlang sample program, though, doesn't ever seem to "get" the return > object, and consequently just sits there. > > Any ideas? Is this supposed to work in windows? Is there a way, in the > 'receive', to print out the actual bytes receieved? I'm using VS2005 and > the most recent 5.6.3 Erlang binaries for windows. I've done other IPC-type > programming before (for the old RS/1 statistical program and others), but > this just stumps me: I hardly know where to begin. > > Thanks, > Peter > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ok@REDACTED Wed Sep 3 04:36:40 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 3 Sep 2008 14:36:40 +1200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <9696_1220398849_m82NekPf012021_238276.8203.qm@web65414.mail.ac4.yahoo.com> References: <9696_1220398849_m82NekPf012021_238276.8203.qm@web65414.mail.ac4.yahoo.com> Message-ID: <40EAAF6A-98F8-4D43-A7A4-68F895182001@cs.otago.ac.nz> On 3 Sep 2008, at 10:27 am, Isaac Gouy wrote: > People tend to have opinions, some justifiable some less so. > > The alternatives seem to be: > - never make a mistake > - make mistakes but don't fix them > - make mistakes and fix them. > > Would you really prefer that we simply didn't fix the mistakes we make > with the rules? There's a better alternative. Versioning. The criteria for version N of a problem remain what they were for all time. When you learn better, you release version N+1. What was a solution to version N as stated remains a solution for all time, but might not be a solution to version N+1. It is a basic principle of justice, after all, that you cannot make laws retroactively. There's a lovely line in Agatha Christie's "Crooked House" that goes something like He never actually broke the law, but somehow, after he found something, you had to have a law about it. From vik@REDACTED Wed Sep 3 06:51:50 2008 From: vik@REDACTED (Vik Olliver) Date: Wed, 03 Sep 2008 16:51:50 +1200 Subject: [erlang-questions] Making rpc calls from escript In-Reply-To: <6c2563b20808312242m1a4f3fd7u2de050efeb72f895@mail.gmail.com> References: <1220243563.7440.47.camel@localhost> <1220246111.7440.51.camel@localhost> <6c2563b20808312242m1a4f3fd7u2de050efeb72f895@mail.gmail.com> Message-ID: <1220417510.7952.48.camel@localhost> Edwin, I did try that bash script. As it was, it tried to use a fully-qualified name because my host used erms@REDACTED as its erlang node name and the algorithm thinks a dotted quad is an fqdn :) So I hack der code a bit. Got a more interesting error: ./erlrunner.sh erms@REDACTED {"init terminating in do_boot",{{badmatch,{error,{1,erl_parse,["syntax error before: ","168.150"]}}},[{init,start_it,1},{init,start_em,1}]}} I'll ponder that as I fly back home. Vik :v) On Mon, 2008-09-01 at 01:42 -0400, Edwin Fine wrote: > Instead of escript, you could try something like this: > > #!/bin/sh > if [ -z $1 ]; then > echo "Usage: $0 erlang-node-name" > exit 1 > fi > .... From gphilip.newsgroups@REDACTED Wed Sep 3 10:25:31 2008 From: gphilip.newsgroups@REDACTED (Geevarghese Philip) Date: Wed, 3 Sep 2008 13:55:31 +0530 Subject: [erlang-questions] fprof doubts Message-ID: Hi, I used fprof to profile my code. I got an analysis report, but I am confused about a couple of things in the report: a) There is not much information about /my/ functions in the report : it is mostly about the underlying Erlang library functions. While I expect that most of the work is done by the libraries, my own functions are the gateways (so to speak) to these library functions, so they should appear in the profile with large ACC numbers against them, but this doesn't happen. Wherever my functions appear, they have very small numbers against them, and only in /two/ places do they occur with a % against them -- which indicates that the information is about calls to these functions. b) I checked every instance in the report where the module name is "graphs" (my module). Everywhere the function reported is a fun. Why isn't the parent function reported at all? c) In nearly every block of information, there is an entry named "undefined" with large numbers against it. What does this mean? Could these be because I have not invoked/named my functions in some specified manner? Thanks, Philip -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenji.rikitake@REDACTED Wed Sep 3 11:28:01 2008 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Wed, 3 Sep 2008 18:28:01 +0900 Subject: [erlang-questions] Setting up Erlang R12B3 ssl-3.9 inet_ssl distribution (Re: Erlang R12B3 inet_ssl_dist does not work with ssl-3.9) In-Reply-To: <20080824040300.GA78691@k2r.org> References: <20080823081636.GA63811@k2r.org> <20080824040300.GA78691@k2r.org> Message-ID: <20080903092801.GA82392@k2r.org> In the message <20080824040300.GA78691@REDACTED> dated Sun, Aug 24, 2008 at 01:02:37PM +0900, Kenji Rikitake writes: > I have been trying many times to start Erlang SSL distribution on R12B3 > with ssl-3.9, which hasn't been successful. > I'm running Erlang VM on FreeBSD 6.3-RELEASE. I finally found out that setting the client/server key pairs of inet_ssl_dist solved the problem, which was written at: http://www.trapexit.org/forum/viewtopic.php?p=22404#22404 I had to build client/server self-signed keys as written in: http://sial.org/howto/openssl/self-signed/ So the real problems were: * ssl-3.9 manual Chapter 5 does not represent the R12B3 implementation difference. In R12B3: * In creating start_ssl.boot as described in ssl-3.9 manual section 5.2, two warnings remain: 1> systools:make_script("start_ssl",[]). *WARNING* ssl: Source code not found: ssl_pkix_oid.erl *WARNING* ssl: Source code not found: 'OTP-PKIX'.erl ok To suppress the warning messages, creating symbolic links worked: (cd $ERLANG_TOP/lib/ssl-3.9/src; ln -s ../pkix/OTP-PKIX.erl; ln -s ../pkix/ssl_pkix_oid.erl;) * Even after the boot script is built, ssl_server is not registered, which is supposed to be, as described in ssl manual Section 5.2. This is due to ssl-3.9 implementation; to invoke ssl_server, do ssl:version() so that the version number tuple like following returns: {ok,{"3.9","OpenSSL 0.9.7e-p1 25 Oct 2004", "OpenSSL 0.9.7e-p1 25 Oct 2004"}} * The starting sequence written in Section 5.5 is *mandatory* to start up the Erlang Shell with inet_ssl distribution. Specifically, the server_certfile and client_certfile options of -ssl_dist_opt are *required*; otherwise, the shell will not start. A startup script example is: erl -boot /my/dir1/start_ssl \ -proto_dist inet_ssl \ -name a1 \ -ssl_dist_opt server_certfile \ /my/certs/host.pem \ -ssl_dist_opt client_certfile \ /my/certs/host.pem \ -ssl_dist_opt verify 1 depth 1 * Summary: the Section 5 of the manual of ssl-3.9 has to be fixed up-to-date to represent the implementation difference. (Yes, I tcpdump'ed the packets, and the exchange between two inet_ssl hosts were actually encrypted :-)) Regards, Kenji Rikitake From raimo+erlang-questions@REDACTED Wed Sep 3 11:32:23 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 3 Sep 2008 11:32:23 +0200 Subject: [erlang-questions] fprof doubts In-Reply-To: References: Message-ID: <20080903093223.GA15669@erix.ericsson.se> On Wed, Sep 03, 2008 at 01:55:31PM +0530, Geevarghese Philip wrote: > Hi, > > I used fprof to profile my code. I got an analysis report, but I am confused > about a couple of things in the report: > > a) There is not much information about /my/ functions in the report : it > is mostly about the underlying Erlang library functions. While I expect that > most of the work is done by the libraries, my own functions are the gateways > (so to speak) to these library functions, so they should appear in the > profile with large ACC numbers against them, but this doesn't happen. > Wherever my functions appear, they have very small numbers against them, and > only in /two/ places do they occur with a % against them -- which indicates > that the information is about calls to these functions. > > b) I checked every instance in the report where the module name is "graphs" > (my module). Everywhere the function reported is a fun. Why isn't the parent > function reported at all? > > c) In nearly every block of information, there is an entry named "undefined" > with large numbers against it. What does this mean? Can you give an example? 'undefined' is an unknown or undefined function. E.g when you spawn a new process the caller of the first function is 'undefined'. > Could these be because I have not invoked/named my functions in some > specified manner? Yes, probably. How _did_ you trace? fprof:apply(graph, func, [arg]) or fprof:trace(start), graph:func(arg), fprof:trace(stop), or fprof:trace(start), %wait a while fprof:trace(stop), on a running system hoping to catch something interesting, or? > > Thanks, > Philip > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From mats.cronqvist@REDACTED Wed Sep 3 11:43:44 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Wed, 03 Sep 2008 11:43:44 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <200809021741.48654.bekesa@sch.bme.hu> References: <48BD4DF9.50903@gmail.com> <200809021741.48654.bekesa@sch.bme.hu> Message-ID: <48BE5C50.70208@gmail.com> Andras Georgy Bekes wrote: >> We can not detect in runtime by automatic if it pays off to be >> parallell for e.g. a lists:map. >> > To conclude what you've said: > With Erlang, better efficiency is often not shorter execution time of a > function call, but less additional CPU load generated by the function > call, i.e. the total CPU time spent. > in the near future, we'll be using CPU's with 100's or 1000's of cores. see e.g. this; http://www.sics.se/multicore08_abstracts_bios on such hardware, it'll be (almost) completely uninteresting how much CPU time we spend. the important thing will be to parallelize everything, and we can take for granted that parallel execution will "pay off". software technologies that doesn't makes this happen under the hood will be the COBOL of 2010's. mats From gphilip.newsgroups@REDACTED Wed Sep 3 12:15:26 2008 From: gphilip.newsgroups@REDACTED (Geevarghese Philip) Date: Wed, 3 Sep 2008 15:45:26 +0530 Subject: [erlang-questions] fprof doubts In-Reply-To: <20080903093223.GA15669@erix.ericsson.se> References: <20080903093223.GA15669@erix.ericsson.se> Message-ID: On 9/3/08, Raimo Niskanen > wrote: > > > > c) In nearly every block of information, there is an entry named > "undefined" > > with large numbers against it. What does this mean? > > > Can you give an example? Here is one: {[{undefined, 156757, 7629.458, 997.459}, {{digraph,out_neighbours,2}, 63, 0.000, 0.368}], { {digraph,out_neighbours,2}, 156820, 7629.458, 997.827}, % [{{digraph,collect_elems,3}, 156820, 5907.714, 471.786}, {{ets,lookup,2}, 156820, 660.148, 660.148}, {garbage_collect, 85, 58.944, 58.944}, {suspend, 353, 4.233, 0.000}, {{digraph,in_neighbours,2}, 8, 0.343, 0.044}, {{lists,dropwhile,2}, 3, 0.218, 0.010}, {{lists,filter,2}, 1, 0.031, 0.006}, {{digraph,out_neighbours,2}, 63, 0.000, 0.368}]}. Every module listed above is from the Erlang distribution. > Could these be because I have not invoked/named my functions in some > > specified manner? > > Yes, probably. How _did_ you trace? At the erl prompt : > fprof:apply(graphs_test, test_run, [300, 3, 1, false], [file]). > fprof:profile([file, {dump, []}]). > fprof:analyse([{dest, []}, totals]). Now look at the file "fprof.analysis" . Thanks, Philip -------------- next part -------------- An HTML attachment was scrubbed... URL: From o.j.mason@REDACTED Wed Sep 3 12:23:40 2008 From: o.j.mason@REDACTED (Oliver Mason) Date: Wed, 3 Sep 2008 11:23:40 +0100 Subject: [erlang-questions] String/List question Message-ID: <73768eac0809030323p7820dadbi4c1ee380739ac9e2@mail.gmail.com> Hi, I'm currently working on a module to parse/generate YAML files in Erlang. The parsing bit is fine for lists and maps, but with the generation bit (which I though ought to be easier) I have a problem, and I don't know if there's a solution. When looking at a list I would usually write each element out separately, and recursively in the case of embedded lists. However, as strings are lists, they get written out as lists of numbers. Which for pure serialisation would not be a problem, but if you want to edit the file by hand, or exchange it with a non-Erlang system, then it becomes a real problem. Do I need to abandon this, and go for something like {string. "This is a string"} to represent strings? I'd rather not, as it breaks compatibility with the standard library modules, but I cannot easily think of a way to distinguish between strings and lists of numbers in the ASCII letter ranges. Any ideas? Thanks, Oliver From gleber.p@REDACTED Wed Sep 3 12:29:57 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 3 Sep 2008 12:29:57 +0200 Subject: [erlang-questions] String/List question In-Reply-To: <73768eac0809030323p7820dadbi4c1ee380739ac9e2@mail.gmail.com> References: <73768eac0809030323p7820dadbi4c1ee380739ac9e2@mail.gmail.com> Message-ID: <14f0e3620809030329k7b45ebc0i1696c5a6f3474de3@mail.gmail.com> On Wed, Sep 3, 2008 at 12:23 PM, Oliver Mason wrote: > Hi, > > I'm currently working on a module to parse/generate YAML files in > Erlang. The parsing bit is fine for lists and maps, but with the > generation bit (which I though ought to be easier) I have a problem, > and I don't know if there's a solution. > > When looking at a list I would usually write each element out > separately, and recursively in the case of embedded lists. However, > as strings are lists, they get written out as lists of numbers. Which > for pure serialisation would not be a problem, but if you want to edit > the file by hand, or exchange it with a non-Erlang system, then it > becomes a real problem. > > Do I need to abandon this, and go for something like {string. "This is > a string"} to represent strings? I'd rather not, as it breaks > compatibility with the standard library modules, but I cannot easily > think of a way to distinguish between strings and lists of numbers in > the ASCII letter ranges. > > Any ideas? > > Thanks, > Oliver > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > That's just an idea You can use binaries for strings. Though you have to decide to use consistent encoding (like UTF-8) all over the place, and to check if YAML says anything about it. -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From kenji.rikitake@REDACTED Wed Sep 3 13:28:28 2008 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Wed, 3 Sep 2008 20:28:28 +0900 Subject: [erlang-questions] New Book "Erlang Programming" from O'Reilly Message-ID: <20080903112828.GA85104@k2r.org> Erlang Programming by Francesco Cesarini and Simon Thompson to be published on December 2008 http://www.amazon.com/dp/0596518188 (Anybody found the www.oreilly.com link? I didn't.) I'm looking forward to reading the book soon. (I've already preordered it at amazon.co.jp.) Kenji Rikitake From chsu79@REDACTED Wed Sep 3 13:52:16 2008 From: chsu79@REDACTED (Christian) Date: Wed, 3 Sep 2008 13:52:16 +0200 Subject: [erlang-questions] New Book "Erlang Programming" from O'Reilly In-Reply-To: <20080903112828.GA85104@k2r.org> References: <20080903112828.GA85104@k2r.org> Message-ID: On Wed, Sep 3, 2008 at 1:28 PM, Kenji Rikitake wrote: > (Anybody found the www.oreilly.com link? I didn't.) No, and I would really like to see a table of contents to understand the direction it takes. From bgustavsson@REDACTED Wed Sep 3 14:17:48 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Wed, 3 Sep 2008 14:17:48 +0200 Subject: [erlang-questions] Erlang/OTP R12B-4 has been released Message-ID: <6672d0160809030517p6857f567yfe44d264d516aa7@mail.gmail.com> Bug fix release : otp_src_R12B-4 Build date : 2008-09-03 This is bug fix release 4 for the R12B release. You can find the README file for the release at http://www.erlang.org/download/otp_src_R12B-4.readme The source distribution and binary distribution for Windows can be downloaded from http://www.erlang.org/download/otp_src_R12B-4.tar.gz http://www.erlang.org/download/otp_win32_R12B-4.exe The distribution can also be downloaded using the BitTorrent protocol. Use the following torrent files to download the source distribution and binary distribution for Windows: http://www.erlang.org/download/otp_src_R12B-4.tar.gz.torrent http://www.erlang.org/download/otp_win32_R12B-4.exe.torrent Note: To unpack the TAR archive you need a GNU TAR compatible program. For installation instructions please read the README file that is part of the distribution. The on-line documentation can be found at: http://www.erlang.org/doc/ You can also download the complete HTML documentation or the Unix manual files http://www.erlang.org/download/otp_doc_html_R12B-4.tar.gz http://www.erlang.org/download/otp_doc_man_R12B-4.tar.gz We also want to thank those that sent us patches, suggestions and bug reports, The OTP Team -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimo+erlang-questions@REDACTED Wed Sep 3 14:34:47 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 3 Sep 2008 14:34:47 +0200 Subject: [erlang-questions] : fprof doubts In-Reply-To: References: <20080903093223.GA15669@erix.ericsson.se> Message-ID: <20080903123447.GA18929@erix.ericsson.se> On Wed, Sep 03, 2008 at 03:45:26PM +0530, Geevarghese Philip wrote: > On 9/3/08, Raimo Niskanen > > > wrote: > > > > > > > c) In nearly every block of information, there is an entry named > > "undefined" > > > with large numbers against it. What does this mean? > > > > > > Can you give an example? > > > Here is one: > > {[{undefined, 156757, 7629.458, 997.459}, > {{digraph,out_neighbours,2}, 63, 0.000, 0.368}], > { {digraph,out_neighbours,2}, 156820, 7629.458, 997.827}, % > [{{digraph,collect_elems,3}, 156820, 5907.714, 471.786}, > {{ets,lookup,2}, 156820, 660.148, 660.148}, > {garbage_collect, 85, 58.944, 58.944}, > {suspend, 353, 4.233, 0.000}, > {{digraph,in_neighbours,2}, 8, 0.343, 0.044}, > {{lists,dropwhile,2}, 3, 0.218, 0.010}, > {{lists,filter,2}, 1, 0.031, 0.006}, > {{digraph,out_neighbours,2}, 63, 0.000, 0.368}]}. > I see digraph:out_neighbours/2 calls itself and this is a typical case where Fprof might get confused since it can get a hard time figuring out which calls are tail recursive. Heuristics are used and sometimes it fails. > Every module listed above is from the Erlang distribution. > > > Could these be because I have not invoked/named my functions in some > > > specified manner? > > > > Yes, probably. How _did_ you trace? > > > At the erl prompt : > > > fprof:apply(graphs_test, test_run, [300, 3, 1, false], [file]). > > > fprof:profile([file, {dump, []}]). > > > fprof:analyse([{dest, []}, totals]). > > > Now look at the file "fprof.analysis" . Can you mail the "fprof.dump" and "fprof.analysis" files to me, if they are smaller than a Megabyte, or place them on a web server somewhere and send me the links? The graphs_test:test_run/4 function should be in the analysis file. > > > Thanks, > Philip > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From babo.online@REDACTED Wed Sep 3 15:17:30 2008 From: babo.online@REDACTED (Attila Babo) Date: Wed, 3 Sep 2008 15:17:30 +0200 Subject: [erlang-questions] Making rpc calls from escript In-Reply-To: <1220243563.7440.47.camel@localhost> References: <1220243563.7440.47.camel@localhost> Message-ID: <597c69660809030617k1481b6a3p8e8f96e2e42a7703@mail.gmail.com> On machine A epmd -daemon erl -name bill -setcookie TheSameCookie On machine B epmd -daemon #!/usr/bin/env escript main(_) -> ok = application:start(inets), {ok, _} = net_kernel:start([john]), true = auth:set_cookie('TheSameCookie'), io:format("Result: ~p~n", [ rpc:call('bill@REDACTED', erlang, time, []) ]). Please note, on machine B you must use a fully qualified domain name instead of the IP address and that must match with the resolved name on machine A. In a none production machine it's easier to use short names. From mats.cronqvist@REDACTED Wed Sep 3 15:59:25 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Wed, 03 Sep 2008 15:59:25 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BE684F.8080305@bigpond.net.au> References: <48BD4DF9.50903@gmail.com> <200809021741.48654.bekesa@sch.bme.hu> <48BE5C50.70208@gmail.com> <48BE684F.8080305@bigpond.net.au> Message-ID: <48BE983D.3000303@gmail.com> Benjamin Tolputt wrote: > Mats Cronqvist wrote: > >> in the near future, we'll be using CPU's with 100's or 1000's of >> cores. see e.g. this; >> >> http://www.sics.se/multicore08_abstracts_bios >> >> on such hardware, it'll be (almost) completely uninteresting how much >> CPU time we spend. the important thing will be to parallelize >> everything, and we can take for granted that parallel execution will >> "pay off". software technologies that doesn't makes this happen under >> the hood will be the COBOL of 2010's. >> >> > The issue is that taking the direction you suggest *right now* will have > the effect of making Erlang slower for most tasks on most platforms it > is currently deployed on. Will it? I doubt it would make a realistic application (e.g. a phone switch) significantly slower even on single core HW. Perhaps you're aware of some measurement that would prove me wrong? regardless, the only way to surf on Moore's Law is to parallelize. parallelizing should be made under the hood. and, frankly, i'm unimpressed by people who care about 10% effects on CPU time but are unwilling to move to multicore HW. mats From imre@REDACTED Wed Sep 3 16:27:23 2008 From: imre@REDACTED (Imre Palik) Date: Wed, 3 Sep 2008 17:27:23 +0300 Subject: [erlang-questions] Erlang vs IO Message-ID: <3BE6DBA1F3BE9D4798255806113D56540F75FE28D4@utx-exchange.utx.local> Hi, It is me messing up something, or the IO in erlang is quite slow? I run the following program on a largish file: -module(intest). -export([run/0]). problem_loop(0, _, Acc) -> io:fwrite("~w~n", [Acc]), void; problem_loop(I, D, A) -> {ok, [V]} = io:fread([], "~d"), if 0 == V rem D -> problem_loop(I - 1, D, A + 1); true -> problem_loop(I - 1, D, A) end. run() -> {ok, [Iter, Div]} = io:fread([], "~d ~d"), problem_loop(Iter, Div, 0). Then both of my cores started to run at 100%, which I find weird in itself with an IO bound problem. Also, I compared the runtime with the following program written in scheme #!/usr/bin/guile -s !# (define (intest iter div acc) (if (= iter 0) (display acc) (if (= 0 (remainder (read) div)) (intest (- iter 1) div (+ acc 1)) (intest (- iter 1) div acc)))) (intest (read) (read) 0) The scheme implementation was 10 times as fast as the erlang, and it only used one of the cores. How can I get a decent IO performance out of erlang? Am I making some mistakes in my erlang code? Should I upgrade my erlang system? (I am running R12B on windows) Thx. ImRe From sebastian.bello@REDACTED Wed Sep 3 14:59:31 2008 From: sebastian.bello@REDACTED (Sebastian Bello) Date: Wed, 03 Sep 2008 09:59:31 -0300 Subject: [erlang-questions] Executing an Erlang function from Perl Message-ID: <48BE8A33.6080608@inswitch.us> Hi list, I need to execute an Erlang function from within Perl code, what do you suggest? Thanks, Sebastian- From bengt.kleberg@REDACTED Wed Sep 3 17:05:44 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 03 Sep 2008 17:05:44 +0200 Subject: [erlang-questions] Executing an Erlang function from Perl In-Reply-To: <48BE8A33.6080608@inswitch.us> References: <48BE8A33.6080608@inswitch.us> Message-ID: <1220454344.7805.32.camel@seasc0918.dyn.rnd.as.sw.ericsson.se> Really simple (slow?): escript There was a more complex method (faster?) that called an already running erlang node, but I have mislaid my notes about it. bengt On Wed, 2008-09-03 at 09:59 -0300, Sebastian Bello wrote: > Hi list, > > I need to execute an Erlang function from within Perl code, what do you > suggest? > Thanks, > Sebastian- > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From bengt.kleberg@REDACTED Wed Sep 3 17:09:08 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 03 Sep 2008 17:09:08 +0200 Subject: [erlang-questions] Erlang vs IO In-Reply-To: <3BE6DBA1F3BE9D4798255806113D56540F75FE28D4@utx-exchange.utx.local> References: <3BE6DBA1F3BE9D4798255806113D56540F75FE28D4@utx-exchange.utx.local> Message-ID: <1220454548.7805.36.camel@seasc0918.dyn.rnd.as.sw.ericsson.se> Greetings, If you are reading a file (as opposed to stdin) you can use file:read_file/2 (if you have enough RAM) or file:read/2 (after using the flag 'raw' when doing file:open/2). bengt On Wed, 2008-09-03 at 17:27 +0300, Imre Palik wrote: > Hi, > > It is me messing up something, or the IO in erlang is quite slow? I run the following program on a largish file: > > -module(intest). > -export([run/0]). > > problem_loop(0, _, Acc) -> > io:fwrite("~w~n", [Acc]), > void; > problem_loop(I, D, A) -> > {ok, [V]} = io:fread([], "~d"), > if > 0 == V rem D -> > problem_loop(I - 1, D, A + 1); > true -> > problem_loop(I - 1, D, A) > end. > > > run() -> > {ok, [Iter, Div]} = io:fread([], "~d ~d"), > problem_loop(Iter, Div, 0). > > Then both of my cores started to run at 100%, which I find weird in itself with an IO bound problem. Also, I compared the runtime with the following program written in scheme > > #!/usr/bin/guile -s > !# > > (define (intest iter div acc) > (if (= iter 0) > (display acc) > (if (= 0 (remainder (read) div)) > (intest (- iter 1) div (+ acc 1)) > (intest (- iter 1) div acc)))) > > (intest (read) (read) 0) > > > The scheme implementation was 10 times as fast as the erlang, and it only used one of the cores. > > How can I get a decent IO performance out of erlang? Am I making some mistakes in my erlang code? Should I upgrade my erlang system? (I am running R12B on windows) > > Thx. > > ImRe > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From chandrashekhar.mullaparthi@REDACTED Wed Sep 3 17:11:52 2008 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 3 Sep 2008 16:11:52 +0100 Subject: [erlang-questions] Executing an Erlang function from Perl In-Reply-To: <48BE8A33.6080608@inswitch.us> References: <48BE8A33.6080608@inswitch.us> Message-ID: 2008/9/3 Sebastian Bello > Hi list, > > I need to execute an Erlang function from within Perl code, what do you > suggest? > Thanks, > Sebastian- Try 'erl -man erl_call' Extract from the man page: NAME erl_call - Call/Start a Distributed Erlang Node DESCRIPTION erl_call makes it possible to start and/or communicate with a dis- tributed Erlang node. It is built upon the erl_interface library as an example application. Its purpose is to use an Unix shell script to interact with a distributed Erlang node. It performs all communication with the Erlang rex server, using the standard Erlang RPC facility. It does not require any special software to be run at the Erlang target node. The main use is to either start a distributed Erlang node or to make an ordinary function call. However, it is also possible to pipe an Erlang module to erl_call and have it compiled, or to pipe a sequence of Erlang expressions to be evaluated (similar to the Erlang shell). Options, which cause stdin to be read, can be used with advantage as scripts from within (Unix) shell scripts. Another nice use of erl_call could be from (http) CGI-bin scripts. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hayeah@REDACTED Wed Sep 3 17:30:15 2008 From: hayeah@REDACTED (Howard Yeh) Date: Wed, 3 Sep 2008 08:30:15 -0700 Subject: [erlang-questions] New Book "Erlang Programming" from O'Reilly In-Reply-To: References: <20080903112828.GA85104@k2r.org> Message-ID: wow. an oreilly book for a functional language? a small step for oreilly, a big step for functional language to take over the world. : ) On Wed, Sep 3, 2008 at 4:52 AM, Christian wrote: > On Wed, Sep 3, 2008 at 1:28 PM, Kenji Rikitake wrote: >> (Anybody found the www.oreilly.com link? I didn't.) > > No, and I would really like to see a table of contents to understand > the direction it takes. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From pat.eyler@REDACTED Wed Sep 3 17:50:00 2008 From: pat.eyler@REDACTED (pat eyler) Date: Wed, 3 Sep 2008 09:50:00 -0600 Subject: [erlang-questions] New Book "Erlang Programming" from O'Reilly In-Reply-To: References: <20080903112828.GA85104@k2r.org> Message-ID: <6fd0654b0809030850i1bc123d4n4d298423a76819c7@mail.gmail.com> On Wed, Sep 3, 2008 at 9:30 AM, Howard Yeh wrote: > wow. an oreilly book for a functional language? > Actually, this is one of two (at least) that are in the works. The other one's a Haskell book. > a small step for oreilly, a big step for functional language to take > over the world. > > : ) > > On Wed, Sep 3, 2008 at 4:52 AM, Christian wrote: >> On Wed, Sep 3, 2008 at 1:28 PM, Kenji Rikitake wrote: >>> (Anybody found the www.oreilly.com link? I didn't.) >> >> No, and I would really like to see a table of contents to understand >> the direction it takes. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- thanks, -pate ------------------------- Duty makes us do things, Love make us do things well. http://on-ruby.blogspot.com http://on-erlang.blogspot.com http://on-soccer.blogspot.com From v-shtok@REDACTED Wed Sep 3 18:46:42 2008 From: v-shtok@REDACTED (Shigeru Tokubo (Mindsource)) Date: Wed, 3 Sep 2008 09:46:42 -0700 Subject: [erlang-questions] where to install Tsung Message-ID: Can tsung/erlang be installed on a third machine With the second machine being the client And the first machine being my server. I would execute everything from where tsung is installed Thanks Shig -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Wed Sep 3 22:37:19 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 3 Sep 2008 22:37:19 +0200 Subject: [erlang-questions] where to install Tsung In-Reply-To: References: Message-ID: <14f0e3620809031337r6be2f44evcf440177548e4207@mail.gmail.com> Probably it is possible. There are two "but": 1) Does tsung loads itself on it's slaves (are modules being transferred there) 2) Does tsung allows not to run "client" VM on the "controller"s VM machine If both answers are yes, it would be enough to install Erlang on the third and the second machine, install tsung on the third and specify the second machine as the only "client" in "tsung.xml". Probably I'll check this features tomorrow, I'll inform you if i did and whether it was successful. Best regards On 9/3/08, Shigeru Tokubo (Mindsource) wrote: > Can tsung/erlang be installed on a third machine > > With the second machine being the client > > And the first machine being my server. > > I would execute everything from where tsung is installed > > Thanks > > Shig > -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From atomly-erl@REDACTED Wed Sep 3 22:44:15 2008 From: atomly-erl@REDACTED (atomly) Date: Wed, 3 Sep 2008 16:44:15 -0400 Subject: [erlang-questions] NYC CouchDB meetup / talk In-Reply-To: References: Message-ID: <20080903204415.GC16945@atomly.com> [Chris Anderson ] > New York Couchers / Erlangers, I fully support this idea. Unfortunately, I'll be in Miami and LA from the 12th to the 22nd, but I think we should get this going soon. The longer we put it off, the more momentum we'll lose. -- :: atomly :: [ atomly@REDACTED : www.atomly.com ... [ atomiq records : new york city : +1.917.442.9450 ... [ e-mail atomly-news-subscribe@REDACTED for atomly info and updates ... From barrye@REDACTED Wed Sep 3 23:04:27 2008 From: barrye@REDACTED (Barry Ezell) Date: Wed, 3 Sep 2008 17:04:27 -0400 Subject: [erlang-questions] Request for comment or contributions Message-ID: <4b7f3e3c0809031404i3b37e2cdid12344e0e7f6d40@mail.gmail.com> In my request for comments post yesterday, I forgot to mention that the code can be viewed at the following URL without requiring a "git clone". http://github.com/btedev/erlang_md5crack/tree/master/pwd.erl Thanks again for any suggestions. From patrickdlogan@REDACTED Thu Sep 4 02:13:58 2008 From: patrickdlogan@REDACTED (Patrick Logan) Date: Wed, 3 Sep 2008 17:13:58 -0700 Subject: [erlang-questions] New Book "Erlang Programming" from O'Reilly Message-ID: My understanding from talking with Francesco about it briefly at OSCON is this book will be between the original thin book and Joe's recent book. I think the content draws a lot from their training experience. From ok@REDACTED Thu Sep 4 02:28:29 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 4 Sep 2008 12:28:29 +1200 Subject: [erlang-questions] New Book "Erlang Programming" from O'Reilly In-Reply-To: <31870_1220441959_m83BdFxO002299_20080903112828.GA85104@k2r.org> References: <31870_1220441959_m83BdFxO002299_20080903112828.GA85104@k2r.org> Message-ID: On 3 Sep 2008, at 11:28 pm, Kenji Rikitake wrote: > Erlang Programming > by Francesco Cesarini and Simon Thompson > to be published on December 2008 > http://www.amazon.com/dp/0596518188 > (Anybody found the www.oreilly.com link? I didn't.) I didn't find much about the book (as opposed to its authors) in that page. What does this book add to the old Erlang book and Joe's newer one? What is the intended audience? Is it going to tell _me_ anything I don't know about Erlang (and there is a huge amount of OTP I don't understand yet) or is it going to be a book that I'll want to give to students? From joseph.stewart@REDACTED Thu Sep 4 02:44:52 2008 From: joseph.stewart@REDACTED (Joseph Stewart) Date: Wed, 3 Sep 2008 20:44:52 -0400 Subject: [erlang-questions] New Book "Erlang Programming" from O'Reilly In-Reply-To: References: <31870_1220441959_m83BdFxO002299_20080903112828.GA85104@k2r.org> Message-ID: <2781f020809031744vb8a7cf5l31cfa76a4e2a6fcf@mail.gmail.com> On a vaguely related note... Are there any plans to re-release Joe's "Concurrent Programming in Erlang" (1996) or "free" part 2 of the document to the world? I'd love to have a copy but I'm unwilling to pay the current $235 US for a used copy. -joe On Wed, Sep 3, 2008 at 8:28 PM, Richard A. O'Keefe wrote: > > On 3 Sep 2008, at 11:28 pm, Kenji Rikitake wrote: > > > Erlang Programming > > by Francesco Cesarini and Simon Thompson > > to be published on December 2008 > > http://www.amazon.com/dp/0596518188 > > (Anybody found the www.oreilly.com link? I didn't.) > > > I didn't find much about the book (as opposed to its > authors) in that page. What does this book add to > the old Erlang book and Joe's newer one? What is the > intended audience? Is it going to tell _me_ anything > I don't know about Erlang (and there is a huge amount > of OTP I don't understand yet) or is it going to be a > book that I'll want to give to students? > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vlm@REDACTED Thu Sep 4 04:22:15 2008 From: vlm@REDACTED (Lev Walkin) Date: Wed, 03 Sep 2008 19:22:15 -0700 Subject: [erlang-questions] New Book "Erlang Programming" from O'Reilly In-Reply-To: <2781f020809031744vb8a7cf5l31cfa76a4e2a6fcf@mail.gmail.com> References: <31870_1220441959_m83BdFxO002299_20080903112828.GA85104@k2r.org> <2781f020809031744vb8a7cf5l31cfa76a4e2a6fcf@mail.gmail.com> Message-ID: <48BF4657.4020106@lionet.info> Joseph Stewart wrote: > On a vaguely related note... > > Are there any plans to re-release Joe's "Concurrent Programming in > Erlang" (1996) or "free" part 2 of the document to the world? > > I'd love to have a copy but I'm unwilling to pay the current $235 US for > a used copy. I paid little more than $100 for that book, try using Amazon's "suggest a price" feature. > -joe > > On Wed, Sep 3, 2008 at 8:28 PM, Richard A. O'Keefe > wrote: > > > On 3 Sep 2008, at 11:28 pm, Kenji Rikitake wrote: > > > Erlang Programming > > by Francesco Cesarini and Simon Thompson > > to be published on December 2008 > > http://www.amazon.com/dp/0596518188 > > (Anybody found the www.oreilly.com link? > I didn't.) > > > I didn't find much about the book (as opposed to its > authors) in that page. What does this book add to > the old Erlang book and Joe's newer one? What is the > intended audience? Is it going to tell _me_ anything > I don't know about Erlang (and there is a huge amount > of OTP I don't understand yet) or is it going to be a > book that I'll want to give to students? > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From dbyrne@REDACTED Thu Sep 4 04:37:40 2008 From: dbyrne@REDACTED (Dennis Byrne) Date: Wed, 3 Sep 2008 21:37:40 -0500 Subject: [erlang-questions] A whole bunch of implementation details Message-ID: Gave a presentation today to a very bright crowd. Lots of these people just wanted to ask questions rather than looks at slides. Here's a handful of questions I got, for which I was anywhere from half way to completely clueless on. Does a process get pinned to one OS thread for it's entire existence? What factors go into the VM's decision to pin a process to one OS thread or another? How do we prevent all the busiest processes from being tied to one OS level thread? How does stack memory grow? Am told Prolog does this dynamically and I was wondering if Erlang did the same. Does heap memory contract? Exactly what is the tipping point between what gets passed by value and what gets passed by reference? The large binary trick is common knowledge, any other corner cases? How does the VM differentiate between a node that is temporarily unresponsive and one that is down? In other words, at what point does a node give up on a peer? ____________________________________________ Dennis Byrne ThoughtWorks - Chicago http://notdennisbyrne.blogspot.com/ 312-505-7965 -------------- next part -------------- An HTML attachment was scrubbed... URL: From btolputt@REDACTED Wed Sep 3 12:34:55 2008 From: btolputt@REDACTED (Benjamin Tolputt) Date: Wed, 03 Sep 2008 20:34:55 +1000 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BE5C50.70208@gmail.com> References: <48BD4DF9.50903@gmail.com> <200809021741.48654.bekesa@sch.bme.hu> <48BE5C50.70208@gmail.com> Message-ID: <48BE684F.8080305@bigpond.net.au> Mats Cronqvist wrote: > in the near future, we'll be using CPU's with 100's or 1000's of > cores. see e.g. this; > > http://www.sics.se/multicore08_abstracts_bios > > on such hardware, it'll be (almost) completely uninteresting how much > CPU time we spend. the important thing will be to parallelize > everything, and we can take for granted that parallel execution will > "pay off". software technologies that doesn't makes this happen under > the hood will be the COBOL of 2010's. > The issue is that taking the direction you suggest *right now* will have the effect of making Erlang slower for most tasks on most platforms it is currently deployed on. I agree that, in the future (near or far is debatable), Erlang is best situated to take advantage of the surplus of CPU power available from many-core systems. At that time, it would be advantageous to make have the OTP make parralel a substantial number of it's list comprehensions. As of *right now* however, we're looking at deployment on single, dual, & quad cores mostly. At this point, we DO need to consider the total CPU dedicated to the task. --Ben From atomly-erl@REDACTED Thu Sep 4 06:55:18 2008 From: atomly-erl@REDACTED (atomly) Date: Thu, 4 Sep 2008 00:55:18 -0400 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BE684F.8080305@bigpond.net.au> References: <48BD4DF9.50903@gmail.com> <200809021741.48654.bekesa@sch.bme.hu> <48BE5C50.70208@gmail.com> <48BE684F.8080305@bigpond.net.au> Message-ID: <20080904045518.GD16945@atomly.com> [Benjamin Tolputt ] > The issue is that taking the direction you suggest *right now* will have > the effect of making Erlang slower for most tasks on most platforms it > is currently deployed on. I agree that, in the future (near or far is > debatable), Erlang is best situated to take advantage of the surplus of > CPU power available from many-core systems. At that time, it would be > advantageous to make have the OTP make parralel a substantial number of > it's list comprehensions. As of *right now* however, we're looking at > deployment on single, dual, & quad cores mostly. At this point, we DO > need to consider the total CPU dedicated to the task. Even those of us doing a lot of our work on CPUs with 24 or more cores (SunFire) don't necessarily always want list operations to be in parallel. I think allowing the developer to do what they want explicitly is generally the best idea until you get to a point where perhaps you have a JIT that can analyze the optimal way to run instead of trying to make a compile-time or run-time guess based solely off of whether or not the CPU is single-core. -- :: atomly :: [ atomly@REDACTED : www.atomly.com ... [ atomiq records : new york city : +1.917.442.9450 ... [ e-mail atomly-news-subscribe@REDACTED for atomly info and updates ... From ok@REDACTED Thu Sep 4 07:41:34 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 4 Sep 2008 17:41:34 +1200 Subject: [erlang-questions] A whole bunch of implementation details In-Reply-To: <17196_1220496487_m842m3qS009126_OFA8B2944E.1A6E0E4E-ON862574BA.000E1EC5-862574BA.000E6A4E@thoughtworks.com> References: <17196_1220496487_m842m3qS009126_OFA8B2944E.1A6E0E4E-ON862574BA.000E1EC5-862574BA.000E6A4E@thoughtworks.com> Message-ID: <08F3714D-5099-4ED8-9C59-8E6B553720EE@cs.otago.ac.nz> On 4 Sep 2008, at 2:37 pm, Dennis Byrne wrote: > How does stack memory grow? Am told Prolog does this dynamically > and I was wondering if Erlang did the same. Some Prologs (DEC-10 Prolog, Quintus Prolog, SICStus Prolog, ...) do this, some Prologs (C Prolog, SWI Prolog) don't. The Burroughs B6700 used to do this for Algol, BASIC, COBOL, DMAlgol, ESPOL, FORTRAN, Pascal, and PL/I, back in the late 60s. "Modern", less capable, systems like say Windows or Unix, do not do this because they don't know where the pointers are. The B6700, Prolog systems, and Erlang systems, tag each word of memory to say what it is, so you can infallibly find the pointers. With that, moving a stack is tedious rather than difficult. > Does heap memory contract? It can. > > Exactly what is the tipping point between what gets passed by value > and what gets passed by reference? There is no pass by reference. All binaries are passed by value. Some binary values are represented by pointers. Some of those pointers point to shared blocks, some don't. But it is still pass by value. Pass by reference is, by definition, passing the address of a VARIABLE ('var x: t' in Pascal, 't& x' in C++). Notionally when you send anything in a message, it is copied, otherwise it isn't. Some Erlang systems have had a shared or hybrid heap, in which the logical copy is a no-op. > The large binary trick is common knowledge, any other corner cases? > How does the VM differentiate between a node that is temporarily > unresponsive and one that is down? In other words, at what point > does a node give up on a peer? There is no infallible way to tell. Mistakes will always be made. The net_kernel module sets up a "ticker" process that periodically sends a message to every node it's in communication with; if it doesn't hear from a node after a while it assumes it's down. If a node is shut down in an orderly way it will tell is peers that it is going down. From kenji.rikitake@REDACTED Thu Sep 4 08:44:28 2008 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Thu, 4 Sep 2008 15:44:28 +0900 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <14f0e3620809020052x5c05b9a5s6a3f8ab5177e0a89@mail.gmail.com> References: <48BCEE7F.7080104@gmail.com> <14f0e3620809020052x5c05b9a5s6a3f8ab5177e0a89@mail.gmail.com> Message-ID: <20080904064428.GA180@k2r.org> The number of parallel (simultaneously running) Erlang processes affect a lot to the total execution time and CPU usage. So I think programmers have to be careful and should tune the numbers of parallel processes for a specific task to get the most out of the given number of CPU cores and nodes. On the other hand, adding some examples of parallel mapping functions into OTP will help beginners to learn and use parallelism. I've written a small piece of code for my own experiments, available at: http://code.google.com/p/nsplit/ FYI Kenji Rikitake In the message <14f0e3620809020052x5c05b9a5s6a3f8ab5177e0a89@REDACTED> dated Tue, Sep 02, 2008 at 09:52:18AM +0200, Gleb Peregud writes: > Maybe it is good idea to include something like > http://code.google.com/p/plists/ into Erlang/OTP? It will probably > introduce more less tuned software created by developers, but it will > make programming multi-core systems much more easier and fun for > beginners. > > On Tue, Sep 2, 2008 at 9:42 AM, Mats Cronqvist wrote: > > Kevin Scaldeferri wrote: > >> First, I don't think it's been mentioned here, but the language > >> benchmarks shootout finally got some multi-core hardware! > >> > >> http://shootout.alioth.debian.org/u64q/ > >> > >> At the moment, though, there are almost no submissions of parallelized > >> code, so the results are about the same as the existing hardware. > >> > >> I figured (slightly spurred on by the Haskell community) that we > >> should try to submit some modified versions that actually use the > >> multiple cores. So, for example, I made a slight change to the binary > >> trees code and got a nearly 2x speedup on my 2-core machine. In doing > >> so, I did run into one of those little things that I've never really > >> known the preferred approach for. My modified function looks like this: > >> > >> depthLoop(D,M) when D > M -> ok; > >> depthLoop(D,M) -> > >> Self = self(), > >> spawn(fun() -> > >> N = 1 bsl (M-D + ?Min), > >> io:fwrite("~w\t trees of depth ~w\t check: ~w~n", > >> [ 2*N, D, sumLoop(N,D,0) ]), > >> Self ! done > >> end), > >> depthLoop (D+2,M), > >> receive done -> done end. > >> > >> > >> > > i'm partial to the monitor-exit idiom. gets rid of the Self for one thing. > > > > mats > > > > depthLoop(D,M) when D > M -> ok; > > depthLoop(D,M) -> > > erlang:spawn_monitor(fun()-> slave(D, M) end), > > depthLoop (D+2,M), > > receive {'DOWN',_,_,_,done} -> done end. > > > > slave(D, M) -> > > N = 1 bsl (M-D + ?Min), > > io:fwrite("~w\t trees of depth ~w\t check: ~w~n", > > [ 2*N, D, sumLoop(N,D,0) ]), > > exit(done). > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > Gleb Peregud > http://gleber.pl/ > > Every minute is to be grasped. > Time waits for nobody. > -- Inscription on a Zen Gong > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From hanssv@REDACTED Thu Sep 4 09:03:32 2008 From: hanssv@REDACTED (Hans Svensson) Date: Thu, 04 Sep 2008 09:03:32 +0200 Subject: [erlang-questions] : order-preserving send? In-Reply-To: <20080829074739.GB19532@erix.ericsson.se> References: <20080827233159.GB16945@atomly.com> <20080827235736.GA5923@contorpis.lisalinda.com> <48B6AE97.4030402@cs.chalmers.se> <20080829074739.GB19532@erix.ericsson.se> Message-ID: <48BF8844.8010003@cs.chalmers.se> Raimo Niskanen wrote: > On Thu, Aug 28, 2008 at 03:56:39PM +0200, Hans Svensson wrote: >> Matthias Lang wrote: > : : >>> That misleading and, for practical purposes, wrong. >>> >>> >From the FAQ: >>> >>> | 10.9 Is the order of message reception guaranteed? >>> | >>> | Yes, but only within one process. >>> | >>> | If there is a live process and you send it message A and then message >>> | B, it's guaranteed that if message B arrived, message A arrived before >>> | it. >>> | >> That is however not true (in the distributed case), it is possible to >> drop A and then later receive B. The paper 'Programming Distributed >> Erlang Applications: Pitfalls and Recipes' describes this situation as >> well as some other quirks: > > I'd say it is true enough. Since for this to happen, the receiving node > has to be restarted 2 (or was it 3) times to wrap the node incarnation > counter, and Erlang was designed under the assumption that the distributed > application must detect the first node restart anyway and handle it. > > Plus, it is a new receiving process that receives B. A went to the old > receiver. The horrible situation where you send A, B, C to a reciever > and B vanishes can not happen. The receiver gets all before a certain > point or all after. Nah, the restarting was for getting back the exact same Pid (and you have to restart 3 times ;-) ). In order to only receive B, it is enough to pull out the ethernet cable (or equivalent) and put it back with some (un)fortunate timing. It is still the same receiving process! > > You are supposed to use links or monitors if you are interested > in the other side's death. That is the answer to just about anything, and it works in this case as well, since the network interruption can be detected. >> http://www.cs.chalmers.se/~hanssv/doc/ew07-dist.pdf /Hans From mats.cronqvist@REDACTED Thu Sep 4 09:11:17 2008 From: mats.cronqvist@REDACTED (mats cronqvist) Date: Thu, 04 Sep 2008 09:11:17 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BF2A7D.8060908@bigpond.net.au> References: <48BD4DF9.50903@gmail.com> <200809021741.48654.bekesa@sch.bme.hu> <48BE5C50.70208@gmail.com> <48BE684F.8080305@bigpond.net.au> <48BE983D.3000303@gmail.com> <48BF2A7D.8060908@bigpond.net.au> Message-ID: <48BF8A15.6030807@gmail.com> Benjamin Tolputt wrote: > Mats Cronqvist wrote: > >> Benjamin Tolputt wrote: >> >>> The issue is that taking the direction you suggest *right now* will >>> have >>> the effect of making Erlang slower for most tasks on most platforms it >>> is currently deployed on. >>> >> Will it? I doubt it would make a realistic application (e.g. a phone >> switch) significantly slower even on single core HW. Perhaps you're >> aware of some measurement that would prove me wrong? >> > > I could not answer that question in any convincing way to you as: > > * You define "realistic applications" to be something I do not use > Erlang for > * You use the words "significantly slower", yet discard 10% as being > insignificant to those unwilling to upgrade existing hardware.. > > In other words, I cannot argue with you when we cannot agree on the > basic definitions of "realistic" and "significant". We'd be lost in a > "semantic argument" - one I would rather avoid. I think, however, that > you agree making everything "parallel" will slow things down on > single/dual core systems even if you find my applications unrealistic > and/or the speed decrease insignificant. agreed. > And thankfully, you are not the person(s) I am appealing to when writing > these messages to the mailing list. yes, i'm sure cooler heads will prevail. and that might well be a good thing. mats From ingela@REDACTED Thu Sep 4 09:15:27 2008 From: ingela@REDACTED (Ingela Anderton Andin) Date: Thu, 04 Sep 2008 09:15:27 +0200 Subject: [erlang-questions] How to use new_ssl in R12? In-Reply-To: References: Message-ID: <48BF8B0F.2020607@erix.ericsson.se> Hi, sorry for the delay in answering this, I promise we have not been ignoring you just been swamped with other things to do for R12B-4 . The new ssl-implementation is still very much a beta. I will look into your particular problem as part of further development of ssl and get back to you when I know more. Regards Ingela Erlang/OTP, Ericsson Hi, I'm trying to use new_ssl to make a simple echo server, but so far, I cannot seem to get it working. Here is a snipped of my code: main() -> application:start(crypto), application:start(ssl), ssl:seed("TODO random here"), {ok, ListenSocket} = ssl:listen(12345, [ {ssl_imp, new}, {verify, 0}, {cacertfile, "ca.pem"}, {certfile, "crt.pem"}, {keyfile, "key.pem"} ]), io:format("ready to accept connections at port 12345 ~p\n", [ListenSocket]), {ok, Socket} = ssl:transport_accept(ListenSocket), io:format("accepted connection from ~p\n", [ssl:peername(Socket)]), ok = ssl:ssl_accept(Socket), io:format("client connection ~p~n", [Socket]), loop(Socket). loop(Socket) -> receive {ssl, Socket, Data} -> io:format("received data: ~p~n", [Data]), ssl:send(Socket, Data), loop(Socket); ... This will open a listen socket at port 12345; after a connection is established, it will echo everything back to the client until the socket is closed. If I comment the {ssl_imp, new} it works as expected, though it does not work with the new implementation, erl just crashes with the message: {"init terminating in do_boot",{{try_clause,{error,esslerrssl}},[{ssl,ssl_accept,2},{echo_ssl,main,0},{init,start_it,1},{init,start_em,1}]}} Before dying, it sends an SSL alert to the client, with the data (as seen in the client console): connection lost: [('SSL routines', 'SSL3_READ_BYTES', 'tlsv1 alert internal error'), ('SSL routines', 'SSL3_READ_BYTES', 'ssl handshake failure')] The code (and dummy certificates, etc) is at: http://ruilopes.com/tmp/echo_ssl/echo_ssl.erl http://ruilopes.com/tmp/echo_ssl/key.pem http://ruilopes.com/tmp/echo_ssl/crt.pem http://ruilopes.com/tmp/echo_ssl/ca.pem The client (written in twisted/python) is at: http://ruilopes.com/tmp/echo_ssl/echo_ssl_client.py Any idea how to make this work? Thanks in advance! Best regards, Rui Lopes From mikpe@REDACTED Thu Sep 4 09:17:23 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Thu, 4 Sep 2008 09:17:23 +0200 Subject: [erlang-questions] A whole bunch of implementation details In-Reply-To: References: Message-ID: <18623.35715.138556.160845@harpo.it.uu.se> Dennis Byrne writes: > Gave a presentation today to a very bright crowd. Lots of these people > just wanted to ask questions rather than looks at slides. Here's a > handful of questions I got, for which I was anywhere from half way to > completely clueless on. > > Does a process get pinned to one OS thread for it's entire existence? What > factors go into the VM's decision to pin a process to one OS thread or > another? How do we prevent all the busiest processes from being tied to > one OS level thread? An Erlang process isn't pinned. The Erlang schedulers themselves are unpinned threads that fetch Erlang processes from a common queue. (At least the queue was common last time I looked.) > How does stack memory grow? Am told Prolog does this dynamically and I > was wondering if Erlang did the same. Dynamic overflow check, followed by reallocation/copy in the overflow case. > Does heap memory contract? Logically, yes. Pages allocated from the OS kernel may or may not be released back to the kernel. I think (haven't looked in detail) that freed pages are kept by the Erlang runtime for future use. > Exactly what is the tipping point between what gets passed by value and > what gets passed by reference? The large binary trick is common > knowledge, any other corner cases? Function calls are pass by reference. Sends are pass by copy, except for largish binary blobs which are allocated off-heap, reference counted, and passed by reference. (Well, a small handle is passed by copy.) > How does the VM differentiate between a node that is temporarily > unresponsive and one that is down? In other words, at what point does a > node give up on a peer? Dunno. /Mikael From hans.bolinder@REDACTED Thu Sep 4 09:17:42 2008 From: hans.bolinder@REDACTED (Hans Bolinder) Date: Thu, 4 Sep 2008 09:17:42 +0200 Subject: [erlang-questions] erlang-questions Digest, Vol 16, Issue 6 In-Reply-To: <337538cb0809012311j4fcc4229j2e95c31c244bc115@mail.gmail.com> References: <337538cb0809012311j4fcc4229j2e95c31c244bc115@mail.gmail.com> Message-ID: <18623.35734.433230.15053@gargle.gargle.HOWL> [Kirill Zaborski:] > BTW It looks like docs for rpc:pmap/3 have List1 and List2 in > reversed places: the signature should look like > pmap({Module, Function}, ExtraArgs, List1) -> List2 > and not like > pmap({Module, Function}, ExtraArgs, List2) -> List1 Thanks. The documentation will be updated in R12B-5. Best regards, Hans Bolinder, Erlang/OTP team, Ericsson AB From raimo+erlang-questions@REDACTED Thu Sep 4 09:36:31 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 4 Sep 2008 09:36:31 +0200 Subject: [erlang-questions] A whole bunch of implementation details In-Reply-To: References: Message-ID: <20080904073631.GA14419@erix.ericsson.se> On Wed, Sep 03, 2008 at 09:37:40PM -0500, Dennis Byrne wrote: > Gave a presentation today to a very bright crowd. Lots of these people > just wanted to ask questions rather than looks at slides. Here's a > handful of questions I got, for which I was anywhere from half way to > completely clueless on. > > Does a process get pinned to one OS thread for it's entire existence? What > factors go into the VM's decision to pin a process to one OS thread or > another? How do we prevent all the busiest processes from being tied to > one OS level thread? Today there is one run queue that all schedulers pick processes from. Each scheduler is pinned to one OS thread. So running processes move randomly betwheen OS threads between schedule out and schedule in. This will be a near future problem since it is desirable to keep processes in the same OS thread to utilize the CPU cache better. The decision on when to move a process between schedulers will be automatic by the scheduling algorithm, but it may be possible for the programmer to hint. It is work in progress. > How does stack memory grow? Am told Prolog does this dynamically and I > was wondering if Erlang did the same. Does heap memory contract? Stack and heap grows towards each other in a common memory block. When they collide a larger block is allocated and the live data is garbage collected over to the new block. That was simplified. A garbage collect may free enough memory to not need to allocate a new memory block too. Heap/stack memory blocks will also shrink if overallocated for too long, but it is easier to know when to grow than when it is profitable to shrink, so shrinking is a bit slow (conservative). > Exactly what is the tipping point between what gets passed by value and > what gets passed by reference? The large binary trick is common > knowledge, any other corner cases? As Rickard O'Keefe answered. Whithin a process all is passed by reference. It can be so since it is a functional language. Data does not change. When sending to another process all is copied. Except for binaries (larger than 64 byte). And there is a VM variant (experimental, the Hybrid Heap VM) that can share data between processes making send non-copy in many cases. > How does the VM differentiate between a node that is temporarily > unresponsive and one that is down? In other words, at what point does a > node give up on a peer? http://www.erlang.org/doc/man/kernel_app.html, read on net_ticktime. > ____________________________________________ > Dennis Byrne > ThoughtWorks - Chicago > http://notdennisbyrne.blogspot.com/ > 312-505-7965 > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From peter.mccarthy.0807@REDACTED Thu Sep 4 09:48:04 2008 From: peter.mccarthy.0807@REDACTED (Peter McCarthy) Date: Thu, 4 Sep 2008 08:48:04 +0100 Subject: [erlang-questions] Linked-in Driver Debugging Message-ID: <57d241cf0809040048y1250b81avb7077ab10237f94d@mail.gmail.com> Hi all I'm currently developing a linked-in driver using the NetBeans IDE (with C/C++ plug-in). Does anyone know if it's possible to set breakpoints in the driver and attach to ERTS, so that when port command messages are sent to the driver, these breakpoint are hit? Thanks in advance for any help received. Peter From rgl@REDACTED Thu Sep 4 11:15:48 2008 From: rgl@REDACTED (Rui Lopes) Date: Thu, 04 Sep 2008 10:15:48 +0100 Subject: [erlang-questions] How to use new_ssl in R12? In-Reply-To: <48BF8B0F.2020607@erix.ericsson.se> References: <48BF8B0F.2020607@erix.ericsson.se> Message-ID: <48BFA744.6010102@ruilopes.com> Hello, Ingela Anderton Andin wrote: > Hi, > > sorry for the delay in answering this, I promise we have not been > ignoring you just been swamped with > other things to do for R12B-4 . The new ssl-implementation is still > very much a beta. I will look into > your particular problem as part of further development of ssl and > get back to you when I know more. Good to known this! Looking forward for news. Thank you! Best regards, Rui Lopes From eranga.erl@REDACTED Thu Sep 4 11:16:53 2008 From: eranga.erl@REDACTED (Eranga Udesh) Date: Thu, 4 Sep 2008 14:46:53 +0530 Subject: [erlang-questions] Erl getting stuck in SMP with 8 cores In-Reply-To: <7c9d57ea0809011157t43ec70d0pd6958eab118bd6e4@mail.gmail.com> References: <912a3c160808311222uec8bed1qd63f5f594465769e@mail.gmail.com> <6c2563b20808311308u4db39997jae41c107195c449c@mail.gmail.com> <912a3c160808311941l37cda5c7pc116fb250c02b607@mail.gmail.com> <912a3c160809010951x7abbdd2bna67b301fa3bd61bc@mail.gmail.com> <48BC21B2.7050900@cs.ntua.gr> <7c9d57ea0809011157t43ec70d0pd6958eab118bd6e4@mail.gmail.com> Message-ID: <912a3c160809040216o1ab35ce2h3c26b9ade0169144@mail.gmail.com> Thanks heap all for giving me inputs and your experiences to identify the issue. Unfortunately there has been a HP Firmware upgrade they released, which we haven't applied and once applied, the problem dissapeared. All the indications and system behaviours were confusing and pointing somewhere else and made it difficult to understand the root cause. Cheers, - Eranga On Tue, Sep 2, 2008 at 12:27 AM, Sargun Dhillon wrote: > This sounds almost like a hardware/kernel issue. I've run erlang on > 8-CPU machines (32 & 64) without any "thread jamming." I was using > yaws & my own erlang code, both of which use recursive functions. The > difference was that I was running it under a fairly optimized Gentoo > system, and not CentOS. If you enable core dumps, do you get anything > from beam? When it locks up try SIGSEVC and get a core dump to > analyze. You can try (l/s)trace also in order to find system calls > which can be crashing on your box. > > > On Mon, Sep 1, 2008 at 10:09 AM, Kostis Sagonas wrote: > > Eranga Udesh wrote: > >> Good to know that Erl works successfully wh 8 or more intel cores. Do > >> you use 8 schedulers with threads/hipe enabled? > > > > I've routinely used Erlang with SMP & HiPE (in fact running native code) > > with both 8 and 16 x86_64 cores for more than 6 months now without any > > problems. No threads enabled though. > > > > The 'application' is running the native code compiler & dialyzer in > > parallel with as many schedulers as cores in the machine. > > > > Kostis > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf.wiger@REDACTED Thu Sep 4 11:55:56 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Thu, 04 Sep 2008 11:55:56 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BE983D.3000303@gmail.com> References: <48BD4DF9.50903@gmail.com> <200809021741.48654.bekesa@sch.bme.hu> <48BE5C50.70208@gmail.com> <48BE684F.8080305@bigpond.net.au> <48BE983D.3000303@gmail.com> Message-ID: <48BFB0AC.9080308@ericsson.com> Mats Cronqvist skrev: > Benjamin Tolputt wrote: >> >> The issue is that taking the direction you suggest *right now* >> will have the effect of making Erlang slower for most tasks on >> most platforms it is currently deployed on. > Will it? I doubt it would make a realistic application (e.g. > a phone switch) significantly slower even on single core HW. > Perhaps you're aware of some measurement that would prove me > wrong? The shootout could be a place to experiment with this, if we could have one Erlang entry that assumes SMP, and one that doesn't, for each benchmark (like we used to have a non-HiPE and a HiPE version). One issue is that there isn't e.g. a plists in the stdlib. With permission from the shootout maintainers, we could possibly have a patched build, with a lists module (etc.) defaulting to parallel solutions (i.e. spawning processes where sensible, and gathering results, preserving order where necessary.) Just a thought. BR, Ulf W From alceste@REDACTED Thu Sep 4 11:01:37 2008 From: alceste@REDACTED (Alceste Scalas) Date: Thu, 04 Sep 2008 11:01:37 +0200 Subject: [erlang-questions] Linked-in Driver Debugging In-Reply-To: <57d241cf0809040048y1250b81avb7077ab10237f94d@mail.gmail.com> References: <57d241cf0809040048y1250b81avb7077ab10237f94d@mail.gmail.com> Message-ID: <1220518897.13582.54.camel@gnatziu> Il giorno gio, 04/09/2008 alle 08.48 +0100, Peter McCarthy ha scritto: > Does anyone know if it's possible to set breakpoints in the driver and > attach to ERTS, so that when port command messages are sent to the > driver, these breakpoint are hit? You can surely do it with GDB (on Unix-like systems, at least): 1. start the Erlang virtual machine, and look for its system PID; 2. start GDB, and attach it to the running VM (using the 'attach' command); 3. put all the breakpoints you need (if the function you want to monitor does not exist, GDB will prompt for making "the breakpoint pending on future shared library load"); 4. use the GDB 'continue' command to let the VM run. GDB will notify when new libraries (or Erlang linked-in drivers) are loaded, and pending breakpoints become active. Have fun, -- Alceste Scalas CRS4 - http://www.crs4.it/ From gleber.p@REDACTED Thu Sep 4 12:45:17 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Thu, 4 Sep 2008 12:45:17 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BFB0AC.9080308@ericsson.com> References: <48BD4DF9.50903@gmail.com> <200809021741.48654.bekesa@sch.bme.hu> <48BE5C50.70208@gmail.com> <48BE684F.8080305@bigpond.net.au> <48BE983D.3000303@gmail.com> <48BFB0AC.9080308@ericsson.com> Message-ID: <14f0e3620809040345n14d5ef4aqe004839837e5cb9c@mail.gmail.com> It would be nice to include plists (or similar) into stdlib permanently. It will allow users of Erlang/OTP fine-tune their applications for SMP systems just by adding "p" (and Malt) where necessary. I think this issue should be in the hands of the programmer. Automatic "parallelization" of lists:* will not be efficient, at least without extensive compile-time (or even run-time) analysis of the code (if this is possible/feasible at all). On Thu, Sep 4, 2008 at 11:55 AM, Ulf Wiger (TN/EAB) wrote: > Mats Cronqvist skrev: >> Benjamin Tolputt wrote: >>> >>> The issue is that taking the direction you suggest *right now* > >> will have the effect of making Erlang slower for most tasks on > >> most platforms it is currently deployed on. >> Will it? I doubt it would make a realistic application (e.g. > > a phone switch) significantly slower even on single core HW. > > Perhaps you're aware of some measurement that would prove me > > wrong? > > The shootout could be a place to experiment with this, if we > could have one Erlang entry that assumes SMP, and one that > doesn't, for each benchmark (like we used to have a non-HiPE > and a HiPE version). > > One issue is that there isn't e.g. a plists in the stdlib. > With permission from the shootout maintainers, we could > possibly have a patched build, with a lists module (etc.) > defaulting to parallel solutions (i.e. spawning processes > where sensible, and gathering results, preserving order > where necessary.) > > Just a thought. > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From nicolas@REDACTED Thu Sep 4 13:10:53 2008 From: nicolas@REDACTED (Nicolas Niclausse) Date: Thu, 04 Sep 2008 13:10:53 +0200 Subject: [erlang-questions] where to install Tsung In-Reply-To: <14f0e3620809031337r6be2f44evcf440177548e4207@mail.gmail.com> References: <14f0e3620809031337r6be2f44evcf440177548e4207@mail.gmail.com> Message-ID: <48BFC23D.3000202@niclux.org> Gleb Peregud ecrivait le 03.09.2008 22:37: > Probably it is possible. There are two "but": > 1) Does tsung loads itself on it's slaves (are modules being transferred there) no > 2) Does tsung allows not to run "client" VM on the "controller"s VM machine yes > If both answers are yes, it would be enough to install Erlang on the > third and the second machine, install tsung on the third and specify > the second machine as the only "client" in "tsung.xml". you need to install tsung on the controller node and on all clients machines. -- Nicolas From mats.cronqvist@REDACTED Thu Sep 4 13:21:07 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 04 Sep 2008 13:21:07 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <14f0e3620809040345n14d5ef4aqe004839837e5cb9c@mail.gmail.com> References: <48BD4DF9.50903@gmail.com> <200809021741.48654.bekesa@sch.bme.hu> <48BE5C50.70208@gmail.com> <48BE684F.8080305@bigpond.net.au> <48BE983D.3000303@gmail.com> <48BFB0AC.9080308@ericsson.com> <14f0e3620809040345n14d5ef4aqe004839837e5cb9c@mail.gmail.com> Message-ID: <48BFC4A3.40303@gmail.com> Gleb Peregud wrote: > It would be nice to include plists (or similar) into stdlib > permanently. It will allow users of Erlang/OTP fine-tune their > applications for SMP systems just by adding "p" (and Malt) where > necessary. I think this issue should be in the hands of the > programmer. that the competent programmer will always be able to tune her application to however many cores she's targeting is a truism. the issue at hand is what strategy the OTP libraries should use when the programmer does not/cannot provide hints (or when running legacy code). > Automatic "parallelization" of lists:* will not be > efficient, at least without extensive compile-time (or even run-time) > analysis of the code (if this is possible/feasible at all). "will not" is strong wording. can you provide some evidence to back that up? mats From gleber.p@REDACTED Thu Sep 4 13:24:50 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Thu, 4 Sep 2008 13:24:50 +0200 Subject: [erlang-questions] where to install Tsung In-Reply-To: <48BFC23D.3000202@niclux.org> References: <14f0e3620809031337r6be2f44evcf440177548e4207@mail.gmail.com> <48BFC23D.3000202@niclux.org> Message-ID: <14f0e3620809040424i23bbb547l108a9ff4bb783e99@mail.gmail.com> On Thu, Sep 4, 2008 at 1:10 PM, Nicolas Niclausse wrote: > Gleb Peregud ecrivait le 03.09.2008 22:37: >> Probably it is possible. There are two "but": >> 1) Does tsung loads itself on it's slaves (are modules being transferred there) > > no > >> 2) Does tsung allows not to run "client" VM on the "controller"s VM machine > > yes > >> If both answers are yes, it would be enough to install Erlang on the >> third and the second machine, install tsung on the third and specify >> the second machine as the only "client" in "tsung.xml". > > you need to install tsung on the controller node and on all clients machines. > > -- > Nicolas > Thanks, Nicolas! -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From vychodil.hynek@REDACTED Thu Sep 4 13:36:11 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Thu, 4 Sep 2008 13:36:11 +0200 Subject: [erlang-questions] where to install Tsung In-Reply-To: <48BFC23D.3000202@niclux.org> References: <14f0e3620809031337r6be2f44evcf440177548e4207@mail.gmail.com> <48BFC23D.3000202@niclux.org> Message-ID: <4d08db370809040436o1147767ej227d176248b248ab@mail.gmail.com> On Thu, Sep 4, 2008 at 1:10 PM, Nicolas Niclausse wrote: > Gleb Peregud ecrivait le 03.09.2008 22:37: > > Probably it is possible. There are two "but": > > 1) Does tsung loads itself on it's slaves (are modules being transferred > there) > > no > > > 2) Does tsung allows not to run "client" VM on the "controller"s VM > machine > > yes > > > If both answers are yes, it would be enough to install Erlang on the > > third and the second machine, install tsung on the third and specify > > the second machine as the only "client" in "tsung.xml". > > you need to install tsung on the controller node and on all clients > machines. And what about nl? > > > -- > Nicolas > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From valentin@REDACTED Wed Sep 3 09:43:47 2008 From: valentin@REDACTED (Valentin Micic) Date: Wed, 3 Sep 2008 09:43:47 +0200 Subject: [erlang-questions] ETS & SMP was: Parallelism, SMP, and multicore question References: <6c2563b20809021009n3f9619d9h4c439a3a64393c84@mail.gmail.com> Message-ID: <00f501c90d98$cf868720$6401a8c0@moneymaker2> Is ETS utilizing the same locking policy for all table types (namely: public, protected or private), and if so, would it be possible to relax locking for protected and private access? We've noticed that if more than one process requires an access to the same ets table (in SMP environment), the system slows down considerably due to the locking mechanism. It is quite possible to optimize this by fronting such a table with a dedicated process for request serialization -- works better as there is always only one proccess requesting a lock. Actually... as much as this works well for one table, not so sure how would such an "optimization" work for a large number of tables. By relaxing (or not having) a locking policy for (at least) tables with a private access, there would be no questions about it. V. ----- Original Message ----- From: Edwin Fine To: erlang-questions@REDACTED Sent: Tuesday, September 02, 2008 7:09 PM Subject: [erlang-questions] Parallelism, SMP, and multicore question Since the cognoscenti are talking about parallelism, maybe someone can answer something that has been perplexing me. Sometimes it has been measurably faster on a multicore system to run one VM per core, each with SMP disabled (or +S 1), than it is to run one or more SMP VMs. This is true even when running code that is innately parallel. On the other hand, I have seen benchmarks that show near-linear speedups using SMP. I don't have code to support this; it's just something I, along with a couple of other people -- for whom I don't want to speak -- have noticed in passing. Does anyone have any insight into the internals of SMP who can tell me when SMP might be an asset, and when a liability? I know this is a "how long is a piece of string" question, but even though it's pretty general, someone somewhere who really knows Erlang inside out (i.e. not me) must surely have encountered this phenomenon. Are there conditions where contention between the threads of the SMP processes (e.g. mutexes) becomes significant enough that multiple separate non-SMP VMs perform better? If so, what would those conditions be? Could it have anything to do with the mix of CPU-bound processes and inter-process messaging or network I/O? If so, please could someone explain the mechanism? Anyone? ------------------------------------------------------------------------------ _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Thu Sep 4 13:42:35 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Thu, 4 Sep 2008 13:42:35 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BFC4A3.40303@gmail.com> References: <48BD4DF9.50903@gmail.com> <200809021741.48654.bekesa@sch.bme.hu> <48BE5C50.70208@gmail.com> <48BE684F.8080305@bigpond.net.au> <48BE983D.3000303@gmail.com> <48BFB0AC.9080308@ericsson.com> <14f0e3620809040345n14d5ef4aqe004839837e5cb9c@mail.gmail.com> <48BFC4A3.40303@gmail.com> Message-ID: <14f0e3620809040442u2109d07fs452758e4a2626d9a@mail.gmail.com> On Thu, Sep 4, 2008 at 1:21 PM, Mats Cronqvist wrote: > Gleb Peregud wrote: >> >> It would be nice to include plists (or similar) into stdlib >> permanently. It will allow users of Erlang/OTP fine-tune their >> applications for SMP systems just by adding "p" (and Malt) where >> necessary. I think this issue should be in the hands of the >> programmer. > > that the competent programmer will always be able to tune her application > to however many cores she's targeting is a truism. the issue at hand is what > strategy the OTP libraries should use when the programmer does not/cannot > provide hints (or when running legacy code). > >> Automatic "parallelization" of lists:* will not be >> efficient, at least without extensive compile-time (or even run-time) >> analysis of the code (if this is possible/feasible at all). > > "will not" is strong wording. can you provide some evidence to back that > up? You are right, I've used too strong words here. I'm not able to back them up. These are just my thoughts/intuition on the subject :) The following are the same. There's a lot of different situations, where for example lists:map may be used. First example: It may be used to run CPU intensive computations on few (comparable to the number of the cores) elements - in such a situation it would be feasible to parallelize it with one process per element. Second example: But when we are talking about hundreds of thousands (N) of elements in a list, where computations for each is not CPU intensive, it makes sense to run P ( = k*C, where C is the number of cores, k is a small integer) processes to process chunks of size N/P. If done in other way (for example one process for each element) the overhead of spawning processes would be too big. My wording was based on such way of thinking. That's why I think there should be no automatic parallelism there and the only person to decide to parallelise is the programmer... Sorry if I'm talking truisms, just ignore the message in this case :) > > mats -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From francesco@REDACTED Thu Sep 4 13:46:21 2008 From: francesco@REDACTED (Francesco Cesarini) Date: Thu, 04 Sep 2008 12:46:21 +0100 Subject: [erlang-questions] New Book "Erlang Programming" from O'Reilly In-Reply-To: References: <31870_1220441959_m83BdFxO002299_20080903112828.GA85104@k2r.org> Message-ID: <48BFCA8D.4040603@erlang-consulting.com> Hi Richard, Unfortunately, you will probably not get any wiser from the book, but I hope your students will love it. The book covers Erlang in depth. It has less contents than Joe's book, but covers them in much more detail. As an example, we are dedicating about 20 pages on basic Erlang data types (excluding records, funs, binaries, refs, etc) and well over 25 on sequential programming (How do you explain recursion to someone coming across it the first time?). We are trying to cater not only for experienced programmers who are new to Erlang, but also for those who do not have a strong computer science background or a lot of programming experience. I will be using a first rough draft next week when I teach the students at the IT University in Gothenburg. It will be interesting to get their feedback and see the results (It gives the saying shoot the messenger a complete new meaning :-)). I am sure O'Reilly will soon publish a table of contents (I think they are waiting to send the first draft to the reviewers), but a good showcase of what we are covering is in our training materials, as that is what we are basing the outline and many of the examples on: http://www.erlang-consulting.com/training/courses/example.html Having developed the training material over a 7 year period, we know they work and that the contents and order in which the subjects are taken up is optimal. We also plan on a chapters covering the trace BIFs and dbg, one on a graphics package (not GS), one on interfacing Erlang with other languages (C / Java / Ruby), and one on testing and TDD. One chapter will be dedicated to OTP behaviours, but we are just scratching the surface. Instead, we concentrate on introducing the problems and concepts the behaviours solve. That includes supervisors, finite state machines, and client server behaviours, all described as Erlang processes. To truly understand the power of the OTP design patterns, you need to understand the ins and outs of concurrency and Erlang. With that in place, OTP will come naturally. We made the decision to tackle Erlang first, and use the experiences to tackle OTP (While laying the foundations for our readers). We should to have an OTP book out late next year, working on a similar concept (Using our training material). Prior to that, however, I really hope the other two books looking at advanced Erlang by Manning and Pragmatic will be out. They should cover some of your questions. Regards, Francesco -- http://www.erlang-consulting.com Richard A. O'Keefe wrote: > On 3 Sep 2008, at 11:28 pm, Kenji Rikitake wrote: > > >> Erlang Programming >> by Francesco Cesarini and Simon Thompson >> to be published on December 2008 >> http://www.amazon.com/dp/0596518188 >> (Anybody found the www.oreilly.com link? I didn't.) >> > > > I didn't find much about the book (as opposed to its > authors) in that page. What does this book add to > the old Erlang book and Joe's newer one? What is the > intended audience? Is it going to tell _me_ anything > I don't know about Erlang (and there is a huge amount > of OTP I don't understand yet) or is it going to be a > book that I'll want to give to students? > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From gleber.p@REDACTED Thu Sep 4 14:01:52 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Thu, 4 Sep 2008 14:01:52 +0200 Subject: [erlang-questions] ETS & SMP was: Parallelism, SMP, and multicore question In-Reply-To: <00f501c90d98$cf868720$6401a8c0@moneymaker2> References: <6c2563b20809021009n3f9619d9h4c439a3a64393c84@mail.gmail.com> <00f501c90d98$cf868720$6401a8c0@moneymaker2> Message-ID: <14f0e3620809040501k3376c501y3a0dc3ace841c6f7@mail.gmail.com> 2008/9/3 Valentin Micic : > Is ETS utilizing the same locking policy for all table types (namely: > public, protected or private), and if so, would it be possible to relax > locking for protected and private access? > > We've noticed that if more than one process requires an access to the same > ets table (in SMP environment), the system slows down considerably due to > the locking mechanism. It is quite possible to optimize this by fronting > such a table with a dedicated process for request serialization -- works > better as there is always only one proccess requesting a lock. Actually... > as much as this works well for one table, not so sure how would such an > "optimization" work for a large number of tables. By relaxing (or not > having) a locking policy for (at least) tables with a private access, there > would be no questions about it. > > V. > > > ----- Original Message ----- > From: Edwin Fine > To: erlang-questions@REDACTED > Sent: Tuesday, September 02, 2008 7:09 PM > Subject: [erlang-questions] Parallelism, SMP, and multicore question > Since the cognoscenti are talking about parallelism, maybe someone can > answer something that has been perplexing me. > > Sometimes it has been measurably faster on a multicore system to run one VM > per core, each with SMP disabled (or +S 1), than it is to run one or more > SMP VMs. This is true even when running code that is innately parallel. On > the other hand, I have seen benchmarks that show near-linear speedups using > SMP. > > I don't have code to support this; it's just something I, along with a > couple of other people -- for whom I don't want to speak -- have noticed in > passing. > > Does anyone have any insight into the internals of SMP who can tell me when > SMP might be an asset, and when a liability? I know this is a "how long is a > piece of string" question, but even though it's pretty general, someone > somewhere who really knows Erlang inside out (i.e. not me) must surely have > encountered this phenomenon. > > Are there conditions where contention between the threads of the SMP > processes (e.g. mutexes) becomes significant enough that multiple separate > non-SMP VMs perform better? If so, what would those conditions be? > > Could it have anything to do with the mix of CPU-bound processes and > inter-process messaging or network I/O? If so, please could someone explain > the mechanism? > > Anyone? > > ________________________________ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > Hello, I've asked very similar question. Take a look here: http://www.erlang.org/pipermail/erlang-questions/2008-April/034514.html http://www.erlang.org/pipermail/erlang-questions/2008-April/034530.html BR -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From alpar@REDACTED Thu Sep 4 14:08:44 2008 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Thu, 04 Sep 2008 13:08:44 +0100 Subject: [erlang-questions] list_to_float() Message-ID: <1220530124.4367.23.camel@piko.site> Hi, I've just noticed that 1> list_to_float("22"). ** exception error: bad argument in function list_to_float/1 called as list_to_float("22") Is this a bug or a feature? Best regards, Alpar From mats.cronqvist@REDACTED Thu Sep 4 14:13:46 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 04 Sep 2008 14:13:46 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <14f0e3620809040442u2109d07fs452758e4a2626d9a@mail.gmail.com> References: <48BD4DF9.50903@gmail.com> <200809021741.48654.bekesa@sch.bme.hu> <48BE5C50.70208@gmail.com> <48BE684F.8080305@bigpond.net.au> <48BE983D.3000303@gmail.com> <48BFB0AC.9080308@ericsson.com> <14f0e3620809040345n14d5ef4aqe004839837e5cb9c@mail.gmail.com> <48BFC4A3.40303@gmail.com> <14f0e3620809040442u2109d07fs452758e4a2626d9a@mail.gmail.com> Message-ID: <48BFD0FA.9080301@gmail.com> Gleb Peregud wrote: > > Sorry if I'm talking truisms, just ignore the message in this case :) > "truism" was a bit snide. sorry. anyway, i feel a bit frustrated by my inability to formulate my point of view clearly. so i'll just quote some random guy off the internets; David Padua, University of Illinois at Urbana-Champaign With the coming of age of multiprocessors, program performance and efficiency has become more important and difficult to achieve. Furthermore, the applications of today must also be scalable so that they can make effective use of the additional parallelism introduced by newer generations of machines. To achieve strong and scalable performance, programmers must do all the work traditionally required for sequential tuning and in addition address the complex optimization issues introduced by parallelism. This difficulty is likely to increase even further if, as it is expected, multicores become heterogeneous or their overall organization changes significanly over time. However, even assuming homogeneous and stable organizations, programmer productivity is bound to suffer due to the initial cost of tuning for multiprocessors and the need for adaptation as the number of processors increase. In this talk, I will discuss future directions for programming language design, compiler technology, and the emerging autotuning strategies in the context of parallel programming. I will argue that advances in languages, compilers, and autotuning techniques will be necessary to recover the ground in productivity that has been lost with the advent of multicores. I will also argue that these tree components of a programming environment must be designed jointly to facilitate program tuning. The ultimate goal is for tuning to be accomplished without requiring the programmer to be concerned with the details of the target machine. It is expected that languages, compilers and autotuning techniques will evolve into a methodology that will dramatically reduce and perhaps eliminate in some cases the cost of porting programs across machine generations and machine classes. The availability of such methodology should not only help programmer productivity but also give machine designers more freedom to innovate. From alpar@REDACTED Thu Sep 4 14:14:57 2008 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Thu, 04 Sep 2008 13:14:57 +0100 Subject: [erlang-questions] Erlang vs IO In-Reply-To: <1220454548.7805.36.camel@seasc0918.dyn.rnd.as.sw.ericsson.se> References: <3BE6DBA1F3BE9D4798255806113D56540F75FE28D4@utx-exchange.utx.local> <1220454548.7805.36.camel@seasc0918.dyn.rnd.as.sw.ericsson.se> Message-ID: <1220530497.4367.29.camel@piko.site> > Greetings, > > If you are reading a file (as opposed to stdin) you can use > file:read_file/2 (if you have enough RAM) or file:read/2 (after using > the flag 'raw' when doing file:open/2). > Could you explain it a little bit more? I'm very interested to see how to transform the code example of the original question to use file:read_file/2 or file:read/2. Best regards, Alpar > > bengt > > On Wed, 2008-09-03 at 17:27 +0300, Imre Palik wrote: > > Hi, > > > > It is me messing up something, or the IO in erlang is quite slow? I run the following program on a largish file: > > > > -module(intest). > > -export([run/0]). > > > > problem_loop(0, _, Acc) -> > > io:fwrite("~w~n", [Acc]), > > void; > > problem_loop(I, D, A) -> > > {ok, [V]} = io:fread([], "~d"), > > if > > 0 == V rem D -> > > problem_loop(I - 1, D, A + 1); > > true -> > > problem_loop(I - 1, D, A) > > end. > > > > > > run() -> > > {ok, [Iter, Div]} = io:fread([], "~d ~d"), > > problem_loop(Iter, Div, 0). > > > > Then both of my cores started to run at 100%, which I find weird in itself with an IO bound problem. Also, I compared the runtime with the following program written in scheme > > > > #!/usr/bin/guile -s > > !# > > > > (define (intest iter div acc) > > (if (= iter 0) > > (display acc) > > (if (= 0 (remainder (read) div)) > > (intest (- iter 1) div (+ acc 1)) > > (intest (- iter 1) div acc)))) > > > > (intest (read) (read) 0) > > > > > > The scheme implementation was 10 times as fast as the erlang, and it only used one of the cores. > > > > How can I get a decent IO performance out of erlang? Am I making some mistakes in my erlang code? Should I upgrade my erlang system? (I am running R12B on windows) > > > > Thx. > > > > ImRe > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From bengt.kleberg@REDACTED Thu Sep 4 14:48:18 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 04 Sep 2008 14:48:18 +0200 Subject: [erlang-questions] list_to_float() In-Reply-To: <1220530124.4367.23.camel@piko.site> References: <1220530124.4367.23.camel@piko.site> Message-ID: <1220532498.19227.20.camel@seasc0918.dyn.rnd.as.sw.ericsson.se> Greetings, It is consistent. Integers are not floats anywhere else (that I know of) in Erlang. bengt On Thu, 2008-09-04 at 13:08 +0100, Alp?r J?ttner wrote: > Hi, > > I've just noticed that > > 1> list_to_float("22"). > ** exception error: bad argument > in function list_to_float/1 > called as list_to_float("22") > > Is this a bug or a feature? > > Best regards, > Alpar > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From richardc@REDACTED Thu Sep 4 14:50:13 2008 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 04 Sep 2008 14:50:13 +0200 Subject: [erlang-questions] list_to_float() In-Reply-To: <1220530124.4367.23.camel@piko.site> References: <1220530124.4367.23.camel@piko.site> Message-ID: <48BFD985.6080504@it.uu.se> Alp?r J?ttner wrote: > I've just noticed that > > 1> list_to_float("22"). > ** exception error: bad argument > in function list_to_float/1 > called as list_to_float("22") > > Is this a bug or a feature? It's a "feature": list_to_float/1 is a rather low level function, which assumes that you have already checked that the string has the proper form for an Erlang float, i.e., "0.0" and "1.0E-3" are ok, but "22", ".0", and "0." are not. /Richard From bgustavsson@REDACTED Thu Sep 4 15:06:56 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Thu, 4 Sep 2008 15:06:56 +0200 Subject: [erlang-questions] ETS & SMP was: Parallelism, SMP, and multicore question In-Reply-To: <00f501c90d98$cf868720$6401a8c0@moneymaker2> References: <6c2563b20809021009n3f9619d9h4c439a3a64393c84@mail.gmail.com> <00f501c90d98$cf868720$6401a8c0@moneymaker2> Message-ID: <6672d0160809040606n75c536d9yd28e3d08a3a220c8@mail.gmail.com> 2008/9/3 Valentin Micic > Is ETS utilizing the same locking policy for all table types (namely: > public, protected or private), and if so, would it be possible to relax > locking for protected and private access? > We currently don't eliminate locking on private tables, mainly to support ets:info/1,2. We may try to eliminate locks on private tables in a future release. (But we are not sure it is worthwhile. Taking a lock that is not already held by another process is relatively cheap - it becomes expensive when several processes want to take the same lock.) However, we take different locks depending on the operation to perform. An operation that only reads from the table (such as ets:lookup/2) will take a read lock, while an operation that will update the table (such as ets:insert/2) takes a write lock. As long as no process has a write lock, any number of processes can take read locks. If a process takes a write lock, it will be exclusive (i.e. no other processes can have either read or write locks). > We've noticed that if more than one process requires an access to the same > ets table (in SMP environment), the system slows down considerably due to > the locking mechanism. It is quite possible to optimize this by fronting > such a table with a dedicated process for request serialization -- works > better as there is always only one proccess requesting a lock. Actually... as much as this works well for one table, not so sure how would > such an "optimization" work for a large number of tables. By relaxing (or > not having) a locking policy for (at least) tables with a private access, > there would be no questions about it. > To access an ETS table, there are actually two locks that need to be taken. 1) A lock to access the meta table, to convert the numeric table identifier to a pointer to the actual table. 2) The lock for the table itself (either a read or write lock, as described above). In R12B-4, the locking of the meta table has been optimized. There used to be only one lock for the meta table, but there are now different locks for different parts of the table; therefore reducing the number of lock conflicts for the meta table. Therefore, if you have an application that accesses many different ETS tables, performance should be slightly better in R12B-4. If you have an application that accesses a single ETS table (and write to it frequently), there will still be lock conflicts on the ETS table itself, so R12B-4 will not make much difference. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From mats.cronqvist@REDACTED Thu Sep 4 15:16:41 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 04 Sep 2008 15:16:41 +0200 Subject: [erlang-questions] Erlang vs IO In-Reply-To: <1220530497.4367.29.camel@piko.site> References: <3BE6DBA1F3BE9D4798255806113D56540F75FE28D4@utx-exchange.utx.local> <1220454548.7805.36.camel@seasc0918.dyn.rnd.as.sw.ericsson.se> <1220530497.4367.29.camel@piko.site> Message-ID: <48BFDFB9.1040207@gmail.com> Alp?r J?ttner wrote: > > I'm very interested to see how to transform the code example of the > original question to use file:read_file/2 or file:read/2. > basically you want to read in the file in as a binary in 'raw' mode (the fastest way to get data into the emu). but you don't want to read the whole file at once, in case the file is GBytes+) as an example, here's some code i wrote to compete with a perl program in a wideFinder type problem. bio:string(FileName,Fun,Acc) calls Fun(Str,Acc)->NewAcc for each string in FileName. It reads from FileName in 8k chunks. mats %%%------------------------------------------------------------------- %%% File : bio.erl %%% Author : Mats Cronqvist %%% Description : block io %%% %%% Created : 13 Mar 2003 by Mats Cronqvist %%%------------------------------------------------------------------- -module(bio). -export([string/3,term/3]). -define(BLOCK, 8092). string(FN, Fun, Acc) -> Bfun = fun(_, O) -> {ok, lists:reverse(O)} end, in(FN, Fun, Acc, Bfun). term(FN, Fun, Acc) -> Bfun = fun(C, O) -> to_term(C, lists:reverse([10|O])) end, in(FN, Fun, Acc, Bfun). in(FN, Fun, Acc, Bfun) -> case file:open(FN, [read, raw]) of {ok, FD} -> R = in(FD, file:read(FD, ?BLOCK), Fun, Bfun, {[], [], Acc}), file:close(FD), R; {error,R} -> exit({open_error, R, FN}) end. in(_FD, eof, _Fun, _Bfun, {_Cont, [], Acc}) -> Acc; in(_FD, eof, Fun, Bfun, {Cont, O, Acc}) -> case Bfun(Cont, O) of {ok, Term} -> Fun(Term, Acc); {cont, NCont} -> exit({incomplete_input, NCont}) end; in(FD, {ok, List}, Fun, Bfun, State) -> in(FD, file:read(FD, ?BLOCK), Fun, Bfun, do(List, Fun, Bfun, State)). do([], _Fun, _Bfun, State) -> State; do([13,10|R], Fun, Bfun, {Cont, O, Acc}) -> %dos... do([10|R], Fun, Bfun, {Cont, O, Acc}); do([10|R], Fun, Bfun, {Cont, O, Acc}) -> case Bfun(Cont, O) of {cont, NCont} -> do(R, Fun, Bfun, {NCont, [], Acc}); {ok, Term} -> do(R, Fun, Bfun, {[], [], Fun(Term, Acc)}) end; do([H|R], Fun, Bfun, {Cont, O, Acc}) -> do(R, Fun, Bfun, {Cont, [H|O], Acc}). to_term(Cont, Str) -> case catch erl_scan:tokens(Cont, Str, 1) of {done, {ok, Toks, _}, []} -> case catch erl_parse:parse_term(Toks) of {ok, Term} -> {ok, Term}; {error, R} -> exit({parser_failed, R, Str}) end; {more, Ncont} -> {cont, Ncont}; _ -> exit({scanner_failed, Str}) end. From btolputt@REDACTED Thu Sep 4 02:23:25 2008 From: btolputt@REDACTED (Benjamin Tolputt) Date: Thu, 04 Sep 2008 10:23:25 +1000 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BE983D.3000303@gmail.com> References: <48BD4DF9.50903@gmail.com> <200809021741.48654.bekesa@sch.bme.hu> <48BE5C50.70208@gmail.com> <48BE684F.8080305@bigpond.net.au> <48BE983D.3000303@gmail.com> Message-ID: <48BF2A7D.8060908@bigpond.net.au> Mats Cronqvist wrote: > Benjamin Tolputt wrote: >> The issue is that taking the direction you suggest *right now* will >> have >> the effect of making Erlang slower for most tasks on most platforms it >> is currently deployed on. > Will it? I doubt it would make a realistic application (e.g. a phone > switch) significantly slower even on single core HW. Perhaps you're > aware of some measurement that would prove me wrong? I could not answer that question in any convincing way to you as: * You define "realistic applications" to be something I do not use Erlang for * You use the words "significantly slower", yet discard 10% as being insignificant to those unwilling to upgrade existing hardware.. In other words, I cannot argue with you when we cannot agree on the basic definitions of "realistic" and "significant". We'd be lost in a "semantic argument" - one I would rather avoid. I think, however, that you agree making everything "parallel" will slow things down on single/dual core systems even if you find my applications unrealistic and/or the speed decrease insignificant. > regardless, the only way to surf on Moore's Law is to parallelize. I'm not arguing that this is the case. However, not all applications Erlang is used for have "surfing Moore's Law" as a fundamental reason for it's use. I know my choice was only partially influenced by this factor. > parallelizing should be made under the hood. and, frankly, i'm > unimpressed by people who care about 10% effects on CPU time but are > unwilling to move to multicore HW. And thankfully, you are not the person(s) I am appealing to when writing these messages to the mailing list. I am sure I am not the only developer that has to deploy Erlang applications on existing hardware setups (you know, those single/dual core ones we paid good money for not that long ago). Having to tell the bean-counters that I need to purchase new "many-core" systems because the platform we're developing in has dropped performance 10% (without our code changing), is not something any developer relishes. --Ben From barrye@REDACTED Thu Sep 4 16:17:29 2008 From: barrye@REDACTED (Barry Ezell) Date: Thu, 4 Sep 2008 10:17:29 -0400 Subject: [erlang-questions] Request for comment or contributions In-Reply-To: <1220534531.19227.40.camel@seasc0918.dyn.rnd.as.sw.ericsson.se> References: <4b7f3e3c0809031404i3b37e2cdid12344e0e7f6d40@mail.gmail.com> <1220534531.19227.40.camel@seasc0918.dyn.rnd.as.sw.ericsson.se> Message-ID: <4b7f3e3c0809040717h4b1ad29di89b5af36858baab6@mail.gmail.com> Hello Bengt, Thank you very much for the suggestions. I've commented the code better to explain the intent of the module. This is my first Erlang program and I'm trying to prepare a talk on concurrency in Erlang to be given in October. The module is demonstration code for breaking MD5 passwords using a brute-force approach. For example, if the string "hi" is hashed by erlang:md5, the program would partition every 2-character variant into as many arrays as processes to be spawned, then each process would test the md5 hash of the character arrays until "hi" is found as a match. This is a contrived example but easy enough to grasp for the purposes of a talk. I have implemented all of the changes you suggested except for #1. There is a reason why the list is reversed before next/3 is evaluated. The character array is examined in reverse order because the increment of one character may affect the increment of the character in front of it. For instance, next("aaz") must yield "aba". When reversed, "z" is matched first, changed to "a", then the increment is passed to the next character in the reversed array, thus changing "a" to "b". If I am missing something I should be doing differently, please let me know. The changes are posted at: http://github.com/btedev/erlang_md5crack/tree/master/pwd.erl Thanks again, Barry On Thu, Sep 4, 2008 at 9:22 AM, Bengt Kleberg wrote: > Greetings, > > Unfortunately I do not understand what your program does. So this is a > very low level comment. > > 1 If possible try to change next() to the following: > next(L) -> > next(L, [], true). > > next([], L, _Incr) -> > lists:reverse(L); > %% the rest as in your code > > Unless there is a specific reason to reverse before use the normal > Erlang way is to reverse afterwards. > > > 2 In partition_alphabet() I would use a tuple for Arr. Like this: > Arr = {chr_array(CurChar, Len, min) , chr_array($z, Len, max)}, > > and also change decrypt()'s fun to fun({Min,Max}) -> > > Lists are normally used for a variable amount of items. Here you always > have 2 items. > > 3 As a personal habit I would change analyze() to use case instead of > if. Like this: > case Test =:= Crypted of > true -> > false -> > end. > > This is just because I find if very different to other langugaes if. > > > bengt > > > On Wed, 2008-09-03 at 17:04 -0400, Barry Ezell wrote: >> In my request for comments post yesterday, I forgot to mention that >> the code can be viewed at the following URL without requiring a "git >> clone". >> >> http://github.com/btedev/erlang_md5crack/tree/master/pwd.erl >> >> Thanks again for any suggestions. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > From kevin@REDACTED Thu Sep 4 17:02:11 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Thu, 4 Sep 2008 08:02:11 -0700 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <14f0e3620809040345n14d5ef4aqe004839837e5cb9c@mail.gmail.com> References: <48BD4DF9.50903@gmail.com> <200809021741.48654.bekesa@sch.bme.hu> <48BE5C50.70208@gmail.com> <48BE684F.8080305@bigpond.net.au> <48BE983D.3000303@gmail.com> <48BFB0AC.9080308@ericsson.com> <14f0e3620809040345n14d5ef4aqe004839837e5cb9c@mail.gmail.com> Message-ID: <5347916F-1E52-48AF-835E-0BC21A43551D@scaldeferri.com> On Sep 4, 2008, at 3:45 AM, Gleb Peregud wrote: > Automatic "parallelization" of lists:* will not be > efficient, at least without extensive compile-time (or even run-time) > analysis of the code (if this is possible/feasible at all). The work on data-parallelism in Haskell seems to suggest this is both possible and feasible. There, the programmer need only mark a list for parallelization; the run-time then decides if it should be parallelized at all, how many thread to use, etc. -kevin From gleber.p@REDACTED Thu Sep 4 17:09:03 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Thu, 4 Sep 2008 17:09:03 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <5347916F-1E52-48AF-835E-0BC21A43551D@scaldeferri.com> References: <48BD4DF9.50903@gmail.com> <200809021741.48654.bekesa@sch.bme.hu> <48BE5C50.70208@gmail.com> <48BE684F.8080305@bigpond.net.au> <48BE983D.3000303@gmail.com> <48BFB0AC.9080308@ericsson.com> <14f0e3620809040345n14d5ef4aqe004839837e5cb9c@mail.gmail.com> <5347916F-1E52-48AF-835E-0BC21A43551D@scaldeferri.com> Message-ID: <14f0e3620809040809u5a4d8622l6877328c17c64776@mail.gmail.com> On Thu, Sep 4, 2008 at 5:02 PM, Kevin Scaldeferri wrote: > On Sep 4, 2008, at 3:45 AM, Gleb Peregud wrote: >> Automatic "parallelization" of lists:* will not be >> efficient, at least without extensive compile-time (or even run-time) >> analysis of the code (if this is possible/feasible at all). > > The work on data-parallelism in Haskell seems to suggest this is both > possible and feasible. There, the programmer need only mark a list for > parallelization; the run-time then decides if it should be parallelized at > all, how many thread to use, etc. > I see. That's very nice to hear! It would be awesome if Erlang was capable of this :) Btw, are lists in haskell tagged with their length? If no how the division into chunks is done without prior knowledge of length? Is it calculated beforehand? Isn't it too slow, since it is O(n)? -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From kevin@REDACTED Thu Sep 4 17:28:22 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Thu, 4 Sep 2008 08:28:22 -0700 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <14f0e3620809040809u5a4d8622l6877328c17c64776@mail.gmail.com> References: <48BD4DF9.50903@gmail.com> <200809021741.48654.bekesa@sch.bme.hu> <48BE5C50.70208@gmail.com> <48BE684F.8080305@bigpond.net.au> <48BE983D.3000303@gmail.com> <48BFB0AC.9080308@ericsson.com> <14f0e3620809040345n14d5ef4aqe004839837e5cb9c@mail.gmail.com> <5347916F-1E52-48AF-835E-0BC21A43551D@scaldeferri.com> <14f0e3620809040809u5a4d8622l6877328c17c64776@mail.gmail.com> Message-ID: <30AECA44-AB66-4F43-A061-7C1607486A3C@scaldeferri.com> On Sep 4, 2008, at 8:09 AM, Gleb Peregud wrote: > On Thu, Sep 4, 2008 at 5:02 PM, Kevin Scaldeferri > wrote: >> On Sep 4, 2008, at 3:45 AM, Gleb Peregud wrote: >>> Automatic "parallelization" of lists:* will not be >>> efficient, at least without extensive compile-time (or even run- >>> time) >>> analysis of the code (if this is possible/feasible at all). >> >> The work on data-parallelism in Haskell seems to suggest this is both >> possible and feasible. There, the programmer need only mark a list >> for >> parallelization; the run-time then decides if it should be >> parallelized at >> all, how many thread to use, etc. >> > > I see. That's very nice to hear! It would be awesome if Erlang was > capable of this :) > > Btw, are lists in haskell tagged with their length? If no how the > division into chunks is done without prior knowledge of length? Is it > calculated beforehand? Isn't it too slow, since it is O(n)? Here's a starting point to learn more: http://www.haskell.org/haskellwiki/GHC/Data_Parallel_Haskell However, skimming over that page a couple of the links, I'm getting the impression that I may have overestimated how far along this work is based on a couple talks I heard SPJ give. In particular, if I read things correctly, at the moment the user must segment the arrays manually; although there's clearly intent to improve on this situation (so that the [: :] syntax is actually useful). -kevin From barrye@REDACTED Thu Sep 4 17:46:14 2008 From: barrye@REDACTED (Barry Ezell) Date: Thu, 4 Sep 2008 11:46:14 -0400 Subject: [erlang-questions] Request for comment or contributions In-Reply-To: <48BFFB28.6050704@e-fractal.cz> References: <4b7f3e3c0809031404i3b37e2cdid12344e0e7f6d40@mail.gmail.com> <1220534531.19227.40.camel@seasc0918.dyn.rnd.as.sw.ericsson.se> <4b7f3e3c0809040717h4b1ad29di89b5af36858baab6@mail.gmail.com> <48BFFB28.6050704@e-fractal.cz> Message-ID: <4b7f3e3c0809040846m71b64e32h91c8f5852fca64dc@mail.gmail.com> Hi Jiri, Thanks for the comments. I've made the changes you recommended in #1 like such: chr_array(C, N, MinMax) when N > 0 Is that a good way of implementing a sanity check or would you recommend something else? I'll work on your #2 suggestion as it's an excellent recommendation. Besides allowing for more than 26 processes, they would be evenly distributed which isn't always the case with the current implementation. In your #3 recommendation, it's missing an increment from non-z characters like b to c. I've used the below test code (from test_pwd.erl): next_test() -> ?assertEqual("b", pwd:next("a")), ?assertEqual("ba", pwd:next("az")), ?assertEqual("zzz", pwd:next("zzy")), ?assertEqual("aba", pwd:next("aaz")), ?assertEqual("zba", pwd:next("zaz")), ?assertEqual("baa", pwd:next("azz")). The test fails with: 2> test_pwd:test(). test_pwd:next_test...*failed* ::error:{assertEqual_failed,[{module,test_pwd}, {line,12}, {expression,"pwd : next ( \"a\" )"}, {expected,"b"}, {value,"a"}]} in function test_pwd:'-next_test/0-fun-0-'/1 in call from test_pwd:next_test/0 ======================================================= Failed: 1. Aborted: 0. Skipped: 0. Succeeded: 3. I very well may be missing something and I'll keep thinking about it. I'm new to Erlang and am trying to get up to speed on best practices. Thanks again for your help. http://github.com/btedev/erlang_md5crack/tree/master Barry On Thu, Sep 4, 2008 at 11:13 AM, Ji?? ?ofka wrote: > Hi, just few quick comments: > > 1. The function partition_alphabet/2 never terminates when Processes < 0. It > is a good practice to include these kinds of sanity checks. The same applies > to chr_array/3 function and its length argument. > > 2. You cannot use more than 26 processes which really kills the point of > this application. I'd suggest to calculate how many different strings of the > specified length are there (let's call that number N) and divide the range > (0; N) into equal subranges according to the number of desired processes. > You'd then need a function that translates subrange boundaries to > starting/ending strings - which shouldn't be hard to write. Each process > will then take care of one of the subranges. > > 3. It is pointless to loop over the rest of the string and check whether the > head equals to $z once the increment in next/1 changes to false. In that > case simply reverse the remainder of the string and append the accumulator > to it. In the end, it's probably about as fast as your version but more > readable: > > next(L) -> > next(lists:reverse(L), []). > next([$z|T], Acc) -> > next(T, [$a|Acc]); > next(List, Acc) -> lists:reverse(List, Acc). > > > JS > > Barry Ezell wrote: >> >> Hello Bengt, >> >> Thank you very much for the suggestions. I've commented the code >> better to explain the intent of the module. This is my first Erlang >> program and I'm trying to prepare a talk on concurrency in Erlang to >> be given in October. The module is demonstration code for breaking >> MD5 passwords using a brute-force approach. For example, if the >> string "hi" is hashed by erlang:md5, the program would partition every >> 2-character variant into as many arrays as processes to be spawned, >> then each process would test the md5 hash of the character arrays >> until "hi" is found as a match. This is a contrived example but easy >> enough to grasp for the purposes of a talk. >> >> I have implemented all of the changes you suggested except for #1. >> There is a reason why the list is reversed before next/3 is evaluated. >> The character array is examined in reverse order because the >> increment of one character may affect the increment of the character >> in front of it. For instance, next("aaz") must yield "aba". When >> reversed, "z" is matched first, changed to "a", then the increment is >> passed to the next character in the reversed array, thus changing "a" >> to "b". If I am missing something I should be doing differently, >> please let me know. >> >> The changes are posted at: >> http://github.com/btedev/erlang_md5crack/tree/master/pwd.erl >> >> Thanks again, >> >> Barry >> >> >> >> On Thu, Sep 4, 2008 at 9:22 AM, Bengt Kleberg >> wrote: >> >>> >>> Greetings, >>> >>> Unfortunately I do not understand what your program does. So this is a >>> very low level comment. >>> >>> 1 If possible try to change next() to the following: >>> next(L) -> >>> next(L, [], true). >>> >>> next([], L, _Incr) -> >>> lists:reverse(L); >>> %% the rest as in your code >>> >>> Unless there is a specific reason to reverse before use the normal >>> Erlang way is to reverse afterwards. >>> >>> >>> 2 In partition_alphabet() I would use a tuple for Arr. Like this: >>> Arr = {chr_array(CurChar, Len, min) , chr_array($z, Len, max)}, >>> >>> and also change decrypt()'s fun to fun({Min,Max}) -> >>> >>> Lists are normally used for a variable amount of items. Here you always >>> have 2 items. >>> >>> 3 As a personal habit I would change analyze() to use case instead of >>> if. Like this: >>> case Test =:= Crypted of >>> true -> >>> false -> >>> end. >>> >>> This is just because I find if very different to other langugaes if. >>> >>> >>> bengt >>> >>> >>> On Wed, 2008-09-03 at 17:04 -0400, Barry Ezell wrote: >>> >>>> >>>> In my request for comments post yesterday, I forgot to mention that >>>> the code can be viewed at the following URL without requiring a "git >>>> clone". >>>> >>>> http://github.com/btedev/erlang_md5crack/tree/master/pwd.erl >>>> >>>> Thanks again for any suggestions. >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>> >>> >>> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > From igouy2@REDACTED Thu Sep 4 17:03:00 2008 From: igouy2@REDACTED (Isaac Gouy) Date: Thu, 4 Sep 2008 08:03:00 -0700 (PDT) Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <48BFB0AC.9080308@ericsson.com> Message-ID: <867011.13818.qm@web65403.mail.ac4.yahoo.com> --- "Ulf Wiger (TN/EAB)" wrote: > Mats Cronqvist skrev: > > Benjamin Tolputt wrote: > >> > >> The issue is that taking the direction you suggest *right now* > >> will have the effect of making Erlang slower for most tasks on > >> most platforms it is currently deployed on. > > Will it? I doubt it would make a realistic application (e.g. > > a phone switch) significantly slower even on single core HW. > > Perhaps you're aware of some measurement that would prove me > > wrong? > > The shootout could be a place to experiment with this, if we > could have one Erlang entry that assumes SMP, and one that > doesn't, for each benchmark (like we used to have a non-HiPE > and a HiPE version). Well, we seem to be heading towards different data sets - q6600 all four cores - q6600 just one core with programs that use different strategies for the same algorithm listed together (yes, I know, it's getting a bit nuanced). > One issue is that there isn't e.g. a plists in the stdlib. > With permission from the shootout maintainers, we could > possibly have a patched build, with a lists module (etc.) > defaulting to parallel solutions (i.e. spawning processes > where sensible, and gathering results, preserving order > where necessary.) Yuck - possibly maybe as a very temporary thing. Wouldn't it be better to try this with fab 24 CPU hardware? From toby@REDACTED Thu Sep 4 18:15:11 2008 From: toby@REDACTED (Toby Thain) Date: Thu, 4 Sep 2008 13:15:11 -0300 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <5347916F-1E52-48AF-835E-0BC21A43551D@scaldeferri.com> References: <48BD4DF9.50903@gmail.com> <200809021741.48654.bekesa@sch.bme.hu> <48BE5C50.70208@gmail.com> <48BE684F.8080305@bigpond.net.au> <48BE983D.3000303@gmail.com> <48BFB0AC.9080308@ericsson.com> <14f0e3620809040345n14d5ef4aqe004839837e5cb9c@mail.gmail.com> <5347916F-1E52-48AF-835E-0BC21A43551D@scaldeferri.com> Message-ID: On 4-Sep-08, at 12:02 PM, Kevin Scaldeferri wrote: > > On Sep 4, 2008, at 3:45 AM, Gleb Peregud wrote: > >> Automatic "parallelization" of lists:* will not be >> efficient, at least without extensive compile-time (or even run-time) >> analysis of the code (if this is possible/feasible at all). > > The work on data-parallelism in Haskell seems to suggest this is both > possible and feasible. There, the programmer need only mark a list > for parallelization; the run-time then decides if it should be > parallelized at all, how many thread to use, etc. I think Perl 6 is heading in this direction as well (junctions etc), perhaps related to the fact that a popular P6 implementation is in Haskell. --Toby > > > -kevin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From kevin@REDACTED Thu Sep 4 18:21:02 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Thu, 4 Sep 2008 09:21:02 -0700 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <867011.13818.qm@web65403.mail.ac4.yahoo.com> References: <867011.13818.qm@web65403.mail.ac4.yahoo.com> Message-ID: On Sep 4, 2008, at 8:03 AM, Isaac Gouy wrote: >> >> One issue is that there isn't e.g. a plists in the stdlib. >> With permission from the shootout maintainers, we could >> possibly have a patched build, with a lists module (etc.) >> defaulting to parallel solutions (i.e. spawning processes >> where sensible, and gathering results, preserving order >> where necessary.) > > Yuck - possibly maybe as a very temporary thing. As a casual observer / contributor, I would find this distasteful. I don't want to have to maintain a patched version of Erlang just for this activity. Until the point where there is a plists in the stdlib, I think we just have to take the hit in line count to paste in implementations to the entry code. -kevin From japerk@REDACTED Thu Sep 4 19:06:51 2008 From: japerk@REDACTED (Jacob Perkins) Date: Thu, 4 Sep 2008 10:06:51 -0700 Subject: [erlang-questions] dealing with large dicts Message-ID: Hey all, I've been having an issue with erlang crashing due to an out-of-memory error. I'm pretty sure the reason is that I'm looking up, updating, then writing back a fairly large dict in a mnesia transaction, and doing that many times for many different dicts. Each dict may contain thousands of 30 character string keys along with float values. My rough calculations say that each dict may be on the order of a couple megabytes, maybe approaching 10M given the indexing overhead of the dict structure. And since all the value copying happens within a transaction, there's a lot of memory being used. Here's the basic transaction function I'm doing: T = fun(Term, Key) -> [Dict1] = mnesia:read(Table, Term), Dict2 = dict:store(Key, Val, Dict1), ok = write_val(Table, Term, Dict2) end. Any thoughts, alternative approaches? Because of erlang's single assignment, I'm thinking maybe what I need is a kind of "binary dict", something where the whole structure is not copied when a small part changes, and still provides very quick value lookup and key iteration. Does this sound feasible, any thoughts on how to implement it? Is there any existing code for something like this? Could I still store the binary in mnesia? Thanks, Jacob -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Thu Sep 4 19:37:06 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Thu, 4 Sep 2008 13:37:06 -0400 Subject: [erlang-questions] ETS & SMP was: Parallelism, SMP, and multicore question In-Reply-To: <00f501c90d98$cf868720$6401a8c0@moneymaker2> References: <6c2563b20809021009n3f9619d9h4c439a3a64393c84@mail.gmail.com> <00f501c90d98$cf868720$6401a8c0@moneymaker2> Message-ID: <6c2563b20809041037sa699ffdh28d436b477531c8f@mail.gmail.com> Well, now I know that at least *one* person read my question :) Aren't concerns about when SMP is and isn't beneficial at least thought-provoking? Or do I need to write and publish actual code showing the differences? 2008/9/3 Valentin Micic > Is ETS utilizing the same locking policy for all table types (namely: > public, protected or private), and if so, would it be possible to relax > locking for protected and private access? > > We've noticed that if more than one process requires an access to the same > ets table (in SMP environment), the system slows down considerably due to > the locking mechanism. It is quite possible to optimize this by fronting > such a table with a dedicated process for request serialization -- works > better as there is always only one proccess requesting a lock. Actually... as much as this works well for one table, not so sure how would > such an "optimization" work for a large number of tables. By relaxing (or > not having) a locking policy for (at least) tables with a private access, > there would be no questions about it. > > V. > > > ----- Original Message ----- > *From:* Edwin Fine > *To:* erlang-questions@REDACTED > *Sent:* Tuesday, September 02, 2008 7:09 PM > *Subject:* [erlang-questions] Parallelism, SMP, and multicore question > > Since the cognoscenti are talking about parallelism, maybe someone can > answer something that has been perplexing me. > > Sometimes it has been measurably faster on a multicore system to run one VM > per core, each with SMP disabled (or +S 1), than it is to run one or more > SMP VMs. This is true even when running code that is innately parallel. On > the other hand, I have seen benchmarks that show near-linear speedups using > SMP. > > I don't have code to support this; it's just something I, along with a > couple of other people -- for whom I don't want to speak -- have noticed in > passing. > > Does anyone have any insight into the internals of SMP who can tell me when > SMP might be an asset, and when a liability? I know this is a "how long is a > piece of string" question, but even though it's pretty general, someone > somewhere who really knows Erlang inside out (i.e. not me) must surely have > encountered this phenomenon. > > Are there conditions where contention between the threads of the SMP > processes (e.g. mutexes) becomes significant enough that multiple separate > non-SMP VMs perform better? If so, what would those conditions be? > > Could it have anything to do with the mix of CPU-bound processes and > inter-process messaging or network I/O? If so, please could someone explain > the mechanism? > > Anyone? > > ------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Thu Sep 4 19:38:47 2008 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 04 Sep 2008 19:38:47 +0200 Subject: [erlang-questions] dealing with large dicts In-Reply-To: References: Message-ID: <48C01D27.6080000@it.uu.se> Jacob Perkins wrote: > T = fun(Term, Key) -> > [Dict1] = mnesia:read(Table, Term), > Dict2 = dict:store(Key, Val, Dict1), > ok = write_val(Table, Term, Dict2) > end. I think the problem is not the updates to the dict itself, but the fact that you are moving the entire dicts in and out of mnesia (whose storage is based on ets/dets tables, which do not share memory with your process). Each transaction thus consists of 1) a huge copy out, 2) relatively minor rewrite of the dict structure, 3) copy entire new structure back. You'll be better off just using a mnesia table (or several) for your key/value data. /Richard From atomly-erl@REDACTED Thu Sep 4 19:49:11 2008 From: atomly-erl@REDACTED (atomly) Date: Thu, 4 Sep 2008 13:49:11 -0400 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: References: <867011.13818.qm@web65403.mail.ac4.yahoo.com> Message-ID: <20080904174911.GE16945@atomly.com> [Kevin Scaldeferri ] > Until the point where there is a plists in the stdlib, I think we just > have to take the hit in line count to paste in implementations to the > entry code. I agree. It's not like parallel map takes that many lines of code, especially if you're only trying to write it for one specific case. -- :: atomly :: [ atomly@REDACTED : www.atomly.com ... [ atomiq records : new york city : +1.917.442.9450 ... [ e-mail atomly-news-subscribe@REDACTED for atomly info and updates ... From japerk@REDACTED Thu Sep 4 20:05:19 2008 From: japerk@REDACTED (Jacob Perkins) Date: Thu, 4 Sep 2008 11:05:19 -0700 Subject: [erlang-questions] dealing with large dicts In-Reply-To: <48C01D27.6080000@it.uu.se> References: <48C01D27.6080000@it.uu.se> Message-ID: On Thu, Sep 4, 2008 at 10:38 AM, Richard Carlsson wrote: > Jacob Perkins wrote: > > T = fun(Term, Key) -> > > [Dict1] = mnesia:read(Table, Term), > > Dict2 = dict:store(Key, Val, Dict1), > > ok = write_val(Table, Term, Dict2) > > end. > > I think the problem is not the updates to the dict itself, but the > fact that you are moving the entire dicts in and out of mnesia > (whose storage is based on ets/dets tables, which do not share memory > with your process). Each transaction thus consists of 1) a huge copy > out, 2) relatively minor rewrite of the dict structure, 3) copy entire > new structure back. You'll be better off just using a mnesia table (or > several) for your key/value data. > > /Richard > The reason for the dicts and not separate tables is that I don't know the initial Terms (string keys to lookup dicts) beforehand, and the number of possible Terms is fairly large. The Terms would have to be converted to atoms in order to be table names, which are limited. The table is for a term-document index, where given a term, I want a list of document ids with their relative weight. So at indexing time, I need to store a document id and a weight for a given term. I can put an upper limit on the number of documents (right now I'm hoping it could be as high as 50k), and in practice the number of terms would probably be much less, but could be as many as 10k. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Thu Sep 4 21:00:27 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 4 Sep 2008 21:00:27 +0200 Subject: [erlang-questions] Selective receive issue In-Reply-To: <48BB9F8A.3010506@theheartofgold.org> References: <95be1d3b0808042359s2a93676eqf3fc0afbb2087f94@mail.gmail.com> <48BB9F8A.3010506@theheartofgold.org> Message-ID: <95be1d3b0809041200m7d0e0557i44d5818320691b3f@mail.gmail.com> Hi, On Mon, Sep 1, 2008 at 09:53, Anders Ramsell wrote: > As our program grows keeping my_flush correct may be hard unless > we keep wanted messages easy to identify. In my "final" version I > have changed all wanted messages to be 2-tuples starting with a > known tag. This is a "duh! why didn't I think of that?" idea: simple and elegant once one sees it :-) Thanks a lot for the input! regards, Vlad From thomasl_erlang@REDACTED Thu Sep 4 20:20:32 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 4 Sep 2008 11:20:32 -0700 (PDT) Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <14f0e3620809040442u2109d07fs452758e4a2626d9a@mail.gmail.com> Message-ID: <213756.29538.qm@web38803.mail.mud.yahoo.com> --- On Thu, 9/4/08, Gleb Peregud wrote: > wrote: > > Gleb Peregud wrote: > >> > >> It would be nice to include plists (or similar) > into stdlib > >> permanently. It will allow users of Erlang/OTP > fine-tune their > >> applications for SMP systems just by adding > "p" (and Malt) where > >> necessary. I think this issue should be in the > hands of the > >> programmer. > > > > that the competent programmer will always be able to > tune her application > > to however many cores she's targeting is a truism. > the issue at hand is what > > strategy the OTP libraries should use when the > programmer does not/cannot > > provide hints (or when running legacy code). > > > >> Automatic "parallelization" of lists:* > will not be > >> efficient, at least without extensive compile-time > (or even run-time) > >> analysis of the code (if this is possible/feasible > at all). > > > > "will not" is strong wording. can you > provide some evidence to back that > > up? > > You are right, I've used too strong words here. I'm > not able to back them up. Well, you just need to look back to the 80s and early 90s to be vindicated :-) Lots and lots of examples there of too fine-grained parallelization meaning the hardware crawled along. In Erlang, we have the basic issue that each spawned task requires a couple of hundred words (I think), so the overhead for a job that requires a few tens of cycles is huge, not a mere 10%. Simple cases can sometimes be handled by manual annotation, but there are lots of pitfalls. And at the bottom of the pit you not just choke on huge run queues, but run out of memory, etc. For example, consider a parallel map operation. For what inputs will parallel evaluation beat sequential evaluation? Clearly it depends on the map operation F, the length of the list, and, in the end, even the actual list elements. (In Erlang, we also have higher-order functions to handle, including nested parallel maps passed at runtime. Composing these operations is non-trivial.) Presumably, it might also depend on the overall state of the system, e.g., whether you can afford to spawn more jobs given current memory etc. So, when should we spawn a task to evaluate E in parallel rather than running it sequentially? In general, we end up with this problem: for an arbitrary expression E, cheaply and precisely predict the cost of evaluating it (sequentially and, for extra credit, taking into consideration dynamic parallelization). There has been some work on doing this automatically, but it's hard to say the least. (Also, tuning your code to the number of cores is a nightmare to maintain, but everyone knows this, right?) I would thus expect a great deal of difficulty in attaining high speedups. At a guess, only embarrassingly parallel applications -- happily, Erlang has lots of those -- will utilize 100s of cores successfully. (One successful example of this is the throughput-hungry realm of graphics. Cf. CUDA and others, which appears to be successive passes of SIMD operations over big arrays. And even there, you can get your nose bloodied when trying to predict performance.) Why? Because bottlenecks tend to turn up much earlier than that. Serious tuning seems likely to be needed. In conclusion, it means good times for the experts :-) Best, Thomas From tbaldridge@REDACTED Thu Sep 4 21:34:19 2008 From: tbaldridge@REDACTED (Timothy Baldridge) Date: Thu, 4 Sep 2008 14:34:19 -0500 Subject: [erlang-questions] Issue with my first program Message-ID: Well, I'm finally making the dive into Erlang programming. I have project at work here that I'm using to learn with. Basically this program will connect to a tcp server. Then it will begin to parse info that the server spits out. The data is in this format (plaintext): command|arg1|arg2#command2|arg2# So # separates commands and | separates phrases. Here's the code I have so far: -module(filemonitor). -export([start/1, dispatchloop/2]). start(Ip) -> {ok, Socket} = gen_tcp:connect(Ip, 9442, [binary]), loop(Socket, []). loop(Socket, Buffer) -> receive {tcp, Socket, Bin} -> io:format("~p~n", [Bin]), Newbuff = dispatchloop(Bin, Buffer), loop(Socket, Newbuff); {tcp_error, Socket, Reason} -> io:format("Error ~p~n", [Reason]), gen_tcp:close(Socket); {tcp_closed, Socket} -> io:format("Connection Terminated~n") end. callcommand(Working) -> io:format("~s~n", [Working]). dispatchloop([],Working) -> Working; dispatchloop([H|T], Working) -> if H == "#" -> callcommand(Working), dispatchloop(T, []); true -> dispatchloop(T, Working) end. I get this error: 4> filemonitor:start("192.168.101.170"). <<"getattr|/#">> ** exception exit: function_clause in function filemonitor:dispatchloop/2 called as filemonitor:dispatchloop(<<"getattr|/#">>,[]) in call from filemonitor:loop/2 Any ideas I'm stumped.... Thanks, Timothy From pfisher@REDACTED Thu Sep 4 20:43:35 2008 From: pfisher@REDACTED (Paul Fisher) Date: Thu, 04 Sep 2008 13:43:35 -0500 Subject: [erlang-questions] dealing with large dicts In-Reply-To: References: Message-ID: <48C02C57.1050505@alertlogic.net> Jacob Perkins wrote: > Hey all, I've been having an issue with erlang crashing due to an > out-of-memory error. I'm pretty sure the reason is that I'm looking up, > updating, then writing back a fairly large dict in a mnesia transaction, > and doing that many times for many different dicts. Each dict may > contain thousands of 30 character string keys along with float values. > My rough calculations say that each dict may be on the order of a couple > megabytes, maybe approaching 10M given the indexing overhead of the dict > structure. And since all the value copying happens within a transaction, > there's a lot of memory being used. Here's the basic transaction > function I'm doing: > > T = fun(Term, Key) -> > [Dict1] = mnesia:read(Table, Term), > Dict2 = dict:store(Key, Val, Dict1), > ok = write_val(Table, Term, Dict2) > end. > > Any thoughts, alternative approaches? While not always the right thing because of the extra cpu overhead, you can reduce some of the memory overhead and copying with something like this: T = fun(Term, Key) -> [CDict1] = mnesia:read(Table, Term), Dict1 = binary_to_term( CDict1 ), Dict2 = dict:store(Key, Val, Dict1), CDict2 = term_to_binary( Dict2, [compressed] ), ok = write_val(Table, Term, CDict2) end. This will keep the size down for the copies and should be ref counted when passed from/to mnesia/ets/dets process to retrieve/store. -- paul From erlang-questions_efine@REDACTED Thu Sep 4 21:55:22 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Thu, 4 Sep 2008 15:55:22 -0400 Subject: [erlang-questions] Issue with my first program In-Reply-To: References: Message-ID: <6c2563b20809041255i1dc5796eu3428616e12d2378a@mail.gmail.com> dispatchloop is expecting a list but you are giving it a binary. You probably want something like dispatchloop(<<>>, Working) -> Working; dispatchloop(<<$#,Rest/bytes>>, Working) -> callcommand(Working), dispatchloop(Rest, []); dispatchloop(<<_Skip,Rest/bytes>>, Working) -> dispatchloop(Rest, Working). HTH On Thu, Sep 4, 2008 at 3:34 PM, Timothy Baldridge wrote: > Well, I'm finally making the dive into Erlang programming. I have > project at work here that I'm using to learn with. Basically this > program will connect to a tcp server. Then it will begin to parse info > that the server spits out. The data is in this format (plaintext): > > command|arg1|arg2#command2|arg2# > > So # separates commands and | separates phrases. Here's the code I have so > far: > > -module(filemonitor). > -export([start/1, dispatchloop/2]). > > start(Ip) -> > {ok, Socket} = gen_tcp:connect(Ip, 9442, [binary]), > loop(Socket, []). > > loop(Socket, Buffer) -> > receive > {tcp, Socket, Bin} -> > io:format("~p~n", [Bin]), > Newbuff = dispatchloop(Bin, Buffer), > loop(Socket, Newbuff); > {tcp_error, Socket, Reason} -> > io:format("Error ~p~n", [Reason]), > gen_tcp:close(Socket); > {tcp_closed, Socket} -> > io:format("Connection Terminated~n") > end. > > > > callcommand(Working) -> > io:format("~s~n", [Working]). > > dispatchloop([],Working) -> > Working; > dispatchloop([H|T], Working) -> > if > H == "#" -> > callcommand(Working), > dispatchloop(T, []); > true -> > dispatchloop(T, Working) > end. > > > I get this error: > > 4> filemonitor:start("192.168.101.170"). > <<"getattr|/#">> > ** exception exit: function_clause > in function filemonitor:dispatchloop/2 > called as filemonitor:dispatchloop(<<"getattr|/#">>,[]) > in call from filemonitor:loop/2 > > > Any ideas I'm stumped.... > > Thanks, > > Timothy > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexander.uvarov@REDACTED Thu Sep 4 23:01:30 2008 From: alexander.uvarov@REDACTED (WildChild) Date: Fri, 5 Sep 2008 03:01:30 +0600 Subject: [erlang-questions] Time to update programming rules? Message-ID: http://www.erlang.se/doc/programming_rules.shtml 7.7 Module names Erlang has a flat module structure (i.e. there are not modules within modules). Often, however, we might like to simulate the effect of a hierarchical module structure. This can be done with sets of related modules having the same module prefix. If, for example, an ISDN handler is implemented using five different and related modules. These module should be given names such as: isdn_init isdn_partb isdn_... We have packages! http://www.erlang.se/publications/packages.html From jongretar@REDACTED Fri Sep 5 00:04:31 2008 From: jongretar@REDACTED (Jon Gretar Borgthorsson) Date: Thu, 4 Sep 2008 22:04:31 +0000 Subject: [erlang-questions] Time to update programming rules? In-Reply-To: References: Message-ID: <4ecde87b0809041504t73c8230fh13ed1c653423ceba@mail.gmail.com> Nice. This is the first time I have heard about them. So I guess it really is time to update the documentation. On Thu, Sep 4, 2008 at 9:01 PM, WildChild wrote: > http://www.erlang.se/doc/programming_rules.shtml > > 7.7 Module names > > Erlang has a flat module structure (i.e. there are not modules within > modules). Often, however, we might like to simulate the effect of a > hierarchical module structure. This can be done with sets of related > modules having the same module prefix. > > If, for example, an ISDN handler is implemented using five different > and related modules. These module should be given names such as: > isdn_init > isdn_partb > isdn_... > > We have packages! http://www.erlang.se/publications/packages.html > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jchris@REDACTED Fri Sep 5 00:48:13 2008 From: jchris@REDACTED (Chris Anderson) Date: Thu, 4 Sep 2008 15:48:13 -0700 Subject: [erlang-questions] CouchDB talk in NYC Message-ID: Thanks to Avi at Arc60, we've got a venue and a time for my CouchDB talk. It will be 6pm on Tuesday, Sept 16th. I'll cover CouchDB from a web-application programmers perspective, but also touch on how replication makes both high-availability and offline client application much easier than under old-style SQL databases. Please come with questions, I'd love to help new people dig into the internals, and understand the long-term roadmap of the project. The location is: Arc90, 747 3rd Ave, 30th Floor, New York, NY 10017 Please RSVP here so we know how many to expect: http://www.mobaganda.com/couchdbtechtalkarc90-20080916 PS. I may give another talk that week, but it's not scheduled yet. Looking forward to meeting some East Coast Couchers! Chris -- Chris Anderson http://jchris.mfdz.com From ok@REDACTED Fri Sep 5 02:11:40 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 5 Sep 2008 12:11:40 +1200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: <17953_1220536814_m84E0BEQ001912_14f0e3620809040345n14d5ef4aqe004839837e5cb9c@mail.gmail.com> References: <48BD4DF9.50903@gmail.com> <200809021741.48654.bekesa@sch.bme.hu> <48BE5C50.70208@gmail.com> <48BE684F.8080305@bigpond.net.au> <48BE983D.3000303@gmail.com> <48BFB0AC.9080308@ericsson.com> <17953_1220536814_m84E0BEQ001912_14f0e3620809040345n14d5ef4aqe004839837e5cb9c@mail.gmail.com> Message-ID: I am all for automatic parallelisation, AS LONG AS IT WORKS. There are ways of dealing with the "but it might be a long list with little per-element work" issue; we might have something to learn from the Cilk people here. However, there is a big difference between a "fibre" created by the run time system to do work in parallel and a "process" created by the programmer to work concurrently with other processes and communicate with them. "Fibres" may be created or *not* at the runtime's whim, and work may be shifted around in various ways because there is no *visible* communication to be affected by it. I am going to keep on repeating my basic point until it sinks in: Erlang processes have side effects, and changing from sequential map to parallel map changes the meaning of the program. I offer you just one example: f(N) -> Pid = spawn(fun loop/0), [Pid!{I,self()} || I <- lists:seq(1, N)], Pid!stop, [receive X -> X end || I <- lists:seq(1, N)], loop() -> receive stop -> stop; {X,Pid} -> Pid!(X*X-3), loop() end. If you "automatically parallelise" the first list comprehension (or the equivalent map I was too lazy to write), it will go wrong. The answers computed by loop/0 will be sent to the wrong processes. Automatic parallelisation is good for PURE functional code. When we have something that can reliably detect chunks of Erlang code that are pure, let's go for it! Till then, beware... From ok@REDACTED Fri Sep 5 04:24:38 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 5 Sep 2008 14:24:38 +1200 Subject: [erlang-questions] Issue with my first program In-Reply-To: <13847_1220557593_m84JkVov025597_b33fdb110809041234m6d620f01w69402436a46020f9@mail.gmail.com> References: <13847_1220557593_m84JkVov025597_b33fdb110809041234m6d620f01w69402436a46020f9@mail.gmail.com> Message-ID: On 5 Sep 2008, at 7:34 am, Timothy Baldridge wrote: > -module(filemonitor). > -export([start/1, dispatchloop/2]). whatiswiththewordsruntogetherlikethis? thatisevenhardertoreadthan BaStudlyCaps. > dispatchloop([],Working) -> > Working; > dispatchloop([H|T], Working) -> > if > H == "#" -> > callcommand(Working), > dispatchloop(T, []); > true -> > dispatchloop(T, Working) > end. > 4> filemonitor:start("192.168.101.170"). > <<"getattr|/#">> > ** exception exit: function_clause > in function filemonitor:dispatchloop/2 > called as filemonitor:dispatchloop(<<"getattr|/#">>,[]) > in call from filemonitor:loop/2 It is telling you plainly that dispatchloop/2 was called with the BINARY <<"getattr|/#">> as its first argument. But dispatchloop wants a LIST as its first argument, so no clause matched. ('function_clause' really means "[no] function clause [matched]".) I also note that you never ever put anything into the Working argument; all you ever do is to pass it along or reset it to []. I also note that you have interleaved >finding< the commands and >processing< the commands. When you are getting started with something, it's often better to keep things separate. These three examples might be helpful: 1> regexp:split("foo#bar#ugh#", "#"). {ok,["foo","bar","ugh",[]]} 2> regexp:split("ick|ack||ugh", "|"). {ok,["ick","ack",[],"ugh"]} 3> binary_to_list(<<"getattr|/#">>). "getattr|/#" From ok@REDACTED Fri Sep 5 04:37:23 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 5 Sep 2008 14:37:23 +1200 Subject: [erlang-questions] Time to update programming rules? In-Reply-To: <20377_1220562821_m84LDcK6006538_b3bfba320809041401t5bac0974vdfc19ac68758cb1b@mail.gmail.com> References: <20377_1220562821_m84LDcK6006538_b3bfba320809041401t5bac0974vdfc19ac68758cb1b@mail.gmail.com> Message-ID: <43927518-39DE-438F-AA14-B3268BF69FF5@cs.otago.ac.nz> On 5 Sep 2008, at 9:01 am, WildChild wrote: > http://www.erlang.se/doc/programming_rules.shtml > > 7.7 Module names > > Erlang has a flat module structure (i.e. there are not modules within > modules). We have packages! http://www.erlang.se/publications/packages.html Yes, but (a) we should not use them because they are inside out, and (b) packages are NOT "modules within modules". Poplog, Ada, and SML have modules within modules. Modules within modules are much more like Java nested classes than they are like Java packages. From erlang-questions_efine@REDACTED Fri Sep 5 04:55:13 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Thu, 4 Sep 2008 22:55:13 -0400 Subject: [erlang-questions] Time to update programming rules? In-Reply-To: <43927518-39DE-438F-AA14-B3268BF69FF5@cs.otago.ac.nz> References: <20377_1220562821_m84LDcK6006538_b3bfba320809041401t5bac0974vdfc19ac68758cb1b@mail.gmail.com> <43927518-39DE-438F-AA14-B3268BF69FF5@cs.otago.ac.nz> Message-ID: <6c2563b20809041955l20ff361an46312fa11c86f54@mail.gmail.com> Richard, Please will you clarify what you mean by (a) we should not use them because they are inside out ? Do you mean, we should not use these facilities at all, ever, because the design is badly flawed, or we should not use them in the way the documentation proposes, because it's "inside out", and there's a better way? Or both, or neither? What do you mean by "inside out"? On Thu, Sep 4, 2008 at 10:37 PM, Richard A. O'Keefe wrote: > > On 5 Sep 2008, at 9:01 am, WildChild wrote: > > > http://www.erlang.se/doc/programming_rules.shtml > > > > 7.7 Module names > > > > Erlang has a flat module structure (i.e. there are not modules within > > modules). We have packages! > http://www.erlang.se/publications/packages.html > > Yes, but > (a) we should not use them because they are inside out, and > (b) packages are NOT "modules within modules". > Poplog, Ada, and SML have modules within modules. > Modules within modules are much more like Java nested classes > than they are like Java packages. > > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Fri Sep 5 05:14:17 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 5 Sep 2008 15:14:17 +1200 Subject: [erlang-questions] Time to update programming rules? In-Reply-To: <28289_1220583318_m852tFlX011084_6c2563b20809041955l20ff361an46312fa11c86f54@mail.gmail.com> References: <20377_1220562821_m84LDcK6006538_b3bfba320809041401t5bac0974vdfc19ac68758cb1b@mail.gmail.com> <43927518-39DE-438F-AA14-B3268BF69FF5@cs.otago.ac.nz> <28289_1220583318_m852tFlX011084_6c2563b20809041955l20ff361an46312fa11c86f54@mail.gmail.com> Message-ID: On 5 Sep 2008, at 2:55 pm, Edwin Fine wrote: > Richard, > > Please will you clarify what you mean by > > (a) we should not use them because they are inside out I have discussed this at length in this mailing list. > Do you mean, we should not use these facilities at all, ever, > because the design is badly flawed, Yes. > One fundamental issue is that dotted names are just that: a *FLAT* module name space that just happens to allow dots in identifiers. Since Erlang already allows @ signs in identifiers, if we had wanted to use names like mnesia@REDACTED@connector@REDACTED we could have and can still. (Think of the "@" signs as "fat dots".) Allowing dots in identifiers doesn't, in principle, accomplish anything that allowing at-signs in identifiers doesn't. Well, there's some sort of abbreviation rule, but all that does is to mess things up horribly. It is now possible for two *different* names to refer to the *same* module. It is also possible for a module (with no mentions of its name anywhere other than ?MODULE) to break if you change its name. In fact, changing the name of a module that doesn't mention its name ANYWHERE other than the -module directive can break it. Why I say it's inside-out is that "compound names" for modules need to be relative to the starting module, not "absolute", so that you can move an entire cluster of related modules in a single renaming, WITHOUT having to hack on every single file. The design also perpetuates a great nastiness from Java, that of mixing up the dotting structure of module names with the arrangement of files in a file system. I have just spent a painful half hour trying to read the documentation and sources for a Haskell package I'd like to use. They've followed Java's lead with module names. One result is that what seems to this potential user like *ONE* thing is actually broken up into about 30 pieces; instead of one coherent manual there are disconnected bits all over the place. Instead of one directory with all the source files, there is a great tree with files, even files that are conceptually at the same level, not only in different directories but in directories at different levels. The right thing to do is to have a "configuration" language like C/Mesa or LACE. From dbyrne@REDACTED Fri Sep 5 05:20:45 2008 From: dbyrne@REDACTED (Dennis Byrne) Date: Thu, 4 Sep 2008 22:20:45 -0500 Subject: [erlang-questions] A whole bunch of implementation details In-Reply-To: <08F3714D-5099-4ED8-9C59-8E6B553720EE@cs.otago.ac.nz> Message-ID: Thank you Richard, Mikael and Raimo. Here's another question I got as a follow up. Can pids be reused, even though the documentation refers to them as unique? Any info on the underlying implementation of how a pid is uniquely generated across a cluster? If they are not unique, what precautions should application developers use to guard against this? ____________________________________________ Dennis Byrne ThoughtWorks - Chicago 312-505-7965 "Richard A. O'Keefe" 09/04/2008 12:41 AM To Dennis Byrne cc Subject Re: [erlang-questions] A whole bunch of implementation details On 4 Sep 2008, at 2:37 pm, Dennis Byrne wrote: > How does stack memory grow? Am told Prolog does this dynamically > and I was wondering if Erlang did the same. Some Prologs (DEC-10 Prolog, Quintus Prolog, SICStus Prolog, ...) do this, some Prologs (C Prolog, SWI Prolog) don't. The Burroughs B6700 used to do this for Algol, BASIC, COBOL, DMAlgol, ESPOL, FORTRAN, Pascal, and PL/I, back in the late 60s. "Modern", less capable, systems like say Windows or Unix, do not do this because they don't know where the pointers are. The B6700, Prolog systems, and Erlang systems, tag each word of memory to say what it is, so you can infallibly find the pointers. With that, moving a stack is tedious rather than difficult. > Does heap memory contract? It can. > > Exactly what is the tipping point between what gets passed by value > and what gets passed by reference? There is no pass by reference. All binaries are passed by value. Some binary values are represented by pointers. Some of those pointers point to shared blocks, some don't. But it is still pass by value. Pass by reference is, by definition, passing the address of a VARIABLE ('var x: t' in Pascal, 't& x' in C++). Notionally when you send anything in a message, it is copied, otherwise it isn't. Some Erlang systems have had a shared or hybrid heap, in which the logical copy is a no-op. > The large binary trick is common knowledge, any other corner cases? > How does the VM differentiate between a node that is temporarily > unresponsive and one that is down? In other words, at what point > does a node give up on a peer? There is no infallible way to tell. Mistakes will always be made. The net_kernel module sets up a "ticker" process that periodically sends a message to every node it's in communication with; if it doesn't hear from a node after a while it assumes it's down. If a node is shut down in an orderly way it will tell is peers that it is going down. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Fri Sep 5 05:31:09 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 5 Sep 2008 15:31:09 +1200 Subject: [erlang-questions] Time to update programming rules? In-Reply-To: <21925_1220584680_m853Hxxm021259_48C0A4DE.3080407@bigpond.net.au> References: <20377_1220562821_m84LDcK6006538_b3bfba320809041401t5bac0974vdfc19ac68758cb1b@mail.gmail.com> <43927518-39DE-438F-AA14-B3268BF69FF5@cs.otago.ac.nz> <6c2563b20809041955l20ff361an46312fa11c86f54@mail.gmail.com> <21925_1220584680_m853Hxxm021259_48C0A4DE.3080407@bigpond.net.au> Message-ID: <2E9A0764-1977-4132-B0C6-0928603FEC2D@cs.otago.ac.nz> On 5 Sep 2008, at 3:17 pm, Benjamin Tolputt wrote: > The idea of using the package support appeals to me as it will help > keep > name-space conflicts to a minimum. As I understand the "packages.html" > page, this is pretty much ALL that the packages functionality offers. It doesn't offer any MORE of that than Erlang has without it. What it DOES give you is extra breakability. From ok@REDACTED Fri Sep 5 05:34:29 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 5 Sep 2008 15:34:29 +1200 Subject: [erlang-questions] A whole bunch of implementation details In-Reply-To: <22362_1220584862_m853KwUb023363_OF93A96BE3.5BA8A83A-ON862574BB.0011C2B8-862574BB.0017EB35@thoughtworks.com> References: <22362_1220584862_m853KwUb023363_OF93A96BE3.5BA8A83A-ON862574BB.0011C2B8-862574BB.0017EB35@thoughtworks.com> Message-ID: On 5 Sep 2008, at 3:20 pm, Dennis Byrne wrote: > > Thank you Richard, Mikael and Raimo. Here's another question I got > as a follow up. > > Can pids be reused, even though the documentation refers to them as > unique? Any info on the underlying implementation of how a pid is > uniquely generated across a cluster? A pid identifies - a process within - an incarnation of - a node. The problem that's been referred to recently in this mailing list is too few bits for incarnation numbers. There was previously a problem with 'references' (which are opaque tokens that don't in fact refer to anything) having too few bits for comfort; IIRC that was dealt with. From erlang-questions_efine@REDACTED Fri Sep 5 06:15:25 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Fri, 5 Sep 2008 00:15:25 -0400 Subject: [erlang-questions] Time to update programming rules? In-Reply-To: References: <20377_1220562821_m84LDcK6006538_b3bfba320809041401t5bac0974vdfc19ac68758cb1b@mail.gmail.com> <43927518-39DE-438F-AA14-B3268BF69FF5@cs.otago.ac.nz> <28289_1220583318_m852tFlX011084_6c2563b20809041955l20ff361an46312fa11c86f54@mail.gmail.com> Message-ID: <6c2563b20809042115r61a17fbcy7e6d152fde3a2b31@mail.gmail.com> Thanks for repeating yourself. I didn't know you had posted about it before, and sometimes I don't even think of searching the lists, mea culpa. I empathize with your pain at having to hack modules with namespace/directory changes. I have done this too many times (actually, once is too many times) with Java to develop a serious allergy to its namespace mechanism. Then again, if you are amenable to IDEs, Eclipse allows you to refactor Java quite painlessly, including moving between namespaces. Of course, that won't stop namespace changes from breaking someone else's existing code that uses the old namespace. I will look into C/Mesa and Lace - they sound interesting. The worse problem is the ability to have two modules with different names to refer to the same module. That's a showstopper. I am reminded of another namespace abomination, namely the addition of namespaces to XML. XML names were originally allowed to contain the colon character. This became a way to retrofit namespaces to XML without breaking backward compatibility (much). It seems that much evil is done in many spheres to retain backward compatibility, especially in the face of temporal or market pressures - remember the segmented x86 architecture? I wonder how many people on this list were forced to work with the various x86 compiler memory models (IIRC, tiny, small, compact, medium, large, and huge). I was praying that the 68000 would win. Oh, the horror, the horror... On Thu, Sep 4, 2008 at 11:14 PM, Richard A. O'Keefe wrote: > > On 5 Sep 2008, at 2:55 pm, Edwin Fine wrote: > > Richard, >> >> Please will you clarify what you mean by >> >> (a) we should not use them because they are inside out >> > > I have discussed this at length in this mailing list. > > Do you mean, we should not use these facilities at all, ever, because the >> design is badly flawed, >> > > Yes. > >> >> > One fundamental issue is that dotted names are just that: > a *FLAT* module name space that just happens to allow dots > in identifiers. Since Erlang already allows @ signs in > identifiers, if we had wanted to use names like > mnesia@REDACTED@connector@REDACTED > we could have and can still. (Think of the "@" signs as > "fat dots".) Allowing dots in identifiers doesn't, in > principle, accomplish anything that allowing at-signs in > identifiers doesn't. > > Well, there's some sort of abbreviation rule, but all that > does is to mess things up horribly. It is now possible for > two *different* names to refer to the *same* module. It is > also possible for a module (with no mentions of its name > anywhere other than ?MODULE) to break if you change its name. > In fact, changing the name of a module that doesn't mention > its name ANYWHERE other than the -module directive can break it. > > Why I say it's inside-out is that "compound names" for modules > need to be relative to the starting module, not "absolute", > so that you can move an entire cluster of related modules > in a single renaming, WITHOUT having to hack on every single > file. > > The design also perpetuates a great nastiness from Java, that > of mixing up the dotting structure of module names with the > arrangement of files in a file system. I have just spent a > painful half hour trying to read the documentation and sources > for a Haskell package I'd like to use. They've followed Java's > lead with module names. One result is that what seems to this > potential user like *ONE* thing is actually broken up into > about 30 pieces; instead of one coherent manual there are > disconnected bits all over the place. Instead of one directory > with all the source files, there is a great tree with files, > even files that are conceptually at the same level, not only > in different directories but in directories at different levels. > > The right thing to do is to have a "configuration" language like > C/Mesa or LACE. > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ngwese-list@REDACTED Fri Sep 5 05:25:53 2008 From: ngwese-list@REDACTED (Greg Wuller) Date: Thu, 4 Sep 2008 20:25:53 -0700 Subject: [erlang-questions] : ./configure In-Reply-To: <7C6DC9C3-E7E9-499E-BBE7-0DF8E56A0384@cs.otago.ac.nz> References: <2579549.8331220315571545.JavaMail.root@ly.sdf.com> <5285_1220344588_m828aMoB006066_20080902082528.GA5561@erix.ericsson.se> <7C6DC9C3-E7E9-499E-BBE7-0DF8E56A0384@cs.otago.ac.nz> Message-ID: <8D0C3C86-A93F-4B46-BBCB-3EDB020DBA8F@sbcglobal.net> On Sep 2, 2008, at 4:52 PM, Richard A. O'Keefe wrote: > > My SPARC has an /etc/release. > I have an account on a Linux box which has an /etc/redhat-release. > My Mac does not have any "release" file at all in /etc. For the sake of completeness the closest equivalent to /etc/*release* that I'm aware on Mac OS X is /System/Library/CoreServices/ SystemVersion.plist. To get a nice text version of that run: % sw_vers ProductName: Mac OS X ProductVersion: 10.5.4 BuildVersion: 9E17 Cheers, -greg From dialtone@REDACTED Fri Sep 5 07:50:10 2008 From: dialtone@REDACTED (Valentino Volonghi) Date: Thu, 4 Sep 2008 22:50:10 -0700 Subject: [erlang-questions] erlang, remote slave and OSX Message-ID: <78DD988B-38FE-4F90-9E59-5BCCB8A094E9@gmail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I've been trying to get discoproject.org to run on OSX 10.5.4 with the system python 2.5.1. The system works in the following way: a master node creates a slave node using slave:start_link on a remote machine (in this case the same one) and there it immediately starts a bunch of workers using open_port, in this case python workers. erlang is started using the following line: exec erl +K true\ -heart\ -noshell\ -sname $DISCO_NAME"_master"\ -rsh ssh\ -pa "$DISCO_HOME/ebin"\ -boot "$DISCO_HOME/disco"\ -kernel error_logger "{file, \"$DISCO_MASTER_LOG\"}"\ -eval "[handle_job, handle_ctrl]"\ -disco disco_name \"$DISCO_NAME\"\ -disco disco_root \"$DISCO_MASTER\"\ -disco disco_master_host \"$DISCO_MASTER_HOST\"\ -disco scgi_port $DISCO_SCGI_PORT\ -disco disco_config \"$DISCO_CONFIG\" /dev/null 2>/ dev/null There are 2 problems that I'm seeing: 1) The environment PATH as returned by os:getenv("PATH") is basically not using the PATH configured in my shell (whether it is bash or zsh). Why? I get this path: "disco/node:/opt/local/lib/erlang/erts-5.6.3/bin:/opt/local/lib/erlang/ bin:/usr/bin:/bin:/usr/sbin:/sbin" instead of: /usr/bin:/usr/sbin:/Users/dialtone/bin:/bin:/sbin:/opt/local/bin:/opt/ local/sbin:/usr/local/bin:\ /usr/local/texlive/2007/bin/i386-darwin:/opt/local/lib/mysql5/bin/:/ Users/dialtone/dev/depot_tools 2) The worker processes in the slave many times fail during a python's getaddrinfo() saying that there's a temporary error in name resolution. I have no idea what's wrong with point 1. For point 2 instead the problem might be related to execution contexts, the problem I'm having is also explained here: http://lists.apple.com/archives/Darwin-dev/2008/Jul/msg00010.html and I wondered if anyone else had experienced it. Both are fairly weird ones and I understand that these are related to OSX and the second one might actually be more related to leopard. thanks for any help or pointers. - -- Valentino Volonghi aka Dialtone Now running MacOS X 10.5 Home Page: http://www.twisted.it http://www.adroll.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Darwin) iEYEARECAAYFAkjAyJIACgkQ9Llz28widGXlawCfZR99VzHddIspWMEPBRHFmO73 /TYAnixAwL/SNgJD9LpsrKXELk3YsCNW =5sKk -----END PGP SIGNATURE----- From gleber.p@REDACTED Fri Sep 5 08:18:42 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Fri, 5 Sep 2008 08:18:42 +0200 Subject: [erlang-questions] Parallel Shootout & a style question In-Reply-To: References: <48BD4DF9.50903@gmail.com> <200809021741.48654.bekesa@sch.bme.hu> <48BE5C50.70208@gmail.com> <48BE684F.8080305@bigpond.net.au> <48BE983D.3000303@gmail.com> <48BFB0AC.9080308@ericsson.com> <17953_1220536814_m84E0BEQ001912_14f0e3620809040345n14d5ef4aqe004839837e5cb9c@mail.gmail.com> Message-ID: <14f0e3620809042318wd40c956o11fbd3c015d171dc@mail.gmail.com> On Fri, Sep 5, 2008 at 2:11 AM, Richard A. O'Keefe wrote: > I am all for automatic parallelisation, AS LONG AS IT WORKS. > > I am going to keep on repeating my basic point until it > sinks in: Erlang processes have side effects, and changing > from sequential map to parallel map changes the meaning of > the program. > > Automatic parallelisation is good for PURE functional > code. When we have something that can reliably detect > chunks of Erlang code that are pure, let's go for it! > Till then, beware... +1 -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From jay@REDACTED Fri Sep 5 08:33:14 2008 From: jay@REDACTED (Jay Nelson) Date: Thu, 4 Sep 2008 23:33:14 -0700 Subject: [erlang-questions] Application granularity (was: Parallel Shootout & a style question) Message-ID: ... in response to a flurry of messages about automatically parallelizing list comprehensions ... If I go through all the code I have written and count the number of list comprehensions relative to the total amount of code, there are not that many occurrences to worry about. The length of each comprehension's data set is not that great in typical code, and unless it is a very data parallel algorithm such as matrix manipulation, there is little to be gained overall. Mats toss off of 10% would over-estimate the likely benefit in the code I typically have to implement. ... also references to tuning the number of processes to the number of cores ... Tuning to a specific hardware configuration is folly unless you have only one implementation site and never plan on modifying the setup. I really would not recommend this approach to programming, unless you have a specific problem that can only be achieved today by a carefully tuned solution. I think the majority of cases do not fall in this boat. ------ In general, the erlang approach is to isolate sequential code within a collection of processes. The great effort comes in architecting a good organization and hierarchy of logic so that failures and efficiency are spread to maximum effect. What is desired is an efficient and responsive _application_ rather than an efficient snippet of code sprinkled here and there. In terms of performance, I look to scalability -- running on a newer machine should run faster without any tweaks. Tweaks may improve things more, but they should be unnecessary to get the basic speed up. Quite a while back (a couple decades) I remember hearing about attempts to parallelize code. No one could seem to get a linear speed up with the number of processors. One day it was announced that a direct linear speed up had been achieved and it seemed the number of processors could be increased without loss of linearity. This alchemy was performed by turning the approach upside down. Instead of trying to decompose an algorithm into components that were independent and could efficiently parallelize, the implementors chose to multiply the problem by a few orders of magnitude. They replicated the algorithm and scaled up the problem to produce more work than the processors could achieve. Adding more processors just made it run faster. Over the last few years I have been contemplating the state of applications, operating systems and the benefits that erlang offers. The biggest advantage is that processes are lightweight and can be treated as equivalent to data structures when designing an architecture. Doing so affords an approach to constructing applications that is far different from the monolithic structures that we currently face, where one failure crashes your entire browser (at least until Google Chrome came out). Instead of futzing with automating the handling of a single vector, I submit you should spend your time trying to figure out how to structure your application so that it can have at least 1000 processes. When you move from 4 core to 8 to 32 or 64, you should see linear speed up in your application without modifying anything. And all the compiler tools that we currently use will work to your advantage without change. If your application ends up with a bunch of large vectors and lots of computation, partition the data to make lots of processes. If it doesn't have large data or computational requirements, partition the software components so that they are easier to test and debug and they can operate on separate processors or cores. With the future of hardware continuing towards many core, the new measure of the quality of application architecture will be the granularity of the components. They should be small, task specific, fault isolating, transparently distributable and interfaced with minimal messaging. Whenever you are confronted with making an algorithm more complicated versus keeping it simpler by introducing more processes, go with more processes. If your first implementation is fast enough (even if it is 10% slower than it could be), future upgrades will automatically scale. I believe the compiler writers and tool builders should focus on making it easier to produce more numerous, but smaller processes, rather than trying to make the sequential code eke out an additional 10% of performance. I want my code to run 1000x faster when I get a 1000 core machine. I likely will need 100,000 processes to realize that goal. jay From richardc@REDACTED Fri Sep 5 08:58:47 2008 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 05 Sep 2008 08:58:47 +0200 Subject: [erlang-questions] dealing with large dicts In-Reply-To: <48C02C57.1050505@alertlogic.net> References: <48C02C57.1050505@alertlogic.net> Message-ID: <48C0D8A7.2080503@it.uu.se> Paul Fisher wrote: > While not always the right thing because of the extra cpu overhead, you > can reduce some of the memory overhead and copying with something like this: > > T = fun(Term, Key) -> > [CDict1] = mnesia:read(Table, Term), > Dict1 = binary_to_term( CDict1 ), > Dict2 = dict:store(Key, Val, Dict1), > CDict2 = term_to_binary( Dict2, [compressed] ), > ok = write_val(Table, Term, CDict2) > end. > > This will keep the size down for the copies and should be ref counted > when passed from/to mnesia/ets/dets process to retrieve/store. No. First, term_to_binary and binary_to_term will do exactly as much work as the original copying. Second, the binaries will use more space than the internal representation (look at term_to_binary({foo,foo}) and you'll see why). Third, if mnesia uses dets tables, you'll now have twice the copying. The solution to the problem is not to have a dynamic number of tables, but to use a more traditional database management approach. /Richard From ulf.wiger@REDACTED Fri Sep 5 10:02:23 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 05 Sep 2008 10:02:23 +0200 Subject: [erlang-questions] Application granularity (was: Parallel Shootout & a style question) In-Reply-To: References: Message-ID: <48C0E78F.90007@ericsson.com> Jay Nelson skrev: > ... in response to a flurry of messages about automatically > parallelizing list comprehensions ... I for one have never suggested parallelizing list comprehensions, but asked for a utility library that offers parallel versions of e.g. list iterations. Richard O'Keefe's EEP12 could perhaps be extended to also support notation for when an LC could be done in parallel, but it could well get really messy if not done Just Right. Most likely, it would make it much less appealing to extend LCs in other ways, e.g. with ideas taken from Haskell or Python. One thread I found about parallel LC was this: http://www.erlang.org/pipermail/erlang-questions/2006-October/023441.html Where you, Jay, suggested explicitly parallel LCs. That, of course has to be weighed against the cost of introducing a new language feature, but at least it doesn't break the Principle of Least Surprise. ... Ok, I admit that I did get carried away and sketched a version of lists:map/2 that parallelizes if SMP is enabled. Richard's point that LCs and the list iteration functions may and often do contain side-effects is of course a show stopper, as regards modifying functions like lists:map/2 and (especially of course) lists:foreach/2 to suddenly have an undefined order of evaluation. QLC might be persuaded to enable parallel LCs, since you can provide a list of options to go with the specification of a query... BR, Ulf W From mats.cronqvist@REDACTED Fri Sep 5 10:02:15 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Fri, 05 Sep 2008 10:02:15 +0200 Subject: [erlang-questions] Application granularity (was: Parallel Shootout & a style question) In-Reply-To: References: Message-ID: <48C0E787.5070101@gmail.com> Jay Nelson wrote: > ... in response to a flurry of messages about automatically > parallelizing list comprehensions ... > > If I go through all the code I have written and count the number of > list comprehensions relative to the total amount of code, there are > not that many occurrences to worry about. The length of each > comprehension's data set is not that great in typical code, and > unless it is a very data parallel algorithm such as matrix > manipulation, there is little to be gained overall. Mats toss off of > 10% would over-estimate the likely benefit in the code I typically > have to implement. > agreed. parallelizing list comprehensions will accomplish nothing in phone switch/web server type applications. but that's not what i'm talking about either. to quote myself; "in an ideal world, all the basic OTP libs should be rewritten to be parallel." {snipped some stuff i more or less agree with} > I believe the compiler writers and tool builders should focus on > making it easier to produce more numerous, but smaller processes, > rather than trying to make the sequential code eke out an additional > 10% of performance. I want my code to run 1000x faster when I get a > 1000 core machine. I likely will need 100,000 processes to realize > that goal. the problem is that it doesn't really matter how many processes you have. to make use of a 1,000 core machine you'll need to have 1,000 *runnable* processes at any one time. E.g. a large phone switch, that handles 10,000 ongoing calls, will typically have ~10 runnable processes (given that you model a call as a process). I.e. for such a system it will buy you nothing to use more than 10 cores. mats From koops.j@REDACTED Fri Sep 5 12:22:31 2008 From: koops.j@REDACTED (Jeroen Koops) Date: Fri, 5 Sep 2008 12:22:31 +0200 Subject: [erlang-questions] Convert atom and arity into fun Message-ID: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> Hi, The answer to this question is probably obvious, but I can't find it after searching around for a while: Given a function's name as an atom and an arity (for instance as returned by module_info(exports)), how can I convert this into a fun that I can invoke? Thanks in advance, Jeroen Koops From dawsdesign@REDACTED Fri Sep 5 12:29:33 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Fri, 5 Sep 2008 06:29:33 -0400 Subject: [erlang-questions] Any way to specify erl flags for sinan shell? Message-ID: Hey Guys, I'd like to specify -boot for sinan shell. Can I do that somehow? -------------- next part -------------- An HTML attachment was scrubbed... URL: From neavirc@REDACTED Fri Sep 5 12:30:03 2008 From: neavirc@REDACTED (Sergey S.) Date: Fri, 5 Sep 2008 14:30:03 +0400 Subject: [erlang-questions] pgsql:prepare() doesn't work with PostgreSQL 8.3.3 Message-ID: <5e693d1f0809050330m748336fcud23ef0ac0e4c1f0c@mail.gmail.com> Does anybody use pgsql:prepare() function from pgsql driver with latest PostgreSQL 8.3.3? I tried with both of jungerl and ejabberd-modules versions and have the following issue: I have the following simple table: CREATE TABLE foo ( bar int ); And this code: % ------------------------------------------------- test_pgsql() -> {ok, Db} = pgsql:connect("localhost", "test", "test", ""), pgsql:prepare(Db, add_example, "INSERT INTO foo (bar) VALUES ($1::int4)"), % <- CRASH occured at this call! pgsql:execute(Db, add_example, [1, 2]), pgsql:terminate(Db). % ------------------------------------------------- When pgsql:prepare() is called I get (in ejabberd-modules edition) the following error message: http://pastebin.com/f1b777cd I tried to ommit "::int4" suffix - this didn't help. squery() and pquery() work fine. Thanks. -- Sergey -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Fri Sep 5 12:31:18 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Fri, 5 Sep 2008 12:31:18 +0200 Subject: [erlang-questions] Convert atom and arity into fun In-Reply-To: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> References: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> Message-ID: <14f0e3620809050331r79ce53d4o54554917ce4c754@mail.gmail.com> On Fri, Sep 5, 2008 at 12:22 PM, Jeroen Koops wrote: > Hi, > > The answer to this question is probably obvious, but I can't find it > after searching around for a while: > > Given a function's name as an atom and an arity (for instance as > returned by module_info(exports)), how can I convert this into a fun > that I can invoke? > > Thanks in advance, > > Jeroen Koops > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > Check out erlang:apply/3 (it's a BIF). It is described in manual (man erlang). You can use Module:Function(Arg1, Arg2, ...) where Module and Function are variables bound to appropriate atoms. Like this: Module = lists, Function = flatlength, [1, 2] = Module:Function([1], [2]) -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From koops.j@REDACTED Fri Sep 5 12:35:48 2008 From: koops.j@REDACTED (Jeroen Koops) Date: Fri, 5 Sep 2008 12:35:48 +0200 Subject: [erlang-questions] Convert atom and arity into fun In-Reply-To: <14f0e3620809050331r79ce53d4o54554917ce4c754@mail.gmail.com> References: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> <14f0e3620809050331r79ce53d4o54554917ce4c754@mail.gmail.com> Message-ID: <331a9abb0809050335nc743bcfq42ffb525151e8fd8@mail.gmail.com> Thanks, just what I was looking for. On Fri, Sep 5, 2008 at 12:31 PM, Gleb Peregud wrote: > On Fri, Sep 5, 2008 at 12:22 PM, Jeroen Koops wrote: >> Hi, >> >> The answer to this question is probably obvious, but I can't find it >> after searching around for a while: >> >> Given a function's name as an atom and an arity (for instance as >> returned by module_info(exports)), how can I convert this into a fun >> that I can invoke? >> >> Thanks in advance, >> >> Jeroen Koops >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > Check out erlang:apply/3 (it's a BIF). It is described in manual (man erlang). > > You can use Module:Function(Arg1, Arg2, ...) where Module and Function > are variables bound to appropriate atoms. Like this: > > Module = lists, > Function = flatlength, > [1, 2] = Module:Function([1], [2]) > > > -- > Gleb Peregud > http://gleber.pl/ > > Every minute is to be grasped. > Time waits for nobody. > -- Inscription on a Zen Gong > From chsu79@REDACTED Fri Sep 5 12:37:37 2008 From: chsu79@REDACTED (Christian) Date: Fri, 5 Sep 2008 12:37:37 +0200 Subject: [erlang-questions] Convert atom and arity into fun In-Reply-To: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> References: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> Message-ID: funny(M,{F, 0}) -> fun () -> M:F() end; funny(M, {F, 1}) -> fun (A) -> M:F(A) end; ... From rvirding@REDACTED Fri Sep 5 12:43:55 2008 From: rvirding@REDACTED (Robert Virding) Date: Fri, 5 Sep 2008 12:43:55 +0200 Subject: [erlang-questions] Convert atom and arity into fun In-Reply-To: <14f0e3620809050331r79ce53d4o54554917ce4c754@mail.gmail.com> References: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> <14f0e3620809050331r79ce53d4o54554917ce4c754@mail.gmail.com> Message-ID: <3dbc6d1c0809050343tfe938f6wcdd20fe7efcf2fae@mail.gmail.com> Of course another way of doing it which seems more in accord to what was asked, at least how I interpreted it, is to do: F = fun mod:name/arity, % or fun name/arity if local function F(Arg1, Arg2, ...) if you know the name and arity of the function. This will not work if you don't know the name or arity of the function at compile-time, then use Gleb's suggestion. Robert 2008/9/5 Gleb Peregud > On Fri, Sep 5, 2008 at 12:22 PM, Jeroen Koops wrote: > > Hi, > > > > The answer to this question is probably obvious, but I can't find it > > after searching around for a while: > > > > Given a function's name as an atom and an arity (for instance as > > returned by module_info(exports)), how can I convert this into a fun > > that I can invoke? > > > > Thanks in advance, > > > > Jeroen Koops > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > Check out erlang:apply/3 (it's a BIF). It is described in manual (man > erlang). > > You can use Module:Function(Arg1, Arg2, ...) where Module and Function > are variables bound to appropriate atoms. Like this: > > Module = lists, > Function = flatlength, > [1, 2] = Module:Function([1], [2]) > > > -- > Gleb Peregud > http://gleber.pl/ > > Every minute is to be grasped. > Time waits for nobody. > -- Inscription on a Zen Gong > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Fri Sep 5 12:45:57 2008 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 05 Sep 2008 12:45:57 +0200 Subject: [erlang-questions] Convert atom and arity into fun In-Reply-To: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> References: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> Message-ID: <48C10DE5.7090102@it.uu.se> Jeroen Koops wrote: > Given a function's name as an atom and an arity (for instance as > returned by module_info(exports)), how can I convert this into a fun > that I can invoke? There is currently no immediate way of doing this. If you just want to call the function, you can use M:F(...) or apply(M,F,[...]). If you need a fun, to pass it somewhere, you can wrap such a call in a new fun, like this: F = fun (...) -> M:F(...) end. /Richard From bekesa@REDACTED Fri Sep 5 12:53:23 2008 From: bekesa@REDACTED (Andras Georgy Bekes) Date: Fri, 05 Sep 2008 12:53:23 +0200 Subject: [erlang-questions] Convert atom and arity into fun In-Reply-To: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> References: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> Message-ID: <200809051253.23655.bekesa@sch.bme.hu> > Given a function's name as an atom and an arity (for instance as > returned by module_info(exports)), how can I convert this into a fun > that I can invoke? fun Module:FunctionName/Arity You can find it here: Erlang Reference Manual/ 6. Expressions/ 6.17 Fun Expressions Georgy From koops.j@REDACTED Fri Sep 5 12:54:55 2008 From: koops.j@REDACTED (Jeroen Koops) Date: Fri, 5 Sep 2008 12:54:55 +0200 Subject: [erlang-questions] Convert atom and arity into fun In-Reply-To: <48C10DE5.7090102@it.uu.se> References: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> <48C10DE5.7090102@it.uu.se> Message-ID: <331a9abb0809050354o1623b379n1aa58883217fdf88@mail.gmail.com> I needed this as a quick way to invoke all exported functions from a module whose names start with 'test_' - a miniature unit-test framework if you will. Each function returns either true, if the test succeeds, or {false, Reason} if it fails. The following function gives a list of all exported functions starting with 'test_' and arity 0: tests() -> lists:filter(fun({Name, Arity}) -> Arity =:= 0 andalso lists:prefix("test_", atom_to_list(Name)) end, module_info(exports)). Next, using apply/3 as suggested by Gleb, they're all invoked and the results formatted by: [ case apply(?MODULE, X, []) of true -> {X, ok}; {false, Why} -> {X, error, Why} end || {X,0} <- tests() ]. Works like a charm (until test-functions start throwing unexpected exceptions, but I'll get to that when it actually happens)! On Fri, Sep 5, 2008 at 12:45 PM, Richard Carlsson wrote: > Jeroen Koops wrote: >> Given a function's name as an atom and an arity (for instance as >> returned by module_info(exports)), how can I convert this into a fun >> that I can invoke? > > There is currently no immediate way of doing this. If you just want > to call the function, you can use M:F(...) or apply(M,F,[...]). If > you need a fun, to pass it somewhere, you can wrap such a call in a > new fun, like this: F = fun (...) -> M:F(...) end. > > /Richard > From bekesa@REDACTED Fri Sep 5 13:09:19 2008 From: bekesa@REDACTED (Andras Georgy Bekes) Date: Fri, 05 Sep 2008 13:09:19 +0200 Subject: [erlang-questions] Convert atom and arity into fun In-Reply-To: <3dbc6d1c0809050343tfe938f6wcdd20fe7efcf2fae@mail.gmail.com> References: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> <14f0e3620809050331r79ce53d4o54554917ce4c754@mail.gmail.com> <3dbc6d1c0809050343tfe938f6wcdd20fe7efcf2fae@mail.gmail.com> Message-ID: <200809051309.19083.bekesa@sch.bme.hu> > F = fun mod:name/arity, % or fun name/arity if local function > F(Arg1, Arg2, ...) If you don't really need a fun to pass around, just want to call the function, then simply: Mod:Name(Arg1,Arg2...) use apply/3 only if you don't know the arity at compile time. Georgy From richardc@REDACTED Fri Sep 5 13:35:15 2008 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 05 Sep 2008 13:35:15 +0200 Subject: [erlang-questions] dealing with large dicts In-Reply-To: <48C1114D.6080604@alertlogic.net> References: <48C02C57.1050505@alertlogic.net> <48C0D8A7.2080503@it.uu.se> <48C1114D.6080604@alertlogic.net> Message-ID: <48C11973.2060309@it.uu.se> Paul Fisher wrote: > Did you notice that i suggested that he use the 'compressed' option in > the term_to_binary/2 call? While this does not avoid all of the > overhead it does have much less data moving between the processes, which > will help some. I missed the compressed flag, but it will not do much for performance, even if it might postpone the memory problem. (A quick test compressing a large dict reduced the binary to a quarter of the uncompressed size.) I looked back to the original post, which said the problem was an out of memory error - and assuming that a single dict (or two) fit in memory, the code example cannot in itself be the problem. It is very inefficient, but that's mostly CPU-wise. At the end of each transaction the dict is ready to be garbage collected, so there is no memory leak. It seems likely that the crashing is due to the entire load on the memory system (huge ets tables?) and perhaps a leak elsewhere. /Richard From zoltan.peter.toth@REDACTED Fri Sep 5 14:08:22 2008 From: zoltan.peter.toth@REDACTED (Zoltan Peter Toth) Date: Fri, 05 Sep 2008 14:08:22 +0200 Subject: [erlang-questions] PID recycling Message-ID: <48C12136.8010401@ericsson.com> An HTML attachment was scrubbed... URL: From neavirc@REDACTED Fri Sep 5 14:30:44 2008 From: neavirc@REDACTED (Sergey S.) Date: Fri, 5 Sep 2008 16:30:44 +0400 Subject: [erlang-questions] pgsql:prepare() doesn't work with PostgreSQL 8.3.3 In-Reply-To: <5e693d1f0809050330m748336fcud23ef0ac0e4c1f0c@mail.gmail.com> References: <5e693d1f0809050330m748336fcud23ef0ac0e4c1f0c@mail.gmail.com> Message-ID: <5e693d1f0809050530r3c7d37b8ib8a3d69bde7efcba@mail.gmail.com> Hello. As addition to the previous message on pgsql. Such code: pgsql:pquery(Db, "INSERT INTO foo VALUES ($1)", [555]) also doesn't work, producing the error: ------------------------------------------------------------------------ ** exception exit: {timeout, {gen_server,call, [<0.131.0>, {equery,{"INSERT INTO foo VALUES ($1)",[2]}}]}} in function gen_server:call/2 in call from gin_test:storage/0 ------------------------------------------------------------------------ The only way I see to do insert is: Query = lists:flatten(io_lib:format("INSERT INTO foo VALUES (~p)", [555])) pgsql:squery(Db, Query) But it's not so fast... Jungerl have the same problems, since pgsql from ejabberd-modules is a fork of pgsql from jungerl. psql from http://code.google.com/p/erlang-psql-driver/ seems to be unmaitaine**d (Project status: this project was just a proof of concept and is currently unmaintained) Driver from Erlang Consulting is too old. ODBC? Which driver do you you with PostgreSQL? Thanks. -- Sergey -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay@REDACTED Fri Sep 5 16:26:34 2008 From: jay@REDACTED (Jay Nelson) Date: Fri, 5 Sep 2008 07:26:34 -0700 Subject: [erlang-questions] Application granularity (was: Parallel Shootout & a style question) In-Reply-To: <48C0E78F.90007@ericsson.com> References: <48C0E78F.90007@ericsson.com> Message-ID: <10F767E8-694B-4D1D-A991-E9DD179B4639@duomark.com> > One thread I found about parallel LC was this: > http://www.erlang.org/pipermail/erlang-questions/2006-October/ > 023441.html > > Where you, Jay, suggested explicitly parallel LCs. I did suggest it and after a discussion involving Kostis and some of the language implementers, I realized it was counter to the philosophy of erlang: code is sequential, processes are explicit. It makes the implementation of the language far easier to manage and the results far more predictable for a programmer. (Or more bluntly, I was disabused of the idea.) Although, this was 2 years ago and as I said, I have been contemplating related topics for a while and have come to the conclusion that granularity of application is more important than worrying about slow spots in the code. I have also suggested receive channels and have since abandoned that suggestion as well, so I am not immune to bad ideas which on reflection must be withdrawn. Which, by the way, I've concluded as ROK pointed out are muted by the introduction of more processes. jay From jay@REDACTED Fri Sep 5 16:35:16 2008 From: jay@REDACTED (Jay Nelson) Date: Fri, 5 Sep 2008 07:35:16 -0700 Subject: [erlang-questions] Application granularity (was: Parallel Shootout & a style question) In-Reply-To: <48C0E787.5070101@gmail.com> References: <48C0E787.5070101@gmail.com> Message-ID: <97B2C652-8774-4AFA-8CB6-8DC80DA6B599@duomark.com> > the problem is that it doesn't really matter how many processes > you have. to make use of a 1,000 core machine you'll need to have > 1,000 *runnable* processes at any one time. > E.g. a large phone switch, that handles 10,000 ongoing calls, will > typically have ~10 runnable processes (given that you model a call > as a process). I.e. for such a system it will buy you nothing to > use more than 10 cores. > > mats > Quite right, but that's where the architecture challenge is. There has to be some areas of the problem where it can be split differently if you assume the hardware is constructed differently. For example, why not one process per subscriber for services lookup rather than a central database? I guess the packet switching is done by other hardware than the erlang router. Surely there are more than 10 packets to route at a time? The granularity of the router process could be reduced by spreading packets across 100s of router processes providing the synchronization of order can be maintained. I don't know enough about your application domain to comment. I can see ways that webservers can be sped up, not by parsing requests and documents into trees, but by treating their data transfers as streams that can be chopped into lots of tiny pieces. I agree that some applications are just sequential in nature. But I can still imagine ways to carve Microsoft Word and the browser into 100s of processes. You may not get complete speed up, but you will get fine-grained responsiveness. We've just gotten used to architecting large applications (and here I am mainly referring to PC applications and traditional IT services), so it is difficult to imagine a radical alternative to design and execution of software. jay From jay@REDACTED Fri Sep 5 16:41:46 2008 From: jay@REDACTED (Jay Nelson) Date: Fri, 5 Sep 2008 07:41:46 -0700 Subject: [erlang-questions] Application granularity (was: Parallel Shootout & a style question) In-Reply-To: <48C0E78F.90007@ericsson.com> References: <48C0E78F.90007@ericsson.com> Message-ID: <7352F023-5B4C-45F1-9D11-57C1613F4E8D@duomark.com> > One thread I found about parallel LC was this: > http://www.erlang.org/pipermail/erlang-questions/2006-October/ > 023441.html > > Where you, Jay, suggested explicitly parallel LCs. A later posting proposed a gen_stream library: http://www.erlang.org/pipermail/erlang-questions/2007-December/ 031634.html which was a change in my thinking based on the earlier failed proposition, the introduction of binary comprehensions (which I think were a fantastic addition, although I'm a bit biased) and the flurry of discussions about the Wide Finder project. I have intended to resubmit with the addition of continuation-based gen_streams, but haven't found the time to make the modifications yet. All of these were geared to a specific problem rather than the general issue of arbitrary code: the efficient handling of raw data in the GB+ (ideally TB+) size so that databases can be replaced with a big blob of binary data. Definitely a heavier task than general computing. jay From pat.eyler@REDACTED Fri Sep 5 16:44:32 2008 From: pat.eyler@REDACTED (pat eyler) Date: Fri, 5 Sep 2008 08:44:32 -0600 Subject: [erlang-questions] New Book "Erlang Programming" from O'Reilly In-Reply-To: <20080903112828.GA85104@k2r.org> References: <20080903112828.GA85104@k2r.org> Message-ID: <6fd0654b0809050744x175631fw99230227cb65c671@mail.gmail.com> O'Reilly's not the only publisher with an Erlang book coming out. I posted a while ago about a then-anonymous publsiher and their plans: http://on-erlang.blogspot.com/2008/02/more-book-rumours.html Since then, Manning has come out of hiding and announced their book, which is now partially available in early access mode: http://www.manning.com/logan/ if you want more information about the O'Reilly books, I posted some interviews with the authors and editor earlier this year: http://on-erlang.blogspot.com/search/label/Practical%20Erlang On Wed, Sep 3, 2008 at 5:28 AM, Kenji Rikitake wrote: > Erlang Programming > by Francesco Cesarini and Simon Thompson > to be published on December 2008 > http://www.amazon.com/dp/0596518188 > (Anybody found the www.oreilly.com link? I didn't.) > > I'm looking forward to reading the book soon. > (I've already preordered it at amazon.co.jp.) > > Kenji Rikitake > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- thanks, -pate ------------------------- Duty makes us do things, Love make us do things well. http://on-ruby.blogspot.com http://on-erlang.blogspot.com http://on-soccer.blogspot.com From jay@REDACTED Fri Sep 5 16:53:57 2008 From: jay@REDACTED (Jay Nelson) Date: Fri, 5 Sep 2008 07:53:57 -0700 Subject: [erlang-questions] Application granularity (was: Parallel Shootout & a style question) In-Reply-To: <48C0E787.5070101@gmail.com> References: <48C0E787.5070101@gmail.com> Message-ID: > agreed. parallelizing list comprehensions will accomplish nothing > in phone switch/web server type applications. but that's not what > i'm talking about either. to quote myself; > > "in an ideal world, all the basic OTP libs should be rewritten to > be parallel." >> I conflated several topics that were discussed in the previous thread. You are right, and this can be done incrementally, even by the community as contributions back to the OTP team. jay From ulf@REDACTED Fri Sep 5 17:03:42 2008 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 5 Sep 2008 17:03:42 +0200 Subject: [erlang-questions] Application granularity (was: Parallel Shootout & a style question) In-Reply-To: <10F767E8-694B-4D1D-A991-E9DD179B4639@duomark.com> References: <48C0E78F.90007@ericsson.com> <10F767E8-694B-4D1D-A991-E9DD179B4639@duomark.com> Message-ID: <8209f740809050803q77787749t4b3c23a5c08f2b02@mail.gmail.com> 2008/9/5 Jay Nelson : > > so I am not immune > to bad ideas which on reflection must be withdrawn. Well, there is a foolish corner in the brain of the wisest man, said Aristotle. It probably holds true still. ;-) I've long since lost count of all the not-so-bright ideas I've aired over the years. I hope everyone else has, too. (: BR, Ulf W From btolputt@REDACTED Fri Sep 5 05:17:50 2008 From: btolputt@REDACTED (Benjamin Tolputt) Date: Fri, 05 Sep 2008 13:17:50 +1000 Subject: [erlang-questions] Time to update programming rules? In-Reply-To: <6c2563b20809041955l20ff361an46312fa11c86f54@mail.gmail.com> References: <20377_1220562821_m84LDcK6006538_b3bfba320809041401t5bac0974vdfc19ac68758cb1b@mail.gmail.com> <43927518-39DE-438F-AA14-B3268BF69FF5@cs.otago.ac.nz> <6c2563b20809041955l20ff361an46312fa11c86f54@mail.gmail.com> Message-ID: <48C0A4DE.3080407@bigpond.net.au> Edwin Fine wrote: > Richard, > > Please will you clarify what you mean by > > (a) we should not use them because they are inside out I too would like some clarification on this. Is this because you disapprove of the design (i.e. personal opinion), because the Erlang developers have recommended it not be used (i.e. it is an experimental or soon to be removed feature), or something else? The idea of using the package support appeals to me as it will help keep name-space conflicts to a minimum. As I understand the "packages.html" page, this is pretty much ALL that the packages functionality offers. --Ben From btolputt@REDACTED Fri Sep 5 06:10:54 2008 From: btolputt@REDACTED (Benjamin Tolputt) Date: Fri, 05 Sep 2008 14:10:54 +1000 Subject: [erlang-questions] Time to update programming rules? In-Reply-To: <2E9A0764-1977-4132-B0C6-0928603FEC2D@cs.otago.ac.nz> References: <20377_1220562821_m84LDcK6006538_b3bfba320809041401t5bac0974vdfc19ac68758cb1b@mail.gmail.com> <43927518-39DE-438F-AA14-B3268BF69FF5@cs.otago.ac.nz> <6c2563b20809041955l20ff361an46312fa11c86f54@mail.gmail.com> <21925_1220584680_m853Hxxm021259_48C0A4DE.3080407@bigpond.net.au> <2E9A0764-1977-4132-B0C6-0928603FEC2D@cs.otago.ac.nz> Message-ID: <48C0B14E.9030308@bigpond.net.au> Richard A. O'Keefe wrote: > On 5 Sep 2008, at 3:17 pm, Benjamin Tolputt wrote: >> The idea of using the package support appeals to me as it will help keep >> name-space conflicts to a minimum. As I understand the "packages.html" >> page, this is pretty much ALL that the packages functionality offers. > > It doesn't offer any MORE of that than Erlang has without it. > What it DOES give you is extra breakability. I understand the possibility of errors. Possibility of error is a decent point, but one that can (and has) been made about other parts of the Erlang system. As I understand it then, this is an "opinion" exclusion of use rather than one endorsed by the developers of Erlang (given they implemented it and have yet to remove it from the system). Not throwing mud at you or anything, just ensuring I understand that this is a feature you don't like versus one that could be ripped out of Erlang on a release's notice. The "extra" functionality it offers is that the beams are split out nicely such that "xyz.abc.mymod" is compiled to a "mymod.beam" file that will not conflict with a "abc.def.mymod" module. This (in my mind) is a Good Thing. Like Java, the multi-folder thing is likely to be a moot issue given a decent IDE. One that I have admittedly not yet found for Erlang - beyond a good text editor (ScITE) and the Erlang shell. --Ben From sebastian.bello@REDACTED Fri Sep 5 18:47:57 2008 From: sebastian.bello@REDACTED (Sebastian Bello) Date: Fri, 05 Sep 2008 13:47:57 -0300 Subject: [erlang-questions] Executing an Erlang function from Perl In-Reply-To: References: <48BE8A33.6080608@inswitch.us> Message-ID: <48C162BD.8080306@inswitch.us> Thanks Bengt and Chandru. An additional question: if I know the full path to a .beam file, and that path has no been added with a -pa for example, what would be the way to execute a function of that module? Sebastian- Chandru escribi?: > 2008/9/3 Sebastian Bello > > > Hi list, > > I need to execute an Erlang function from within Perl code, what > do you > suggest? > Thanks, > Sebastian- > > > Try 'erl -man erl_call' > > Extract from the man page: > > NAME > erl_call - Call/Start a Distributed Erlang Node > > DESCRIPTION > erl_call makes it possible to start and/or communicate > with a dis- > tributed Erlang node. It is built upon the erl_interface > library as an > example application. Its purpose is to use an Unix shell > script to > interact with a distributed Erlang node. It performs all > communication > with the Erlang rex server, using the standard Erlang RPC > facility. It > does not require any special software to be run at the > Erlang target > node. > > The main use is to either start a distributed Erlang node or to > make an > ordinary function call. However, it is also possible to pipe > an Erlang > module to erl_call and have it compiled, or to pipe a > sequence of > Erlang expressions to be evaluated (similar to the Erlang shell). > > Options, which cause stdin to be read, can be used with > advantage as > scripts from within (Unix) shell scripts. Another nice use of > erl_call > could be from (http) CGI-bin scripts. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From anders.nygren@REDACTED Fri Sep 5 19:41:15 2008 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 5 Sep 2008 12:41:15 -0500 Subject: [erlang-questions] Executing an Erlang function from Perl In-Reply-To: <48C162BD.8080306@inswitch.us> References: <48BE8A33.6080608@inswitch.us> <48C162BD.8080306@inswitch.us> Message-ID: 2008/9/5 Sebastian Bello : > Thanks Bengt and Chandru. > An additional question: if I know the full path to a .beam file, and that > path has no been added with a -pa for example, what would be the way to > execute a function of that module? > Sebastian- Sebastian Dir = filename:dirname(Beam), code:addpatha(Dir) /Anders > > Chandru escribi?: > > 2008/9/3 Sebastian Bello >> >> Hi list, >> >> I need to execute an Erlang function from within Perl code, what do you >> suggest? >> Thanks, >> Sebastian- > > Try 'erl -man erl_call' > > Extract from the man page: > > NAME > erl_call - Call/Start a Distributed Erlang Node > > DESCRIPTION > erl_call makes it possible to start and/or communicate with a > dis- > tributed Erlang node. It is built upon the erl_interface library as > an > example application. Its purpose is to use an Unix shell script > to > interact with a distributed Erlang node. It performs all > communication > with the Erlang rex server, using the standard Erlang RPC facility. > It > does not require any special software to be run at the Erlang > target > node. > > The main use is to either start a distributed Erlang node or to make > an > ordinary function call. However, it is also possible to pipe an > Erlang > module to erl_call and have it compiled, or to pipe a sequence > of > Erlang expressions to be evaluated (similar to the Erlang shell). > > Options, which cause stdin to be read, can be used with advantage > as > scripts from within (Unix) shell scripts. Another nice use of > erl_call > could be from (http) CGI-bin scripts. > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From martin.logan@REDACTED Sat Sep 6 06:47:02 2008 From: martin.logan@REDACTED (Martin Logan) Date: Fri, 05 Sep 2008 23:47:02 -0500 Subject: [erlang-questions] New Book "Erlang Programming" from O'Reilly In-Reply-To: <6fd0654b0809050744x175631fw99230227cb65c671@mail.gmail.com> Message-ID: On 9/5/08 9:44 AM, "pat eyler" wrote: > O'Reilly's not the only publisher with an Erlang book > coming out. I posted a while ago about a > then-anonymous publsiher and their plans: > > http://on-erlang.blogspot.com/2008/02/more-book-rumours.html > > Since then, Manning has come out of hiding and > announced their book, which is now partially available in > early access mode: > > http://www.manning.com/logan/ > Yes we are working quite hard on this one. The stuff in MEAP is not really worth reading right now as it is in pre pre beta form and very unedited. We are moving quickly though and will be putting a much larger set of text and code (which actually works, the stuff in the second chapter of what is currently out there is not even compliable at this point :) ) I have been doing Erlang for some 9 years now, same with Eric, and Richard was around since the beginning as far as I can tell. Even with all that experience I must say writing a book is far more difficult than I could have imagined. I am sitting here tonght punishing my brain to put out the most concise explanation possible on pattern matching :) Putting yourself in the shoes of someone who does not know what you know is not easy. But hey, we need more books to accommodate and teach the flood of eager folks that need to learn our language so they don't drown in threaded messes. In our book we will be focusing more on really practical Erlang. Each of us has worked full time for years with Erlang and put multiple systems into production. The book will focus less on theory and more on practice with heavy emphasis on OTP. I believe it will be an asset to our community. Cheers, Martin > > if you want more information about the O'Reilly books, I > posted some interviews with the authors and editor earlier > this year: > > http://on-erlang.blogspot.com/search/label/Practical%20Erlang > > > On Wed, Sep 3, 2008 at 5:28 AM, Kenji Rikitake wrote: >> Erlang Programming >> by Francesco Cesarini and Simon Thompson >> to be published on December 2008 >> http://www.amazon.com/dp/0596518188 >> (Anybody found the www.oreilly.com link? I didn't.) >> >> I'm looking forward to reading the book soon. >> (I've already preordered it at amazon.co.jp.) >> >> Kenji Rikitake >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > From igwan@REDACTED Sat Sep 6 13:49:59 2008 From: igwan@REDACTED (igwan) Date: Sat, 06 Sep 2008 13:49:59 +0200 Subject: [erlang-questions] [bug?] R12B-4 HTTP header parsing Message-ID: <48C26E67.5020702@free.fr> Hi, While testing the new erlang:decode_packet/3 I found it returns http_error for inputs that are allowed by RFC2616 : 1> erlang:decode_packet(httph,<<"Host: erlang.org:80\r\n\r\n">>,[]). {ok,{http_header,14,'Host',undefined,"erlang.org:80"}, <<"\r\n">>} 2> erlang:decode_packet(httph,<<"Host : erlang.org:80\r\n\r\n">>,[]). {ok,{http_error,"Host : erlang.org:80\r\n"},<<"\r\n">>} (i.e. just adding a space between the field-name and the ':' separator) From RFC2616 section 2.1 "Except where noted otherwise, linear white space (LWS) can be included between any two adjacent words (token or quoted-string), and between adjacent words and separators, without changing the interpretation of a field." -- igwan From bobcalco@REDACTED Sat Sep 6 19:25:08 2008 From: bobcalco@REDACTED (Bob Calco) Date: Sat, 6 Sep 2008 13:25:08 -0400 Subject: [erlang-questions] New Book "Erlang Programming" from O'Reilly In-Reply-To: References: <6fd0654b0809050744x175631fw99230227cb65c671@mail.gmail.com> Message-ID: <07dd01c91045$8307e3d0$8917ab70$@rr.com> Fellow Erlangers: I am also a co-author of "Concurrent Programming with Erlang/OTP", and the original guy who sold Manning on the book idea. Since that time I have been buried in a huge Erlang project that has ironically made it very hard for me to contribute as much time as I would like to this august forum, let alone the book, which is why I am glad I was able to entice Martin, Eric and Richard aboard early. That saved this project because they were able to step up when I had to take a step back. I have been focusing in my work on designing RESTful OTP web services in Erlang that "play nice" with client technologies like Ruby's ActiveResource and Adobe's Flex/AIR, and the chapters that make their way into the book on that subject will be authored mainly by me. But Martin & Eric are doing the most important work on the book right now, with Richard playing a key role as only he can--and thank God. :) (BTW, folks who are interested in those specific technology integrations, feel free to contact me offline or online with you war stories, thoughts, suggestions, etc...) Incidentally I'm not quite "the expert" in Erlang yet compared to those guys by any means (few people could be more expert than Richard, who actually worked on the compiler!), but I love Erlang, warts and all. It has been serving me well in what I've been building. The learning curve has been quite an experience, and the results so far--wonderful and well worth the effort. I'll share details about what I have been building in Erlang later, when it's Officially Official. ;) I never liked back-end server or web programming before (EJB and ASP.NET being my main "day job" background in that--so no wonder), but now I love it. Pattern matching is to die for, and thinking in terms of processes is so much more natural for concurrent and distributed programming than objects per se. It's a fantastic paradigm. All this by way of saying: You relative Erlang newbies (relative compared to Erlang icons, like my co-authors) out there will also have a representative (not to mention enthusiastic) voice in the book. ;) I'm very glad for the O'Reilly book as well. We all share a common interest in promoting Erlang's many virtues. I really think Erlang, or some evolutionary successor thereto, represents the future of programming in the hyper-interconnected world of tomorrow. I'm betting my career on it, in fact. Sincerely, Bob Calco > -----Original Message----- > From: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > bounces@REDACTED] On Behalf Of Martin Logan > Sent: Saturday, September 06, 2008 12:47 AM > To: pat eyler; Erlang > Subject: Re: [erlang-questions] New Book "Erlang Programming" from > O'Reilly > > On 9/5/08 9:44 AM, "pat eyler" wrote: > > > O'Reilly's not the only publisher with an Erlang book > > coming out. I posted a while ago about a > > then-anonymous publsiher and their plans: > > > > http://on-erlang.blogspot.com/2008/02/more-book-rumours.html > > > > Since then, Manning has come out of hiding and > > announced their book, which is now partially available in > > early access mode: > > > > http://www.manning.com/logan/ > > > > Yes we are working quite hard on this one. The stuff in MEAP is not > really > worth reading right now as it is in pre pre beta form and very > unedited. We > are moving quickly though and will be putting a much larger set of text > and > code (which actually works, the stuff in the second chapter of what is > currently out there is not even compliable at this point :) ) > > I have been doing Erlang for some 9 years now, same with Eric, and > Richard > was around since the beginning as far as I can tell. Even with all that > experience I must say writing a book is far more difficult than I could > have > imagined. I am sitting here tonght punishing my brain to put out the > most > concise explanation possible on pattern matching :) Putting yourself > in the > shoes of someone who does not know what you know is not easy. But hey, > we > need more books to accommodate and teach the flood of eager folks that > need > to learn our language so they don't drown in threaded messes. > > In our book we will be focusing more on really practical Erlang. Each > of us > has worked full time for years with Erlang and put multiple systems > into > production. The book will focus less on theory and more on practice > with > heavy emphasis on OTP. I believe it will be an asset to our community. > > Cheers, > Martin From francesco@REDACTED Sun Sep 7 12:02:42 2008 From: francesco@REDACTED (Francesco Cesarini) Date: Sun, 07 Sep 2008 11:02:42 +0100 Subject: [erlang-questions] Change in Semantics in dbg:c ? Message-ID: <48C3A6C2.60202@erlang-consulting.com> I was working through some old training material from 2001, testing the output on R12. I am getting significantly different behaviours in-between the releases which I was not expecting. The example I use (Attached to the mail) spawn_links a process which goes into a receive loop. When the child receives a ping message, it spawns a new process which immediately fails with reason undef and loops on itself. In the older release (Probably R9), tracing a function which does a spawn_link using dbg:c/4 setting the process trace flags and the set on spawn flags, I get all of the events and set on spawn works. More calls using dbg:c affecting the child process obviously demonstrate that the child inherited the trace flags. Using R12, first thing I get is an unlinked trace event. Subsequent messages to the process do not generate any new trace events. In R12 (possibly earlier), a quick look confirms my suspicions; an intermediate process has been inserted between the shell and the child, and when this process terminates, the unlink event is generated. Is this the intended behaviour? I would say the old behaviour is the correct one, as the documentation states that dbg:c/4 it is a traced variant of apply/3. If so, the unlink trace message should not be received, and the state (sos and sofl trace flags) should be maintained in-between calls. Either way, either the documentation is incorrect or the intermediary process should be removed. Which version would you like documented in the book? Old Release (Probably R9): 2> Pid = dbg:c(ping, start, [], [p, sos]). <0.31.0> (<0.21.0>) spawn <0.31.0> (<0.21.0>) link <0.31.0> 3> dbg:c(ping, send, [Pid], [p, sos]). (<0.31.0>) spawn <0.33.0> pong (<0.33.0>) exit {undef,[{crash,do_not_exist,[]}]} R12: 4> Pid = dbg:c(ping, start, [], [p, sos]). (<0.41.0>) spawn <0.42.0> as ping:loop() (<0.41.0>) link <0.42.0> (<0.42.0>) getting_unlinked <0.41.0> <0.42.0> 5> dbg:c(ping, send, [Pid], [p, sos]). pong 6> =ERROR REPORT==== 7-Sep-2008::10:42:42 === Error in process <0.48.0> with exit value: {undef,[{crash,do_not_exist,[]}]} Suggestions? Regards, Francesco -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ping.erl URL: From sh@REDACTED Fri Sep 5 13:46:16 2008 From: sh@REDACTED (=?iso-8859-1?Q?S=F8ren_Hilmer?=) Date: Fri, 5 Sep 2008 13:46:16 +0200 (CEST) Subject: [erlang-questions] EUC 2008 Message-ID: <59706.193.3.141.121.1220615176.squirrel@www.widetrail.dk> Looks like registration has opened! http://www.erlang.se/euc/08/index.html Good luck only 135 seats!! --S?ren -- S?ren Hilmer, M.Sc., M.Crypt. wideTrail Phone: +45 25481225 Pilev?nget 41 Email: sh@REDACTED DK-8961 Alling?bro Web: www.widetrail.dk From galeal@REDACTED Sun Sep 7 16:02:37 2008 From: galeal@REDACTED (Luke Galea) Date: Sun, 7 Sep 2008 10:02:37 -0400 Subject: [erlang-questions] String Pattern Matching Message-ID: Hi all, I get the sense that most erlangers feel that regular expressions aren't needed and that pattern matching can do the job. I want to believe. I really do. But I am absolutely killing myself trying to port Ruby's ActiveSupport Inflector over to erlang. It lets you pluralize and singularize strings based on a set of rules. For instance: ([m|l])ouse$ -> $1ice or ([^aeiouy]|qu)y$ -> $1ies So, given that erlang has insufficient regular expression support to tackle this (and given that I want to do this the "erlang way"), how does one go about doing this? The bit syntax won't work on arbitrary length fields as far as I know. And I *really* don't want to invent my own subset/alternate syntax of regular expressions that is more than what erlang supports and less than a PCRE. Thanks in advance, -- Luke Galea From vinoski@REDACTED Sun Sep 7 20:13:35 2008 From: vinoski@REDACTED (Steve Vinoski) Date: Sun, 7 Sep 2008 14:13:35 -0400 Subject: [erlang-questions] String Pattern Matching In-Reply-To: References: Message-ID: <65b2728e0809071113q12f9afa5hf73476c552b3fb0@mail.gmail.com> On 9/7/08, Luke Galea wrote: > Hi all, > > I get the sense that most erlangers feel that regular expressions > aren't needed and that pattern matching can do the job. Not exactly. > But I am absolutely killing myself trying to port Ruby's > ActiveSupport Inflector over to erlang. It lets you pluralize and > singularize strings based on a set of rules. > > For instance: > ([m|l])ouse$ -> $1ice > or > ([^aeiouy]|qu)y$ -> $1ies With R12B-4: Eshell V5.6.4 (abort with ^G) 1> {ok, Re1} = re:compile("([m|l])ouse$"), 1> re:replace("mouse", Re1, "\\1ice", [{return, list}]). "mice" 2> {ok, Re2} = re:compile("([^aeiouy]|qu)y$"), 2> re:replace("body", Re2, "\\1ies", [{return, list}]). "bodies" --steve From vances@REDACTED Sun Sep 7 20:47:46 2008 From: vances@REDACTED (Vance Shipley) Date: Sun, 7 Sep 2008 14:47:46 -0400 Subject: [erlang-questions] String Pattern Matching In-Reply-To: References: Message-ID: <20080907184746.GM257@h216-235-12-173.host.egate.net> On Sun, Sep 07, 2008 at 10:02:37AM -0400, Luke Galea wrote: } I get the sense that most erlangers feel that regular expressions } aren't needed and that pattern matching can do the job. Whenever possible. } ([m|l])ouse$ -> $1ice -module(inflector). -export([singularize/1]). singularize(Word) -> L = lists:reverse(Word), lists:reverse(singularize1(L)). singularize1("ecil" ++ L) -> "esuol" ++ L; singularize1("ecim" ++ L) -> "esuom" ++ L. 1> inflector:singularize("titmice"). "titmouse" If you're really just dealing in words the penalty of a double reverse isn't as bad as the penalty of having to use REs. -Vance From erlang-questions_efine@REDACTED Sun Sep 7 21:31:46 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sun, 7 Sep 2008 15:31:46 -0400 Subject: [erlang-questions] String Pattern Matching In-Reply-To: <20080907184746.GM257@h216-235-12-173.host.egate.net> References: <20080907184746.GM257@h216-235-12-173.host.egate.net> Message-ID: <6c2563b20809071231k3793d5a4ld0394e5c82f556b2@mail.gmail.com> >If you're really just dealing in words the penalty of a double >reverse isn't as bad as the penalty of having to use REs. True, but the penalty of writing and maintaining code that could be much more clearly expressed as an RE may outweigh the performance penalty. If there is not a large performance penalty I would go for the RE rather than have to start writing code backwards ;-) Regards, Edwin Fine On Sun, Sep 7, 2008 at 2:47 PM, Vance Shipley wrote: > On Sun, Sep 07, 2008 at 10:02:37AM -0400, Luke Galea wrote: > } I get the sense that most erlangers feel that regular expressions > } aren't needed and that pattern matching can do the job. > > Whenever possible. > > } ([m|l])ouse$ -> $1ice > > -module(inflector). > -export([singularize/1]). > > singularize(Word) -> > L = lists:reverse(Word), > lists:reverse(singularize1(L)). > > singularize1("ecil" ++ L) -> > "esuol" ++ L; > singularize1("ecim" ++ L) -> > "esuom" ++ L. > > 1> inflector:singularize("titmice"). > "titmouse" > > If you're really just dealing in words the penalty of a double > reverse isn't as bad as the penalty of having to use REs. > > -Vance > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Rainer.Hansen@REDACTED Sun Sep 7 23:16:38 2008 From: Rainer.Hansen@REDACTED (Rainer Hansen) Date: Sun, 07 Sep 2008 23:16:38 +0200 Subject: [erlang-questions] Aachen-Euskirchen-Bonn Erlounge on Tuesday Message-ID: <20080907211638.268350@gmx.net> Welcome to the first Aachen-Euskirchen-Bonn Erlounge taking place in the Parkhotel in Euskirchen. We meet at 19:30 o'clock on September 9th, 2008. All Erlang developers and users are welcome to meet each other and talk about what you are doing. Homepage of Parkhotel Euskirchen: http://www.parkhotel-euskirchen.com/ You can get driving instructions by just typing Parkhotel Euskirchen into the Google search bar. The Parkhotel is very good to reach by public transport because it is opposite to the bus and train station in Euskirchen. Don't hesitate to contact me if you've got any questions or comments. Rainer Hansen -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal f?r Modem und ISDN: http://www.gmx.net/de/go/smartsurfer From ok@REDACTED Mon Sep 8 04:21:16 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 8 Sep 2008 14:21:16 +1200 Subject: [erlang-questions] Time to update programming rules? In-Reply-To: <7721_1220587870_m854B2Pl030001_48C0B14E.9030308@bigpond.net.au> References: <20377_1220562821_m84LDcK6006538_b3bfba320809041401t5bac0974vdfc19ac68758cb1b@mail.gmail.com> <43927518-39DE-438F-AA14-B3268BF69FF5@cs.otago.ac.nz> <6c2563b20809041955l20ff361an46312fa11c86f54@mail.gmail.com> <21925_1220584680_m853Hxxm021259_48C0A4DE.3080407@bigpond.net.au> <2E9A0764-1977-4132-B0C6-0928603FEC2D@cs.otago.ac.nz> <7721_1220587870_m854B2Pl030001_48C0B14E.9030308@bigpond.net.au> Message-ID: <1310A1F7-E8E5-44AD-9064-EF02C99EE81A@cs.otago.ac.nz> On 5 Sep 2008, at 4:10 pm, Benjamin Tolputt wrote: > I understand the possibility of errors. Possibility of error is a > decent > point, but one that can (and has) been made about other parts of the > Erlang system. That's pretty much of a straw man position. It's not a question of a mere *possibility* of errors, but of a "feature" that makes errors *especially* likely, and which offers no compensating advantages. > As I understand it then, this is an "opinion" exclusion > of use rather than one endorsed by the developers of Erlang (given > they > implemented it and have yet to remove it from the system). The developers of Erlang have so far refrained from announcing dotted module names as a permanent feature of the language. There was a lot of discussion back in 2003 and it does not appear that the dotted names "feature" has been significantly revised since to address any of the issues that were seen five years ago. > > The "extra" functionality it offers is that the beams are split out > nicely such that "xyz.abc.mymod" is compiled to a "mymod.beam" file > that > will not conflict with a "abc.def.mymod" module. Actually, no. There never ever was anything whatsoever in Erlang to stop you writing module names like 'a.b.c' and thereby having the beam file placed as 'a.b.c.beam', which quite naturally never did conflict with an 'e.f.c.beam' file or 'e.f.c' module. Allowing you to write dotted names without quotation marks is no big deal either: we ALWAYS had the ability to write module names with @ signs in them. > This (in my mind) is a Good Thing. I am not saying one word against the idea of compound names. (Although I note that the compound name features originally present in SETL and ZetaLisp were dropped in SETL2 and Common Lisp. It would be very interesting to know why.) I am, as it happens, a big fan of 'child modules' in Ada, but unlike Java, Ada does child modules *well*. > Like Java, the multi-folder thing is likely to be a moot > issue given a decent IDE. One that I have admittedly not yet found for > Erlang - beyond a good text editor (ScITE) and the Erlang shell. You should not need a Gargantuan cycle-hogging "IDE" to paper over mistakes in a design. Have you studied Meyer's LACE at all? The mapping of module names to file names, whether simple or compounds, is inherently problematic in Haskell (which does it) and Erlang (which does it) and Prolog (which does it), in that names (including module names) are case sensitive in those languages, but in certain popular operating systems file names are not. Off hand I can think of four "POSIX-compatible" file systems that do not distinguish alphabetic case, so myModule and mymodule might, or might not, be distinguishable in BEAM file names. Then too, there are characters that can be present in an Erlang module name (like 'date/time mgmt') that are not allowed in a file name (Unix or Windows). Quoting http://www.erlang.org/pipermail/erlang-questions/2003-September/009794.html "if you insist on mapping Erlang module names directly to file names, NOBODY CAN EVER KNOW WHAT THE SET OF PORTABLE ERLANG MODULE NAMES IS! Nobody can even know how long an Erlang module name may be: is the limit 8 or 10 or 27 or 251 or what?" Aside from the mapping to file names, the only genuinely new thing that the "packages" "feature" for Erlang gives you is the ability to have more than one name for the same module, and to use the wrong one in a context where it matters. We can, and should, do MUCH MUCH better. For example, if a module is going to be referred to elsewhere as a.b.c, and if we compile a module M by invoking "erlc M.erl", then erlc a.b.c.erl should work. (It doesn't.) Certainly if a module announces itself as "-module(a.b.c)" then compiling it should not produce a simple c.beam. (It does.) > > > --Ben > > > > > ==================================================================== > Auto Generated Mail Footer > If this email is requesting your password then it is a HOAX. > DO NOT reply to the email. > Validate this footer at the > Otago University web site keyword search: information security phish > ==================================================================== > > > -- If stupidity were a crime, who'd 'scape hanging? From erlang-questions_efine@REDACTED Mon Sep 8 04:48:21 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sun, 7 Sep 2008 22:48:21 -0400 Subject: [erlang-questions] Time to update programming rules? In-Reply-To: <1310A1F7-E8E5-44AD-9064-EF02C99EE81A@cs.otago.ac.nz> References: <20377_1220562821_m84LDcK6006538_b3bfba320809041401t5bac0974vdfc19ac68758cb1b@mail.gmail.com> <43927518-39DE-438F-AA14-B3268BF69FF5@cs.otago.ac.nz> <6c2563b20809041955l20ff361an46312fa11c86f54@mail.gmail.com> <21925_1220584680_m853Hxxm021259_48C0A4DE.3080407@bigpond.net.au> <2E9A0764-1977-4132-B0C6-0928603FEC2D@cs.otago.ac.nz> <7721_1220587870_m854B2Pl030001_48C0B14E.9030308@bigpond.net.au> <1310A1F7-E8E5-44AD-9064-EF02C99EE81A@cs.otago.ac.nz> Message-ID: <6c2563b20809071948v606b9d6dhbbf1358675f16943@mail.gmail.com> > You should not need a Gargantuan cycle-hogging "IDE" to paper over > mistakes in a design. Have you studied Meyer's LACE at all? > > Now hold on a second :) Firstly, unless you are running X on a PDP-11/44 or NT on a 286, an IDE like Eclipse is not that much of a big deal. These days there are plenty of spare cycles and memory addresses to hog on a modern development workstation. Secondly, although I agree that ideally one should not need an IDE to compensate for design errors in a programming language, IDEs are peerless when it comes to supporting computer-aided processes like refactoring. Machines are far better at cross-checking fiddly things like inter- and intra-module references than are humans. And besides, I know of no significant (i.e. those I have heard of ;) programming languages that lack design errors. Although I must admit, I probably only know of a fraction of the scores or hundreds that you know about. As an aside, I think it would be rather indelicate to study Meyer's LACE, even if Meyer wasn't wearing it. Regards, Edwin Fine -------------- next part -------------- An HTML attachment was scrubbed... URL: From luoyi.ly@REDACTED Mon Sep 8 04:52:39 2008 From: luoyi.ly@REDACTED (luoyi) Date: Mon, 8 Sep 2008 10:52:39 +0800 Subject: [erlang-questions] maybe a BUG in the build system of erlang? In-Reply-To: References: Message-ID: I'm making slackware pkgs for erlang R12B4, and find the "make INSTALL_PREFIX=xxx install" command do some wrong work. my process is: ./configure --prefix=/usr make make INSTALL_PREFIX=/opt/SBo/package-erlang then I make a slackware pkgs and install it. after install , I found there still some files contain the "INSTALL_PREFIX" string, such as: luoyi@REDACTED:/usr/lib/erlang$ grep -r '/opt/SBo' * bin/start:ROOTDIR=/opt/SBo/package-erlang/usr/lib/erlang bin/erl:ROOTDIR=/opt/SBo/package-erlang/usr/lib/erlang erts-5.6.4/bin/start:ROOTDIR=/opt/SBo/package-erlang/usr/lib/erlang erts-5.6.4/bin/erl:ROOTDIR=/opt/SBo/package-erlang/usr/lib/erlang Binary file lib/kernel-2.12.4/ebin/hipe_unified_loader.beam matches Binary file lib/hipe-3.6.8/ebin/hipe_sparc_registers.beam matches Binary file lib/hipe-3.6.8/ebin/hipe_amd64_liveness.beam matches Binary file lib/hipe-3.6.8/ebin/hipe_rtl_varmap.beam matches Binary file lib/hipe-3.6.8/ebin/erl_types.beam matches Binary file lib/hipe-3.6.8/ebin/hipe_x86_ra.beam matches Binary file lib/hipe-3.6.8/ebin/hipe_sparc_ra_ls.beam matches Binary file lib/hipe-3.6.8/ebin/cerl_cconv.beam matches Binary file lib/hipe-3.6.8/ebin/hipe_x86_spill_restore.beam matches Binary file lib/hipe-3.6.8/ebin/hipe_ppc_ra_ls.beam matches .......... obviously, in the shell file, the ROOTDIR should be "/usr/lib/erlang" and there should no "/opt/SBo/package-erlang" string contained in the hipe beam files. is this a bug in the build system ? From anders.nygren@REDACTED Mon Sep 8 05:35:35 2008 From: anders.nygren@REDACTED (Anders Nygren) Date: Sun, 7 Sep 2008 22:35:35 -0500 Subject: [erlang-questions] maybe a BUG in the build system of erlang? In-Reply-To: References: Message-ID: On Sun, Sep 7, 2008 at 9:52 PM, luoyi wrote: > I'm making slackware pkgs for erlang R12B4, and find the "make > INSTALL_PREFIX=xxx install" command do some wrong work. > > my process is: > > ./configure --prefix=/usr > make > make INSTALL_PREFIX=/opt/SBo/package-erlang > > then I make a slackware pkgs and install it. after install , I found > there still some files contain the "INSTALL_PREFIX" string, such as: > > luoyi@REDACTED:/usr/lib/erlang$ grep -r '/opt/SBo' * > bin/start:ROOTDIR=/opt/SBo/package-erlang/usr/lib/erlang > bin/erl:ROOTDIR=/opt/SBo/package-erlang/usr/lib/erlang > erts-5.6.4/bin/start:ROOTDIR=/opt/SBo/package-erlang/usr/lib/erlang > erts-5.6.4/bin/erl:ROOTDIR=/opt/SBo/package-erlang/usr/lib/erlang > Binary file lib/kernel-2.12.4/ebin/hipe_unified_loader.beam matches > Binary file lib/hipe-3.6.8/ebin/hipe_sparc_registers.beam matches > Binary file lib/hipe-3.6.8/ebin/hipe_amd64_liveness.beam matches > Binary file lib/hipe-3.6.8/ebin/hipe_rtl_varmap.beam matches > Binary file lib/hipe-3.6.8/ebin/erl_types.beam matches > Binary file lib/hipe-3.6.8/ebin/hipe_x86_ra.beam matches > Binary file lib/hipe-3.6.8/ebin/hipe_sparc_ra_ls.beam matches > Binary file lib/hipe-3.6.8/ebin/cerl_cconv.beam matches > Binary file lib/hipe-3.6.8/ebin/hipe_x86_spill_restore.beam matches > Binary file lib/hipe-3.6.8/ebin/hipe_ppc_ra_ls.beam matches > .......... > > obviously, in the shell file, the ROOTDIR should be "/usr/lib/erlang" > and there should no "/opt/SBo/package-erlang" string contained in the > hipe beam files. > > is this a bug in the build system ? Was the source that You built from in /opt/SBo/something? The full path of the source filename is placed in the .beam so that could explain it. /Anders > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From luoyi.ly@REDACTED Mon Sep 8 05:41:26 2008 From: luoyi.ly@REDACTED (luoyi) Date: Mon, 8 Sep 2008 11:41:26 +0800 Subject: [erlang-questions] maybe a BUG in the build system of erlang? In-Reply-To: References: Message-ID: I've said that I'm making a *package*, that means the /opt/SBo/xxx is just a fake root for the package purpose. the program will be run after they were installed into the true root director ----- in my example, this should be: /usr/lib/erlang 2008/9/8 Anders Nygren : > > Was the source that You built from in /opt/SBo/something? > > The full path of the source filename is placed in the .beam > so that could explain it. > > /Anders > >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > From ok@REDACTED Mon Sep 8 06:59:32 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 8 Sep 2008 16:59:32 +1200 Subject: [erlang-questions] Convert atom and arity into fun In-Reply-To: <12276_1220612079_m85Asb3L001728_48C10DE5.7090102@it.uu.se> References: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> <12276_1220612079_m85Asb3L001728_48C10DE5.7090102@it.uu.se> Message-ID: <14915773-8CCF-447E-B7DC-DF04291315A6@cs.otago.ac.nz> On 5 Sep 2008, at 10:45 pm, Richard Carlsson wrote: > There is currently no immediate way of doing this. We have the "fun /" notation, which I believe has been extended or will be extended to "fun :/". It would seem like a minor change to the language to allow variables here. It must be said, this looks like a case for the old-fashioned {M,F} or {M,F,A} tuples-naming-functions. From ok@REDACTED Mon Sep 8 07:26:00 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 8 Sep 2008 17:26:00 +1200 Subject: [erlang-questions] Time to update programming rules? In-Reply-To: <8295_1220842712_m882wSFf019034_6c2563b20809071948v606b9d6dhbbf1358675f16943@mail.gmail.com> References: <20377_1220562821_m84LDcK6006538_b3bfba320809041401t5bac0974vdfc19ac68758cb1b@mail.gmail.com> <43927518-39DE-438F-AA14-B3268BF69FF5@cs.otago.ac.nz> <6c2563b20809041955l20ff361an46312fa11c86f54@mail.gmail.com> <21925_1220584680_m853Hxxm021259_48C0A4DE.3080407@bigpond.net.au> <2E9A0764-1977-4132-B0C6-0928603FEC2D@cs.otago.ac.nz> <7721_1220587870_m854B2Pl030001_48C0B14E.9030308@bigpond.net.au> <1310A1F7-E8E5-44AD-9064-EF02C99EE81A@cs.otago.ac.nz> <8295_1220842712_m882wSFf019034_6c2563b20809071948v606b9d6dhbbf1358675f16943@mail.gmail.com> Message-ID: <830D7928-DAF5-4761-8C81-533C02EEE8AE@cs.otago.ac.nz> On 8 Sep 2008, at 2:48 pm, Edwin Fine wrote: > Firstly, unless you are running X on a PDP-11/44 or NT on a 286, an > IDE like Eclipse is not that much of a big deal. These days there > are plenty of spare cycles and memory addresses to hog on a modern > development workstation. My main machine is a 500MHz UltraSPARC II. The IDE from Sun is NetBeans. So I tried downloading Sun's IDE (written in Sun's language) from Sun's website and installing it on Sun hardware running Sun's operating system with Sun's compilers. And it didn't work. Last night I was using Microsoft Visual Studio 2008 on a new laptop (not mine). It did nothing to improve my opinion of IDEs, let's put it that way. The worst thing that these things hog is screen area. I'm a fan of Smalltalk, which gets the screen area bit right. It's pretty much the only IDE that I do like. But they said "oh, machines are faster bigger, so we can make pretty-print-as-you-type and colourising defaults" and pretty soon the 1GHz PowerMac I was using was crawling. Hogs! > Secondly, although I agree that ideally one should not need an IDE > to compensate for design errors in a programming language, IDEs are > peerless when it comes to supporting computer-aided processes like > refactoring. The Smalltalk refactoring browser is a fine example of that. > Machines are far better at cross-checking fiddly things like inter- > and intra-module references than are humans. And besides, I know of > no significant (i.e. those I have heard of ;) programming languages > that lack design errors. Meyer's LACE referred to the "Language for Assembling Classes in Eiffel." As for design errors, there are differences of degree. The inconsistencies in the dotted module names "feature" put it roughly on a level with C's switch() statement. From ok@REDACTED Mon Sep 8 07:36:44 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 8 Sep 2008 17:36:44 +1200 Subject: [erlang-questions] Time to update programming rules? In-Reply-To: <15202_1220843798_m883GaPS022236_48C498FA.2050501@bigpond.net.au> References: <20377_1220562821_m84LDcK6006538_b3bfba320809041401t5bac0974vdfc19ac68758cb1b@mail.gmail.com> <43927518-39DE-438F-AA14-B3268BF69FF5@cs.otago.ac.nz> <6c2563b20809041955l20ff361an46312fa11c86f54@mail.gmail.com> <21925_1220584680_m853Hxxm021259_48C0A4DE.3080407@bigpond.net.au> <2E9A0764-1977-4132-B0C6-0928603FEC2D@cs.otago.ac.nz> <7721_1220587870_m854B2Pl030001_48C0B14E.9030308@bigpond.net.au> <1310A1F7-E8E5-44AD-9064-EF02C99EE81A@cs.otago.ac.nz> <15202_1220843798_m883GaPS022236_48C498FA.2050501@bigpond.net.au> Message-ID: On 8 Sep 2008, at 3:16 pm, Benjamin Tolputt wrote: [about a number of side issues and avoiding the core of it] I agree that we should get an official opinion about what is likely to happen to the dotted names stuff in Erlang from the Erlang/OTP developers. There are two fundamental problems with dotted module names. One is perhaps a matter of opinion. First: the fact that dotted module names are like "absolute" file names rather than "relative" file names. There is a rival design, or more precisely, a sketch of one, available for discussion, which does not have this problem. Some day I should convert it to EEP form. It is idle to say that an IDE can fix up module names when you move a cluster of modules; that only works if the IDE can *find* module names reliably. And that leads us to ... Second: the dotted names proposal is a *compile-time* retrofit to a language with a *run-time* approach to naming. The compiler or preprocessor or whatever simply cannot find all references to a module. The rewrite rules for handling "names" are inconsistent (some occurrences of an "abbreviated" module name will be expanded, others will not) and in any case do not apply to module names determined at run time. If this were an essential property of every possible way to add macro-level structuring to Erlang, we'd just have to live with it, but as it happens, there is also a sketch of an approach that doesn't have this problem posted to this mailing list years ago and available for discussion. It is entirely possible to have a macro-level structured module system for Erlang in which ALL module references in source code are simple identifiers, so that there are _necessarily_ no inconsistencies about rewriting module names (because they don't get rewritten). From kevin@REDACTED Mon Sep 8 07:33:44 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Sun, 7 Sep 2008 22:33:44 -0700 Subject: [erlang-questions] noob HIPE question Message-ID: <88A4D57A-ECD2-4B97-ADD1-3CAC4C551556@scaldeferri.com> I spend most of my time on Mac, so HIPE is pretty new to me. Can anyone explain this behavior? $ erlc binarytrees.erl $ erl -noshell -run binarytrees main 10 stretch tree of depth 11 check: -1 2048 trees of depth 4 check: -2048 512 trees of depth 6 check: -512 128 trees of depth 8 check: -128 32 trees of depth 10 check: -32 long lived tree of depth 10 check: -1 $ erlc +native +"{hipe,[o3]}" binarytrees.erl $ erl -noshell -run binarytrees main 10 {"init terminating in do_boot",{undef,[{binarytrees,main,[["10"]]}, {init,start_it,1},{init,start_em,1}]}} Crash dump was written to: erl_crash.dump init terminating in do_boot () Why would 'erl' fail to find the code when it's been compiled with HIPE? -kevin From ok@REDACTED Mon Sep 8 08:16:01 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 8 Sep 2008 18:16:01 +1200 Subject: [erlang-questions] String Pattern Matching In-Reply-To: <26051_1220819152_m87KPTms012931_BAE3675D-3A8F-49B0-AB1E-7856D41A79F6@ideaforge.org> References: <26051_1220819152_m87KPTms012931_BAE3675D-3A8F-49B0-AB1E-7856D41A79F6@ideaforge.org> Message-ID: <962EDEDB-C558-46B3-894F-75195F75240F@cs.otago.ac.nz> On 8 Sep 2008, at 2:02 am, Luke Galea wrote: > For instance: > ([m|l])ouse$ -> $1ice > or > ([^aeiouy]|qu)y$ -> $1ies > > So, given that erlang has insufficient regular expression support to > tackle this (and given that I want to do this the "erlang way"), how > does one go about doing this? Key insight: PROGRAMS ARE DATA. This means that you can compute a program (or a module); you don't have to write it by hand. Given rules of the form $ -> you can write a fairly straightforward program (I'd probably do it in AWK, to be honest) to turn that into Erlang like replace("esuom"++X) -> rev(X, "mice"); replace("esoul"++X) -> rev(X, "lice"); replace("yuq" ++X) -> rev(X, "ies"); replace("y"++[C|X]) when (C =\= $a, C =\= $e, ... C =\= $y) -> rev(X, [C|"ies"]); ... rev([X|Xs], R) -> rev(Xs, [X|R]); rev([], R) -> R. rewrite(S) -> replace(rev(S, [])). (Think "trie".) Yes, you definitely DON'T want to write this kind of code by hand. But you also do NOT want to write it as a whole bunch of regular expression matches either. I first encountered this idea when I tried to write a morphological analyser for Latin in Prolog, many years ago. Too tedious to write by hand, but simple to write a reverse/match+replace/reverse compiler for. > The bit syntax won't work on arbitrary length fields as far as I > know. And I *really* don't want to invent my own subset/alternate > syntax of regular expressions that is more than what erlang supports > and less than a PCRE. I suggest that you really DO want to invent your own subset of regular expressions that is just powerful enough to do the job. Maybe something like alternation, concatenation, literal, and set will be enough. Then you compile that to Erlang. From bengt.kleberg@REDACTED Mon Sep 8 08:57:39 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 08 Sep 2008 08:57:39 +0200 Subject: [erlang-questions] noob HIPE question In-Reply-To: <88A4D57A-ECD2-4B97-ADD1-3CAC4C551556@scaldeferri.com> References: <88A4D57A-ECD2-4B97-ADD1-3CAC4C551556@scaldeferri.com> Message-ID: <1220857059.4541.1.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Greetings, Just to be really, really sure: Do you still have a file called binarytrees.beam after doing "erlc +native +"{hipe,[o3]}" binarytrees.erl"? bengt On Sun, 2008-09-07 at 22:33 -0700, Kevin Scaldeferri wrote: > I spend most of my time on Mac, so HIPE is pretty new to me. Can > anyone explain this behavior? > > $ erlc binarytrees.erl > $ erl -noshell -run binarytrees main 10 > stretch tree of depth 11 check: -1 > 2048 trees of depth 4 check: -2048 > 512 trees of depth 6 check: -512 > 128 trees of depth 8 check: -128 > 32 trees of depth 10 check: -32 > long lived tree of depth 10 check: -1 > > $ erlc +native +"{hipe,[o3]}" binarytrees.erl > $ erl -noshell -run binarytrees main 10 > {"init terminating in do_boot",{undef,[{binarytrees,main,[["10"]]}, > {init,start_it,1},{init,start_em,1}]}} > > Crash dump was written to: erl_crash.dump > init terminating in do_boot () > > > Why would 'erl' fail to find the code when it's been compiled with HIPE? > > > -kevin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From bengt.kleberg@REDACTED Mon Sep 8 09:10:27 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 08 Sep 2008 09:10:27 +0200 Subject: [erlang-questions] Executing an Erlang function from Perl In-Reply-To: References: <48BE8A33.6080608@inswitch.us> <48C162BD.8080306@inswitch.us> Message-ID: <1220857827.4541.4.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Greetings, This is just a correction of a typo below: code:add_patha(Dir) bengt On Fri, 2008-09-05 at 12:41 -0500, Anders Nygren wrote: > 2008/9/5 Sebastian Bello : > > Thanks Bengt and Chandru. > > An additional question: if I know the full path to a .beam file, and that > > path has no been added with a -pa for example, what would be the way to > > execute a function of that module? > > Sebastian- > > Sebastian > > Dir = filename:dirname(Beam), > code:addpatha(Dir) > > /Anders > > > > > Chandru escribi?: > > > > 2008/9/3 Sebastian Bello > >> > >> Hi list, > >> > >> I need to execute an Erlang function from within Perl code, what do you > >> suggest? > >> Thanks, > >> Sebastian- > > > > Try 'erl -man erl_call' > > > > Extract from the man page: > > > > NAME > > erl_call - Call/Start a Distributed Erlang Node > > > > DESCRIPTION > > erl_call makes it possible to start and/or communicate with a > > dis- > > tributed Erlang node. It is built upon the erl_interface library as > > an > > example application. Its purpose is to use an Unix shell script > > to > > interact with a distributed Erlang node. It performs all > > communication > > with the Erlang rex server, using the standard Erlang RPC facility. > > It > > does not require any special software to be run at the Erlang > > target > > node. > > > > The main use is to either start a distributed Erlang node or to make > > an > > ordinary function call. However, it is also possible to pipe an > > Erlang > > module to erl_call and have it compiled, or to pipe a sequence > > of > > Erlang expressions to be evaluated (similar to the Erlang shell). > > > > Options, which cause stdin to be read, can be used with advantage > > as > > scripts from within (Unix) shell scripts. Another nice use of > > erl_call > > could be from (http) CGI-bin scripts. > > > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ulf.wiger@REDACTED Mon Sep 8 10:42:04 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Mon, 08 Sep 2008 10:42:04 +0200 Subject: [erlang-questions] Time to update programming rules? In-Reply-To: <6c2563b20809071948v606b9d6dhbbf1358675f16943@mail.gmail.com> References: <20377_1220562821_m84LDcK6006538_b3bfba320809041401t5bac0974vdfc19ac68758cb1b@mail.gmail.com> <43927518-39DE-438F-AA14-B3268BF69FF5@cs.otago.ac.nz> <6c2563b20809041955l20ff361an46312fa11c86f54@mail.gmail.com> <21925_1220584680_m853Hxxm021259_48C0A4DE.3080407@bigpond.net.au> <2E9A0764-1977-4132-B0C6-0928603FEC2D@cs.otago.ac.nz> <7721_1220587870_m854B2Pl030001_48C0B14E.9030308@bigpond.net.au> <1310A1F7-E8E5-44AD-9064-EF02C99EE81A@cs.otago.ac.nz> <6c2563b20809071948v606b9d6dhbbf1358675f16943@mail.gmail.com> Message-ID: <48C4E55C.6060804@ericsson.com> Edwin Fine skrev: > > > You should not need a Gargantuan cycle-hogging "IDE" to > paper over mistakes in a design. Have you studied Meyer's > LACE at all? > > > Now hold on a second :) > > Firstly, unless you are running X on a PDP-11/44 or NT on a > 286, an IDE like Eclipse is not that much of a big deal. > These days there are plenty of spare cycles and memory > addresses to hog on a modern development workstation. I've frequently argued for the use (or at least the preparation for use) of Eclipse in our projects, but every single time so far that I've tried to use it myself, I've run into obstacles like: - The workstation I tried it on didn't have a compatible version of JDK installed (and I lacked the privileges to fix it.) - The workstation certainly did NOT have enough cycles to spare in order to make running Eclipse anything but excruciatingly painful. - (Most recently) Running Eclipse on my dual-core Vista laptop seems to trigger some locking violation in Eclipse, crashing the editor every time at startup. I will admit that I've never been willing to commit more than a few hours each time to try to get Eclipse working. This amount of work or less has been perfectly sufficient for trying out any number of plain editors, none of which were good enough to lure me away from Emacs, but at least I could quickly get them to work. I will feel much better about my tacit endorsement of Eclipse the day I can actually get some work done with it myself. (: > Secondly, although I agree that ideally one should not need > an IDE to compensate for design errors in a programming language, > IDEs are peerless when it comes to supporting computer-aided > processes like refactoring. I'm all for the use of IDEs and other power tools, but in my experience, early adopters easily forget that a large number of people will actually be using quite modest hardware - the kind that the early adopter has piled up in the closet because he considers it practically useless. I very much like the fact that you can be very productive in Erlang /without/ an IDE. I side completely with Richard on this particular issue. BR, Ulf W From mazen@REDACTED Mon Sep 8 13:21:30 2008 From: mazen@REDACTED (Mazen Harake) Date: Mon, 08 Sep 2008 12:21:30 +0100 Subject: [erlang-questions] m4 not checked in configure. Message-ID: <48C50ABA.6080502@erlang-consulting.com> I'm sure this has been brought up before but configure doesn't check for m4... annoying but true... we've known this for a long time but I always do the same mistake when setting up a new systems on various machines :) can it be fixed? :) That's all, Thank you, :) /Mazen From raimo+erlang-questions@REDACTED Mon Sep 8 12:31:41 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 8 Sep 2008 12:31:41 +0200 Subject: [erlang-questions] : A whole bunch of implementation details In-Reply-To: References: <08F3714D-5099-4ED8-9C59-8E6B553720EE@cs.otago.ac.nz> Message-ID: <20080908103141.GA2810@erix.ericsson.se> On Thu, Sep 04, 2008 at 10:20:45PM -0500, Dennis Byrne wrote: > Thank you Richard, Mikael and Raimo. Here's another question I got as a > follow up. > > Can pids be reused, even though the documentation refers to them as > unique? Any info on the underlying implementation of how a pid is > uniquely generated across a cluster? The unique part is a 28 bit field per node. If you spawn processes in a tight loop you can wrap the 28 bits rather fast, but for any decent application it will take quite a while. In a cluster, a particular node name and incarnation identifies the node, and a remote pid is identified by the node (+incarnation) and the node's local pid id. A connection between nodes may go down and come up, and a remote pid still remain valid. > > If they are not unique, what precautions should application developers use > to guard against this? * Short enough timeouts for the process ids not to wrap. * Short enough timeouts for a remote node node not restart unnoticed. * Process links and monitors. * Node monitors. > ____________________________________________ > Dennis Byrne > ThoughtWorks - Chicago > 312-505-7965 > > > > > "Richard A. O'Keefe" > 09/04/2008 12:41 AM > > To > Dennis Byrne > cc > > Subject > Re: [erlang-questions] A whole bunch of implementation details > > > > > > > > On 4 Sep 2008, at 2:37 pm, Dennis Byrne wrote: > > How does stack memory grow? Am told Prolog does this dynamically > > and I was wondering if Erlang did the same. > > Some Prologs (DEC-10 Prolog, Quintus Prolog, SICStus Prolog, ...) do > this, > some Prologs (C Prolog, SWI Prolog) don't. > The Burroughs B6700 used to do this for Algol, BASIC, COBOL, DMAlgol, > ESPOL, FORTRAN, Pascal, and PL/I, back in the late 60s. > > "Modern", less capable, systems like say Windows or Unix, do not do this > because they don't know where the pointers are. The B6700, Prolog > systems, > and Erlang systems, tag each word of memory to say what it is, so you > can > infallibly find the pointers. With that, moving a stack is tedious > rather > than difficult. > > > Does heap memory contract? > > It can. > > > > Exactly what is the tipping point between what gets passed by value > > and what gets passed by reference? > > There is no pass by reference. All binaries are passed by value. > Some binary values are > represented by pointers. Some of those pointers point to shared > blocks, some don't. But > it is still pass by value. Pass by reference is, by definition, > passing the address of a > VARIABLE ('var x: t' in Pascal, 't& x' in C++). > > Notionally when you send anything in a message, it is copied, > otherwise it isn't. > Some Erlang systems have had a shared or hybrid heap, in which the > logical copy is > a no-op. > > > The large binary trick is common knowledge, any other corner cases? > > How does the VM differentiate between a node that is temporarily > > unresponsive and one that is down? In other words, at what point > > does a node give up on a peer? > > There is no infallible way to tell. Mistakes will always be made. > The net_kernel module sets up a "ticker" process that periodically > sends a message to every node it's in communication with; if it > doesn't hear from a node after a while it assumes it's down. > If a node is shut down in an orderly way it will tell is peers > that it is going down. > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From joelr1@REDACTED Mon Sep 8 12:51:35 2008 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 8 Sep 2008 11:51:35 +0100 Subject: [erlang-questions] noob HIPE question In-Reply-To: <88A4D57A-ECD2-4B97-ADD1-3CAC4C551556@scaldeferri.com> References: <88A4D57A-ECD2-4B97-ADD1-3CAC4C551556@scaldeferri.com> Message-ID: <5B2CC3DB-EA6E-4F7E-8BB2-9DE4115DC56B@gmail.com> On Sep 8, 2008, at 6:33 AM, Kevin Scaldeferri wrote: > I spend most of my time on Mac, so HIPE is pretty new to me. Can > anyone explain this behavior? I thought there was no HiPE on the Mac, not as part of the standard distribution anyway. Did this change with Leopard? -- wagerlabs.com From torben.lehoff@REDACTED Mon Sep 8 13:15:04 2008 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Mon, 8 Sep 2008 13:15:04 +0200 Subject: [erlang-questions] Switching and Routing protocols In-Reply-To: <7c9d57ea0808301646q5cbfb4fcka23c0f9044b83ee2@mail.gmail.com> References: <7c9d57ea0808281637w1f209ec3r43559bee004de86f@mail.gmail.com> <20080829050305.GA13907@metalman.digium.internal> <7c9d57ea0808301646q5cbfb4fcka23c0f9044b83ee2@mail.gmail.com> Message-ID: On Sun, Aug 31, 2008 at 1:46 AM, Sargun Dhillon wrote: > Apparently gen_udp does support multicast, but it isn't in the > documentation. Does anyone know where one may find documentation > regarding multicasting with gen_udp? I cannot remember where we found the information, but I think we looked in the code... gen_udp:open(?PORT_NUM_TX_MULTI, [binary, {active, true}, {ip, SomeIP}, inet, {multicast_ttl, 255}, {multicast_loop, true}, {multicast_if, IsiGwIP}]), > > > 2008/8/28 mog : > > On Thu, Aug 28, 2008 at 04:37:29PM -0700, Sargun Dhillon wrote: > >> protocol Erlang is great. Regarding OSPFd/RIP (other (broad/multi)cast > >> IGPs) the gen_udp module doesn't implement multicast last time I > >> checked. Unless this has changed you'll need to write an external port > >> driver for this purpose. > >> We'd love to hear your attempts at routing protocols in Erlang. > > > > I can't speak to the rest of this email but multicast support is > available in erlang as of r11b3 i know for sure probably earlier. > > > > Mog > > > > -----BEGIN PGP SIGNATURE----- > > Version: GnuPG v1.4.9 (GNU/Linux) > > > > iEYEARECAAYFAki3gwkACgkQeq+tARrxhnthiwCff+r9R7kH8O/pUp7gLVJHRqKo > > P5AAoKC9/n0nVkUaRZe3jhzr3Y0vBrq0 > > =rrPM > > -----END PGP SIGNATURE----- > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From torben.lehoff@REDACTED Mon Sep 8 13:17:02 2008 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Mon, 8 Sep 2008 13:17:02 +0200 Subject: [erlang-questions] Switching and Routing protocols In-Reply-To: References: <7c9d57ea0808281637w1f209ec3r43559bee004de86f@mail.gmail.com> <20080829050305.GA13907@metalman.digium.internal> <7c9d57ea0808301646q5cbfb4fcka23c0f9044b83ee2@mail.gmail.com> Message-ID: Got the reply going a bit to fast. The code should look like this: gen_udp:open(?PORT_NUM_TX_MULTI, [binary, {active, true}, {ip, SomeIP}, inet, {multicast_ttl, 255}, {multicast_loop, true}, {multicast_if, SomeIP}]), This works for real! Cheers, Torben On Mon, Sep 8, 2008 at 1:15 PM, Torben Hoffmann < torben.lehoff@REDACTED> wrote: > > > On Sun, Aug 31, 2008 at 1:46 AM, Sargun Dhillon wrote: > >> Apparently gen_udp does support multicast, but it isn't in the >> documentation. Does anyone know where one may find documentation >> regarding multicasting with gen_udp? > > > I cannot remember where we found the information, but I think we looked in > the code... > > gen_udp:open(?PORT_NUM_TX_MULTI, > [binary, {active, true}, > > {ip, SomeIP}, > inet, > {multicast_ttl, 255}, > {multicast_loop, true}, > {multicast_if, IsiGwIP}]), > > > > > >> >> >> 2008/8/28 mog : >> > On Thu, Aug 28, 2008 at 04:37:29PM -0700, Sargun Dhillon wrote: >> >> protocol Erlang is great. Regarding OSPFd/RIP (other (broad/multi)cast >> >> IGPs) the gen_udp module doesn't implement multicast last time I >> >> checked. Unless this has changed you'll need to write an external port >> >> driver for this purpose. >> >> We'd love to hear your attempts at routing protocols in Erlang. >> > >> > I can't speak to the rest of this email but multicast support is >> available in erlang as of r11b3 i know for sure probably earlier. >> > >> > Mog >> > >> > -----BEGIN PGP SIGNATURE----- >> > Version: GnuPG v1.4.9 (GNU/Linux) >> > >> > iEYEARECAAYFAki3gwkACgkQeq+tARrxhnthiwCff+r9R7kH8O/pUp7gLVJHRqKo >> > P5AAoKC9/n0nVkUaRZe3jhzr3Y0vBrq0 >> > =rrPM >> > -----END PGP SIGNATURE----- >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://www.erlang.org/mailman/listinfo/erlang-questions >> > >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikpe@REDACTED Mon Sep 8 13:29:14 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Mon, 8 Sep 2008 13:29:14 +0200 Subject: [erlang-questions] noob HIPE question In-Reply-To: <5B2CC3DB-EA6E-4F7E-8BB2-9DE4115DC56B@gmail.com> References: <88A4D57A-ECD2-4B97-ADD1-3CAC4C551556@scaldeferri.com> <5B2CC3DB-EA6E-4F7E-8BB2-9DE4115DC56B@gmail.com> Message-ID: <18629.3210.877039.288170@harpo.it.uu.se> Joel Reymont writes: > > On Sep 8, 2008, at 6:33 AM, Kevin Scaldeferri wrote: > > > I spend most of my time on Mac, so HIPE is pretty new to me. Can > > anyone explain this behavior? > > > I thought there was no HiPE on the Mac, not as part of the standard > distribution anyway. Did this change with Leopard? HiPE supports MacOS on PowerPC but not on x86. This situation is unlikely to change anytime soon. (The MacOS issues on x86 have been mentioned on this mailing list several times before. Search the archives if you have to know what they are.) From galeal@REDACTED Mon Sep 8 13:20:27 2008 From: galeal@REDACTED (Luke Galea) Date: Mon, 8 Sep 2008 07:20:27 -0400 Subject: [erlang-questions] String Pattern Matching In-Reply-To: <20080908091132.6B99D2407F@relay.gooddata.com> References: <26051_1220819152_m87KPTms012931_BAE3675D-3A8F-49B0-AB1E-7856D41A79F6@ideaforge.org> <962EDEDB-C558-46B3-894F-75195F75240F@cs.otago.ac.nz> <20080908091132.6B99D2407F@relay.gooddata.com> Message-ID: Thanks everyone! I'll probably release a "quick and dirty" regular expression based inflection library and then go back and rewrite it afterwards. The new RE lib is working great, but there are a lot of regular expressions involved and to make the compiled REs cached I'm thinking I should spawn a process that holds the compiled REs (or use the process dictionary which I'd rather avoid). Being able to generate erlang based on the rules would simplify that nicely (albeit, moving the complexity into the code generator). I'll send a link to the release around as soon as I've finished implementing all the remaining "easy" inflector stuff like camel_case/ 1 and underscore/1. -- Luke From raimo+erlang-questions@REDACTED Mon Sep 8 13:48:48 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 8 Sep 2008 13:48:48 +0200 Subject: [erlang-questions] PID recycling In-Reply-To: <48C12136.8010401@ericsson.com> References: <48C12136.8010401@ericsson.com> Message-ID: <20080908114848.GB2810@erix.ericsson.se> Firstly. Please do not send HTML code to this list. It is very hard to read for some (at least me). On Fri, Sep 05, 2008 at 02:08:22PM +0200, Zoltan Peter Toth wrote: : > Question: how is the last used incarnation stored and when are values recycled > ? (on Linux) > Is there any way to change the cycling range ? > Just for my curiosity :) > > Br, > Zoltan The incarnation aka "Creation" is stored in EPMD, the Erlang Port Mapper Daemon, that is external to all nodes. It cycles 1,2,3 then round to 1 again. You can not change it. It is platform independent. An undistributed node has creation 0. Creation 0 is also used for dirty tricks having the meaning of the current creation. We have had plans to change it from 2 bits to 32 but it would hit hard on erl_interface and applications using it. -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From tuncer.ayaz@REDACTED Mon Sep 8 13:48:47 2008 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Mon, 8 Sep 2008 13:48:47 +0200 Subject: [erlang-questions] m4 not checked in configure. In-Reply-To: <48C50ABA.6080502@erlang-consulting.com> References: <48C50ABA.6080502@erlang-consulting.com> Message-ID: <4ac8254d0809080448m4330ef94l4146751e581e7eaf@mail.gmail.com> On Mon, Sep 8, 2008 at 1:21 PM, Mazen Harake wrote: > I'm sure this has been brought up before but configure doesn't check for > m4... > annoying but true... we've known this for a long time but I always do > the same mistake when setting up a new systems on various machines :) Different check but same topic: If we're at this we should fix the missing check for the openssl executable. Having OpenSSL headers/libs installed is not enough or was not enough on one of my systems. Maybe I should create a small patch as soon as I have time to patch and test. > can it be fixed? :) > > That's all, > > Thank you, :) From joelr1@REDACTED Mon Sep 8 13:49:02 2008 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 8 Sep 2008 12:49:02 +0100 Subject: [erlang-questions] noob HIPE question In-Reply-To: <18629.3210.877039.288170@harpo.it.uu.se> References: <88A4D57A-ECD2-4B97-ADD1-3CAC4C551556@scaldeferri.com> <5B2CC3DB-EA6E-4F7E-8BB2-9DE4115DC56B@gmail.com> <18629.3210.877039.288170@harpo.it.uu.se> Message-ID: On Sep 8, 2008, at 12:29 PM, Mikael Pettersson wrote: > (The MacOS issues on x86 have been mentioned on this > mailing list several times before. Search the archives > if you have to know what they are.) I don't need to search, I ported HiPE to Mac x86 with your help ;-). -- wagerlabs.com From erlang-questions_efine@REDACTED Mon Sep 8 14:28:45 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Mon, 8 Sep 2008 08:28:45 -0400 Subject: [erlang-questions] Time to update programming rules? In-Reply-To: <48C4E55C.6060804@ericsson.com> References: <20377_1220562821_m84LDcK6006538_b3bfba320809041401t5bac0974vdfc19ac68758cb1b@mail.gmail.com> <43927518-39DE-438F-AA14-B3268BF69FF5@cs.otago.ac.nz> <6c2563b20809041955l20ff361an46312fa11c86f54@mail.gmail.com> <21925_1220584680_m853Hxxm021259_48C0A4DE.3080407@bigpond.net.au> <2E9A0764-1977-4132-B0C6-0928603FEC2D@cs.otago.ac.nz> <7721_1220587870_m854B2Pl030001_48C0B14E.9030308@bigpond.net.au> <1310A1F7-E8E5-44AD-9064-EF02C99EE81A@cs.otago.ac.nz> <6c2563b20809071948v606b9d6dhbbf1358675f16943@mail.gmail.com> <48C4E55C.6060804@ericsson.com> Message-ID: <6c2563b20809080528n5f0f5596lf7940db765490b40@mail.gmail.com> Look, Make no mistake, I am no IDE apologist. I use Vim, and only Vim, to do all my work, unless I have Java work to do, in which case I use Eclipse because of its very good support for Java and all the other things I mentioned. I didn't realize that any people actually still used 500MHz SunSparc II pizza boxes other than for bookends. I truly commiserate. No, really, I was forced to use one at my previous job for some things, and after being treated for post-traumatic stress disorder from that experience, I am mostly ok now. I hear that since they were so obsolete they couldn't even run some of the newer versions of Solaris, they loaded them all into the back of a truck, along with some ancient and horribly underpowered HP workstations, and melted them down for something more valuable, the plastic or metals or something. So if one is truly forced to use such state of the ark equipment, I totally understand the anti-IDE allergy. But if you work for a company that forces you to suffer such curel and unusual punishment, you should let them know it is false economy to force developers to use such underpowered tools. They would get far more productivity from spending even US$1,000 on a decent dual-core or quad-core x86_64 CPU, 4 GB of RAM, 500GB of disk and running some flavor of Linux. I understand that for architecture-specific development, such as for SPARC or PA-RISC, one may have to make do with some old clunker. I've done plenty of multiple-platform development and understand that you can't always have the best and latest, especially since companies like Sun and HP tend to charge fortunes for modern workstations. However, you could do much of the development on a decent Linux box and then switch to the bronze-age box to do the final compile and testing. It's truly shameful that people of your calibre should be forced into such indignities. As for Windows Vista, I feel for you, but anyone who actually uses that abomination (talk about cycle-hogging!) and expects it to work needs to have their head read. Format the hard disk and put on a copy of XP or maybe even Linux. Some of the downsides of IDEs, excluding the memory/cycle hogging, include things like project and build files that are IDE-dependent AND version dependent. Microsoft seem historically to be particularly offensive in this regard. I recently tried to help someone fix a C# .NET application. Let me reproduce what I wrote a couple of weeks ago about trying to get an older version of the Microsoft Visual Studio .NET to work with the project files that were created on a newer version. --------------------------- Be warned: rant ahead, but please take it in the spirit of "ha ha, he's only serious". I set PATH and LIB to the bin directory containing both the .exe and the .dll. I threatened the computer with viruses. I promised my firstborn to Microsoft. I sacrificed goats to Yahweh, Ahura Mazda, Zeus, Apollo, Pallas Athena, Thor, Odin, Loki, Moloch, Baal, Isis, Osiris, Seth, Prostetnic Vogon Jeltz, Beelzebub, Pazuzu, Satan, and George W. Bush. Then I ran out of goats, so I used a neighbor and tried to raise Cthulhu, Yog-Sothoth, and Shub-Niggurath. I ingested magic mushrooms and other hallucinogens because I thought the "Windows development environment", and I use the term loosely, might make more sense if I were in an alternate reality. Nothing worked. The way the f-ing stuff hangs together is impenetrable to me, and evidently to many deities and evil spirits. I installed MS VisualStudio .NET 2003 so I could at least build the code, but the project files that are there are from a newer version of VS .NET, so I can't open them. Sorry to say this, but this is one reason why I detest IDEs in general, and Microsoft's specifically - for that matter, I despise Microsoft in general, may the bugs of a thousand Vistas infest their armpits. The old, primitive make system or newer ones like Ant work just about everywhere, but IDE-based things don't. Why MS had to reinvent the f-ing wheel and create .NET and yet another level of non-interoperability I don't know, but I hope there is a special, very low infernal level of Hades reserved just for them. And may there only be Windows Me 4.77MHz 8088 PCs available there. And 300 baud modems. --------------------------------- I rest my case. I'll stick to human-readable configuration files that I can fix by hand if I have to. And Vim (yes, laugh at me, O Emacs lovers, but it's what I learned first, so there). Regards, Edwin Fine On Mon, Sep 8, 2008 at 4:42 AM, Ulf Wiger (TN/EAB) wrote: > Edwin Fine skrev: > >> >> You should not need a Gargantuan cycle-hogging "IDE" to >> > > paper over mistakes in a design. Have you studied Meyer's > > LACE at all? > >> >> >> Now hold on a second :) >> >> Firstly, unless you are running X on a PDP-11/44 or NT on a >> > > 286, an IDE like Eclipse is not that much of a big deal. > > These days there are plenty of spare cycles and memory > > addresses to hog on a modern development workstation. > > I've frequently argued for the use (or at least the preparation > for use) of Eclipse in our projects, but every single time so > far that I've tried to use it myself, I've run into obstacles > like: > > - The workstation I tried it on didn't have a compatible version > of JDK installed (and I lacked the privileges to fix it.) > > - The workstation certainly did NOT have enough cycles to spare > in order to make running Eclipse anything but excruciatingly > painful. > > - (Most recently) Running Eclipse on my dual-core Vista laptop > seems to trigger some locking violation in Eclipse, crashing > the editor every time at startup. > > I will admit that I've never been willing to commit more than > a few hours each time to try to get Eclipse working. This > amount of work or less has been perfectly sufficient for trying > out any number of plain editors, none of which were good enough > to lure me away from Emacs, but at least I could quickly get them > to work. I will feel much better about my tacit endorsement of > Eclipse the day I can actually get some work done with it > myself. (: > > > Secondly, although I agree that ideally one should not need >> > > an IDE to compensate for design errors in a programming language, > > IDEs are peerless when it comes to supporting computer-aided > > processes like refactoring. > > I'm all for the use of IDEs and other power tools, but in my > experience, early adopters easily forget that a large number > of people will actually be using quite modest hardware - the > kind that the early adopter has piled up in the closet because > he considers it practically useless. I very much like the fact > that you can be very productive in Erlang /without/ an IDE. > > I side completely with Richard on this particular issue. > > BR, > Ulf W > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sverker@REDACTED Mon Sep 8 14:34:14 2008 From: sverker@REDACTED (Sverker Eriksson) Date: Mon, 08 Sep 2008 14:34:14 +0200 Subject: [erlang-questions] [bug?] R12B-4 HTTP header parsing In-Reply-To: <48C26E67.5020702@free.fr> References: <48C26E67.5020702@free.fr> Message-ID: <48C51BC6.8080606@erix.ericsson.se> igwan wrote: > While testing the new erlang:decode_packet/3 I found it returns > http_error for inputs that are allowed by RFC2616 : > : > 2> erlang:decode_packet(httph,<<"Host : erlang.org:80\r\n\r\n">>,[]). > {ok,{http_error,"Host : erlang.org:80\r\n"},<<"\r\n">>} > > (i.e. just adding a space between the field-name and the ':' separator) > This seems be to an old bug in the http-parsing for sockets that was reused for erlang:decode_packet. Inserting this in erts/emulator/beam/packet_parser.c line 791 would fix it (not tested yet): } + while (n && SP(ptr)) { + ptr++; n--; + } if (*ptr != ':') { I will fix it for next release. Thanks /Sverker, Erlang/OTP Ericsson From erlang-questions_efine@REDACTED Mon Sep 8 14:49:58 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Mon, 8 Sep 2008 08:49:58 -0400 Subject: [erlang-questions] Convert atom and arity into fun In-Reply-To: <14915773-8CCF-447E-B7DC-DF04291315A6@cs.otago.ac.nz> References: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> <12276_1220612079_m85Asb3L001728_48C10DE5.7090102@it.uu.se> <14915773-8CCF-447E-B7DC-DF04291315A6@cs.otago.ac.nz> Message-ID: <6c2563b20809080549h2d86b889ve7a2be7c78343b86@mail.gmail.com> I had this exact issue last night, and this is something like what I did because I knew in advance what the arities would be (for better or worse, IANAEE): mf_to_fun1(M, F) -> fun(X) -> M:F(X) end. mf_to_fun2(M, F) -> fun(X,Y) -> M:F(X,Y) end. Ugly but it got the job done. It would be really nice if we could just use fun M:F/A, with all these being variables. Surely it can't be a big step beyond apply(M, F, [Args])? On Mon, Sep 8, 2008 at 12:59 AM, Richard A. O'Keefe wrote: > On 5 Sep 2008, at 10:45 pm, Richard Carlsson wrote: > > There is currently no immediate way of doing this. > > We have the "fun /" notation, which I believe > has been extended or will be extended to "fun :/". > It would seem like a minor change to the language to allow > variables here. > > It must be said, this looks like a case for the > old-fashioned {M,F} or {M,F,A} tuples-naming-functions. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rtrlists@REDACTED Mon Sep 8 14:56:50 2008 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 8 Sep 2008 13:56:50 +0100 Subject: [erlang-questions] Time to update programming rules? In-Reply-To: <6c2563b20809080528n5f0f5596lf7940db765490b40@mail.gmail.com> References: <20377_1220562821_m84LDcK6006538_b3bfba320809041401t5bac0974vdfc19ac68758cb1b@mail.gmail.com> <43927518-39DE-438F-AA14-B3268BF69FF5@cs.otago.ac.nz> <6c2563b20809041955l20ff361an46312fa11c86f54@mail.gmail.com> <21925_1220584680_m853Hxxm021259_48C0A4DE.3080407@bigpond.net.au> <2E9A0764-1977-4132-B0C6-0928603FEC2D@cs.otago.ac.nz> <7721_1220587870_m854B2Pl030001_48C0B14E.9030308@bigpond.net.au> <1310A1F7-E8E5-44AD-9064-EF02C99EE81A@cs.otago.ac.nz> <6c2563b20809071948v606b9d6dhbbf1358675f16943@mail.gmail.com> <48C4E55C.6060804@ericsson.com> <6c2563b20809080528n5f0f5596lf7940db765490b40@mail.gmail.com> Message-ID: <6a3ae47e0809080556w3d2983a5qd75c2c90e8b7ef91@mail.gmail.com> 2008/9/8 Edwin Fine : > But if you work for a company that forces you to suffer such curel and > unusual punishment, you should let them know it is false economy to force > developers to use such underpowered tools. They would get far more > productivity from spending even US$1,000 on a decent dual-core or quad-core > x86_64 CPU, 4 GB of RAM, 500GB of disk and running some flavor of Linux This is one of the big contributers to bloated software, you know. In order to get performant software out of your development department, give them slow machines with limited memory. And give your testing department fast machines, so they can feedback information quickly. I always marvel at IT departments that feel compelled to give developers mega machines, while the sales force are fobbed off with laptops that barely cope with demoing the stuff written for a multi-core 4GHz 8GB machine. Robby From raimo+erlang-questions@REDACTED Mon Sep 8 16:05:33 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 8 Sep 2008 16:05:33 +0200 Subject: [erlang-questions] Change in Semantics in dbg:c ? In-Reply-To: <48C3A6C2.60202@erlang-consulting.com> References: <48C3A6C2.60202@erlang-consulting.com> Message-ID: <20080908140533.GC2810@erix.ericsson.se> On Sun, Sep 07, 2008 at 11:02:42AM +0100, Francesco Cesarini wrote: > I was working through some old training material from 2001, testing the > output on R12. I am getting significantly different behaviours > in-between the releases which I was not expecting. > > The example I use (Attached to the mail) spawn_links a process which > goes into a receive loop. When the child receives a ping message, it > spawns a new process which immediately fails with reason undef and loops > on itself. > > In the older release (Probably R9), tracing a function which does a > spawn_link using dbg:c/4 setting the process trace flags and the set on > spawn flags, I get all of the events and set on spawn works. More calls > using dbg:c affecting the child process obviously demonstrate that the > child inherited the trace flags. > > Using R12, first thing I get is an unlinked trace event. Subsequent > messages to the process do not generate any new trace events. In R12 > (possibly earlier), a quick look confirms my suspicions; an intermediate > process has been inserted between the shell and the child, and when this > process terminates, the unlink event is generated. Is this the intended > behaviour? I would say the old behaviour is the correct one, as the > documentation states that dbg:c/4 it is a traced variant of apply/3. If > so, the unlink trace message should not be received, and the state (sos > and sofl trace flags) should be maintained in-between calls. Either way, > either the documentation is incorrect or the intermediary process should > be removed. Which version would you like documented in the book? : Well, which behaviour do you actually prefer? It changed from R8B to R9B-1 on request from guess who... You! Francesco wrote: > When using c/4, the documentation states that it is useful > when running from the shell?. Should all the shell internal > messages not be hidden, however? Isn?t it better to spawn a > new process and execute it there, stopping the trace flags > b4 returning the result? >From the R9B-1 release notes: ========= Runtime_tools 1.3 Fixed errors and malfunctions * dbg:p/2 always returns error (i.e. does not crash) if faulty flag is given. Also dbg:c/4 now executes on a separate process and internal messages are no longer traced. (Own Id: OTP-4111) (Aux Id: Seq7131) ========= Since the same release all dbg trace is stopped at the end of dbg:c/4 so no dbg server is running any more. This may seem drastic, but it was a separate change made just after your suggested intermediate process change, so I guess there is a very good reason. So it seems dbg:c/4 now is designed to only trace exactly what you give to it and nothing after. This and that an intermediate process is used should be clearer in the documentation. : > Suggestions? > > Regards, > Francesco If you try for example this example: -module(ping). -export([run/0]). run() -> Wait = fun() -> receive {Pid, ping} -> spawn(crash, do_not_exist, []), Pid ! pong end end, Pid = spawn_link(Wait), Pid ! {self(), ping}, receive pong -> receive after 100 -> ok end, pong end. It all looks rather nice... Erlang (BEAM) emulator version 5.6.4 [source] [64-bit] [smp:4] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.4 (abort with ^G) 1> dbg:c(ping, run, [], [p,sos]). (<0.35.0>) spawn <0.36.0> as erlang:apply(#Fun,[]) (<0.35.0>) link <0.36.0> (<0.36.0>) spawn <0.37.0> as crash:do_not_exist() (<0.36.0>) exit normal (<0.35.0>) getting_unlinked <0.36.0> (<0.37.0>) exit {undef,[{crash,do_not_exist,[]}]} =ERROR REPORT==== 8-Sep-2008::15:59:39 === Error in process <0.37.0> with exit value: {undef,[{crash,do_not_exist,[]}]} pong -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From raimo+erlang-questions@REDACTED Mon Sep 8 16:33:31 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 8 Sep 2008 16:33:31 +0200 Subject: [erlang-questions] : PID recycling In-Reply-To: <48C513BC.1070408@ericsson.com> References: <48C12136.8010401@ericsson.com> <20080908114848.GB2810@erix.ericsson.se> <48C513BC.1070408@ericsson.com> Message-ID: <20080908143331.GD2810@erix.ericsson.se> On Mon, Sep 08, 2008 at 01:59:56PM +0200, Zoltan Peter Toth wrote: > Hi Raimo ! > > Thanks. So if a node completely restarts, i.e. epmd as well, then the > cycling is lost, > i.e. after 0 there will be 0 again after the reboot, right ? Well, 1, since nodes with names use creation 1..3, but you are right. > > (Regarding HMTL, I think you could try Seamonkey or Thunderbird, they > have no difficulties > displaying HMTL mail.) There _are_ reasons I prefer not to use a graphical mail client. Furthermore I strongly believe mail should remain non-graphical. > > Br, > Zoltan > > Raimo Niskanen wrote: > >Firstly. Please do not send HTML code to this list. > >It is very hard to read for some (at least me). > > > >On Fri, Sep 05, 2008 at 02:08:22PM +0200, Zoltan Peter Toth wrote: > >: > > > >>Question: how is the last used incarnation stored and when are values > >>recycled > >>? (on Linux) > >>Is there any way to change the cycling range ? > >>Just for my curiosity :) > >> > >>Br, > >> Zoltan > >> > > > >The incarnation aka "Creation" is stored in EPMD, the Erlang > >Port Mapper Daemon, that is external to all nodes. > >It cycles 1,2,3 then round to 1 again. You can not change it. > >It is platform independent. An undistributed node has creation 0. > >Creation 0 is also used for dirty tricks having the meaning > >of the current creation. > > > >We have had plans to change it from 2 bits to 32 but it would > >hit hard on erl_interface and applications using it. > > > > > > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From btolputt@REDACTED Mon Sep 8 05:16:10 2008 From: btolputt@REDACTED (Benjamin Tolputt) Date: Mon, 08 Sep 2008 13:16:10 +1000 Subject: [erlang-questions] Time to update programming rules? In-Reply-To: <1310A1F7-E8E5-44AD-9064-EF02C99EE81A@cs.otago.ac.nz> References: <20377_1220562821_m84LDcK6006538_b3bfba320809041401t5bac0974vdfc19ac68758cb1b@mail.gmail.com> <43927518-39DE-438F-AA14-B3268BF69FF5@cs.otago.ac.nz> <6c2563b20809041955l20ff361an46312fa11c86f54@mail.gmail.com> <21925_1220584680_m853Hxxm021259_48C0A4DE.3080407@bigpond.net.au> <2E9A0764-1977-4132-B0C6-0928603FEC2D@cs.otago.ac.nz> <7721_1220587870_m854B2Pl030001_48C0B14E.9030308@bigpond.net.au> <1310A1F7-E8E5-44AD-9064-EF02C99EE81A@cs.otago.ac.nz> Message-ID: <48C498FA.2050501@bigpond.net.au> Richard A. O'Keefe wrote: > That's pretty much of a straw man position. > It's not a question of a mere *possibility* of errors, > but of a "feature" that makes errors *especially* likely, > and which offers no compensating advantages. Without trying to be a pain, I'll separate the fact (use of the feature increases the possibility of errors) from the opinion (no compensating advantages). I agree that using the feature will increase the likelihood of a particular type of bug creeping into the code. In fact, this likelihood is currently enough to keep me from using the feature. On the other hand stating that there is "no" compensating advantages is simply your opinion (well respected as it is). > The developers of Erlang have so far refrained from announcing > dotted module names as a permanent feature of the language. True, and neither of us can state categorically what their plans are on the feature until they make an official comment on it. > There was a lot of discussion back in 2003 and it does not appear > that the dotted names "feature" has been significantly revised since > to address any of the issues that were seen five years ago. It is still a feature of Erlang five years from then. My interpretation is that this implies the feature is likely to stay. Your opinion differs, but neither of us can make statements of *fact* on it until the Erlang developers pipe up with something official. > Actually, no. There never ever was anything whatsoever in Erlang > to stop you writing module names like 'a.b.c' and thereby having > the beam file placed as 'a.b.c.beam', which quite naturally never > did conflict with an 'e.f.c.beam' file or 'e.f.c' module. > > Allowing you to write dotted names without quotation marks is no > big deal either: we ALWAYS had the ability to write module names > with @ signs in them. The readability alone of "x@REDACTED@z" compared to "x.y.z" should make junk of that argument. Using quotes for atoms appears (from all Erlang text & code I have been able to get a hold off) to be for "special cases only". A "compound name system" for modules is not something I would like to think of as special case. > You should not need a Gargantuan cycle-hogging "IDE" to paper over > mistakes in a design. Have you studied Meyer's LACE at all? *laugh* And what language does not have design flaws? Seriously though, not all IDE's are cycle-hogging beasts to the level that they impede development. Unless you are "developing" code on an embedded device or a machine approaching it's 12th birthday, I'm sure an Erlang IDE based on Eclipse or similar would operate just fine without killing the OS you'd be developing on.. In summary, though - I'd be just as happy (if not happier) if the package system created "a.b.c.beam" files for the "a.b.c" module, so long as it provided a similar syntax. Quoting all my module names (or worse, using the '@' character for compound names) seems counter to all the other code I have seen written for Erlang. Admittedly, there doesn't seem to be any using the packages functionality either, but I find it alot more readable than (for example) "inet@REDACTED@reponse:some_func(...)" --Ben P.S. Honestly find it difficult to argue this case as my respect for you in regards to Erlang development. Your name in the sender line is generally enough for me to read a subject I might otherwise skip on this list. Please do not take this thread to be my overall assessment of your skills & experience; just a difference of opinion. From neavirc@REDACTED Mon Sep 8 17:52:19 2008 From: neavirc@REDACTED (Sergey S.) Date: Mon, 8 Sep 2008 19:52:19 +0400 Subject: [erlang-questions] ODBC 160 times slower thatn pgsql - is it normal? Message-ID: <5e693d1f0809080852w77dc10fcga66ce29d5bd35dd8@mail.gmail.com> Hello. I've wrote simple benchmark, in order to test ODBC and pgsql drivers. I got very strange results, saying that ODBC 160 times slower than pgsql: [pgsql_bm] runtime = 50, wall_clock = 144 [odbc_bm] runtime = 0, wall_clock = 8009 There might be my mistake in odbc.ini/odbcinst.ini or smth else, so I'm writting this letter. Is it normal that ODBC works too slow? The code used: ------------------------------------ odbc_bm() -> odbc:start(), {ok, Ref} = odbc:connect("DSN=PostgreSQL", []), benchmark("odbc_bm", fun() -> odbc:sql_query(Ref, "INSERT INTO foo (bar) VALUES (123)") end, 200), odbc:stop(). pgsql_bm() -> {ok, Db} = pgsql:connect("localhost", "gin", "gin", ""), benchmark("pgsql_bm", fun() -> pgsql:squery(Db, "INSERT INTO foo (bar) VALUES (123)") end, 200), pgsql:terminate(Db). benchmark(Title, Fun, Times) -> statistics(runtime), statistics(wall_clock), for(1, Times, Fun), {_, Runtime} = statistics(runtime), {_, Wallclock} = statistics(wall_clock), for(I, Max, _) when I > Max -> ok; for(I, Max, F) -> F(), for(I+1, Max, F). ------------------------------------ Additional information: I use pgsql from ejabberd-modules package, erlang R12B.3, PostgreSQL 8.3.3, unixodbc 2.2.12, psqlodbc 08.03.0200 OS: Archlinux current odbc.ini: [PostgreSQL] Description = foobar Driver = PostgreSQL Database = gin Servername = localhost UserName = sergey Password = odbcinst.ini: [PostgreSQL] Description = PostgreSQL driver Driver = /usr/lib/psqlodbcw.so Setup = /usr/lib/libodbcpsqlS.so -- Sergey -------------- next part -------------- An HTML attachment was scrubbed... URL: From tuncer.ayaz@REDACTED Mon Sep 8 18:39:13 2008 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Mon, 8 Sep 2008 18:39:13 +0200 Subject: [erlang-questions] m4 not checked in configure. In-Reply-To: <4ac8254d0809080448m4330ef94l4146751e581e7eaf@mail.gmail.com> References: <48C50ABA.6080502@erlang-consulting.com> <4ac8254d0809080448m4330ef94l4146751e581e7eaf@mail.gmail.com> Message-ID: <4ac8254d0809080939s71469923m35412ee1b35bea34@mail.gmail.com> On Mon, Sep 8, 2008 at 1:48 PM, Tuncer Ayaz wrote: > On Mon, Sep 8, 2008 at 1:21 PM, Mazen Harake > wrote: >> I'm sure this has been brought up before but configure doesn't check for >> m4... >> annoying but true... we've known this for a long time but I always do >> the same mistake when setting up a new systems on various machines :) > > Different check but same topic: > If we're at this we should fix the missing check for the openssl executable. > Having OpenSSL headers/libs installed is not enough or was not enough > on one of my systems. > > Maybe I should create a small patch as soon as I have time to patch and > test. Actually I would say it's not even checking for OpenSSL libs or headers. Please correct me if I'm wrong as I'm no autofoo expert. If there's interest I can patch this in my spare time otherwise I would like to let an experienced autofoo magician or the official OTP team decide and do the changes :-) >> can it be fixed? :) >> >> That's all, >> >> Thank you, :) From harveyd@REDACTED Mon Sep 8 19:00:14 2008 From: harveyd@REDACTED (Dale Harvey) Date: Mon, 8 Sep 2008 18:00:14 +0100 Subject: [erlang-questions] m4 not checked in configure. In-Reply-To: <4ac8254d0809080939s71469923m35412ee1b35bea34@mail.gmail.com> References: <48C50ABA.6080502@erlang-consulting.com> <4ac8254d0809080448m4330ef94l4146751e581e7eaf@mail.gmail.com> <4ac8254d0809080939s71469923m35412ee1b35bea34@mail.gmail.com> Message-ID: Just a note if anyone is going to be patching ./configure I also think the tcl / tk libraries arent checked for 2008/9/8 Tuncer Ayaz > On Mon, Sep 8, 2008 at 1:48 PM, Tuncer Ayaz wrote: > > On Mon, Sep 8, 2008 at 1:21 PM, Mazen Harake > > wrote: > >> I'm sure this has been brought up before but configure doesn't check for > >> m4... > >> annoying but true... we've known this for a long time but I always do > >> the same mistake when setting up a new systems on various machines :) > > > > Different check but same topic: > > If we're at this we should fix the missing check for the openssl > executable. > > Having OpenSSL headers/libs installed is not enough or was not enough > > on one of my systems. > > > > Maybe I should create a small patch as soon as I have time to patch and > > test. > > Actually I would say it's not even checking for OpenSSL libs or headers. > Please correct me if I'm wrong as I'm no autofoo expert. If there's > interest > I can patch this in my spare time otherwise I would like to let an > experienced autofoo magician or the official OTP team decide and > do the changes :-) > > >> can it be fixed? :) > >> > >> That's all, > >> > >> Thank you, :) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From als@REDACTED Mon Sep 8 19:09:43 2008 From: als@REDACTED (Anthony Shipman) Date: Tue, 9 Sep 2008 03:09:43 +1000 Subject: [erlang-questions] maybe a BUG in the build system of erlang? In-Reply-To: References: Message-ID: <200809090309.43730.als@iinet.net.au> On Mon, 8 Sep 2008 12:52:39 pm luoyi wrote: > obviously, in the shell file, the ROOTDIR should be "/usr/lib/erlang" > and there should no "/opt/SBo/package-erlang" string contained in the > hipe beam files. > > is this a bug in the build system ? I have an RPM spec file that does the hacks to repair the various scripts. This should show you what needs to be fixed to prepare a package. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From kevin@REDACTED Mon Sep 8 21:08:19 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Mon, 8 Sep 2008 12:08:19 -0700 Subject: [erlang-questions] noob HIPE question In-Reply-To: <48C57609.5010602@it.uu.se> References: <88A4D57A-ECD2-4B97-ADD1-3CAC4C551556@scaldeferri.com> <48C4CEEE.6020806@it.uu.se> <007E2E6C-022C-44D2-9D77-FF1A0FC8C098@scaldeferri.com> <48C57609.5010602@it.uu.se> Message-ID: <5261085F-31DA-4CEB-802E-BF764C04501D@scaldeferri.com> On Sep 8, 2008, at 11:59 AM, Richard Carlsson wrote: > Kevin Scaldeferri wrote: >> On Sep 8, 2008, at 12:06 AM, Richard Carlsson wrote: >>> Kevin Scaldeferri wrote: >>>> I spend most of my time on Mac, so HIPE is pretty new to me. Can >>>> anyone explain this behavior? >>>> >>>> $ erlc binarytrees.erl >>>> $ erl -noshell -run binarytrees main 10 >>>> stretch tree of depth 11 check: -1 >>>> 2048 trees of depth 4 check: -2048 >>>> 512 trees of depth 6 check: -512 >>>> 128 trees of depth 8 check: -128 >>>> 32 trees of depth 10 check: -32 >>>> long lived tree of depth 10 check: -1 >>>> >>>> $ erlc +native +"{hipe,[o3]}" binarytrees.erl >>>> $ erl -noshell -run binarytrees main 10 >>>> {"init terminating in do_boot",{undef,[{binarytrees,main,[["10"]]}, >>>> {init,start_it,1},{init,start_em,1}]}} >>>> >>>> Crash dump was written to: erl_crash.dump >>>> init terminating in do_boot () >>> >>> Can you post the code, either to the list or to me personally? >> http://shootout.alioth.debian.org/u64q/benchmark.php?test=binarytrees&lang=hipe > > Well, it works fine using R12B-3 under Ubuntu. It could be Mac- > related. > The main interesting point now is: after the erlc +native command, do > you have a binarytrees.beam file? If not, it is conceivable that there > is some kind of silent crash in the compiler (even though that should > not happen). Sorry about the confusion from my initial message, but this in on Linux (thus newfound ability to use HIPE), not on Mac. Also, there's some weird environment or config thing going on. The same commands, on the same machine, run via make work just fine. But, at the command-line, it fails. So, I'm trying to figure out what could possibly be different that would cause this. (and, yes, binarytrees.beam is there) -kevin From tuncer.ayaz@REDACTED Mon Sep 8 21:25:53 2008 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Mon, 8 Sep 2008 21:25:53 +0200 Subject: [erlang-questions] m4 not checked in configure. In-Reply-To: References: <48C50ABA.6080502@erlang-consulting.com> <4ac8254d0809080448m4330ef94l4146751e581e7eaf@mail.gmail.com> <4ac8254d0809080939s71469923m35412ee1b35bea34@mail.gmail.com> Message-ID: <4ac8254d0809081225r33d7485fqbd8a01de99284362@mail.gmail.com> On Mon, Sep 8, 2008 at 7:00 PM, Dale Harvey wrote: > Just a note if anyone is going to be patching ./configure > I also think the tcl / tk libraries arent checked for This may very well be true. Still there is at least some check going on which I've not dug into yet as it is able to tell later on which functionality will not be enabled due to missing external dependencies. > 2008/9/8 Tuncer Ayaz >> >> On Mon, Sep 8, 2008 at 1:48 PM, Tuncer Ayaz wrote: >> > On Mon, Sep 8, 2008 at 1:21 PM, Mazen Harake >> > wrote: >> >> I'm sure this has been brought up before but configure doesn't check >> >> for >> >> m4... >> >> annoying but true... we've known this for a long time but I always do >> >> the same mistake when setting up a new systems on various machines :) >> > >> > Different check but same topic: >> > If we're at this we should fix the missing check for the openssl >> > executable. >> > Having OpenSSL headers/libs installed is not enough or was not enough >> > on one of my systems. >> > >> > Maybe I should create a small patch as soon as I have time to patch and >> > test. >> >> Actually I would say it's not even checking for OpenSSL libs or headers. >> Please correct me if I'm wrong as I'm no autofoo expert. If there's >> interest >> I can patch this in my spare time otherwise I would like to let an >> experienced autofoo magician or the official OTP team decide and >> do the changes :-) >> >> >> can it be fixed? :) >> >> >> >> That's all, >> >> >> >> Thank you, :) >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > From tuncer.ayaz@REDACTED Mon Sep 8 21:28:42 2008 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Mon, 8 Sep 2008 21:28:42 +0200 Subject: [erlang-questions] maybe a BUG in the build system of erlang? In-Reply-To: <200809090309.43730.als@iinet.net.au> References: <200809090309.43730.als@iinet.net.au> Message-ID: <4ac8254d0809081228i457260y894c85a03253d961@mail.gmail.com> On Mon, Sep 8, 2008 at 7:09 PM, Anthony Shipman wrote: > On Mon, 8 Sep 2008 12:52:39 pm luoyi wrote: >> obviously, in the shell file, the ROOTDIR should be "/usr/lib/erlang" >> and there should no "/opt/SBo/package-erlang" string contained in the >> hipe beam files. >> >> is this a bug in the build system ? > > I have an RPM spec file that does the hacks to repair the various scripts. > This should show you what needs to be fixed to prepare a package. Is it good enough as an addition to upstream? From vances@REDACTED Tue Sep 9 00:14:23 2008 From: vances@REDACTED (Vance Shipley) Date: Mon, 8 Sep 2008 18:14:23 -0400 Subject: [erlang-questions] User Based Security Model (USM) in OTP's SNMP manager Message-ID: <20080908221423.GZ257@h216-235-12-173.host.egate.net> I was updating the SNMP Quick Start tutorial on trapexit today and I find that I still can't get USM working with the manager. It was originally written when R10B-4 was current and there was a known issue as I recall. I made a note of it and went on without using USM in the manager. I see that OTP-5499 was closed in R10B-5 however I still can't get the tutorial to work with USM in the manager. If anyone more familiar with SNMP could follow along and point out why my examples are not working I'd appreciate it. Maybe it's a bug? http://www.trapexit.org/SNMP_Quick_Start -Vance From ok@REDACTED Tue Sep 9 03:17:25 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 9 Sep 2008 13:17:25 +1200 Subject: [erlang-questions] String Pattern Matching In-Reply-To: <3073_1220867282_m889ltic007605_20080908091132.76F5524081@relay.gooddata.com> References: <26051_1220819152_m87KPTms012931_BAE3675D-3A8F-49B0-AB1E-7856D41A79F6@ideaforge.org> <962EDEDB-C558-46B3-894F-75195F75240F@cs.otago.ac.nz> <3073_1220867282_m889ltic007605_20080908091132.76F5524081@relay.gooddata.com> Message-ID: <9F09B6B4-8100-4BB1-83FD-8E4964EB493E@cs.otago.ac.nz> On 8 Sep 2008, at 9:11 pm, Hynek Vychodil wrote: > There is much more efficient lists:reverse/2 BIF written in C. Not relevant to the main point. (Even in pure Erlang, it's possible to do better than the simple code I showed.) I wanted _all_ the relevant code to be in the message. The key point is that the cost of the trie match is proportional to the length of the string (times something for choosing the right branch at each step) and not directly related to the number of patterns. From galeal@REDACTED Tue Sep 9 03:32:16 2008 From: galeal@REDACTED (Luke Galea) Date: Mon, 8 Sep 2008 21:32:16 -0400 Subject: [erlang-questions] Rails Style String Inflection For Erlang Message-ID: Hi erlangers, Thanks to the help I received on this list, I've managed to complete inflector.erl. You can get it at http://www.ideaforge.org/blog/?p=11 It handles everything relevant that ruby's ActiveSupport inflector can do: pluralize, singularize, camelcase, etc. There was a lot of discussion re: pattern matching versus regular expressions. Ultimately I chose to release this first version with the R12B4 regexps, but cached them to minimize the overhead from compiling. I think there might be some value in separating out the regexp cache, unless there is a simpler way to avoid recompiling regexps that I missed. Thanks again for everyone's help. -- Luke Galea From eeajam@REDACTED Tue Sep 9 07:05:10 2008 From: eeajam@REDACTED (Alex Alvarez) Date: Tue, 9 Sep 2008 01:05:10 -0400 Subject: [erlang-questions] maybe a BUG in the build system of erlang? Message-ID: When making Slackware packages, I would recommend using Checkinstall... http://asic-linux.com.mx/~izto/checkinstall/ You need to read the instructions for it, but it's pretty straight forward. Basically, run "configure" and "make" and substitute "make install" with "checkinstall." It will ask you a few questions to set up the package and that's it. I've used it dozens of times and it works like a charm... Cheers, Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: From als@REDACTED Tue Sep 9 07:27:31 2008 From: als@REDACTED (Anthony Shipman) Date: Tue, 9 Sep 2008 15:27:31 +1000 Subject: [erlang-questions] maybe a BUG in the build system of erlang? In-Reply-To: <4ac8254d0809081228i457260y894c85a03253d961@mail.gmail.com> References: <200809090309.43730.als@iinet.net.au> <4ac8254d0809081228i457260y894c85a03253d961@mail.gmail.com> Message-ID: <200809091527.31363.als@iinet.net.au> On Tue, 9 Sep 2008 05:28:42 am Tuncer Ayaz wrote: > > I have an RPM spec file that does the hacks to repair the various > > scripts. This should show you what needs to be fixed to prepare a > > package. > > Is it good enough as an addition to upstream? I'm not sure what you mean by upstream. I've attached a copy. It is used at my company for producing Erlang rpms. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. -------------- next part -------------- %define version 12B.4 %define release 1 Name: erlang Summary: Erlang: A programming language for distributed systems. Group: Development/Languages Version: %{version} Release: %{release} License: The Erlang license (see "EPLICENCE" file included in distribution) Packager: Symstream Technologies URL: http://www.erlang.org/ Source0: otp_src_R12B-4.tar.gz Source1: otp_doc_html_R12B-4.tar.gz Source2: otp_doc_man_R12B-4.tar.gz BuildRoot: /var/tmp/erlang-%{version} %description Erlang is a programming language designed at the Ericsson Computer Science Laboratory. %prep %setup -a 0 -n otp_src_R12B-4 %build ./configure make %install rm -rf $RPM_BUILD_ROOT make INSTALL_PREFIX=$RPM_BUILD_ROOT install # Correct the symlinks pushd $RPM_BUILD_ROOT/usr/local/bin for f in dialyzer epmd erl erlc escript run_erl to_erl typer do if [ -x $f ] then /bin/rm $f ln -s /usr/local/lib/erlang/bin/$f $f fi done cd ../lib/erlang/bin if [ -x epmd ] then /bin/rm epmd ln -s ../erts-5.6.4/bin/epmd epmd fi # Correct the paths in the scripts for dir in $RPM_BUILD_ROOT/usr/local/lib/erlang/bin $RPM_BUILD_ROOT/usr/local/lib/erlang/erts*/bin do cd $dir for f in erl start do if [ -x $f ] then sed "s,$RPM_BUILD_ROOT,," <$f >$$ mv $$ $f chmod 755 $f fi done done popd # Install the doco pushd $RPM_BUILD_ROOT/usr/local/lib/erlang tar zxvf %_sourcedir/otp_doc_html_R12B-4.tar.gz tar zxvf %_sourcedir/otp_doc_man_R12B-4.tar.gz popd %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) /usr/local/bin /usr/local/lib/erlang %doc AUTHORS EPLICENCE README From bjarne.dacker@REDACTED Tue Sep 9 09:28:10 2008 From: bjarne.dacker@REDACTED (=?iso-8859-1?Q?Bjarne_Olov_D=E4cker?=) Date: Tue, 9 Sep 2008 09:28:10 +0200 Subject: [erlang-questions] Erlang User Conference 2008 - call for presentations Message-ID: <001601c9124d$9ebf03b0$d84eef5a@Dell> Hello, All Erlang developers, researchers, users, programmers, and interested persons are hereby kindly invited to the 14th International Erlang/OTP User Conference, EUC in Stockholm on November 13. Please see the Call for Papers at http://www.erlang.se/euc/08/ This year's Erlang/OTP User Conference will follow the same format as previous years. Proceedings and photographs from earlier EUC's can be found at http://www.erlang.se/euc/ Dead-line for submissions is October 20 and presentations of exiting new technical developments and applications are invited. Presentations can be in the form of a report, academic paper or just over-head slides. Also demos to be shown at intermissions are invited. Registrations for the conference is now open. To register for the EUC, send a mail to euc@REDACTED stating name, affiliation (company, university...), town and country. State also whether you would like to take part in a kindly sponsored conference dinner in the evening after the EUC. Unfortunately the seating capacity of the lecture hall is limited so be certain to register early. Presenters are given precedence. Welcome Bjarne D?cker EUC chairman -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimo+erlang-questions@REDACTED Tue Sep 9 09:27:52 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Tue, 9 Sep 2008 09:27:52 +0200 Subject: [erlang-questions] : : fprof doubts In-Reply-To: <20080903123447.GA18929@erix.ericsson.se> References: <20080903093223.GA15669@erix.ericsson.se> <20080903123447.GA18929@erix.ericsson.se> Message-ID: <20080909072752.GC30749@erix.ericsson.se> On Wed, Sep 03, 2008 at 02:34:47PM +0200, Raimo Niskanen wrote: > On Wed, Sep 03, 2008 at 03:45:26PM +0530, Geevarghese Philip wrote: > > On 9/3/08, Raimo Niskanen > > > > > wrote: > > > > > > > > > > c) In nearly every block of information, there is an entry named > > > "undefined" > > > > with large numbers against it. What does this mean? > > > > > > > > > Can you give an example? > > > > > > Here is one: > > > > {[{undefined, 156757, 7629.458, 997.459}, > > {{digraph,out_neighbours,2}, 63, 0.000, 0.368}], > > { {digraph,out_neighbours,2}, 156820, 7629.458, 997.827}, % > > [{{digraph,collect_elems,3}, 156820, 5907.714, 471.786}, > > {{ets,lookup,2}, 156820, 660.148, 660.148}, > > {garbage_collect, 85, 58.944, 58.944}, > > {suspend, 353, 4.233, 0.000}, > > {{digraph,in_neighbours,2}, 8, 0.343, 0.044}, > > {{lists,dropwhile,2}, 3, 0.218, 0.010}, > > {{lists,filter,2}, 1, 0.031, 0.006}, > > {{digraph,out_neighbours,2}, 63, 0.000, 0.368}]}. > > > > I see digraph:out_neighbours/2 calls itself and this is > a typical case where Fprof might get confused since > it can get a hard time figuring out which calls are > tail recursive. Heuristics are used and > sometimes it fails. > > > Every module listed above is from the Erlang distribution. > > > > > Could these be because I have not invoked/named my functions in some > > > > specified manner? > > > > > > Yes, probably. How _did_ you trace? > > > > > > At the erl prompt : > > > > > fprof:apply(graphs_test, test_run, [300, 3, 1, false], [file]). > > > > > fprof:profile([file, {dump, []}]). > > > > > fprof:analyse([{dest, []}, totals]). > > > > > > Now look at the file "fprof.analysis" . > For the record. The OP (Original Poster) had Hipe compiled the module, and breakpoints can not be set on Hipe compiled code, hence it can not be traced, and therefore it does not show up in fprof, well shows up as 'undfined'. Alas. -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From devdoer2@REDACTED Tue Sep 9 09:46:00 2008 From: devdoer2@REDACTED (devdoer bird) Date: Tue, 9 Sep 2008 15:46:00 +0800 Subject: [erlang-questions] How to dynamically add one node to erlang's distrubted application? Message-ID: HI: I have a distrbuted system using erlang's distributed application mechanism.It firstly ran on 3 nodes with the config file like this: [{kernel, [{distributed, [{myapp, 5000, [cp1@REDACTED, {cp2@REDACTED, cp3@REDACTED}]}]}, {sync_nodes_mandatory, [cp2@REDACTED, cp3@REDACTED]}, {sync_nodes_timeout, 5000} ] } ]. Now I want to add one more node to the system .How can I do this using erlang's distributed applicaiton mechanism? Do I have to edit the config file on all 3 nodes to add the 4th node and restart all of them? Thanks . ------------------------------------ devdoer -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Tue Sep 9 10:07:41 2008 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 09 Sep 2008 10:07:41 +0200 Subject: [erlang-questions] : : fprof doubts In-Reply-To: <20080909072752.GC30749@erix.ericsson.se> References: <20080903093223.GA15669@erix.ericsson.se> <20080903123447.GA18929@erix.ericsson.se> <20080909072752.GC30749@erix.ericsson.se> Message-ID: <48C62ECD.2080505@it.uu.se> Raimo Niskanen wrote: > For the record. The OP (Original Poster) had Hipe compiled > the module, and breakpoints can not be set on Hipe compiled > code, hence it can not be traced, and therefore it does > not show up in fprof, well shows up as 'undfined'. Alas. Would it be possible to make the system report it as 'native' at least, instead of just 'undefined'? /Richard -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham From raimo+erlang-questions@REDACTED Tue Sep 9 13:14:26 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Tue, 9 Sep 2008 13:14:26 +0200 Subject: [erlang-questions] : : PID recycling In-Reply-To: <48C6361E.9020002@ericsson.com> References: <48C12136.8010401@ericsson.com> <20080908114848.GB2810@erix.ericsson.se> <48C513BC.1070408@ericsson.com> <20080908143331.GD2810@erix.ericsson.se> <48C6361E.9020002@ericsson.com> Message-ID: <20080909111426.GB1263@erix.ericsson.se> On Tue, Sep 09, 2008 at 10:38:54AM +0200, Zoltan Peter Toth wrote: > Hi, > > What about the case when we have a number of erlang nodes on different > hosts ? > Will the epmd-s on the other hosts maintain the incarnation counter for > a restarted host ? > > It seems to me that even if one host is restarted (or beam and epmd > killed on it), the > incarnation counter continues as if the local epmd was running. So I > assume that > those are the other epmd-s that keep track of that counter. > (... or I just overlooked something ? ) Well, yes. The incarnation counter aka creation is kept in the local epmd. Any erlang node only registers with the local epmd. When you look up a node on a remote host you ask the remote epmd. Epmd is mostly a local register on a host to map from node to TCP/IP port number, and it also keeps the creation counter (for the local nodes). For a new node (also when epmd is new) the initial creation is "randomized" in the interval 1..3 as current time in seconds modulo 3 plus 1. epmd_srv.c:1093: node->creation = (current_time(g) % 3) + 1; /* "random" 1-3 */ > > Br, > Zoltan > > Raimo Niskanen wrote: > >On Mon, Sep 08, 2008 at 01:59:56PM +0200, Zoltan Peter Toth wrote: > > > >>Hi Raimo ! > >> > >>Thanks. So if a node completely restarts, i.e. epmd as well, then the > >>cycling is lost, > >>i.e. after 0 there will be 0 again after the reboot, right ? > >> > > > >Well, 1, since nodes with names use creation 1..3, > >but you are right. > > > > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From bgustavsson@REDACTED Tue Sep 9 13:58:55 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Tue, 9 Sep 2008 13:58:55 +0200 Subject: [erlang-questions] Convert atom and arity into fun In-Reply-To: <6c2563b20809080549h2d86b889ve7a2be7c78343b86@mail.gmail.com> References: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> <12276_1220612079_m85Asb3L001728_48C10DE5.7090102@it.uu.se> <14915773-8CCF-447E-B7DC-DF04291315A6@cs.otago.ac.nz> <6c2563b20809080549h2d86b889ve7a2be7c78343b86@mail.gmail.com> Message-ID: <6672d0160809090458x5ef4b0f1nd9c17fdfc5285b72@mail.gmail.com> 2008/9/8 Edwin Fine > I had this exact issue last night, and this is something like what I did > because I knew in advance what the arities would be (for better or worse, > IANAEE): > > mf_to_fun1(M, F) -> > fun(X) -> M:F(X) end. > > mf_to_fun2(M, F) -> > fun(X,Y) -> M:F(X,Y) end. > > Ugly but it got the job done. It would be really nice if we could just use > fun M:F/A, with all these being variables. Surely it can't be a big step > beyond apply(M, F, [Args])? > There is an undocumented BIF that can be called like this erlang:make_fun(Mod, Name, Arity) to create a fun. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmercer@REDACTED Tue Sep 9 16:18:28 2008 From: dmercer@REDACTED (David Mercer) Date: Tue, 9 Sep 2008 09:18:28 -0500 Subject: [erlang-questions] Bit String Comprehension Question Message-ID: <911DB3483F8E401C829B2CF9A35C76EE@SSI.CORP> Why does the bit-string comprehension #133 below work whereas #134 is a syntax error? 133> << <> || {X,N} <- [{3,5}] >>. <<3:5>> 134> << Bin || Bin <- [<<3:5>>] >>. * 1: syntax error before: '||' Please advise. Thank-you. David Mercer -------------- next part -------------- An HTML attachment was scrubbed... URL: From luoyi.ly@REDACTED Tue Sep 9 16:42:12 2008 From: luoyi.ly@REDACTED (luoyi) Date: Tue, 9 Sep 2008 22:42:12 +0800 Subject: [erlang-questions] maybe a BUG in the build system of erlang? In-Reply-To: <200809091527.31363.als@iinet.net.au> References: <200809090309.43730.als@iinet.net.au> <4ac8254d0809081228i457260y894c85a03253d961@mail.gmail.com> <200809091527.31363.als@iinet.net.au> Message-ID: you can see in my post, there are "/opt/SBo" such strings in the binary beam files, I don't know whether it's a serious problem 2008/9/9 Anthony Shipman : > I'm not sure what you mean by upstream. I've attached a copy. It is used at my > company for producing Erlang rpms. > > -- > Anthony Shipman Mamas don't let your babies > als@REDACTED grow up to be outsourced. > From B.Candler@REDACTED Tue Sep 9 16:43:51 2008 From: B.Candler@REDACTED (Brian Candler) Date: Tue, 9 Sep 2008 15:43:51 +0100 Subject: [erlang-questions] Examining bindings on the stack Message-ID: <20080909144351.GA13085@uk.tiscali.com> I'd like to know the easiest way to examine bindings on the stack in an error backtrace. In particular I'd to be able to see the arguments to all the functions called up to this point. I've had limited success with the erlang debugger. I was trying to debug a backtrace from a call into an existing complex library (in this case yaws_soap_lib) Is it necessary to recompile the library using c(Module, debug_info), just to examine the arguments sitting on the stack? Or is there an easier way? Can the standard backtrace of [{Module,Function,Arity},...] be expanded to include the function arguments? Thanks, Brian. From tonyg@REDACTED Tue Sep 9 16:52:23 2008 From: tonyg@REDACTED (Tony Garnock-Jones) Date: Tue, 09 Sep 2008 15:52:23 +0100 Subject: [erlang-questions] Erlang + SMTP + TLS/SSL In-Reply-To: <003048E2-7BA3-434A-8FD4-A91B3718580B@gmail.com> References: <003048E2-7BA3-434A-8FD4-A91B3718580B@gmail.com> Message-ID: <48C68DA7.5040208@lshift.net> Hi Dmitrii, Do you want a TLS-enabled SMTP *server* or do you want a *client*? If you're after a server: - you could use stunnel4 to use boring old SSL-tunnelled plain SMTP - you could write a generic_ssl_server.erl module, by analogy with generic_tcp_server.erl, which you could use in smtp_server:start/2 to get an stunnel4-like effect without requiring a separate wrapper or - you could implement STARTTLS in smtp_server_session.erl. This is by far the trickiest of the options :-) Regards, Tony Dmitrii Dimandt wrote: > Does anyone know of an erlang library that can send mail through smtp > with TLS/SSL enabled (like through gmail). > > I'm currently using http://www.lshift.net/~tonyg/erlang-smtp/ (http://www.lshift.net/blog/2007/12/28/erlang-smtp-code-updated > ), and it's super easy to use and works :) I'd like to have some TLS > as well, though > > Thank you > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- [][][] Tony Garnock-Jones | Mob: +44 (0)7905 974 211 [][] LShift Ltd | Tel: +44 (0)20 7729 7060 [] [] http://www.lshift.net/ | Email: tonyg@REDACTED From ulf@REDACTED Tue Sep 9 16:58:14 2008 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 9 Sep 2008 16:58:14 +0200 Subject: [erlang-questions] blunt error reporting by escript Message-ID: <8209f740809090758k47b5b0eeh5da2aa5e90173f4f@mail.gmail.com> I'm writing a non-trivial escript script, and am getting pretty frustrated with the error reporting. escript: exception error: no match of right hand side value {ok, ["..."]} My script is only 75 lines so far but has 10 different functions, and it would certainly help to at least know in which function the error occured, if not the line. If the script is interpreted, couldn't it give me the line number? I'd even forego the pretty-printing of the message in favor of some hard facts about where in the program the exception happened. BR, Ulf W From C.Grasl@REDACTED Tue Sep 9 16:55:18 2008 From: C.Grasl@REDACTED (Grasl Christoph) Date: Tue, 9 Sep 2008 16:55:18 +0200 Subject: [erlang-questions] Bit String Comprehension Question References: <911DB3483F8E401C829B2CF9A35C76EE@SSI.CORP> Message-ID: <94C5430AA547F24AA801BA5706F29D2E25CDA6@srvkeyx01.KEYTRONIX.local> Dear, David [Bin || Bin <- [<<3:5>>] ]. works fine.. the syntactical notation for a list comprehension needs to be in '[' & ]' whereas you have used the binary/bitstring syntax to 'bracket' your comprehension together with the '||', which is typically a list-comp. could be mistaken, but it looks like u'r mixing up to notations.. Cheers, Christoph Grasl Embedded Software Entwickler KEYTRONIX Gesellschaft f?r industrielle Elektronik und Informationstechnologie mbH Ungargasse 64-66/1/109 A-1030 WIEN E-Mail: c.grasl@REDACTED Tel.: +43 (1) 718 06 60 - 323 Mobil: +43 (664) 8556456 WWW: http://www.keytronix.com HG Wien FN 261131t Confidentiality Notice: This message may contain privileged and confidential information. If you think, for any reason, that this message may have been addressed to you in error, you must not disseminate, copy or take any action in reliance on it, and we would ask you to notify us immediately by return email. -----Urspr?ngliche Nachricht----- Von: erlang-questions-bounces@REDACTED im Auftrag von David Mercer Gesendet: Di 09.09.2008 16:18 An: 'erlang-questions' Betreff: [erlang-questions] Bit String Comprehension Question Why does the bit-string comprehension #133 below work whereas #134 is a syntax error? 133> << <> || {X,N} <- [{3,5}] >>. <<3:5>> 134> << Bin || Bin <- [<<3:5>>] >>. * 1: syntax error before: '||' Please advise. Thank-you. David Mercer -------------- next part -------------- An HTML attachment was scrubbed... URL: From tuncer.ayaz@REDACTED Tue Sep 9 17:40:56 2008 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Tue, 9 Sep 2008 17:40:56 +0200 Subject: [erlang-questions] maybe a BUG in the build system of erlang? In-Reply-To: <200809091527.31363.als@iinet.net.au> References: <200809090309.43730.als@iinet.net.au> <4ac8254d0809081228i457260y894c85a03253d961@mail.gmail.com> <200809091527.31363.als@iinet.net.au> Message-ID: <4ac8254d0809090840jaad9874l81d6c01e10c89852@mail.gmail.com> On Tue, Sep 9, 2008 at 7:27 AM, Anthony Shipman wrote: > On Tue, 9 Sep 2008 05:28:42 am Tuncer Ayaz wrote: >> > I have an RPM spec file that does the hacks to repair the various >> > scripts. This should show you what needs to be fixed to prepare a >> > package. >> >> Is it good enough as an addition to upstream? > > I'm not sure what you mean by upstream. I've attached a copy. It is used at my > company for producing Erlang rpms. What I meant was whether it would make sense to have either your sed script included upstream or making other changes upstream that would allow you to avoid sed substitution in the spec file. I am of course assuming that this is a common issue which makes sense to be adjusted in OTP upstream. >From your spec file: # Correct the paths in the scripts for dir in $RPM_BUILD_ROOT/usr/local/lib/erlang/bin $RPM_BUILD_ROOT/usr/local/lib/erlang/erts*/bin do cd $dir for f in erl start do if [ -x $f ] then sed "s,$RPM_BUILD_ROOT,," <$f >$$ mv $$ $f chmod 755 $f fi done done From dmercer@REDACTED Tue Sep 9 17:52:44 2008 From: dmercer@REDACTED (David Mercer) Date: Tue, 9 Sep 2008 10:52:44 -0500 Subject: [erlang-questions] Bit String Comprehension Question In-Reply-To: <94C5430AA547F24AA801BA5706F29D2E25CDA6@srvkeyx01.KEYTRONIX.local> References: <911DB3483F8E401C829B2CF9A35C76EE@SSI.CORP> <94C5430AA547F24AA801BA5706F29D2E25CDA6@srvkeyx01.KEYTRONIX.local> Message-ID: <8DB725E6AEB748028B2FF8C15CEB24D7@SSI.CORP> My question, however, is regarding bit string comprehension, not list comprehension. Please advise. Thank-you. > -----Original Message----- > From: Grasl Christoph [mailto:C.Grasl@REDACTED] > Sent: Tuesday, September 09, 2008 09:55 > To: dmercer@REDACTED; erlang-questions@REDACTED > Subject: AW: [erlang-questions] Bit String Comprehension Question > > Dear, David > > [Bin || Bin <- [<<3:5>>] ]. > > works fine.. > > the syntactical notation for a list comprehension needs to be in '[' & ]' > whereas you have used the binary/bitstring syntax to 'bracket' your > comprehension > together with the '||', which is typically a list-comp. > could be mistaken, but it looks like u'r mixing up to notations.. > > Cheers, > > Christoph Grasl > Embedded Software Entwickler > > KEYTRONIX > Gesellschaft f?r industrielle Elektronik und Informationstechnologie mbH > > Ungargasse 64-66/1/109 > A-1030 WIEN > > E-Mail: c.grasl@REDACTED > Tel.: +43 (1) 718 06 60 - 323 > Mobil: +43 (664) 8556456 > WWW: http://www.keytronix.com > > HG Wien FN 261131t > > Confidentiality Notice: > This message may contain privileged and confidential information. If you > think, for any reason, that this message may have been addressed to you in > error, you must not disseminate, copy or take any action in reliance on > it, and we would ask you to notify us immediately by return email. > > > > -----Urspr?ngliche Nachricht----- > Von: erlang-questions-bounces@REDACTED im Auftrag von David Mercer > Gesendet: Di 09.09.2008 16:18 > An: 'erlang-questions' > Betreff: [erlang-questions] Bit String Comprehension Question > > Why does the bit-string comprehension #133 below work whereas #134 is a > syntax error? > > > > 133> << <> || {X,N} <- [{3,5}] >>. > > > <<3:5>> > > 134> << Bin || Bin <- [<<3:5>>] >>. > > * 1: syntax error before: '||' > > > > Please advise. Thank-you. > > > > David Mercer > > > > > From stondage123@REDACTED Tue Sep 9 17:08:48 2008 From: stondage123@REDACTED (Andrew Stone) Date: Tue, 9 Sep 2008 08:08:48 -0700 (PDT) Subject: [erlang-questions] How to dynamically add one node to erlang's distrubted application? Message-ID: <553010.47717.qm@web35902.mail.mud.yahoo.com> You can start the 4th node and do a net_kernel:connect to one of the other nodes. Just make sure that the cookies are the same on all nodes. ----- Original Message ---- From: devdoer bird To: erlang-questions@REDACTED Sent: Tuesday, September 9, 2008 3:46:00 AM Subject: [erlang-questions] How to dynamically add one node to erlang's distrubted application? HI: I have a distrbuted system using erlang's distributed application mechanism.It firstly ran on 3 nodes with the config file like this: [{kernel, [{distributed, [{myapp, 5000, [cp1@REDACTED, {cp2@REDACTED, cp3@REDACTED}]}]}, {sync_nodes_mandatory, [cp2@REDACTED, cp3@REDACTED]}, {sync_nodes_timeout, 5000} ] } ]. Now I want to add one more node to the system .How can I do this using erlang's distributed applicaiton mechanism? Do I have to edit the config file on all 3 nodes to add the 4th node and restart all of them? Thanks . ------------------------------------ devdoer -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Tue Sep 9 18:18:58 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 09 Sep 2008 19:18:58 +0300 Subject: [erlang-questions] Bit String Comprehension Question In-Reply-To: <911DB3483F8E401C829B2CF9A35C76EE@SSI.CORP> References: <911DB3483F8E401C829B2CF9A35C76EE@SSI.CORP> Message-ID: <48C6A1F2.6080700@cs.ntua.gr> David Mercer wrote: > Why does the bit-string comprehension #133 below work whereas #134 is a > syntax error? > > 133> << <> || {X,N} <- [{3,5}] >>. > <<3:5>> > > 134> << Bin || Bin <- [<<3:5>>] >>. > * 1: syntax error before: '||' In bit stream comprehensions, the elements of the resulting binary have to have an unambiguously defined size. This means that they have to be a bit stream *segments*, and the parser requires segments to be enclosed in << and >>. So, if you want to write the above, you have to write something like: << <> || Bin <- [<<3:5>>] >>. which is just a convenient shorthand for the following expression, which you can also write: << <> || Bin <- [<<3:5>>] >>. (This because bit_size(Bin) is the default size for bits type segments.) If you do not like this default expansion of "take all bits, please" you are also allowed to take less: << <> || Bin <- [<<3:5>>] >>. Kostis From C.Grasl@REDACTED Tue Sep 9 18:22:40 2008 From: C.Grasl@REDACTED (Grasl Christoph) Date: Tue, 9 Sep 2008 18:22:40 +0200 Subject: [erlang-questions] Bit String Comprehension Question References: <911DB3483F8E401C829B2CF9A35C76EE@SSI.CORP> <94C5430AA547F24AA801BA5706F29D2E25CDA6@srvkeyx01.KEYTRONIX.local> <8DB725E6AEB748028B2FF8C15CEB24D7@SSI.CORP> Message-ID: <94C5430AA547F24AA801BA5706F29D2E25CDA7@srvkeyx01.KEYTRONIX.local> sorry, however, for the noize dear david, you need to declare that's a bitstring, binaries is default and therefore the expected type, so this will work 4 u: << <> || Bin <- [<<3:5>>] >>. it's well explained in the documentation ('programming-examples/constructing binaries and bitstrings').. Cheers, Christoph Grasl Embedded Software Entwickler KEYTRONIX Gesellschaft f?r industrielle Elektronik und Informationstechnologie mbH Ungargasse 64-66/1/109 A-1030 WIEN E-Mail: c.grasl@REDACTED Tel.: +43 (1) 718 06 60 - 323 Mobil: +43 (664) 8556456 WWW: http://www.keytronix.com HG Wien FN 261131t Confidentiality Notice: This message may contain privileged and confidential information. If you think, for any reason, that this message may have been addressed to you in error, you must not disseminate, copy or take any action in reliance on it, and we would ask you to notify us immediately by return email. -----Urspr?ngliche Nachricht----- Von: David Mercer [mailto:dmercer@REDACTED] Gesendet: Di 09.09.2008 17:52 An: Grasl Christoph; erlang-questions@REDACTED Betreff: RE: [erlang-questions] Bit String Comprehension Question My question, however, is regarding bit string comprehension, not list comprehension. Please advise. Thank-you. > -----Original Message----- > From: Grasl Christoph [mailto:C.Grasl@REDACTED] > Sent: Tuesday, September 09, 2008 09:55 > To: dmercer@REDACTED; erlang-questions@REDACTED > Subject: AW: [erlang-questions] Bit String Comprehension Question > > Dear, David > > [Bin || Bin <- [<<3:5>>] ]. > > works fine.. > > the syntactical notation for a list comprehension needs to be in '[' & ]' > whereas you have used the binary/bitstring syntax to 'bracket' your > comprehension > together with the '||', which is typically a list-comp. > could be mistaken, but it looks like u'r mixing up to notations.. > > Cheers, > > Christoph Grasl > Embedded Software Entwickler > > KEYTRONIX > Gesellschaft f?r industrielle Elektronik und Informationstechnologie mbH > > Ungargasse 64-66/1/109 > A-1030 WIEN > > E-Mail: c.grasl@REDACTED > Tel.: +43 (1) 718 06 60 - 323 > Mobil: +43 (664) 8556456 > WWW: http://www.keytronix.com > > HG Wien FN 261131t > > Confidentiality Notice: > This message may contain privileged and confidential information. If you > think, for any reason, that this message may have been addressed to you in > error, you must not disseminate, copy or take any action in reliance on > it, and we would ask you to notify us immediately by return email. > > > > -----Urspr?ngliche Nachricht----- > Von: erlang-questions-bounces@REDACTED im Auftrag von David Mercer > Gesendet: Di 09.09.2008 16:18 > An: 'erlang-questions' > Betreff: [erlang-questions] Bit String Comprehension Question > > Why does the bit-string comprehension #133 below work whereas #134 is a > syntax error? > > > > 133> << <> || {X,N} <- [{3,5}] >>. > > > <<3:5>> > > 134> << Bin || Bin <- [<<3:5>>] >>. > > * 1: syntax error before: '||' > > > > Please advise. Thank-you. > > > > David Mercer > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Tue Sep 9 18:26:42 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Tue, 9 Sep 2008 12:26:42 -0400 Subject: [erlang-questions] Convert atom and arity into fun In-Reply-To: <6672d0160809090458x5ef4b0f1nd9c17fdfc5285b72@mail.gmail.com> References: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> <12276_1220612079_m85Asb3L001728_48C10DE5.7090102@it.uu.se> <14915773-8CCF-447E-B7DC-DF04291315A6@cs.otago.ac.nz> <6c2563b20809080549h2d86b889ve7a2be7c78343b86@mail.gmail.com> <6672d0160809090458x5ef4b0f1nd9c17fdfc5285b72@mail.gmail.com> Message-ID: <6c2563b20809090926m9061d5ex33d98a1a4081c230@mail.gmail.com> Thanks, Bjorn. Is there a good reason it is undocumented? I mean, if I use it, am I in danger of my code breaking in a future release because of that? Regards, Edwin On Tue, Sep 9, 2008 at 7:58 AM, Bjorn Gustavsson wrote: > 2008/9/8 Edwin Fine > >> I had this exact issue last night, and this is something like what I did >> because I knew in advance what the arities would be (for better or worse, >> IANAEE): >> >> mf_to_fun1(M, F) -> >> fun(X) -> M:F(X) end. >> >> mf_to_fun2(M, F) -> >> fun(X,Y) -> M:F(X,Y) end. >> >> Ugly but it got the job done. It would be really nice if we could just use >> fun M:F/A, with all these being variables. Surely it can't be a big step >> beyond apply(M, F, [Args])? >> > > There is an undocumented BIF that can be called like this > > erlang:make_fun(Mod, Name, Arity) > > to create a fun. > > /Bjorn > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dawsdesign@REDACTED Tue Sep 9 18:39:34 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Tue, 9 Sep 2008 12:39:34 -0400 Subject: [erlang-questions] How to dynamically add one node to erlang's distrubted application? In-Reply-To: <553010.47717.qm@web35902.mail.mud.yahoo.com> References: <553010.47717.qm@web35902.mail.mud.yahoo.com> Message-ID: Andrew, that will indeed connect them, but it won't start the application on the dynamically added node if all the rest go down. That is what this mechanism does. I do not know how to do it. I've been wondering about it myself. 2008/9/9 Andrew Stone > You can start the 4th node and do a net_kernel:connect to one of the other > nodes. Just make sure that the cookies are the same on all nodes. > > ----- Original Message ---- > From: devdoer bird > To: erlang-questions@REDACTED > Sent: Tuesday, September 9, 2008 3:46:00 AM > Subject: [erlang-questions] How to dynamically add one node to erlang's > distrubted application? > > HI: > I have a distrbuted system using erlang's distributed application > mechanism.It firstly ran on 3 nodes with the config file like this: > > [{kernel, > [{distributed, [{myapp, 5000, [cp1@REDACTED, {cp2@REDACTED, cp3@REDACTED}]}]}, > {sync_nodes_mandatory, [cp2@REDACTED, cp3@REDACTED]}, > {sync_nodes_timeout, 5000} > ] > } > ]. > > Now I want to add one more node to the system .How can I do this using > erlang's distributed applicaiton mechanism? Do I have to edit the config > file on all 3 nodes to add the 4th node and restart all of them? > > Thanks . > ------------------------------------ > devdoer > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stondage123@REDACTED Tue Sep 9 18:48:02 2008 From: stondage123@REDACTED (Andrew Stone) Date: Tue, 9 Sep 2008 09:48:02 -0700 (PDT) Subject: [erlang-questions] How to dynamically add one node to erlang's distrubted application? Message-ID: <607309.19058.qm@web35903.mail.mud.yahoo.com> Ok. I misunderstood. That was just the first thing that came to mind. I don't know about this as I haven't done it before. -Andrew ----- Original Message ---- From: Matt Williamson To: Andrew Stone Cc: devdoer bird ; erlang-questions@REDACTED Sent: Tuesday, September 9, 2008 12:39:34 PM Subject: Re: [erlang-questions] How to dynamically add one node to erlang's distrubted application? Andrew, that will indeed connect them, but it won't start the application on the dynamically added node if all the rest go down. That is what this mechanism does. I do not know how to do it. I've been wondering about it myself. 2008/9/9 Andrew Stone You can start the 4th node and do a net_kernel:connect to one of the other nodes. Just make sure that the cookies are the same on all nodes. ----- Original Message ---- From: devdoer bird To: erlang-questions@REDACTED Sent: Tuesday, September 9, 2008 3:46:00 AM Subject: [erlang-questions] How to dynamically add one node to erlang's distrubted application? HI: I have a distrbuted system using erlang's distributed application mechanism.It firstly ran on 3 nodes with the config file like this: [{kernel, [{distributed, [{myapp, 5000, [cp1@REDACTED, {cp2@REDACTED, cp3@REDACTED}]}]}, {sync_nodes_mandatory, [cp2@REDACTED, cp3@REDACTED]}, {sync_nodes_timeout, 5000} ] } ]. Now I want to add one more node to the system .How can I do this using erlang's distributed applicaiton mechanism? Do I have to edit the config file on all 3 nodes to add the 4th node and restart all of them? Thanks . ------------------------------------ devdoer _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmercer@REDACTED Tue Sep 9 21:27:42 2008 From: dmercer@REDACTED (David Mercer) Date: Tue, 9 Sep 2008 14:27:42 -0500 Subject: [erlang-questions] Bit String Comprehension Question In-Reply-To: <48C6A1F2.6080700@cs.ntua.gr> References: <911DB3483F8E401C829B2CF9A35C76EE@SSI.CORP> <48C6A1F2.6080700@cs.ntua.gr> Message-ID: <7656AB4CEFA54A11AA0457EF4C3B6303@SSI.CORP> Perfect. Thank-you. Thanks also to Grasl Christoph for his assistance. However, Grasl did write: > it's well explained in the documentation ('programming- > examples/constructing binaries and bitstrings').. Which I do disagree with, somewhat. I wouldn't call it "well explained" in that section, at least not in version 5.6.4 of the same. I read that section twice before posting my question, and once after I knew the solution, and I still don't see this case really explained. I'd suggest a modification to the documentation, but apparently I am the only nimrod who couldn't figure out. Sorry for the line noise, but thanks for the help. Cheers, David > -----Original Message----- > From: Kostis Sagonas [mailto:kostis@REDACTED] > Sent: Tuesday, September 09, 2008 11:19 > To: 'erlang-questions' > Cc: dmercer@REDACTED > Subject: Re: [erlang-questions] Bit String Comprehension Question > > David Mercer wrote: > > Why does the bit-string comprehension #133 below work whereas #134 is a > > syntax error? > > > > 133> << <> || {X,N} <- [{3,5}] >>. > > <<3:5>> > > > > 134> << Bin || Bin <- [<<3:5>>] >>. > > * 1: syntax error before: '||' > > In bit stream comprehensions, the elements of the resulting binary have > to have an unambiguously defined size. This means that they have to be > a bit stream *segments*, and the parser requires segments to be enclosed > in << and >>. So, if you want to write the above, you have to write > something like: > > << <> || Bin <- [<<3:5>>] >>. > > which is just a convenient shorthand for the following expression, which > you can also write: > > << <> || Bin <- [<<3:5>>] >>. > > (This because bit_size(Bin) is the default size for bits type segments.) > > If you do not like this default expansion of "take all bits, please" you > are also allowed to take less: > > << <> || Bin <- [<<3:5>>] >>. > > Kostis From francesca@REDACTED Tue Sep 9 21:33:43 2008 From: francesca@REDACTED (Francesca Gangemi) Date: Tue, 09 Sep 2008 21:33:43 +0200 Subject: [erlang-questions] Memory usage Message-ID: <48C6CF97.5070309@erlang-consulting.com> Hi, we notice that nodes crash during a load test because they cannot allocate more memory. The slogan from the crash dump says "eheap_alloc: Cannot allocate 3328160 bytes of memory (of type old_heap")." Memory information reports the following values total 2468460696 processes 2060871072 processes_used 2060858920 system 407589624 If then I look at the process information and I add up the Stack+heap values for all the processes I get 243183460 bytes. This number is quite less than the processes_used one. I wonder if something else is added up to the process_used memory value. We run the test using R11B-3 and R12B-4. There are 6000 processes running under a supervisor. They generate xml requests and parse xml responses. The XML structure is quite complex and its size is up to 80KB. The following lines report information about allocated areas sys_misc 3422757 static 14417920 atom_space 163860 162413 atom_table 91901 module_table 5768 export_table 48008 register_table 852 fun_table 3250 module_refs 4096 loaded_code 4553244 dist_table 555 node_table 299 bits_bufs_size 0 bif_timer 40604 link_lh 0 proc 3995708 3988028 atom_entry 316564 316276 export_entry 312364 312172 module_entry 12088 11888 reg_proc 6320 6104 monitor_sh 253288 252248 nlink_sh 362060 358844 proc_list 28 28 fun_entry 60724 60220 db_tab 12848 10416 driver_event_data_state 28 28 driver_select_data_state 1000 328 Kind regards Francesca From ulf@REDACTED Tue Sep 9 22:29:54 2008 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 9 Sep 2008 22:29:54 +0200 Subject: [erlang-questions] Memory usage In-Reply-To: <48C6CF97.5070309@erlang-consulting.com> References: <48C6CF97.5070309@erlang-consulting.com> Message-ID: <8209f740809091329pb24dd54p7e35615fdb3fd2b4@mail.gmail.com> Hi Francesca, It sounds a bit similar to this: http://www.erlangatwork.com/2008/07/hunting-bugs.html In that case, xmerl was used, and was happily gobbling up memory (now, that was a 64-bit system, which of course aggravated the problem. OTOH the XML bits were fairly small.) BR, Ulf W 2008/9/9 Francesca Gangemi : > Hi, > > we notice that nodes crash during a load test because they cannot > allocate more memory. > The slogan from the crash dump says > "eheap_alloc: Cannot allocate 3328160 bytes of memory (of type old_heap")." > > Memory information reports the following values > total 2468460696 > processes 2060871072 > processes_used 2060858920 > system 407589624 > > If then I look at the process information and I add up the Stack+heap > values for all the processes I get 243183460 bytes. This number is quite > less than the processes_used one. > I wonder if something else is added up to the process_used memory value. > > We run the test using R11B-3 and R12B-4. > There are 6000 processes running under a supervisor. They generate xml > requests and parse xml responses. The XML structure is quite complex and > its size is up to 80KB. > > The following lines report information about allocated areas > > sys_misc 3422757 > static 14417920 > atom_space 163860 162413 > atom_table 91901 > module_table 5768 > export_table 48008 > register_table 852 > fun_table 3250 > module_refs 4096 > loaded_code 4553244 > dist_table 555 > node_table 299 > bits_bufs_size 0 > bif_timer 40604 > link_lh 0 > proc 3995708 3988028 > atom_entry 316564 316276 > export_entry 312364 312172 > module_entry 12088 11888 > reg_proc 6320 6104 > monitor_sh 253288 252248 > nlink_sh 362060 358844 > proc_list 28 28 > fun_entry 60724 60220 > db_tab 12848 10416 > driver_event_data_state 28 28 > driver_select_data_state 1000 328 > > > Kind regards > Francesca > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From francesca@REDACTED Tue Sep 9 22:48:25 2008 From: francesca@REDACTED (Francesca Gangemi) Date: Tue, 09 Sep 2008 22:48:25 +0200 Subject: [erlang-questions] Memory usage In-Reply-To: <8209f740809091329pb24dd54p7e35615fdb3fd2b4@mail.gmail.com> References: <48C6CF97.5070309@erlang-consulting.com> <8209f740809091329pb24dd54p7e35615fdb3fd2b4@mail.gmail.com> Message-ID: <48C6E119.8030207@erlang-consulting.com> Hi Ulf, thanks for your suggestion, we already knew about this article but it didn't help. In our case the process parsing the xml does not use a huge amount of memory and we don't have so many requests at the same time. Furthermore I can't see which process is using all the memory. The memory information says that processes_used memory is 2060858920 (~1965MB) while the process information reports a total of 24318346 bytes (~231 MB), adding up the stack+heap values for all the processes. What is included in the calculation of the processes_used value? Kind regards Francesca Ulf Wiger wrote: > Hi Francesca, > > It sounds a bit similar to this: > > http://www.erlangatwork.com/2008/07/hunting-bugs.html > > In that case, xmerl was used, and was happily gobbling up memory > (now, that was a 64-bit system, which of course aggravated the problem. > OTOH the XML bits were fairly small.) > > BR, > Ulf W > > 2008/9/9 Francesca Gangemi : > >> Hi, >> >> we notice that nodes crash during a load test because they cannot >> allocate more memory. >> The slogan from the crash dump says >> "eheap_alloc: Cannot allocate 3328160 bytes of memory (of type old_heap")." >> >> Memory information reports the following values >> total 2468460696 >> processes 2060871072 >> processes_used 2060858920 >> system 407589624 >> >> If then I look at the process information and I add up the Stack+heap >> values for all the processes I get 243183460 bytes. This number is quite >> less than the processes_used one. >> I wonder if something else is added up to the process_used memory value. >> >> We run the test using R11B-3 and R12B-4. >> There are 6000 processes running under a supervisor. They generate xml >> requests and parse xml responses. The XML structure is quite complex and >> its size is up to 80KB. >> >> The following lines report information about allocated areas >> >> sys_misc 3422757 >> static 14417920 >> atom_space 163860 162413 >> atom_table 91901 >> module_table 5768 >> export_table 48008 >> register_table 852 >> fun_table 3250 >> module_refs 4096 >> loaded_code 4553244 >> dist_table 555 >> node_table 299 >> bits_bufs_size 0 >> bif_timer 40604 >> link_lh 0 >> proc 3995708 3988028 >> atom_entry 316564 316276 >> export_entry 312364 312172 >> module_entry 12088 11888 >> reg_proc 6320 6104 >> monitor_sh 253288 252248 >> nlink_sh 362060 358844 >> proc_list 28 28 >> fun_entry 60724 60220 >> db_tab 12848 10416 >> driver_event_data_state 28 28 >> driver_select_data_state 1000 328 >> >> >> Kind regards >> Francesca >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> From ulf@REDACTED Tue Sep 9 22:57:03 2008 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 9 Sep 2008 22:57:03 +0200 Subject: [erlang-questions] Memory usage In-Reply-To: <48C6E119.8030207@erlang-consulting.com> References: <48C6CF97.5070309@erlang-consulting.com> <8209f740809091329pb24dd54p7e35615fdb3fd2b4@mail.gmail.com> <48C6E119.8030207@erlang-consulting.com> Message-ID: <8209f740809091357t7297d906j3305e9c3b7659002@mail.gmail.com> It's late, and since you're still up and about (and the ERTS experts perhaps aren't), I'll take a wild stab and suggest that it has something to do with generational GC etc. The process_info(P,heap_size) only looks at the youngest heap, so it misses all data on the old heap. Perhaps you can play around a bit with GC parameter tuning if you're planning to stay up all night? ;-) BR, Ulf W 2008/9/9 Francesca Gangemi : > Hi Ulf, > > thanks for your suggestion, we already knew about this article but it didn't > help. > In our case the process parsing the xml does not use a huge amount of memory > and we don't have so many requests at the same time. > Furthermore I can't see which process is using all the memory. > The memory information says that processes_used memory is 2060858920 > (~1965MB) while the process information reports a total of 24318346 bytes > (~231 MB), adding up the stack+heap values for all the processes. > > What is included in the calculation of the processes_used value? > > Kind regards > Francesca > > Ulf Wiger wrote: >> >> Hi Francesca, >> >> It sounds a bit similar to this: >> >> http://www.erlangatwork.com/2008/07/hunting-bugs.html >> >> In that case, xmerl was used, and was happily gobbling up memory >> (now, that was a 64-bit system, which of course aggravated the problem. >> OTOH the XML bits were fairly small.) >> >> BR, >> Ulf W >> >> 2008/9/9 Francesca Gangemi : >> >>> >>> Hi, >>> >>> we notice that nodes crash during a load test because they cannot >>> allocate more memory. >>> The slogan from the crash dump says >>> "eheap_alloc: Cannot allocate 3328160 bytes of memory (of type >>> old_heap")." >>> >>> Memory information reports the following values >>> total 2468460696 >>> processes 2060871072 >>> processes_used 2060858920 >>> system 407589624 >>> >>> If then I look at the process information and I add up the Stack+heap >>> values for all the processes I get 243183460 bytes. This number is quite >>> less than the processes_used one. >>> I wonder if something else is added up to the process_used memory value. >>> >>> We run the test using R11B-3 and R12B-4. >>> There are 6000 processes running under a supervisor. They generate xml >>> requests and parse xml responses. The XML structure is quite complex and >>> its size is up to 80KB. >>> >>> The following lines report information about allocated areas >>> >>> sys_misc 3422757 >>> static 14417920 >>> atom_space 163860 162413 >>> atom_table 91901 >>> module_table 5768 >>> export_table 48008 >>> register_table 852 >>> fun_table 3250 >>> module_refs 4096 >>> loaded_code 4553244 >>> dist_table 555 >>> node_table 299 >>> bits_bufs_size 0 >>> bif_timer 40604 >>> link_lh 0 >>> proc 3995708 3988028 >>> atom_entry 316564 316276 >>> export_entry 312364 312172 >>> module_entry 12088 11888 >>> reg_proc 6320 6104 >>> monitor_sh 253288 252248 >>> nlink_sh 362060 358844 >>> proc_list 28 28 >>> fun_entry 60724 60220 >>> db_tab 12848 10416 >>> driver_event_data_state 28 28 >>> driver_select_data_state 1000 328 >>> >>> >>> Kind regards >>> Francesca >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >>> > > From ok@REDACTED Wed Sep 10 04:10:14 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 10 Sep 2008 14:10:14 +1200 Subject: [erlang-questions] Convert atom and arity into fun In-Reply-To: <15483_1220962185_m89C9gho006410_6672d0160809090458x5ef4b0f1nd9c17fdfc5285b72@mail.gmail.com> References: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> <12276_1220612079_m85Asb3L001728_48C10DE5.7090102@it.uu.se> <14915773-8CCF-447E-B7DC-DF04291315A6@cs.otago.ac.nz> <6c2563b20809080549h2d86b889ve7a2be7c78343b86@mail.gmail.com> <15483_1220962185_m89C9gho006410_6672d0160809090458x5ef4b0f1nd9c17fdfc5285b72@mail.gmail.com> Message-ID: On 9 Sep 2008, at 11:58 pm, Bjorn Gustavsson wrote: > erlang:make_fun(Mod, Name, Arity) I have just used this as the basis for an EEP. -- If stupidity were a crime, who'd 'scape hanging? From Bill.McKeeman@REDACTED Wed Sep 10 06:19:49 2008 From: Bill.McKeeman@REDACTED (Bill McKeeman) Date: Wed, 10 Sep 2008 00:19:49 -0400 Subject: [erlang-questions] Looking for a code review In-Reply-To: References: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> <12276_1220612079_m85Asb3L001728_48C10DE5.7090102@it.uu.se> <14915773-8CCF-447E-B7DC-DF04291315A6@cs.otago.ac.nz> <6c2563b20809080549h2d86b889ve7a2be7c78343b86@mail.gmail.com> <15483_1220962185_m89C9gho006410_6672d0160809090458x5ef4b0f1nd9c17fdfc5285b72@mail.gmail.com> Message-ID: Folks, Because of needing to understand how to use SMP, I have been learning Erlang. I seem to be able to get things to run but suspect I could do many things better. One of my exercises is a numerical quadrature routine (80 lines including comments). I would appreciate it if someone out there would be willing to review my code and advise me on how to improve it. The file is http://www.cs.dartmouth.edu/~mckeeman/pquadn.erl Thanks, /s/ Bill From murugaa.software@REDACTED Wed Sep 10 06:21:51 2008 From: murugaa.software@REDACTED (Murugathasan Murugiah) Date: Wed, 10 Sep 2008 09:51:51 +0530 Subject: [erlang-questions] Erlang - Postgresql Driver Message-ID: <14b0910a0809092121l1ec6b1a5yc180d23dd6036504@mail.gmail.com> Hi, I used postgreSql database with Erlang by using erlang - postgresql driver got from "erlang-consulting.com". I need a higher rate of insertation with other basic operations. Is this driver support for this capacity? If any other alternatives? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexander.uvarov@REDACTED Wed Sep 10 06:41:39 2008 From: alexander.uvarov@REDACTED (Alexander) Date: Wed, 10 Sep 2008 10:41:39 +0600 Subject: [erlang-questions] Erlang - Postgresql Driver In-Reply-To: <14b0910a0809092121l1ec6b1a5yc180d23dd6036504@mail.gmail.com> References: <14b0910a0809092121l1ec6b1a5yc180d23dd6036504@mail.gmail.com> Message-ID: <200809101041.39996.alexander.uvarov@gmail.com> On Wednesday 10 September 2008 10:21:51 Murugathasan Murugiah wrote: > Hi, > > I used postgreSql database with Erlang by using erlang - postgresql driver > got from "erlang-consulting.com". > I need a higher rate of insertation with other basic operations. > > Is this driver support for this capacity? If any other alternatives? > > Thanks. Yes, alternatives are: 1. pgsql from jungerl http://github.com/noss/pgsql/tree/master 2. erlang-psql-driver (based on the original PostgreSQL driver obtained from Erlang Consulting) http://code.google.com/p/erlang-psql-driver/ 3. pgsql from ejabberd (fork of 1) PS: We really need edbc. Raise, edbc. Raise! Just kidding :) From murugaa.software@REDACTED Wed Sep 10 07:01:28 2008 From: murugaa.software@REDACTED (Murugathasan Murugiah) Date: Wed, 10 Sep 2008 10:31:28 +0530 Subject: [erlang-questions] Erlang - Postgresql Driver Message-ID: <14b0910a0809092201m70286f13j9c3930c905d25f05@mail.gmail.com> What is the maximum rate u achived for insertion and deletion? Is it possible to achive nearly 3000 insertion & deletion per sec? -------------- next part -------------- An HTML attachment was scrubbed... URL: From nc@REDACTED Wed Sep 10 07:17:45 2008 From: nc@REDACTED (Nicolas Charpentier) Date: Wed, 10 Sep 2008 07:17:45 +0200 Subject: [erlang-questions] How to dynamically add one node to erlang's distrubted application? In-Reply-To: References: Message-ID: <48C75879.6010904@charpi.net> devdoer bird wrote: >... > Now I want to add one more node to the system .How can I do this > using erlang's distributed applicaiton mechanism? Do I have to edit the > config file on all 3 nodes to add the 4th node and restart all of them? > Hi, if you can't stop your nodes because others mandatory applications are running you can try to use application:load/2 on all your nodes. The second param is the distribution parameter which overload kernel value. To be able to load an application, it have to be stopped. Don't forget to update the config file for the next node restart. I never tried to do that but the documentation seems to say that it's possible Regards, ---- Nicolas http://charpi.net From devdoer2@REDACTED Wed Sep 10 07:21:47 2008 From: devdoer2@REDACTED (devdoer bird) Date: Wed, 10 Sep 2008 13:21:47 +0800 Subject: [erlang-questions] How to dynamically add one node to erlang's distrubted application? In-Reply-To: <48C75879.6010904@charpi.net> References: <48C75879.6010904@charpi.net> Message-ID: Thanks. If I have 100 machines ,I have to edt the config files on all 100 machines, that's unacceptable. Are there any solutions? 2008/9/10 Nicolas Charpentier > devdoer bird wrote: > >> ... >> Now I want to add one more node to the system .How can I do this using >> erlang's distributed applicaiton mechanism? Do I have to edit the config >> file on all 3 nodes to add the 4th node and restart all of them? >> >> > > > Hi, > > if you can't stop your nodes because others mandatory applications are > running you can try to use application:load/2 on all your nodes. The second > param is the distribution parameter which overload kernel value. > To be able to load an application, it have to be stopped. > Don't forget to update the config file for the next node restart. > > I never tried to do that but the documentation seems to say that it's > possible > > > Regards, > > ---- > Nicolas > http://charpi.net > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nc@REDACTED Wed Sep 10 07:33:46 2008 From: nc@REDACTED (Nicolas Charpentier) Date: Wed, 10 Sep 2008 07:33:46 +0200 Subject: [erlang-questions] Examining bindings on the stack In-Reply-To: <20080909144351.GA13085@uk.tiscali.com> References: <20080909144351.GA13085@uk.tiscali.com> Message-ID: <48C75C3A.3030008@charpi.net> Brian Candler wrote: > I'd like to know the easiest way to examine bindings on the stack in an > error backtrace. In particular I'd to be able to see the arguments to all > the functions called up to this point. > > I've had limited success with the erlang debugger. I was trying to debug a > backtrace from a call into an existing complex library (in this case > yaws_soap_lib) Hi, If you know the name of the function in which the 'bug' occurs you can easily see the value of parameters using *dbg* (http://www.erlang.org/doc/apps/runtime_tools/index.html). dbg is a trace/debug tool which can be used on a runtime system (almost the time safely) without any specific compilation (like debug_info for example). With dbg, you can *at run-time* add a trace on any function of your system and see the value of parameters and the result of the function call. As dbg is complex, I can't give you exactly the instructions to type but basically to activate trace on a specific function it will be something like that: > dbg:tracer(). > dbg:p(all,[c]). > dbg:tpl(Module,Function,Match_spec). The Match_spec allow you to filter the function call you want to trace according to the value of the parameter. By default I always use Match_spec = [{'_',[],[{return_trace}]}]. Hope that it will help Regards, --- Nicolas http://charpi.net From ok@REDACTED Wed Sep 10 08:06:00 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 10 Sep 2008 18:06:00 +1200 Subject: [erlang-questions] Looking for a code review In-Reply-To: <23533_1221021101_m8A4VZfZ005557_A72F8BF2E3DF3A4DA991556C59CC4D834BC52BBC80@EXCHANGE-AH.ad.mathworks.com> References: <331a9abb0809050322k7c6e544av22e5b949750001bf@mail.gmail.com> <12276_1220612079_m85Asb3L001728_48C10DE5.7090102@it.uu.se> <14915773-8CCF-447E-B7DC-DF04291315A6@cs.otago.ac.nz> <6c2563b20809080549h2d86b889ve7a2be7c78343b86@mail.gmail.com> <15483_1220962185_m89C9gho006410_6672d0160809090458x5ef4b0f1nd9c17fdfc5285b72@mail.gmail.com> <23533_1221021101_m8A4VZfZ005557_A72F8BF2E3DF3A4DA991556C59CC4D834BC52BBC80@EXCHANGE-AH.ad.mathworks.com> Message-ID: <4B6D5848-BC59-4269-A1E9-2BF5C4DCE699@cs.otago.ac.nz> On 10 Sep 2008, at 4:19 pm, Bill McKeeman wrote: Xs = samples(N, B-Dx, Dx, [B]), % N+1 sample points Fs = fvals(F, Xs, []), % N+1 sample values ... samples(0, _M, _Dx, L) -> L; samples(N, M, Dx, L) -> samples(N-1, M-Dx, Dx, [M|L]). fvals(_F, [], L) -> L; fvals(F, [X|Xs], L) -> [F(X) | fvals(F, Xs, L)]. I'd be inclined to write Xs = [A+I*Dx || I <- lists:seq(0, N)], Fs = [F(X) || X <- Xs], The 'dock' function does a receive expecting only to receive a message from a worker; that means you cannot use this code in any process that might receive a message from anywhere else. This is the only thing that really *NEEDS* fixing. I'd be inclined to fold together launching and spawning; what was the reason for separating them? start([_], [_], _, _, Workers) -> Workers; start([X1|Xs=[X2|_]], [F1|Fs=[F2|_]], Tol, Self, Workers) -> Worker = spawn(fun () -> worker(X1, X2, F1, F2, Tol, Self) end), start(Xs, Fs, Self, [Worker|Workers]). In fact, we don't need these lists. So run(F, A, B, Tol, N) -> Dx = (B - A)/B, Self = self(), lists:sum([receive {Worker,Value} -> Value end || Worker <- start(0, N, A, A, Dx, F(A), Tol, Self, [])]). start(N, N, _. _, _, _, _, Workers) -> Workers; start(I, N, X1, A, Dx, F1, Tol, Self, Workers) -> J = I + 1, X2 = I*Dx + A, F2 = F(X2), Worker = spawn(fun () -> worker(X1, X2, F1, F2, Tol, Self) end), start(J, N, X2, A, Dx, F2, Tol, Self, [Worker|Workers]). worker(X1, X2, F1, F2, Tol, Master) -> .... Master ! Value. From bengt.kleberg@REDACTED Wed Sep 10 09:24:57 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 10 Sep 2008 09:24:57 +0200 Subject: [erlang-questions] blunt error reporting by escript In-Reply-To: <8209f740809090758k47b5b0eeh5da2aa5e90173f4f@mail.gmail.com> References: <8209f740809090758k47b5b0eeh5da2aa5e90173f4f@mail.gmail.com> Message-ID: <1221031497.25391.100.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Greetings, While waiting for escript to get better error reporting have you considered using: a() -> {_, {ok, Value}} = {a, call_that_should_return_ok_value()}. b() -> {_, {ok, Value}} = {b, call_that_should_return_ok_value()}. bengt On Tue, 2008-09-09 at 16:58 +0200, Ulf Wiger wrote: > I'm writing a non-trivial escript script, and am getting pretty > frustrated with the error reporting. > > escript: exception error: no match of right hand side value {ok, ["..."]} > > My script is only 75 lines so far but has 10 different functions, and it would > certainly help to at least know in which function the error occured, > if not the line. > > If the script is interpreted, couldn't it give me the line number? > I'd even forego the pretty-printing of the message in favor of some hard > facts about where in the program the exception happened. > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From B.Candler@REDACTED Wed Sep 10 10:28:25 2008 From: B.Candler@REDACTED (Brian Candler) Date: Wed, 10 Sep 2008 09:28:25 +0100 Subject: [erlang-questions] Examining bindings on the stack In-Reply-To: <48C75C3A.3030008@charpi.net> References: <20080909144351.GA13085@uk.tiscali.com> <48C75C3A.3030008@charpi.net> Message-ID: <20080910082825.GA7124@uk.tiscali.com> On Wed, Sep 10, 2008 at 07:33:46AM +0200, Nicolas Charpentier wrote: > As dbg is complex, I can't give you exactly the instructions to type but > basically to activate trace on a specific function it will be something > like that: > > > dbg:tracer(). > > dbg:p(all,[c]). > > dbg:tpl(Module,Function,Match_spec). > > The Match_spec allow you to filter the function call you want to trace > according to the value of the parameter. By default I always use > Match_spec = [{'_',[],[{return_trace}]}]. This does the job perfectly, thank you. It's rather cool to watch recursive functions expanding themselves: (<0.36.0>) call adder:addup([1,2,3]) (<0.36.0>) call adder:addup([1,2,3],0) (<0.36.0>) call adder:addup([2,3],1) (<0.36.0>) call adder:addup([3],3) (<0.36.0>) call adder:addup([],6) so I think could usefully be introduced to new erlangers very early on. I also see it can trace messages in and out of a process. A question: is it possible to call dbg:p in such a way as to clear individual flags? The reason is that I found dbg:p(Regname,[all]). disables display of the function arguments. After some digging, I found it's because 'all' sets the 'arity' flag too (documented under erlang:trace/3) I finally managed to clear just the arity flag by talking to the lower layer: erlang:trace(whereis(Regname), false, [arity]). but I can't see a way in dbg to do this. dbg:p(Regname,[clear]) clears them all. Regards, Brian. From raimo+erlang-questions@REDACTED Wed Sep 10 11:12:36 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 10 Sep 2008 11:12:36 +0200 Subject: [erlang-questions] : Examining bindings on the stack In-Reply-To: <20080910082825.GA7124@uk.tiscali.com> References: <20080909144351.GA13085@uk.tiscali.com> <48C75C3A.3030008@charpi.net> <20080910082825.GA7124@uk.tiscali.com> Message-ID: <20080910091236.GA12583@erix.ericsson.se> On Wed, Sep 10, 2008 at 09:28:25AM +0100, Brian Candler wrote: > On Wed, Sep 10, 2008 at 07:33:46AM +0200, Nicolas Charpentier wrote: > > As dbg is complex, I can't give you exactly the instructions to type but > > basically to activate trace on a specific function it will be something > > like that: > > > > > dbg:tracer(). > > > dbg:p(all,[c]). > > > dbg:tpl(Module,Function,Match_spec). > > > > The Match_spec allow you to filter the function call you want to trace > > according to the value of the parameter. By default I always use > > Match_spec = [{'_',[],[{return_trace}]}]. Then you would love: Match_spec = [{'_',[],[{exception_trace}]}]. We should have dbg shortcuts for those. > > This does the job perfectly, thank you. It's rather cool to watch recursive > functions expanding themselves: > > (<0.36.0>) call adder:addup([1,2,3]) > > (<0.36.0>) call adder:addup([1,2,3],0) > (<0.36.0>) call adder:addup([2,3],1) > (<0.36.0>) call adder:addup([3],3) > (<0.36.0>) call adder:addup([],6) > > so I think could usefully be introduced to new erlangers very early on. I > also see it can trace messages in and out of a process. > > A question: is it possible to call dbg:p in such a way as to clear > individual flags? The reason is that I found > > dbg:p(Regname,[all]). > > disables display of the function arguments. After some digging, I found it's > because 'all' sets the 'arity' flag too (documented under erlang:trace/3) There is acually an error in the dbg documentation here. The 'all's are not the same. erlang:trace/3's 'all' is as documented, but dbg's 'all' is [m,c,p,garbage_collection,running,sos,sofs,sol,sofl,timestamp,arity,return_to], it's in the source. > > I finally managed to clear just the arity flag by talking to the lower layer: > > erlang:trace(whereis(Regname), false, [arity]). > > but I can't see a way in dbg to do this. dbg:p(Regname,[clear]) clears them > all. Unfortunately today dbg has no way to clear individual flags. dbg:p(Regname, [m,c,p,garbage_collection,running,sos,sofs,sol,sofl,timestamp,return_to] but if you use the match spec for return_trace you might skip the process trace flag return_to, and you will have to consider if you really need the sos,sofs,sol,sofl flags - gives: dbg:p(Regname, [m,c,p,garbage_collection,running,timestamp] And do you really need to see how your process is garbage collected and scheduled in or out? dbg:p(Regname, [m,c,p,timestamp] With propagation to childs: dbg:p(Regname, [m,c,p,sos,timestamp] Is that one worthy of a shorcut name? > > Regards, > > Brian. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From realaqura@REDACTED Wed Sep 10 11:16:31 2008 From: realaqura@REDACTED (leon zhao) Date: Wed, 10 Sep 2008 17:16:31 +0800 Subject: [erlang-questions] How about the net IO ability of erlang Message-ID: <2f39bec70809100216o2c700ea2o80dcfcb05091567@mail.gmail.com> I worte a tcp proxy to forward data from peer to peer, but i find the CPU usage of beam is high in test The client make 1000 connections per second and get 16K data from server, and the server send 8K to client per second, because we want to decrease the traffic. And the compute's CPU is Intel(R) Xeon(TM) CPU 3.20GHz, so the proxy's usage is on avenage 26% Is my codes have some problem or erlang need some optimization. Anyone can tell me here is my codes %%%---------------------------------------------------------------------- %%% File : tcp.erl %%% Author : Zhao Liang %%%---------------------------------------------------------------------- -module(tcp). -author('realaqura@REDACTED'). -compile(export_all). -define(MAIN_MODULE, tcp). -record(cfg, { listen_port = 10080, idle = 30000}). main(Port) -> Cfg = #cfg{listen_port=Port}, case gen_tcp:listen(Port, [{reuseaddr,true}, {active,false}, {backlog,64}, binary]) of {ok, LSock} -> create_accept_thread(LSock, Cfg, self()), tcp_ctl_loop(LSock, Cfg, self()); ERR -> ERR end. tcp_ctl_loop(LSock, Cfg, Self) -> receive {_, next} -> create_accept_thread(LSock, Cfg, Self), tcp_ctl_loop(LSock, Cfg, Self); _ -> tcp_ctl_loop(LSock, Cfg, Self) end. create_accept_thread(LSock, Cfg, Pid) -> spawn_link(?MAIN_MODULE, accept_thread, [LSock, Cfg, Pid]). accept_thread(LSock, Cfg, Parent) -> accept_loop(LSock, Cfg, Parent). accept_loop(LSock, Cfg, Parent) -> case prim_inet:async_accept(LSock, -1) of {ok, Ref} -> receive {inet_async, LSock, Ref, {ok,CSock}} -> Parent ! {self(), next}, tcp_start(CSock, Cfg); {inet_async, LSock, Ref, _} -> accept_loop(LSock, Cfg, Parent) end; _ -> accept_loop(LSock, Cfg, Parent) end. tcp_start(CSock, Cfg) -> case prim_inet:getopts(CSock, [original_dst]) of {ok, [{original_dst, {Oport, Oip}}]} -> case gen_tcp:connect(Oip, Oport, [{active,true}, {packet,raw}, binary], Cfg#cfg.idle) of {ok, SSock} -> tcp_start(CSock, SSock, Cfg); _ -> inet:tcp_close(CSock) end; _ -> inet:tcp_close(CSock) end. tcp_start(CSock, SSock, Cfg) -> inet:setopts(CSock, [{active, true}, {packet,raw}, binary]), tcp_data_loop(CSock, SSock, Cfg). tcp_data_loop(CSock, SSock, Cfg) -> receive {tcp, Socket, Data} -> if Socket == CSock -> case prim_inet:send(SSock, Data) of ok -> tcp_data_loop(CSock, SSock, Cfg); _ -> gen_tcp:close(CSock), gen_tcp:close(SSock) end; Socket == SSock -> case prim_inet:send(CSock, Data) of ok -> tcp_data_loop(CSock, SSock, Cfg); _ -> gen_tcp:close(CSock), gen_tcp:close(SSock) end; true -> tcp_data_loop(CSock, SSock, Cfg) end; {tcp_closed, Socket} -> if Socket == CSock -> gen_tcp:close(SSock); Socket == SSock -> gen_tcp:close(CSock); true -> gen_tcp:close(CSock), gen_tcp:close(SSock) end; _ -> gen_tcp:close(CSock), gen_tcp:close(SSock) after Cfg#cfg.idle -> gen_tcp:close(CSock), gen_tcp:close(SSock) end. -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Wed Sep 10 11:22:49 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Wed, 10 Sep 2008 05:22:49 -0400 Subject: [erlang-questions] How to dynamically add one node to erlang's distrubted application? In-Reply-To: References: <48C75879.6010904@charpi.net> Message-ID: <6c2563b20809100222m7704ef93i48dacd62e1593eca@mail.gmail.com> I do have a suggestion. Write a program that takes the configurations for all 100 (1000, 10000) machines from a file or database, generates the configuration files, and then distributes them to the nodes using an agent or something similar. The config files are kept under configuration management centrally and pushed out to nodes when changes are made. 2008/9/10 devdoer bird > Thanks. If I have 100 machines ,I have to edt the config files on all 100 > machines, that's unacceptable. Are there any solutions? > > 2008/9/10 Nicolas Charpentier > >> devdoer bird wrote: >> >>> ... >>> Now I want to add one more node to the system .How can I do this using >>> erlang's distributed applicaiton mechanism? Do I have to edit the config >>> file on all 3 nodes to add the 4th node and restart all of them? >>> >>> >> >> >> Hi, >> >> if you can't stop your nodes because others mandatory applications are >> running you can try to use application:load/2 on all your nodes. The second >> param is the distribution parameter which overload kernel value. >> To be able to load an application, it have to be stopped. >> Don't forget to update the config file for the next node restart. >> >> I never tried to do that but the documentation seems to say that it's >> possible >> >> >> Regards, >> >> ---- >> Nicolas >> http://charpi.net >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsu79@REDACTED Wed Sep 10 11:45:53 2008 From: chsu79@REDACTED (Christian) Date: Wed, 10 Sep 2008 11:45:53 +0200 Subject: [erlang-questions] Erlang - Postgresql Driver In-Reply-To: <14b0910a0809092201m70286f13j9c3930c905d25f05@mail.gmail.com> References: <14b0910a0809092201m70286f13j9c3930c905d25f05@mail.gmail.com> Message-ID: A potential problem with the pgsql driver design (Apart from other suckyness) is that it is completely synchronous in the protocol. The postgres FE/BE protocol allow you to pipeline requests. Databases also tend to perform better with slight connection pooling. From igwan@REDACTED Wed Sep 10 13:26:28 2008 From: igwan@REDACTED (igwan) Date: Wed, 10 Sep 2008 13:26:28 +0200 Subject: [erlang-questions] How about the net IO ability of erlang In-Reply-To: <2f39bec70809100216o2c700ea2o80dcfcb05091567@mail.gmail.com> References: <2f39bec70809100216o2c700ea2o80dcfcb05091567@mail.gmail.com> Message-ID: <48C7AEE4.8080102@free.fr> leon zhao wrote : > I worte a tcp proxy to forward data from peer to peer, but i find the > CPU usage of beam is high in test > The client make 1000 connections per second and get 16K data from > server, and the server send 8K to client per second, because we want > to decrease the traffic. > And the compute's CPU is Intel(R) Xeon(TM) CPU 3.20GHz, so the proxy's > usage is on avenage 26% > Is my codes have some problem or erlang need some optimization. > Anyone can tell me > > here is my codes > > [...] > tcp_start(CSock, SSock, Cfg) -> > inet:setopts(CSock, [{active, true}, {packet,raw}, binary]), > tcp_data_loop(CSock, SSock, Cfg). > [...] Hi, Just a few hints from a non-expert. You're using the {active, true} mode for your client socket. Try other modes like {active, once} (which was optimized in R12B-4) or {active, false}. Or a combination of the two : set {active, once} and when receiving the message, use gen_tcp:recv/2 to get the rest of available data, then set the socket to {active, once} again, ... This should make a big difference in CPU usage vs. {active, true}. -- igwan From rapsey@REDACTED Wed Sep 10 14:06:56 2008 From: rapsey@REDACTED (Rapsey) Date: Wed, 10 Sep 2008 14:06:56 +0200 Subject: [erlang-questions] How about the net IO ability of erlang In-Reply-To: <2f39bec70809100216o2c700ea2o80dcfcb05091567@mail.gmail.com> References: <2f39bec70809100216o2c700ea2o80dcfcb05091567@mail.gmail.com> Message-ID: <97619b170809100506p77678793oef622f8fe21cff5e@mail.gmail.com> gen_tcp:send is a very expensive call. Try to buffer the data for a bit before sending it. I use 8kB and have filled up a 500mbit connection without problems. When I had small packets (< 1k) CPU usage was very high. Sergej 2008/9/10 leon zhao > I worte a tcp proxy to forward data from peer to peer, but i find the CPU > usage of beam is high in test > The client make 1000 connections per second and get 16K data from > server, and the server send 8K to client per second, because we want to > decrease the traffic. > And the compute's CPU is Intel(R) Xeon(TM) CPU 3.20GHz, so the proxy's > usage is on avenage 26% > Is my codes have some problem or erlang need some optimization. > Anyone can tell me > > here is my codes > > %%%---------------------------------------------------------------------- > %%% File : tcp.erl > %%% Author : Zhao Liang > %%%---------------------------------------------------------------------- > -module(tcp). > -author('realaqura@REDACTED' <%27realaqura@REDACTED%27>). > -compile(export_all). > > -define(MAIN_MODULE, tcp). > > -record(cfg, { > listen_port = 10080, > idle = 30000}). > > main(Port) -> > Cfg = #cfg{listen_port=Port}, > case gen_tcp:listen(Port, [{reuseaddr,true}, {active,false}, > {backlog,64}, binary]) of > {ok, LSock} -> > create_accept_thread(LSock, Cfg, self()), > tcp_ctl_loop(LSock, Cfg, self()); > ERR -> ERR > end. > tcp_ctl_loop(LSock, Cfg, Self) -> > receive > {_, next} -> > create_accept_thread(LSock, Cfg, Self), > tcp_ctl_loop(LSock, Cfg, Self); > _ -> > tcp_ctl_loop(LSock, Cfg, Self) > end. > create_accept_thread(LSock, Cfg, Pid) -> > spawn_link(?MAIN_MODULE, accept_thread, [LSock, Cfg, Pid]). > accept_thread(LSock, Cfg, Parent) -> > accept_loop(LSock, Cfg, Parent). > accept_loop(LSock, Cfg, Parent) -> > case prim_inet:async_accept(LSock, -1) of > {ok, Ref} -> > receive > {inet_async, LSock, Ref, {ok,CSock}} -> > Parent ! {self(), next}, > tcp_start(CSock, Cfg); > {inet_async, LSock, Ref, _} -> > accept_loop(LSock, Cfg, Parent) > end; > _ -> > accept_loop(LSock, Cfg, Parent) > end. > tcp_start(CSock, Cfg) -> > case prim_inet:getopts(CSock, [original_dst]) of > {ok, [{original_dst, {Oport, Oip}}]} -> > case gen_tcp:connect(Oip, Oport, [{active,true}, {packet,raw}, > binary], Cfg#cfg.idle) of > {ok, SSock} -> > tcp_start(CSock, SSock, Cfg); > _ -> > inet:tcp_close(CSock) > end; > _ -> > inet:tcp_close(CSock) > end. > tcp_start(CSock, SSock, Cfg) -> > inet:setopts(CSock, [{active, true}, {packet,raw}, binary]), > tcp_data_loop(CSock, SSock, Cfg). > tcp_data_loop(CSock, SSock, Cfg) -> > receive > {tcp, Socket, Data} -> > if > Socket == CSock -> > case prim_inet:send(SSock, Data) of > ok -> > tcp_data_loop(CSock, SSock, Cfg); > _ -> > gen_tcp:close(CSock), > gen_tcp:close(SSock) > end; > Socket == SSock -> > case prim_inet:send(CSock, Data) of > ok -> > tcp_data_loop(CSock, SSock, Cfg); > _ -> > gen_tcp:close(CSock), > gen_tcp:close(SSock) > end; > true -> > tcp_data_loop(CSock, SSock, Cfg) > end; > {tcp_closed, Socket} -> > if > Socket == CSock -> > gen_tcp:close(SSock); > Socket == SSock -> > gen_tcp:close(CSock); > true -> > gen_tcp:close(CSock), > gen_tcp:close(SSock) > end; > _ -> > gen_tcp:close(CSock), > gen_tcp:close(SSock) > after > Cfg#cfg.idle -> > gen_tcp:close(CSock), > gen_tcp:close(SSock) > end. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Wed Sep 10 14:21:07 2008 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 10 Sep 2008 14:21:07 +0200 Subject: [erlang-questions] blunt error reporting by escript In-Reply-To: <1221031497.25391.100.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> References: <8209f740809090758k47b5b0eeh5da2aa5e90173f4f@mail.gmail.com> <1221031497.25391.100.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Message-ID: <8209f740809100521w5077d832j35cdab2442388c12@mail.gmail.com> Yes, I do that already. /Ulf 2008/9/10 Bengt Kleberg : > Greetings, > > While waiting for escript to get better error reporting have you > considered using: > > a() -> > {_, {ok, Value}} = {a, call_that_should_return_ok_value()}. > > b() -> > {_, {ok, Value}} = {b, call_that_should_return_ok_value()}. > > bengt > > On Tue, 2008-09-09 at 16:58 +0200, Ulf Wiger wrote: >> I'm writing a non-trivial escript script, and am getting pretty >> frustrated with the error reporting. >> >> escript: exception error: no match of right hand side value {ok, ["..."]} >> >> My script is only 75 lines so far but has 10 different functions, and it would >> certainly help to at least know in which function the error occured, >> if not the line. >> >> If the script is interpreted, couldn't it give me the line number? >> I'd even forego the pretty-printing of the message in favor of some hard >> facts about where in the program the exception happened. >> >> BR, >> Ulf W >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From kevin@REDACTED Wed Sep 10 13:46:26 2008 From: kevin@REDACTED (Kevin A. Smith) Date: Wed, 10 Sep 2008 07:46:26 -0400 Subject: [erlang-questions] How to dynamically add one node to erlang's distrubted application? In-Reply-To: <6c2563b20809100222m7704ef93i48dacd62e1593eca@mail.gmail.com> References: <48C75879.6010904@charpi.net> <6c2563b20809100222m7704ef93i48dacd62e1593eca@mail.gmail.com> Message-ID: <69AA4EF5-B7C3-497B-8EAC-9E2AADED4F54@hypotheticalabs.com> Would using Erlang's network file loader (erl_prim_loader) in combination with one or more boot servers address the problem? This would allow you to load code and config from a centralized set of servers. You could push dynamic updates out to the nodes while at the same time updating the centralized files for any new nodes or nodes which have to be restarted. --Kevin On Sep 10, 2008, at 5:22 AM, Edwin Fine wrote: > I do have a suggestion. Write a program that takes the > configurations for all 100 (1000, 10000) machines from a file or > database, generates the configuration files, and then distributes > them to the nodes using an agent or something similar. The config > files are kept under configuration management centrally and pushed > out to nodes when changes are made. > > 2008/9/10 devdoer bird > Thanks. If I have 100 machines ,I have to edt the config files on > all 100 machines, that's unacceptable. Are there any solutions? > > 2008/9/10 Nicolas Charpentier > > devdoer bird wrote: > ... > > Now I want to add one more node to the system .How can I do this > using erlang's distributed applicaiton mechanism? Do I have to edit > the config file on all 3 nodes to add the 4th node and restart all > of them? > > > > Hi, > > if you can't stop your nodes because others mandatory applications > are running you can try to use application:load/2 on all your nodes. > The second param is the distribution parameter which overload kernel > value. > To be able to load an application, it have to be stopped. > Don't forget to update the config file for the next node restart. > > I never tried to do that but the documentation seems to say that > it's possible > > > Regards, > > ---- > Nicolas > http://charpi.net > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From nicolas@REDACTED Wed Sep 10 14:39:55 2008 From: nicolas@REDACTED (Nicolas Niclausse) Date: Wed, 10 Sep 2008 14:39:55 +0200 Subject: [erlang-questions] where to install Tsung In-Reply-To: <4d08db370809040436o1147767ej227d176248b248ab@mail.gmail.com> References: <14f0e3620809031337r6be2f44evcf440177548e4207@mail.gmail.com> <48BFC23D.3000202@niclux.org> <4d08db370809040436o1147767ej227d176248b248ab@mail.gmail.com> Message-ID: <48C7C01B.1010407@niclux.org> Hynek Vychodil ecrivait le 04.09.2008 13:36: > > > On Thu, Sep 4, 2008 at 1:10 PM, Nicolas Niclausse > wrote: > > Gleb Peregud ecrivait le 03.09.2008 22:37: > > Probably it is possible. There are two "but": > > 1) Does tsung loads itself on it's slaves (are modules being > transferred there) > no > And what about nl? a full OTP application must be loaded on slaves, so I don't think nl can handle this situation . -- Nicolas From chandrashekhar.mullaparthi@REDACTED Wed Sep 10 15:03:29 2008 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 10 Sep 2008 14:03:29 +0100 Subject: [erlang-questions] How to dynamically add one node to erlang's distrubted application? In-Reply-To: References: <48C75879.6010904@charpi.net> Message-ID: 2008/9/10 devdoer bird > Thanks. If I have 100 machines ,I have to edt the config files on all 100 > machines, that's unacceptable. Are there any solutions? > > I don't have an answer to your specific question, but... I wouldn't recommend using this feature across 100 machines. Do you really need an application to failover across 100 machines? I had trouble with this feature even across four erlang nodes. The nodes used to hang arbitrarily at various times. It was a long time ago and lots of fixes have been made for this but I'm still quite wary of it. I've found that designing my applications so that failover is handled at the application level gives me more reliability. If you are using this feature to ensure that only one instance of your application is running at any one time, then you are getting a false sense of security. One node can never definitely know if it's peer is running or not. Network outages between the two nodes can make it look like the other node is down, when in reality they are both running. > 2008/9/10 Nicolas Charpentier > >> devdoer bird wrote: >> >>> ... >>> Now I want to add one more node to the system .How can I do this using >>> erlang's distributed applicaiton mechanism? Do I have to edit the config >>> file on all 3 nodes to add the 4th node and restart all of them? >>> >>> >> >> >> Hi, >> >> if you can't stop your nodes because others mandatory applications are >> running you can try to use application:load/2 on all your nodes. The second >> param is the distribution parameter which overload kernel value. >> To be able to load an application, it have to be stopped. >> Don't forget to update the config file for the next node restart. >> >> I never tried to do that but the documentation seems to say that it's >> possible >> >> >> Regards, >> >> ---- >> Nicolas >> http://charpi.net >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From francesco@REDACTED Wed Sep 10 16:54:03 2008 From: francesco@REDACTED (Francesco Cesarini) Date: Wed, 10 Sep 2008 15:54:03 +0100 Subject: [erlang-questions] Erlang User Groups Message-ID: <48C7DF8B.4040206@erlang-consulting.com> Hi All, there have been lots of emails about starting User groups all over. I attended an interesting talk at OSCON, pretty much in conjunction with all of these discussions... I finally managed to hear back fromt he presenters with a link to their slides. http://www.baconandtech.com/?p=16 with notes on the slides from one of the many bloggers here: http://www.networkworld.com/community/node/30268 Having kicked off the London User Group which currently meets up once a month, with about 20 - 40 participants, and slowly putting together one in Stockholm, the above talk pretty much covered it all.. Meet people, listen to interesting presentations, and socialise. If you do set up your user group, make sure you list it on the wiki at http://www.trapexit.org/ErlangUserGroups Currently, 10 user groups have been added! Francesco -- http://www.erlang-consulting.com From B.Candler@REDACTED Wed Sep 10 17:00:14 2008 From: B.Candler@REDACTED (Brian Candler) Date: Wed, 10 Sep 2008 16:00:14 +0100 Subject: [erlang-questions] : Examining bindings on the stack In-Reply-To: <20080910091236.GA12583@erix.ericsson.se> References: <20080909144351.GA13085@uk.tiscali.com> <48C75C3A.3030008@charpi.net> <20080910082825.GA7124@uk.tiscali.com> <20080910091236.GA12583@erix.ericsson.se> Message-ID: <20080910150014.GA13146@uk.tiscali.com> On Wed, Sep 10, 2008 at 11:12:36AM +0200, Raimo Niskanen wrote: > Then you would love: > Match_spec = [{'_',[],[{exception_trace}]}]. Nice. I need to start making a recipe page to copy-paste from. > There is acually an error in the dbg documentation here. The 'all's are > not the same. erlang:trace/3's 'all' is as documented, but dbg's 'all' is > [m,c,p,garbage_collection,running,sos,sofs,sol,sofl,timestamp,arity,return_to], > it's in the source. Ah I see it: lib/runtime_tools/src/dbg.erl all() -> [send,'receive',call,procs,garbage_collection,running, set_on_spawn,set_on_first_spawn,set_on_link,set_on_first_link, timestamp,arity,return_to]. > dbg:p(Regname, [m,c,p,sos,timestamp]) Also to go on the copy-paste page. Thanks again! Regards, Brian. From francesco@REDACTED Wed Sep 10 17:05:45 2008 From: francesco@REDACTED (Francesco Cesarini) Date: Wed, 10 Sep 2008 16:05:45 +0100 Subject: [erlang-questions] Change in Semantics in dbg:c ? In-Reply-To: <20080908140533.GC2810@erix.ericsson.se> References: <48C3A6C2.60202@erlang-consulting.com> <20080908140533.GC2810@erix.ericsson.se> Message-ID: <48C7E249.7050406@erlang-consulting.com> Hi Raimo, Thanks for the reply. > > Well, which behaviour do you actually prefer? It changed from R8B to R9B-1 > on request from guess who...You! > There were quite a few features, bugs and documentation issues I came across back then when going through it with a magnifying glass. This was one of them. My memory was GCed some time back, but from what I recall, using c/4 was interfering with other activities and not cleaning up the trace flags after itself (or clearing ones which were already set, or something which made me spend a day debugging dbg). What confused me this time was the comparison with the apply BIF. Not tracing side effects makes sense. In that case, I would probably not allow the sos and sol flags, as well as the p flags, but I am not too bothered about it. I guess it is as you say, stating it in the documentation. Take care, Francesco -- http://www.erlang-consulting.com From rick.richardson@REDACTED Wed Sep 10 22:52:03 2008 From: rick.richardson@REDACTED (Rick R) Date: Wed, 10 Sep 2008 16:52:03 -0400 Subject: [erlang-questions] Erlang - Postgresql Driver In-Reply-To: <14b0910a0809092121l1ec6b1a5yc180d23dd6036504@mail.gmail.com> References: <14b0910a0809092121l1ec6b1a5yc180d23dd6036504@mail.gmail.com> Message-ID: <9810b81b0809101352w15bd5123s935f5f76c8d00acb@mail.gmail.com> There is apparently a postgresql driver that is part of the ejabberd project. I'm not sure how good/fast it is, but others seem to like it. 2008/9/10 Murugathasan Murugiah > Hi, > > I used postgreSql database with Erlang by using erlang - postgresql driver > got from "erlang-consulting.com". > I need a higher rate of insertation with other basic operations. > > Is this driver support for this capacity? If any other alternatives? > > Thanks. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- An idea that is not dangerous is unworthy of being called an idea at all. -- Oscar Wilde -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Wed Sep 10 23:05:35 2008 From: vances@REDACTED (Vance Shipley) Date: Wed, 10 Sep 2008 17:05:35 -0400 Subject: [erlang-questions] Welcome to the mainstream Message-ID: <20080910210534.GG257@h216-235-12-173.host.egate.net> I found two copies of Joe's book on the shelves of a downtown Chapters book store. We have arrived! -Vance From goofyheadedpunk@REDACTED Thu Sep 11 01:01:51 2008 From: goofyheadedpunk@REDACTED (Brian Troutwine) Date: Wed, 10 Sep 2008 16:01:51 -0700 Subject: [erlang-questions] Problems Creating First Target System Message-ID: <971980cc0809101601v56c798e1sc0bdca2abddbe7df@mail.gmail.com> I'm following the OTP Design Principles document in creating my first release, but am having difficulties getting the system to boot properly. I would appreciate help in fixing my errors. Here is my .rel file: {release, {"Aule", "production-1"}, {erts, "5.6.3"}, [{kernel, "2.12.3"}, {stdlib, "1.15.3"}, {sasl, "2.1.5.3"}, {inets, "5.0.9"}, {ecouch, "0.1"}, {parse_app, "0.0.1"}, {dispatch, "0.0.1"}, {warehouse, "0.0.1"}, {a_interface, "0.0.1"}, {aule, "0.0.1"}]}. Following the guide I issue > systools:make_script("aule", [local]). and receive an aule.boot file. I then run $ erl -pa dispatch/ebin/ a_interface/ebin/ aule/ebin/ parse/ebin/ warehouse/ebin/ ../ecouch/ebin boot aule but only inets, ecouch, stdlib and kernel start. My custom applications (parse_app, dispatch, warehouse, a_interface and aule) do not start, though nothing stops me from starting them manually. When started manually the system runs appropriately. I do not understand why this has failed. Thanks, Brian From goofyheadedpunk@REDACTED Thu Sep 11 01:05:34 2008 From: goofyheadedpunk@REDACTED (Brian Troutwine) Date: Wed, 10 Sep 2008 16:05:34 -0700 Subject: [erlang-questions] Problems Creating First Target System In-Reply-To: <971980cc0809101601v56c798e1sc0bdca2abddbe7df@mail.gmail.com> References: <971980cc0809101601v56c798e1sc0bdca2abddbe7df@mail.gmail.com> Message-ID: <971980cc0809101605n475d6d43j6714f444f43966ab@mail.gmail.com> Slight addendum: On further inspection aule is started, though the remaining applications are not. On Wed, Sep 10, 2008 at 4:01 PM, Brian Troutwine wrote: > I'm following the OTP Design Principles document in creating my first > release, but am having difficulties getting the system to boot > properly. I would appreciate help in fixing my errors. Here is my .rel > file: > > {release, {"Aule", "production-1"}, {erts, "5.6.3"}, > [{kernel, "2.12.3"}, > {stdlib, "1.15.3"}, > {sasl, "2.1.5.3"}, > {inets, "5.0.9"}, > {ecouch, "0.1"}, > {parse_app, "0.0.1"}, > {dispatch, "0.0.1"}, > {warehouse, "0.0.1"}, > {a_interface, "0.0.1"}, > {aule, "0.0.1"}]}. > > Following the guide I issue > >> systools:make_script("aule", [local]). > > and receive an aule.boot file. I then run > > $ erl -pa dispatch/ebin/ a_interface/ebin/ aule/ebin/ parse/ebin/ > warehouse/ebin/ ../ecouch/ebin boot aule > > but only inets, ecouch, stdlib and kernel start. My custom > applications (parse_app, dispatch, warehouse, a_interface and aule) do > not start, though nothing stops me from starting them manually. When > started manually the system runs appropriately. I do not understand > why this has failed. > > Thanks, > Brian > -- Brian From l1nk2306@REDACTED Thu Sep 11 00:19:07 2008 From: l1nk2306@REDACTED (Yunita C) Date: Wed, 10 Sep 2008 15:19:07 -0700 (PDT) Subject: [erlang-questions] splitting string into to substring Message-ID: <659772.55564.qm@web38202.mail.mud.yahoo.com> Hi All, I am new to erlang and I want to write Erlang function that given a string and a pattern and uses the pattern to split the string into like this: For example if the pattern is "ab" and the string is "acabcabts" the code will return ["ac", "cabts"]. If the pattern is "bc" and the string is "bcad" the code returns ["", ad]. If the pattern is "ac" and the string is "bcad" the code will return ["bcad", ""]. I'm trying to make function using? list but still stuck there. Can anybody help me? Thank's so much. -------------- next part -------------- An HTML attachment was scrubbed... URL: From goofyheadedpunk@REDACTED Thu Sep 11 01:28:02 2008 From: goofyheadedpunk@REDACTED (Brian Troutwine) Date: Wed, 10 Sep 2008 16:28:02 -0700 Subject: [erlang-questions] Etop issues: Erlang top got garbage Message-ID: <971980cc0809101628m1605418g4def91b9f9585061@mail.gmail.com> I'm attempting to use etop to debug a memory issue I am having, but the output of etop is almost impossible to read. I get many, many messages of this sort: Erlang top got garbage {trace_ts,<4549.52.0>,out, {gen_server,loop,6}, {1221,89025,387602}} After searching a bit I found a post that mentioned the use of tracing will disturb etop, but I am not, to the best of my knowledge, using such things. How can I find what's making etop unusable? Is it possible simply to suppress these messages? Thanks, Brian From stondage123@REDACTED Thu Sep 11 01:51:22 2008 From: stondage123@REDACTED (Andrew Stone) Date: Wed, 10 Sep 2008 16:51:22 -0700 (PDT) Subject: [erlang-questions] splitting string into to substring Message-ID: <73559.94647.qm@web35905.mail.mud.yahoo.com> You can try string:tokens() -Andrew ----- Original Message ---- From: Yunita C To: erlang-questions@REDACTED Sent: Wednesday, September 10, 2008 6:19:07 PM Subject: [erlang-questions] splitting string into to substring Hi All, I am new to erlang and I want to write Erlang function that given a string and a pattern and uses the pattern to split the string into like this: For example if the pattern is "ab" and the string is "acabcabts" the code will return ["ac", "cabts"]. If the pattern is "bc" and the string is "bcad" the code returns ["", ad]. If the pattern is "ac" and the string is "bcad" the code will return ["bcad", ""]. I'm trying to make function using list but still stuck there. Can anybody help me? Thank's so much. -------------- next part -------------- An HTML attachment was scrubbed... URL: From headspin@REDACTED Thu Sep 11 04:32:42 2008 From: headspin@REDACTED (dda) Date: Thu, 11 Sep 2008 10:32:42 +0800 Subject: [erlang-questions] Erlang User Groups In-Reply-To: <48C7DF8B.4040206@erlang-consulting.com> References: <48C7DF8B.4040206@erlang-consulting.com> Message-ID: Are there any Erlangers in HK? I remember reading posts by a gentleman named Anthony Kong. Any others? -- Didier On Wed, Sep 10, 2008 at 10:54 PM, Francesco Cesarini wrote: > Hi All, > > there have been lots of emails about starting User groups all over. I > attended an interesting talk at OSCON, pretty much in conjunction with > all of these discussions... I finally managed to hear back fromt he > presenters with a link to their slides. > > http://www.baconandtech.com/?p=16 with notes on the slides from one of > the many bloggers here: http://www.networkworld.com/community/node/30268 > > Having kicked off the London User Group which currently meets up once a > month, with about 20 - 40 participants, and slowly putting together one > in Stockholm, the above talk pretty much covered it all.. Meet people, > listen to interesting presentations, and socialise. > > If you do set up your user group, make sure you list it on the wiki at > http://www.trapexit.org/ErlangUserGroups Currently, 10 user groups have > been added! > > Francesco > -- > http://www.erlang-consulting.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From chandrashekhar.mullaparthi@REDACTED Thu Sep 11 05:27:35 2008 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Thu, 11 Sep 2008 04:27:35 +0100 Subject: [erlang-questions] Problems Creating First Target System In-Reply-To: <971980cc0809101605n475d6d43j6714f444f43966ab@mail.gmail.com> References: <971980cc0809101601v56c798e1sc0bdca2abddbe7df@mail.gmail.com> <971980cc0809101605n475d6d43j6714f444f43966ab@mail.gmail.com> Message-ID: 2008/9/11 Brian Troutwine > Slight addendum: On further inspection aule is started, though the > remaining applications are not. what do the commands application:info() and application:which_applications() show? Also, can you send the SASL reports you get when you startup the node? Given that 'aule' is started, indicates that the node would've atleast tried to start the apps before it. When you say you can start them manually, does it mean you can start them using the application:start/1 command or some other means? If that is the case, it means you are missing the {mod, {Module, Args}} directive in the .app file of those apps. cheers Chandru > > On Wed, Sep 10, 2008 at 4:01 PM, Brian Troutwine > wrote: > > I'm following the OTP Design Principles document in creating my first > > release, but am having difficulties getting the system to boot > > properly. I would appreciate help in fixing my errors. Here is my .rel > > file: > > > > {release, {"Aule", "production-1"}, {erts, "5.6.3"}, > > [{kernel, "2.12.3"}, > > {stdlib, "1.15.3"}, > > {sasl, "2.1.5.3"}, > > {inets, "5.0.9"}, > > {ecouch, "0.1"}, > > {parse_app, "0.0.1"}, > > {dispatch, "0.0.1"}, > > {warehouse, "0.0.1"}, > > {a_interface, "0.0.1"}, > > {aule, "0.0.1"}]}. > > > > Following the guide I issue > > > >> systools:make_script("aule", [local]). > > > > and receive an aule.boot file. I then run > > > > $ erl -pa dispatch/ebin/ a_interface/ebin/ aule/ebin/ parse/ebin/ > > warehouse/ebin/ ../ecouch/ebin boot aule > > > > but only inets, ecouch, stdlib and kernel start. My custom > > applications (parse_app, dispatch, warehouse, a_interface and aule) do > > not start, though nothing stops me from starting them manually. When > > started manually the system runs appropriately. I do not understand > > why this has failed. > > > > Thanks, > > Brian > > > > > > -- > Brian > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Thu Sep 11 06:22:59 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 11 Sep 2008 16:22:59 +1200 Subject: [erlang-questions] splitting string into to substring In-Reply-To: <794_1221090937_m8ANtU6L013214_659772.55564.qm@web38202.mail.mud.yahoo.com> References: <794_1221090937_m8ANtU6L013214_659772.55564.qm@web38202.mail.mud.yahoo.com> Message-ID: On 11 Sep 2008, at 10:19 am, Yunita C wrote: > I am new to erlang and I want to write Erlang function that given a > string and a pattern and uses the pattern to split the string into > like this: If the pattern is then turns into [,,]. If only we had a function that would take and give us {,} or (with no ) and give us {} we could write split(List, Separator) -> case first_substring(List, Separator) of {First,Rest} -> [First | split(Rest, Separator)] ; {Only} -> [Only] end. Already we can see that split("", Sep) = [""] for any Sep. If only we had a function that would tell us if one list was a prefix of another, we could write the missing function: first_substring(List, Separator) -> first_substring_loop(List, Separator, []). first_substring_loop([], _, Reversed_First) -> {lists:reverse(Reversed_First)}; first_substring_loop(List = [Head|Tail], Separator, Reversed_First) -> case prefix_check(Separator, List) of no -> first_substring_loop(Tail, Separator, [Head| Reversed_First]) ; Suffix -> {lists:reverse(Reversed_First), Suffix} end. Writing prefix_check/2 isn't going to be hard. prefix_check([], List) -> List; prefix_check([Head|Prefix], [Head|List]) -> prefix_check(Prefix, List); prefix_check(_, _) -> no. I would have mentioned regexp:split/2, except that it gets the separator " " (one space) wrong. So I shan't. From rasmussen.bryan@REDACTED Thu Sep 11 10:08:15 2008 From: rasmussen.bryan@REDACTED (bryan rasmussen) Date: Thu, 11 Sep 2008 10:08:15 +0200 Subject: [erlang-questions] general questions for making large bookmarking site with Erlang Message-ID: <3bb44c6e0809110108x2dbb1600qa0ea6997903bb677@mail.gmail.com> Hi, It's been some time since I've had a chance to do anything with Erlang, now some friends and I have a project that we are starting work on and because of the extreme scalability and uptime that I think this project is going to require I want to use Erlang. The best way to describe it without actually describing what it is is to say that I am going to need to make basically what amounts to a bookmarking service like delicious. That's fine enough, but I have a fear that this service is going need to scale really big - let's suggest as many users as Delicious (but probably more as I have several innovations that I think will allow us to drain users from other bookmarking service), I expect that because of the innovations I am interested in introducing that our users will also use the site significantly more than the other bookmarking services,and it will probably also have days of extreme growth in the early days. I was going to ask about some of the ideas I had for doing this and provide more concrete details, but then I just realized that people would start responding to those ideas (stuff like Hypertable, Yaws etc.) Instead I think I would just like some ideas from people, what do you consider the best way that you would do this kind of thing (bookmarking service with large userbase and high usage) using Erlang, in which cases would you feel that you would step outside of Erlang (for example, if you want to use a particular database that doesn't have an already established Erlang api), and the reasons why this would be optimal. Cheers, Bryan Rasmussen From sh@REDACTED Thu Sep 11 10:37:45 2008 From: sh@REDACTED (=?iso-8859-1?Q?S=F8ren_Hilmer?=) Date: Thu, 11 Sep 2008 10:37:45 +0200 (CEST) Subject: [erlang-questions] splitting string into to substring In-Reply-To: <659772.55564.qm@web38202.mail.mud.yahoo.com> References: <659772.55564.qm@web38202.mail.mud.yahoo.com> Message-ID: <21228.193.3.141.121.1221122265.squirrel@www.widetrail.dk> What about something like this: -module(split). -export([split/2]). split(S,P) -> split_h (S,P,[]). split_h([],_P,H) -> {lists:reverse(H), []}; split_h(S,P,H) -> case lists:prefix(P,S) of true -> {lists:reverse(H), lists:nthtail(length(P),S)}; false -> [A|S2] = S, split_h(S2,P,[A|H]) end. -- S?ren Hilmer, M.Sc., M.Crypt. wideTrail Phone: +45 25481225 Pilev?nget 41 Email: sh@REDACTED DK-8961 Alling?bro Web: www.widetrail.dk On Thu, September 11, 2008 00:19, Yunita C wrote: > Hi All, > > > > > > I am new to erlang and I want to write Erlang function that given a > string and a pattern and uses the pattern to split the string into like > this: > > > > > For example if the pattern is "ab" and the string is "acabcabts" the code > will return ["ac", "cabts"]. > > > > > > If the pattern is "bc" and the string is "bcad" the code returns ["", ad]. > > > > > > If the pattern is "ac" and the string is "bcad" the code will return > ["bcad", ""]. > > > > > > I'm trying to make function using? list but still stuck there. Can anybody > help me? Thank's so much. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ville.h.tuulos@REDACTED Thu Sep 11 11:15:47 2008 From: ville.h.tuulos@REDACTED (Ville H Tuulos) Date: Thu, 11 Sep 2008 02:15:47 -0700 Subject: [erlang-questions] [ANN] Map/Reduce in Erlang and Python - Disco 0.1 Message-ID: <48C8E1C3.1090900@nokia.com> Hi all, I am happy to announce the availability of Disco (as already featured in Reddit, Hacker News etc.), an open-source implementation of the Map/Reduce framework for distributed computing. Its core is written in Erlang but users typically write jobs in Python. Find the project site at http://discoproject.org or see the source code right away at http://github.com/tuulos/disco/tree/master We at Nokia Research in Palo Alto have been using it successfully for data mining, building probabilistic models, and full-text indexing of hundreds of gigabytes of real-world data on hundreds of CPUs in parallel. If you don't have a spare cluster available, we provide a script that sets up a working cluster automatically on the Amazon's EC2 cloud. It has been a pleasure to use Erlang to implement the job scheduler and other core components of the system. It uses SCGI to provide a web interface through an external web server, the slave module to start Erlang VMs on slave nodes, and normal port commands to launch Python workers on the nodes. Disco is released under the BSD license. The system is still young, there are known bugs, and there is still work to be done on scalability issues as well. You're very welcome to try out the system, give feedback, and develop the system with us. I'll be at the ICFP / Erlang Workshop in Victoria, so if you're attending I'd be happy to show a demo and have a chat with you about Disco. Ville Tuulos Member of Research Staff Nokia Research Center Palo Alto From als@REDACTED Thu Sep 11 11:56:03 2008 From: als@REDACTED (Anthony Shipman) Date: Thu, 11 Sep 2008 19:56:03 +1000 Subject: [erlang-questions] 12B4 dialyzer problem 2 Message-ID: <200809111956.03645.als@iinet.net.au> I have a gen_server with a state record specified as: -record(state, { parent :: pid(), strmID :: integer(), .... }). -type state() :: #state{}. It is initialised in my init() function like: State = #state{ parent = Parent, strmID = StrmID, .... } and then threaded through the handle_* functions which reaches this code: cancelCall(State) -> streamIface:specialToDevice(State#state.parent, State#state.strmID, streamClose), I get this error from dialyzer: stream_reman.erl:576: The call streamIface:specialToDevice('undefined' | pid(),'undefined' | integer(),'streamClose') breaks the contract (serverRef(),integer(),specialCtrl()) -> 'ok' It appears that dialyzer can't prove that the parent and strmID fields can never be undefined. This isn't surprising. But I expected that dialyzer would accept the declaration parent:: pid(), to tell it that the field is never undefined. If I am going to get this problem everywhere I use this basic gen_server idiom then dialyzer is going to give me lots and lots of false negatives. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From als@REDACTED Thu Sep 11 12:17:39 2008 From: als@REDACTED (Anthony Shipman) Date: Thu, 11 Sep 2008 20:17:39 +1000 Subject: [erlang-questions] 12B4 dialyzer problem 3 Message-ID: <200809112017.39163.als@iinet.net.au> In a simple non-gen_server I have this state: -record(callState, { parent :: pid(), deviceID :: integer(), % the device we are making the call for ......... abort :: bool(), callTag % reference(), a private signal }). -type state() :: #callState{}. This start code: State = #callState { parent = Parent, deviceID = DeviceID, .............. abort = false, callTag = make_ref() }, spawn_link(?MODULE, enter, [State]). and a loop with this layout: -spec loopWS(state(), ref()) -> no_return(). loopWS(State, RingTag) -> receive ............... {result, Error} -> case State#callState.abort of true -> exit(abort); false -> ........ S1 = State#callState{retryCount = Count - 1}, loopDelay(S1); ......... end; abort -> loopWS(State#callState{abort = true}, RingTag); .... end where loopDelay makes a tail call back to loopWS. Dialyzer gives me this error: caller.erl:234: The call caller:loopWS(#callState{abort::'true'},RingTag::ref()) will fail since it differs in argument position 1 from the success typing arguments: (#callState{retryCount::pos_integer(),abort::'false'},ref()) It seems to have decided already that the abort field can only ever be false so my attempt to set it to true is bad. The success typing seems to describe the type of S1 which has looped back to the type of the first argument to loopWS(). This looks like a bug in the reasoning to me. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From als@REDACTED Thu Sep 11 12:22:44 2008 From: als@REDACTED (Anthony Shipman) Date: Thu, 11 Sep 2008 20:22:44 +1000 Subject: [erlang-questions] 12B4 dialyzer problem 4 Message-ID: <200809112022.44748.als@iinet.net.au> I have some functions in a gen_server: enableConnecting(State, T) -> {ok, TRef} = timer:send_after(T, State#state.timerRef), State#state{timer = TRef}. disableConnecting(State) -> case State#state.timer of undefined -> State; (285) TRef -> timer:cancel(TRef), State#state{timer = undefined} end. Dialyzer says muConnector.erl:285: The variable TRef can never match since previous clauses completely covered the type 'undefined' enableConnecting() is definitely reachable so how can this be so? -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From als@REDACTED Thu Sep 11 12:34:56 2008 From: als@REDACTED (Anthony Shipman) Date: Thu, 11 Sep 2008 20:34:56 +1000 Subject: [erlang-questions] 12B4 ODBC problem Message-ID: <200809112034.56347.als@iinet.net.au> There is code in odbc:init() to automatically determine whether to use IPV6 or IPV4. Inet = case inet:getaddr("localhost", inet6) of {ok, {_,_,_,_}} -> inet; {ok, {0, 0, 0, 0, 0, 16#ffff, _, _}} -> inet; {ok, {_,_,_,_,_,_,_,_}} -> inet6; _ -> inet end, Unless I have /etc/hosts fixed just right then this makes a DNS query for localhost in a number of domains. This can delay the startup for quite a few seconds and it's no fun trying to figure out why. How about adding an option {inet, ipv4 | ipv6 | auto} with ipv4 the default for compatibility with most installations? -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From kostis@REDACTED Thu Sep 11 12:41:30 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 11 Sep 2008 13:41:30 +0300 Subject: [erlang-questions] 12B4 dialyzer problem 2 In-Reply-To: <200809111956.03645.als@iinet.net.au> References: <200809111956.03645.als@iinet.net.au> Message-ID: <48C8F5DA.2090509@cs.ntua.gr> Anthony Shipman wrote: > I have a gen_server with a state record specified as: > > .... SNIP ... > > I get this error from dialyzer: > > stream_reman.erl:576: The call streamIface:specialToDevice('undefined' | > pid(),'undefined' | integer(),'streamClose') > breaks the contract (serverRef(),integer(),specialCtrl()) -> 'ok' > > It appears that dialyzer can't prove that the parent and strmID fields can > never be undefined. This isn't surprising. Yes, this is not surprising and indeed Dialyzer does not have any analysis that allows it to prove that record fields cannot have some value. But this is NOT the problem here. The error you get is: - either because serverRef() does not include pid() in its definition - or because specialCtrl() does not include the atom 'streamClose' It has nothing to do with 'undefined'. I suggest you take a closer look at these types. However, the following is very interesting: > But I expected that dialyzer would accept the declaration > parent :: pid(), > to tell it that the field is never undefined. Type declarations in record fields have an implicit 'undefined' in them, unless there is an explicit initialization of the field, as e.g. in something like: parent = self() :: pid() Kostis From tobias.lindahl@REDACTED Thu Sep 11 12:55:56 2008 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Thu, 11 Sep 2008 12:55:56 +0200 Subject: [erlang-questions] 12B4 dialyzer problem 2 In-Reply-To: <200809111956.03645.als@iinet.net.au> References: <200809111956.03645.als@iinet.net.au> Message-ID: <48C8F93C.3000506@it.uu.se> Hi Anthony, Anthony Shipman wrote: > > It appears that dialyzer can't prove that the parent and strmID fields can > never be undefined. This isn't surprising. But I expected that dialyzer would > accept the declaration > parent:: pid(), > to tell it that the field is never undefined. Currently, the only way to say that a field cannot contain 'undefined' is to have a default value in the record declaration. The reason is that all record constructions must follow the type declarations, and if you construct an empty record without a default value the type must also allow 'undefied'. > > If I am going to get this problem everywhere I use this basic gen_server idiom > then dialyzer is going to give me lots and lots of false negatives. > If Dialyzer reports a false positive, then this is a bug. You do not include the contract for streamIface:specialToDevice/3, so I can't determine if it is a false positive. Dialyzer should not complain unless one of the arguments is _totally_ incompatible with the contract, i.e., the argument type and the contract type has no intersection. Tobias From kostis@REDACTED Thu Sep 11 13:03:15 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 11 Sep 2008 14:03:15 +0300 Subject: [erlang-questions] 12B4 dialyzer problem 2 In-Reply-To: <200809112054.12272.als@iinet.net.au> References: <200809111956.03645.als@iinet.net.au> <48C8F5DA.2090509@cs.ntua.gr> <200809112054.12272.als@iinet.net.au> Message-ID: <48C8FAF3.3010004@cs.ntua.gr> Anthony Shipman wrote: > > Does this mean that the 'undefined|...' is overlooked by dialyzer when type > matching? Nope. As I wrote in my previous mail, it has nothing to do with 'undefined'. This value has no special treatment by Dialyzer; it's just an atom. It just means than in a message like: stream_reman.erl:576: The call streamIface:specialToDevice('undefined' | pid(),'undefined' | integer(),'streamClose') breaks the contract (serverRef(),integer(),specialCtrl()) -> 'ok' the problem cannot possibly be in the second argument because the type of this argument in the call, namely integer(), is compatible (i.e. a subtype) of the corresponding argument in the success typing ('undefined' | integer()). Kostis From tobias.lindahl@REDACTED Thu Sep 11 13:06:31 2008 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Thu, 11 Sep 2008 13:06:31 +0200 Subject: [erlang-questions] 12B4 dialyzer problem 3 In-Reply-To: <200809112017.39163.als@iinet.net.au> References: <200809112017.39163.als@iinet.net.au> Message-ID: <48C8FBB7.3060007@it.uu.se> Anthony Shipman wrote: > In a simple non-gen_server I have this state: > > -record(callState, { > parent :: pid(), > deviceID :: integer(), % the device we are making the call for > ......... > abort :: bool(), > callTag % reference(), a private signal > }). > > -type state() :: #callState{}. > > This start code: > > State = #callState { > parent = Parent, > deviceID = DeviceID, > .............. > abort = false, > callTag = make_ref() > }, > spawn_link(?MODULE, enter, [State]). > > and a loop with this layout: > > -spec loopWS(state(), ref()) -> no_return(). > > loopWS(State, RingTag) -> > receive > ............... > {result, Error} -> > case State#callState.abort of > true -> > exit(abort); > false -> > ........ > S1 = State#callState{retryCount = Count - 1}, > loopDelay(S1); > ......... > end; > > abort -> > loopWS(State#callState{abort = true}, RingTag); > > .... > end > > where loopDelay makes a tail call back to loopWS. > > Dialyzer gives me this error: > > caller.erl:234: The call > caller:loopWS(#callState{abort::'true'},RingTag::ref()) will fail since it > differs in argument position 1 from the success typing arguments: > (#callState{retryCount::pos_integer(),abort::'false'},ref()) > > It seems to have decided already that the abort field can only ever be false > so my attempt to set it to true is bad. > > The success typing seems to describe the type of S1 which has looped back to > the type of the first argument to loopWS(). This looks like a bug in the > reasoning to me. Yes, this is a suspicious warning, and I wish I could fix it, but I probably will not (at least not in the near future) The success typing of your function can never return when you set abort to true, thus the Dialyzer warning is correct. However, you clearly intend the call to be allowed, so the warning should not be there. It is a hard problem to distinguish between deliberate calls that should not return and the ones that are there by mistake. The solution is to add an abort function that wraps the exit(abort) and tells Dialyzer to accept the call. -spec(abort/2 :: () -> no_return()). abort() -> exit(abort). Tobias PS I am not completely sure why you want to go another round in the loop before the aborting, but there might be good reasons not included in the code. From als@REDACTED Thu Sep 11 13:08:29 2008 From: als@REDACTED (Anthony Shipman) Date: Thu, 11 Sep 2008 21:08:29 +1000 Subject: [erlang-questions] 12B4 dialyzer problem 2 In-Reply-To: <48C8F93C.3000506@it.uu.se> References: <200809111956.03645.als@iinet.net.au> <48C8F93C.3000506@it.uu.se> Message-ID: <200809112108.29582.als@iinet.net.au> On Thu, 11 Sep 2008 08:55:56 pm Tobias Lindahl wrote: > If Dialyzer reports a false positive, then this is a bug. You do not > include the contract for streamIface:specialToDevice/3, so I can't > determine if it is a false positive. Dialyzer should not complain unless > one of the arguments is _totally_ incompatible with the contract, i.e., > the argument type and the contract type has no intersection. > > Tobias A previous responder showed me that the third argument was wrong. I had mistyped the atom. So this is a win for dialyzer. I'm a little worried if you say dialyzer won't complain unless the intersection is empty. I think that it should be silent if the argument type is a subset of the contract type, otherwise complain. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From kostis@REDACTED Thu Sep 11 13:10:23 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 11 Sep 2008 14:10:23 +0300 Subject: [erlang-questions] 12B4 dialyzer problem 4 In-Reply-To: <200809112022.44748.als@iinet.net.au> References: <200809112022.44748.als@iinet.net.au> Message-ID: <48C8FC9F.6030400@cs.ntua.gr> Anthony Shipman wrote: > I have some functions in a gen_server: > > ... SNIP ... > > Dialyzer says > > muConnector.erl:285: The variable TRef can never match since previous clauses > completely covered the type 'undefined' > > enableConnecting() is definitely reachable so how can this be so? With the information you have provided, we cannot possibly answer this question -- at least I can't. Please send the complete program. Also, Dialyzer warnings often tend to have cascading effects. If the module you are dialyzing has other warnings, I suggest you first concentrate on them. Kostis From als@REDACTED Thu Sep 11 11:45:52 2008 From: als@REDACTED (Anthony Shipman) Date: Thu, 11 Sep 2008 19:45:52 +1000 Subject: [erlang-questions] 12B4 dialyzer problem 1 Message-ID: <200809111945.52959.als@iinet.net.au> I get this each time my plt is updated: {"init terminating in do_boot",{{case_clause,{ok,2}},[{dialyzer,plain_cl,0}, {init,start_it,1},{init,start_em,1}]}} build/dial: line 53: 19765 Segmentation fault dialyzer --plt $PLT $DARGS The problem code appears to be in dialyzer.erl somewhere near line 70 where the case doesn't test all return codes. case cl_check_init(Opts) of {error, _} = Error -> cl_halt(Error, Opts); {ok, ?RET_NOTHING_SUSPICIOUS} -> cl_halt(cl(Opts), Opts) end; -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From tobias.lindahl@REDACTED Thu Sep 11 13:55:42 2008 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Thu, 11 Sep 2008 13:55:42 +0200 Subject: [erlang-questions] 12B4 dialyzer problem 1 In-Reply-To: <200809111945.52959.als@iinet.net.au> References: <200809111945.52959.als@iinet.net.au> Message-ID: <48C9073E.6000606@it.uu.se> Thanks, I'll have a look at this. Tobias Anthony Shipman wrote: > I get this each time my plt is updated: > > {"init terminating in do_boot",{{case_clause,{ok,2}},[{dialyzer,plain_cl,0}, > {init,start_it,1},{init,start_em,1}]}} > > build/dial: line 53: 19765 Segmentation fault dialyzer --plt $PLT $DARGS > > The problem code appears to be in dialyzer.erl somewhere near line 70 where > the case doesn't test all return codes. > > case cl_check_init(Opts) of > {error, _} = Error -> cl_halt(Error, Opts); > {ok, ?RET_NOTHING_SUSPICIOUS} -> > cl_halt(cl(Opts), Opts) > end; > From alexander.uvarov@REDACTED Thu Sep 11 13:58:37 2008 From: alexander.uvarov@REDACTED (Alexander) Date: Thu, 11 Sep 2008 17:58:37 +0600 Subject: [erlang-questions] Erlang - Postgresql Driver In-Reply-To: <9810b81b0809101352w15bd5123s935f5f76c8d00acb@mail.gmail.com> References: <14b0910a0809092121l1ec6b1a5yc180d23dd6036504@mail.gmail.com> <9810b81b0809101352w15bd5123s935f5f76c8d00acb@mail.gmail.com> Message-ID: <200809111758.37882.alexander.uvarov@gmail.com> On Thursday 11 September 2008 02:52:03 Rick R wrote: > There is apparently a postgresql driver that is part of the ejabberd > project. > I'm not sure how good/fast it is, but others seem to like it. > Driver from process-one does not support NULL values in result set. Appropriate ticket https://support.process-one.net/browse/EJAB-443 marked as resolved, but actually has not. From als@REDACTED Thu Sep 11 12:54:12 2008 From: als@REDACTED (Anthony Shipman) Date: Thu, 11 Sep 2008 20:54:12 +1000 Subject: [erlang-questions] 12B4 dialyzer problem 2 In-Reply-To: <48C8F5DA.2090509@cs.ntua.gr> References: <200809111956.03645.als@iinet.net.au> <48C8F5DA.2090509@cs.ntua.gr> Message-ID: <200809112054.12272.als@iinet.net.au> On Thu, 11 Sep 2008 08:41:30 pm Kostis Sagonas wrote: > Yes, this is not surprising and indeed Dialyzer does not have any > analysis that allows it to prove that record fields cannot have some > value. ?But this is NOT the problem here. > > The error you get is: > > ? - either because serverRef() does not include pid() in its definition > ? - or because specialCtrl() does not include the atom 'streamClose' > > It has nothing to do with 'undefined'. ?I suggest you take a closer look > at these types. Aha. Yes the atom should have been 'streamClosed'. Thanks Does this mean that the 'undefined|...' is overlooked by dialyzer when type matching? -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From kostis@REDACTED Thu Sep 11 14:20:49 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 11 Sep 2008 15:20:49 +0300 Subject: [erlang-questions] 12B4 dialyzer problem 4 In-Reply-To: <200809112022.44748.als@iinet.net.au> References: <200809112022.44748.als@iinet.net.au> Message-ID: <48C90D21.4050704@cs.ntua.gr> Anthony Shipman wrote: > I have some functions in a gen_server: > > enableConnecting(State, T) -> > {ok, TRef} = timer:send_after(T, State#state.timerRef), > State#state{timer = TRef}. > > disableConnecting(State) -> > case State#state.timer of > undefined -> > State; > > (285) TRef -> > timer:cancel(TRef), > State#state{timer = undefined} > end. > > Dialyzer says > > muConnector.erl:285: The variable TRef can never match since previous clauses > completely covered the type 'undefined' > > enableConnecting() is definitely reachable so how can this be so? > [... Anthony has sent me his complete program in a private mail ...] In that program I see that disableConnecting/1 is a function which is local to the module; it's not exported. The only place where it is called is in a function which reads: onUp(State) -> #state{locn = Locn, subscribers = Subs, isUp = Up, waiters = W} = State, S1 = if not Up -> %% ?INFO_("muConnector: MU is up"), lists:foreach(fun(Sub) -> Sub!{muUp, Locn} end, Subs), lists:foreach(fun(From) -> gen_server:reply(From, ok) end, W), State#state{isUp = true, waiters = []}; true -> State end, disableConnecting(S1). If one looks closely in this function, she can observe that the 'timer' field is never initialized so it defaults to 'undefined'. This happens on all paths to the disableConnecting(S1) call. Dialyzer has every right to claim that State#state.timer will always be 'undefined' and the second clause (with TRef) will never be reached. One more subtle bug uncovered. Kostis From mats.cronqvist@REDACTED Thu Sep 11 14:25:41 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 11 Sep 2008 14:25:41 +0200 Subject: [erlang-questions] Memory usage In-Reply-To: <48C6CF97.5070309@erlang-consulting.com> References: <48C6CF97.5070309@erlang-consulting.com> Message-ID: <48C90E45.4050305@gmail.com> Francesca Gangemi wrote: > Hi, > > we notice that nodes crash during a load test because they cannot > allocate more memory. > The slogan from the crash dump says > "eheap_alloc: Cannot allocate 3328160 bytes of memory (of type old_heap")." > try logging the output of erlang:system_info(allocated_areas) every 10 sec or so. should give you a handle on what's going on. mats From klacke@REDACTED Thu Sep 11 15:35:01 2008 From: klacke@REDACTED (Claes Wikstrom) Date: Thu, 11 Sep 2008 15:35:01 +0200 Subject: [erlang-questions] Memory usage In-Reply-To: <8209f740809091357t7297d906j3305e9c3b7659002@mail.gmail.com> References: <48C6CF97.5070309@erlang-consulting.com> <8209f740809091329pb24dd54p7e35615fdb3fd2b4@mail.gmail.com> <48C6E119.8030207@erlang-consulting.com> <8209f740809091357t7297d906j3305e9c3b7659002@mail.gmail.com> Message-ID: <48C91E85.6000706@hyber.org> Ulf Wiger wrote: > It's late, and since you're still up and about (and the ERTS experts perhaps > aren't), I'll take a wild stab and suggest that it has something to do with > generational GC etc. The process_info(P,heap_size) only looks at the > youngest heap, so it misses all data on the old heap. > There is also the process_info(P, memory) to consider. {memory, Size}: Size is the size of the process in bytes. This includes call stack, heap and internal structures. /klacke From francesca@REDACTED Thu Sep 11 15:39:53 2008 From: francesca@REDACTED (Francesca Gangemi) Date: Thu, 11 Sep 2008 15:39:53 +0200 Subject: [erlang-questions] Memory usage In-Reply-To: <48C91E85.6000706@hyber.org> References: <48C6CF97.5070309@erlang-consulting.com> <8209f740809091329pb24dd54p7e35615fdb3fd2b4@mail.gmail.com> <48C6E119.8030207@erlang-consulting.com> <8209f740809091357t7297d906j3305e9c3b7659002@mail.gmail.com> <48C91E85.6000706@hyber.org> Message-ID: <48C91FA9.2020400@erlang-consulting.com> Claes Wikstrom wrote: > Ulf Wiger wrote: >> It's late, and since you're still up and about (and the ERTS experts >> perhaps >> aren't), I'll take a wild stab and suggest that it has something to >> do with >> generational GC etc. The process_info(P,heap_size) only looks at the >> youngest heap, so it misses all data on the old heap. >> > > > There is also the process_info(P, memory) to consider. > > {memory, Size}: > Size is the size of the process in bytes. This > includes > call stack, heap and internal structures. > > > /klacke Thanks for the suggestions. Apparently there is a lot of memory ~2GB used by processes that is not stack or heap (young), we'll monitor the system to find out where it's used. Francesca From exta7@REDACTED Thu Sep 11 17:10:28 2008 From: exta7@REDACTED (Zvi) Date: Thu, 11 Sep 2008 08:10:28 -0700 (PDT) Subject: [erlang-questions] [ANN] Map/Reduce in Erlang and Python - Disco 0.1 In-Reply-To: <48C8E1C3.1090900@nokia.com> References: <48C8E1C3.1090900@nokia.com> Message-ID: <19436494.post@talk.nabble.com> Hi, nice work, It's not clear from the FAQ, if it's possible to write map and reduce functions in other languages, except Python. Can they be implemented in native Erlang and/or C/C++ compiled executable? thanks, Zvi Ville H Tuulos wrote: > > > Hi all, > > I am happy to announce the availability of Disco (as already featured in > Reddit, Hacker News etc.), an open-source implementation of the > Map/Reduce framework for distributed computing. Its > core is written in Erlang but users typically write jobs in Python. > > Find the project site at > > http://discoproject.org > > or see the source code right away at > > http://github.com/tuulos/disco/tree/master > > We at Nokia Research in Palo Alto have been using it successfully for > data mining, building probabilistic models, and full-text indexing of > hundreds of gigabytes of real-world data on hundreds of CPUs in > parallel. If you don't have a spare cluster available, we provide a > script that sets up a working cluster automatically on the Amazon's EC2 > cloud. > > It has been a pleasure to use Erlang to implement the job scheduler > and other core components of the system. It uses SCGI to provide a web > interface through an external web server, the slave module to start > Erlang VMs on slave nodes, and normal port commands to launch Python > workers on the nodes. > > Disco is released under the BSD license. The system is still young, > there are known bugs, and there is still work to be done on scalability > issues as well. You're very welcome to try out the system, give > feedback, and develop the system with us. > > I'll be at the ICFP / Erlang Workshop in Victoria, so if you're > attending I'd be happy to show a demo and have a chat with you about > Disco. > > > Ville Tuulos > Member of Research Staff > Nokia Research Center > Palo Alto > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/-ANN--Map-Reduce-in-Erlang-and-Python---Disco-0.1-tp19431063p19436494.html Sent from the Erlang Questions mailing list archive at Nabble.com. From als@REDACTED Thu Sep 11 17:38:37 2008 From: als@REDACTED (Anthony Shipman) Date: Fri, 12 Sep 2008 01:38:37 +1000 Subject: [erlang-questions] 12B4 dialyzer problem 4 In-Reply-To: <48C90D21.4050704@cs.ntua.gr> References: <200809112022.44748.als@iinet.net.au> <48C90D21.4050704@cs.ntua.gr> Message-ID: <200809120138.37167.als@iinet.net.au> On Thu, 11 Sep 2008 10:20:49 pm Kostis Sagonas wrote: > If one looks closely in this function, she can observe that the 'timer' > field is never initialized so it defaults to 'undefined'. ?This happens > on all paths to the disableConnecting(S1) call. > > Dialyzer has every right to claim that State#state.timer will always be > 'undefined' and the second clause (with TRef) will never be reached. > > One more subtle bug uncovered. > > Kostis Excellent. I've been staring at that for months since the 11B dialyzer complained as well. A one-line change some time ago made a whole function unreachable. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From als@REDACTED Thu Sep 11 17:45:30 2008 From: als@REDACTED (Anthony Shipman) Date: Fri, 12 Sep 2008 01:45:30 +1000 Subject: [erlang-questions] encapsulating types and dialyzer Message-ID: <200809120145.30587.als@iinet.net.au> Suppose I have a module MC that implements a collection type known as coll(). Internally this is some record that I want to be private to the module. The external functions in the interface mention the type coll(). So the clients of the interface must also mention coll() if dialyzer is to check the types. As far as I can see the only way to do this is to put the coll() type into a .hrl file. This exposes the record definition, and recursively every other type that it depends on. Is there a better way to do this? C at least allows me to declare a type abstractly typedef struct private* coll; while leaving private undefined everywhere except in the implementing module. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From bob@REDACTED Thu Sep 11 18:15:54 2008 From: bob@REDACTED (Bob Ippolito) Date: Thu, 11 Sep 2008 09:15:54 -0700 Subject: [erlang-questions] [ANN] Map/Reduce in Erlang and Python - Disco 0.1 In-Reply-To: <48C8E1C3.1090900@nokia.com> References: <48C8E1C3.1090900@nokia.com> Message-ID: <6a36e7290809110915m2bb57baaw62a3f1183993b299@mail.gmail.com> Why the choice of SCGI? It seems like it would be a lot simpler not to require an external web server. Erlang does HTTP on its own pretty well, in my experience :) On Thu, Sep 11, 2008 at 2:15 AM, Ville H Tuulos wrote: > > Hi all, > > I am happy to announce the availability of Disco (as already featured in > Reddit, Hacker News etc.), an open-source implementation of the > Map/Reduce framework for distributed computing. Its > core is written in Erlang but users typically write jobs in Python. > > Find the project site at > > http://discoproject.org > > or see the source code right away at > > http://github.com/tuulos/disco/tree/master > > We at Nokia Research in Palo Alto have been using it successfully for > data mining, building probabilistic models, and full-text indexing of > hundreds of gigabytes of real-world data on hundreds of CPUs in > parallel. If you don't have a spare cluster available, we provide a > script that sets up a working cluster automatically on the Amazon's EC2 > cloud. > > It has been a pleasure to use Erlang to implement the job scheduler > and other core components of the system. It uses SCGI to provide a web > interface through an external web server, the slave module to start > Erlang VMs on slave nodes, and normal port commands to launch Python > workers on the nodes. > > Disco is released under the BSD license. The system is still young, > there are known bugs, and there is still work to be done on scalability > issues as well. You're very welcome to try out the system, give > feedback, and develop the system with us. > > I'll be at the ICFP / Erlang Workshop in Victoria, so if you're > attending I'd be happy to show a demo and have a chat with you about Disco. > > > Ville Tuulos > Member of Research Staff > Nokia Research Center > Palo Alto > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From kostis@REDACTED Thu Sep 11 18:56:17 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 11 Sep 2008 19:56:17 +0300 Subject: [erlang-questions] encapsulating types and dialyzer In-Reply-To: <200809120145.30587.als@iinet.net.au> References: <200809120145.30587.als@iinet.net.au> Message-ID: <48C94DB1.1040202@cs.ntua.gr> Anthony Shipman wrote: > Suppose I have a module MC that implements a collection type known as coll(). > Internally this is some record that I want to be private to the module. > > The external functions in the interface mention the type coll(). So the > clients of the interface must also mention coll() if dialyzer is to check the > types. > > As far as I can see the only way to do this is to put the coll() type into > a .hrl file. This exposes the record definition, and recursively every other > type that it depends on. > > Is there a better way to do this? In the HiPE group, we have had extensive discussions about this issue. The solution we came up with is to allow module-qualified types, as in mc:col(), which can then be used in other modules. This works in R12B-4 but not in any previous version. Currently, all types defined in a module are also implicitly exported -- this might change in a future version and modules might need to declare their exported types. Kostis PS. I should point out that the language of types and -spec declarations is currently an EEP. Officially, it is not part of Erlang yet. From ville.h.tuulos@REDACTED Thu Sep 11 20:00:33 2008 From: ville.h.tuulos@REDACTED (Ville H Tuulos) Date: Thu, 11 Sep 2008 11:00:33 -0700 Subject: [erlang-questions] [ANN] Map/Reduce in Erlang and Python - Disco 0.1 In-Reply-To: <6a36e7290809110915m2bb57baaw62a3f1183993b299@mail.gmail.com> References: <48C8E1C3.1090900@nokia.com> <6a36e7290809110915m2bb57baaw62a3f1183993b299@mail.gmail.com> Message-ID: <48C95CC1.70803@nokia.com> ext Bob Ippolito wrote: > Why the choice of SCGI? It seems like it would be a lot simpler not to > require an external web server. Erlang does HTTP on its own pretty > well, in my experience :) Thanks Bob for the comment (: I have used Mochiweb quite happily(*) in another Erlang project of mine. There are people already working on Disco to make it work with Mochiweb. The web server is mainly used to serve large files to workers; SCGI is just used to forward control requests to the Erlang process. Using an external web server for IO intensive jobs was a safe choice in the first place. I'd be happy to replace it with, say, Mochiweb, if it handle the load. Ville (*) I think I had a problem with Mochiweb: It uses the raw mode for sockets, and it seems that there's a 16M limit for gen_tcp:recv() in that case: http://www.erlang.org/pipermail/erlang-questions/2006-September/022907.html If I remember correctly, this caused any HTTP POST requests larger than 16M fail. Please correct me if I'm wrong. > > On Thu, Sep 11, 2008 at 2:15 AM, Ville H Tuulos > wrote: >> Hi all, >> >> I am happy to announce the availability of Disco (as already featured in >> Reddit, Hacker News etc.), an open-source implementation of the >> Map/Reduce framework for distributed computing. Its >> core is written in Erlang but users typically write jobs in Python. >> >> Find the project site at >> >> http://discoproject.org >> >> or see the source code right away at >> >> http://github.com/tuulos/disco/tree/master >> >> We at Nokia Research in Palo Alto have been using it successfully for >> data mining, building probabilistic models, and full-text indexing of >> hundreds of gigabytes of real-world data on hundreds of CPUs in >> parallel. If you don't have a spare cluster available, we provide a >> script that sets up a working cluster automatically on the Amazon's EC2 >> cloud. >> >> It has been a pleasure to use Erlang to implement the job scheduler >> and other core components of the system. It uses SCGI to provide a web >> interface through an external web server, the slave module to start >> Erlang VMs on slave nodes, and normal port commands to launch Python >> workers on the nodes. >> >> Disco is released under the BSD license. The system is still young, >> there are known bugs, and there is still work to be done on scalability >> issues as well. You're very welcome to try out the system, give >> feedback, and develop the system with us. >> >> I'll be at the ICFP / Erlang Workshop in Victoria, so if you're >> attending I'd be happy to show a demo and have a chat with you about Disco. >> >> >> Ville Tuulos >> Member of Research Staff >> Nokia Research Center >> Palo Alto >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > From ville.h.tuulos@REDACTED Thu Sep 11 20:55:10 2008 From: ville.h.tuulos@REDACTED (Ville H Tuulos) Date: Thu, 11 Sep 2008 11:55:10 -0700 Subject: [erlang-questions] [ANN] Map/Reduce in Erlang and Python - Disco 0.1 In-Reply-To: <19436494.post@talk.nabble.com> References: <48C8E1C3.1090900@nokia.com> <19436494.post@talk.nabble.com> Message-ID: <48C9698E.70909@nokia.com> ext Zvi wrote: > nice work, > It's not clear from the FAQ, if it's possible to write map and reduce > functions in other languages, except Python. Can they be implemented in > native Erlang and/or C/C++ compiled executable? Yes. There's an external interface for that purpose: http://discoproject.org/doc/external.html However, this approach still uses Python as a middleman so it's mainly useful for implementing CPU-intensive tasks in C/C++/OCaml etc. It is possible to get rid of Python totally and replace it with another language without changing anything in the Disco's Erlang core. No one has tried that yet --- feel free to be the first (: For a pure Erlang Map/Reduce implementation, you can use something considerably simpler than Disco, like we know from "Programming Erlang". Ville > Ville H Tuulos wrote: >> >> Hi all, >> >> I am happy to announce the availability of Disco (as already featured in >> Reddit, Hacker News etc.), an open-source implementation of the >> Map/Reduce framework for distributed computing. Its >> core is written in Erlang but users typically write jobs in Python. >> >> Find the project site at >> >> http://discoproject.org >> >> or see the source code right away at >> >> http://github.com/tuulos/disco/tree/master >> >> We at Nokia Research in Palo Alto have been using it successfully for >> data mining, building probabilistic models, and full-text indexing of >> hundreds of gigabytes of real-world data on hundreds of CPUs in >> parallel. If you don't have a spare cluster available, we provide a >> script that sets up a working cluster automatically on the Amazon's EC2 >> cloud. >> >> It has been a pleasure to use Erlang to implement the job scheduler >> and other core components of the system. It uses SCGI to provide a web >> interface through an external web server, the slave module to start >> Erlang VMs on slave nodes, and normal port commands to launch Python >> workers on the nodes. >> >> Disco is released under the BSD license. The system is still young, >> there are known bugs, and there is still work to be done on scalability >> issues as well. You're very welcome to try out the system, give >> feedback, and develop the system with us. >> >> I'll be at the ICFP / Erlang Workshop in Victoria, so if you're >> attending I'd be happy to show a demo and have a chat with you about >> Disco. >> >> >> Ville Tuulos >> Member of Research Staff >> Nokia Research Center >> Palo Alto >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > From psa@REDACTED Thu Sep 11 20:06:02 2008 From: psa@REDACTED (=?ISO-8859-1?Q?Paulo_S=E9rgio_Almeida?=) Date: Thu, 11 Sep 2008 19:06:02 +0100 Subject: [erlang-questions] Combining ets and mnesia operations for extreme performance Message-ID: <48C95E0A.2010907@di.uminho.pt> Hi all, This one is for mnesia hackers (Ulf, Joel, ...) I have a scenario where I am building aggregations over some data, most of the time counting things. For the performance I want I cannot use mnesia transactions naively, but even dirty_writes would be too slow and would not give me some atomicity I need. A typical scenario would be to atomically apply e.g. 1 million increments spread over some hundreds/thousands of keys in some dozen tables. This atomicity is from the durability point of view. i.e. either all increments are processed and made persistent, or, e.g. if the machine crashes before, no update must have been made persistent. I don't need to worry about atomicity from the lookup point of view (i.e. there would be no problem doing a lookup and reading some intermediate value). This leads to my strategy: - using mnesia disc_copies; - operating directly on the underlying ets tables; e.g. ets:update_counter - marking which keys become "dirty"; - then, in a single mnesia:transaction: - ets:lookup the dirty keys - mnesia:write these records Basically, it has been working for me. But as I am doing something I shouldn't (updating the ets tables directly), I ask what could go wrong. I thought a bit and could only see one potential problem: that mnesia dumps the ets table to the DCD file when I already started a subsequent aggregation and have already done some ets operations myself. Therefore I ask: when exactly does mnesia try to see whether to dump a table or not (according to dc_dump_limit)? Can it be after a mnesia:transaction finished? How long after? The "solution" I came up with is: - prevent mnesia from dumping ets tables to DCD by putting an extremely low value in dc_dump_limit; e.g. 0.000001; btw, can floats be used here? - take control of the dumping, deciding myself wether to do it for each table and if so, doing it after the mnesia:transaction, and before starting to mess again with ets tables in the subsequent aggregation; - I found out I can do this with mnesia_log:ets2dcd. Is this the right way to do it? The above uses functions which are internal to mnesia and not part of the official API, which is not a good thing. I would sugest that it would be nice if mnesia exported officially functionality such as the above, so that one can take some control, use only some parts of it, or combine them in novel ways. In my case, I don't need distribution or concurrency control (only 1 process writes to such tables; well in fact I have several processes but no two of them write to the same table)), and I am using mnesia just for persistence of ets tables with some atomicity involved. Or an alternative point of view: forgetting mnesia, does someone know other solutions for persistence of ets tables. I used mnesia as a first approach, but I am open to alternatives. Regards, Paulo Almeida From jason.ganetsky@REDACTED Thu Sep 11 21:31:10 2008 From: jason.ganetsky@REDACTED (JasonGanetsky) Date: Thu, 11 Sep 2008 12:31:10 -0700 (PDT) Subject: [erlang-questions] Network partition scenario Message-ID: I have 2 nodes, each running an instance of the same application, with shared, distributed mnesia tables. This is for redundancy. If one node has a ton of bricks fall on it, the show goes on. Everything works well if one node dies. Scenario: because of swapping, Node 2 temporarily stops responding. Node 1 decides that Node 2 has gone down. Now, swapping stops. Node 2 is now responding, and serving requests... but nodes() == [] on both. Both nodes are now serving requests with no synchronization in mnesia. My plan is to handle the mnesia event message {inconsistent_database, running_partitioned_network, _}. I will handle this, basically, by shutting down the application on both nodes, clearing mnesia (which is acceptable in this case), restarting mnesia, and then restarting my application. I will not use mnesia:set_master_nodes(), as it apparently causes the inconsistent_database message to be suppressed. However, this inconsistent_database message is only generated when mnesia_monitor receives a nodeup message. That means that, after the two nodes have severed their connection, the partition is not detected until the two nodes reconnect. My question is: how do I get them to reconnect? Should I do this by simpling calling net_adm:ping() on the other node regularly? Or is there a better way? Also, am I correct in assuming that restarting mnesia will cause them to re-sync? My testing seems to point to use. From bob@REDACTED Thu Sep 11 21:57:08 2008 From: bob@REDACTED (Bob Ippolito) Date: Thu, 11 Sep 2008 12:57:08 -0700 Subject: [erlang-questions] [ANN] Map/Reduce in Erlang and Python - Disco 0.1 In-Reply-To: <48C95CC1.70803@nokia.com> References: <48C8E1C3.1090900@nokia.com> <6a36e7290809110915m2bb57baaw62a3f1183993b299@mail.gmail.com> <48C95CC1.70803@nokia.com> Message-ID: <6a36e7290809111257i32cec5cau2067e8d03a44d74e@mail.gmail.com> On Thu, Sep 11, 2008 at 11:00 AM, Ville H Tuulos wrote: > ext Bob Ippolito wrote: >> >> Why the choice of SCGI? It seems like it would be a lot simpler not to >> require an external web server. Erlang does HTTP on its own pretty >> well, in my experience :) > > Thanks Bob for the comment (: I have used Mochiweb quite happily(*) in > another Erlang project of mine. There are people already working on Disco to > make it work with Mochiweb. > > The web server is mainly used to serve large files to workers; SCGI is just > used to forward control requests to the Erlang process. Using an external > web server for IO intensive jobs was a safe choice in the first place. I'd > be happy to replace it with, say, Mochiweb, if it handle the load. > > > Ville > > (*) I think I had a problem with Mochiweb: It uses the raw mode for sockets, > and it seems that there's a 16M limit for gen_tcp:recv() in that case: > > http://www.erlang.org/pipermail/erlang-questions/2006-September/022907.html > > If I remember correctly, this caused any HTTP POST requests larger than 16M > fail. Please correct me if I'm wrong. Well sure, that just means that you shouldn't receive the entire POST body in one shot from the socket directly. Take a look at the mochiweb_multipart.erl code for example. Req:recv_body() has a size limit of 1MB because it should only really be used as a convenience when dealing with small bodies, otherwise you should be using some kind of streaming API that brings the data in a chunk at a time. Chunks obviously should not be bigger than 16MB, more like a few kb :) -bob From dizzyd@REDACTED Thu Sep 11 22:12:47 2008 From: dizzyd@REDACTED (Dave Smith) Date: Thu, 11 Sep 2008 14:12:47 -0600 Subject: [erlang-questions] common_test w/o shell Message-ID: Greetings, I'm in the process of trying to invoke the common_test framework programatically, from an escript. However, ct_run keeps crashing with the error: {'EXIT', {{badmatch,[]}, [{ct_run, set_group_leader_same_as_shell, 0}, {ct_run,continue,1}, {ct_run,do_run,5}, {meab_pipelines, evaluate_pipeline,1}, {meab_pipelines,invoke,1}, {meab_runner, invoke_pipelines,1}, {meab_runner,handle_call,3}, {gen_server,handle_msg,5}]}} >From what I can tell, common_test needs to have the shell running, regardless of how it's invoked -- is there a way around this that I'm missing? Thanks, D. From devdoer2@REDACTED Fri Sep 12 04:38:06 2008 From: devdoer2@REDACTED (devdoer bird) Date: Fri, 12 Sep 2008 10:38:06 +0800 Subject: [erlang-questions] How to show non-ascii charaters correctly in erlang shell? Message-ID: HI: We have chinese words input /output in erlang shell,and we want to show them correctly in terminal ,but the erlang shell only show the integer number . Eg. If we input "??" in the shell,it will appear as : 9> "\326\320\316\304". "\326\320\316\304" Is there a way to solve this? Can we telnet into erlang VM ,so we can interact with the erlang VM by telent terminal not the erlang shell and the telnet terminal can show the non-ascii word correctly. Can someone help me? -------------- next part -------------- An HTML attachment was scrubbed... URL: From devdoer2@REDACTED Fri Sep 12 04:41:53 2008 From: devdoer2@REDACTED (devdoer bird) Date: Fri, 12 Sep 2008 10:41:53 +0800 Subject: [erlang-questions] How to dynamically add one node to erlang's distrubted application? In-Reply-To: References: <48C75879.6010904@charpi.net> Message-ID: Thank you for your suggestion. 2008/9/10 Chandru > 2008/9/10 devdoer bird > >> Thanks. If I have 100 machines ,I have to edt the config files on all 100 >> machines, that's unacceptable. Are there any solutions? >> >> > I don't have an answer to your specific question, but... > > I wouldn't recommend using this feature across 100 machines. Do you really > need an application to failover across 100 machines? I had trouble with this > feature even across four erlang nodes. The nodes used to hang arbitrarily at > various times. It was a long time ago and lots of fixes have been made for > this but I'm still quite wary of it. I've found that designing my > applications so that failover is handled at the application level gives me > more reliability. > > If you are using this feature to ensure that only one instance of your > application is running at any one time, then you are getting a false sense > of security. One node can never definitely know if it's peer is running or > not. Network outages between the two nodes can make it look like the other > node is down, when in reality they are both running. > > >> 2008/9/10 Nicolas Charpentier >> >>> devdoer bird wrote: >>> >>>> ... >>>> Now I want to add one more node to the system .How can I do this >>>> using erlang's distributed applicaiton mechanism? Do I have to edit the >>>> config file on all 3 nodes to add the 4th node and restart all of them? >>>> >>>> >>> >>> >>> Hi, >>> >>> if you can't stop your nodes because others mandatory applications are >>> running you can try to use application:load/2 on all your nodes. The second >>> param is the distribution parameter which overload kernel value. >>> To be able to load an application, it have to be stopped. >>> Don't forget to update the config file for the next node restart. >>> >>> I never tried to do that but the documentation seems to say that it's >>> possible >>> >>> >>> Regards, >>> >>> ---- >>> Nicolas >>> http://charpi.net >>> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From devdoer2@REDACTED Fri Sep 12 04:55:47 2008 From: devdoer2@REDACTED (devdoer bird) Date: Fri, 12 Sep 2008 10:55:47 +0800 Subject: [erlang-questions] How to dynamically add one node to erlang's distrubted application? In-Reply-To: <6c2563b20809100222m7704ef93i48dacd62e1593eca@mail.gmail.com> References: <48C75879.6010904@charpi.net> <6c2563b20809100222m7704ef93i48dacd62e1593eca@mail.gmail.com> Message-ID: Thanks. It works for me. but I have some more questions. If we have a center server, how can we let other client know where it is? We can pass the center server information to each node at each node's startup,but if we want to change the center server Eg. for its poor performance,how can we let other nodes know "the center server is changed" ,suppose we don't know how many client nodes are alive either? The solution I found d is we can save the client nodes informaton into a persistent storage. Does someone have a better way to solve these problems? Any suggestion is helpful,Thanks. 2008/9/10 Edwin Fine > I do have a suggestion. Write a program that takes the configurations for > all 100 (1000, 10000) machines from a file or database, generates the > configuration files, and then distributes them to the nodes using an agent > or something similar. The config files are kept under configuration > management centrally and pushed out to nodes when changes are made. > > 2008/9/10 devdoer bird > >> Thanks. If I have 100 machines ,I have to edt the config files on all 100 >> machines, that's unacceptable. Are there any solutions? >> >> >> 2008/9/10 Nicolas Charpentier >> >>> devdoer bird wrote: >>> >>>> ... >>>> Now I want to add one more node to the system .How can I do this >>>> using erlang's distributed applicaiton mechanism? Do I have to edit the >>>> config file on all 3 nodes to add the 4th node and restart all of them? >>>> >>>> >>> >>> >>> Hi, >>> >>> if you can't stop your nodes because others mandatory applications are >>> running you can try to use application:load/2 on all your nodes. The second >>> param is the distribution parameter which overload kernel value. >>> To be able to load an application, it have to be stopped. >>> Don't forget to update the config file for the next node restart. >>> >>> I never tried to do that but the documentation seems to say that it's >>> possible >>> >>> >>> Regards, >>> >>> ---- >>> Nicolas >>> http://charpi.net >>> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tobias.lindahl@REDACTED Fri Sep 12 09:13:45 2008 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Fri, 12 Sep 2008 09:13:45 +0200 Subject: [erlang-questions] encapsulating types and dialyzer In-Reply-To: <48C94DB1.1040202@cs.ntua.gr> References: <200809120145.30587.als@iinet.net.au> <48C94DB1.1040202@cs.ntua.gr> Message-ID: <48CA16A9.1050202@it.uu.se> Kostis Sagonas wrote: > Anthony Shipman wrote: >> Suppose I have a module MC that implements a collection type known as coll(). >> Internally this is some record that I want to be private to the module. >> >> The external functions in the interface mention the type coll(). So the >> clients of the interface must also mention coll() if dialyzer is to check the >> types. >> >> As far as I can see the only way to do this is to put the coll() type into >> a .hrl file. This exposes the record definition, and recursively every other >> type that it depends on. >> >> Is there a better way to do this? > > In the HiPE group, we have had extensive discussions about this issue. > The solution we came up with is to allow module-qualified types, as in > mc:col(), which can then be used in other modules. This works in R12B-4 > but not in any previous version. > > Currently, all types defined in a module are also implicitly exported -- > this might change in a future version and modules might need to declare > their exported types. > > Kostis > > PS. I should point out that the language of types and -spec declarations > is currently an EEP. Officially, it is not part of Erlang yet. As Kostis points out, you are allowed to declare these remote types, but currently they are not used. Of course, this will change in the future. Tobias > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ulf.wiger@REDACTED Fri Sep 12 15:40:51 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 12 Sep 2008 15:40:51 +0200 Subject: [erlang-questions] Combining ets and mnesia operations for extreme performance In-Reply-To: <48C95E0A.2010907@di.uminho.pt> References: <48C95E0A.2010907@di.uminho.pt> Message-ID: <48CA7163.4000201@ericsson.com> Paulo S?rgio Almeida skrev: > Hi all, > > This one is for mnesia hackers (Ulf, Joel, ...) > > I have a scenario where I am building aggregations over some data, > most of the time counting things. For the performance I want I cannot > use mnesia transactions naively, but even dirty_writes would be too > slow and would not give me some atomicity I need. > > A typical scenario would be to atomically apply e.g. 1 million > increments spread over some hundreds/thousands of keys in some dozen > tables. This atomicity is from the durability point of view. i.e. > either all increments are processed and made persistent, or, e.g. if > the machine crashes before, no update must have been made persistent. > I don't need to worry about atomicity from the lookup point of view > (i.e. there would be no problem doing a lookup and reading some > intermediate value). > > This leads to my strategy: - using mnesia disc_copies; - operating > directly on the underlying ets tables; e.g. ets:update_counter - > marking which keys become "dirty"; - then, in a single > mnesia:transaction: - ets:lookup the dirty keys - mnesia:write these > records Perhaps you'd want to consider using ram_copies and dumping to disk using mnesia:dump_tables(Tabs)? That wouldn't be such a blatant violation of mnesia rules. ;-) I assume from your description that the table isn't replicated? > Basically, it has been working for me. But as I am doing something I > shouldn't (updating the ets tables directly), I ask what could go > wrong. I thought a bit and could only see one potential problem: that > mnesia dumps the ets table to the DCD file when I already started a > subsequent aggregation and have already done some ets operations > myself. > > Therefore I ask: when exactly does mnesia try to see whether to dump > a table or not (according to dc_dump_limit)? Can it be after a > mnesia:transaction finished? How long after? You could mess with the dump limit, but if you were to use mnesia for some other tasks in your application, this might come back and bite you. Log dump is a background job, and it's scheduled as soon as the time or write threshold is exceeded. If it's a write threshold, the number of committed writes is what triggers it. > Or an alternative point of view: forgetting mnesia, does someone know > other solutions for persistence of ets tables. I used mnesia as a > first approach, but I am open to alternatives. If you have no particular need for some mnesia functions, it would seem as if just using an ets table and calling ets:tab2file/2 would seem to be sufficient for what you've described. BR, Ulf W From joelr1@REDACTED Fri Sep 12 15:52:07 2008 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 12 Sep 2008 14:52:07 +0100 Subject: [erlang-questions] My frustration with Erlang Message-ID: <762B727D-125A-4739-B599-4114C0460869@gmail.com> I sell a poker server written in Erlang. It's supposed to be super- robust and super-scalable. I'm about to move to the next level by adding the missing features, e.g. tournaments and a Flash client. I appreciate everything that the Erlang/OTP is doing but I thought I would vent a few of my recent frustrations with Erlang. I'm in a good mood after spending a day with OCaml and I have calmed down. Still, prepare yourself for a long rant ahead! My development workstation is a Mac Pro 2x2.8Ghz Quad Xeon, 12Gb of memory, one 250Gb and two more drives 500Gb each, all 7200RPM SATA. I use R12B3, SMP and kernel poll, i.e. Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:8] [async- threads:0] [kernel-poll:true] My overwhelming frustration is the opacity of a running Erlang system. There are no decent tools for peering inside. No usable ones whatsoever! With any other language you can profile, make changes, evaluate performance and make a judgement but not with Erlang. I first wrote OpenPoker using OTP everywhere. My players, games, pots, limits, hands, decks, etc. were all gen_server processes. I used Mnesia transactions everywhere and I used them often. Then I discovered that I cannot scale past 2-3k concurrent players under heavy use. I have a test harness that launches bots which connect to the server and play by the script. The bots don't wait before replying to bet requests and so launching a few thousand bots heavily loads the server. I don't want just a few thousand concurrent bots, though! I want at least 10k on a single VM and hundreds of thousands on a cluster, so I set to optimize my poker server. The Erlang Efficiency Guide recommends fprof as the tool. I ran fprof on my test harness and discovered that the result set cannot be processed in my 12Gb of memory. I made this discovery after leaving fprof running for a couple of days and realized this because the fprof data files were approaching 100Gb and my machine became unusable due to heavy swapping. fprof usets ets tables to analyze the trace results and ets tables must fit in memory. I shortened my test run and was able to see the output of the fprof trace analysis. To say that it's dense would be an understatement! I realize that dumping out tuples is easy but aren't computers suppose to help us humans? The final output from fprof is still too raw for me to analyze. There's absolutely, positively, definitely no way to get a picture of a running system by reading through it. I understand that I can infer from the analysis that certain functions take a lot of time but what if there are none? The bulk of the time in my system was taken by various OTP functions and processes, Mnesia and unknown functions. All I could infer from it is that perhaps I have too many processes. Another thing that I inferred is that the normal method of writing gen_server code doesn't work for profiling. I had to rewrite the gen_server clauses to immediately dispatch to functions, e.g. handle_cast('LOGOUT', Data) -> handle_cast_logout(Data); handle_cast('DISCONNECT', Data) -> handle_cast_disconnect(Data); otherwise all the clauses of a gen_server are squashed together, regardless of the message pattern. I don't know if there's a better way to tackle this. Next, I rewrote most of my gen_servers as data structures, e.g. pot, limit, deck, etc. A deck of cards can take a message to draw a card but the message can just as well be a function call. The deck structure will need to be modified regardless and the tuple will be duplicated anyway. There didn't seem to be any advantage in using a process here, much less a gen_server. Next I carefully went trough my Mnesia schema and split some tables into smaller tables. I made sure that only the absolutely necessary tables were disk-based. I wish I could run without updating Mnesia tables during a game but this is impossible since player balances and status need to be updated when players join or leave a game, as well as when a game finishes. All my hard work paid off and I was able to get close to 10K players, with kernel poll enabled, of course. Then I ran out of ETS tables. I don't create ETS tables on the fly but, apparently, Mnesia does. For every transaction!!! This prompted me to go through the server again and use dirty_read, dirty_write wherever possible. I also placed balanced in two separate "counter" tables, integers to be divided by 10000 to get 4 decimal points of precision. This is so that I could use dirty_update_counter instead of a regular read, bump, write pattern. My frustration kept increasing but I gained more concurrent players. I can now safely run up to 8K bots before timeouts start to appear. These are gen_server call timeouts when requests for game information take longer than the default 5 seconds. I have an average of 5 players per game so this is not because a large number of processes are trying to access the game. I suppose this is a reflection of the load on the system, although CPU usage never goes past 300% which tells me that no more than 3 cores are used by Erlang. The straw that broke my back was when stopping a bot's matching player gen_server by returning {stop, ... } started causing my observer process to receive tcp_close and exit. I could repeat this like clockwork. Only spawning a separate process to send player a stop message would fix this. Then I changed the way I represent cards started seeing this behavior again, in just one of my tests. What do cards have to do with tcp_close? I don't know and dbg tracer is my best friend! What I know is what git tells me and git says cards were the only difference. Anyway, I don't think I have fully recovered yet. I may need a weekend just to regain my sanity. I will try to spread the load among several VMs but my hunch is that my distributed 100k players target is far far away. I'll may have to keep flying blind, with only traces and printouts to my rescue. Thanks for listening, Joel -- wagerlabs.com From michael.regen@REDACTED Fri Sep 12 16:00:17 2008 From: michael.regen@REDACTED (Michael Regen) Date: Fri, 12 Sep 2008 16:00:17 +0200 Subject: [erlang-questions] Erlang crash gen_tcp related (probably only under Windows) Message-ID: <9b59d0270809120700l67787190v7cb1a4c0e670589a@mail.gmail.com> Hi, I got a series of troubles with gen_tcp all eventually resulting in crashes. I tested this under Windows XP and with R12B-3 as well as R12B-4. Under Linux it seems to work but I am not perfectly sure since the crash happens sporadically and seems to be timing related. The two problems below lead me to a couple of questions: a) What is the real cause? Is it the socket error enfile? Do both problems have the same root cause? b) Is there a bug in Erlang? I guess this should not lead to a crash. c) How do you avoid this problem on systems you do not control yourself? Problem #1: ########### Just compile the following code and run it with sasl enabled and the following command: tcp_test:test(1000). and - yes - without anything listening on port 2222. And sometimes you have to try two times! -------------------------- start: tcp_test.erl -------------------------- -module(tcp_test). -export([test/1, test_con/0]). -define(DEF_PORT, 2222). -define(DEF_IP, {127,0,0,1}). test(0) -> ok; test(HowManyProcs) -> spawn(?MODULE, test_con, []), test(HowManyProcs-1). test_con() -> {ok,S} = gen_tcp:connect(?DEF_IP, ?DEF_PORT,[]), gen_tcp:send(S,<<0,5,65,66,67,68,69>>), receive {tcp_closed, _Socket} -> ok; _Msg -> gen_tcp:close(S) after 500 -> gen_tcp:close(S) end. -------------------------- end: tcp_test.erl -------------------------- It just spawns a bunch of processes all trying to connect to a currently closed port and sending some garbage there. This is what happens: -------------------------- start: log tcp_test.erl -------------------------- =ERROR REPORT==== 12-Sep-2008::15:28:47 === Error in process <0.41.0> with exit value: {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} [... a couple of them but usually between 1 and 20.] =ERROR REPORT==== 12-Sep-2008::15:28:47 === Error in process <0.103.0> with exit value: {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} Crash dump was written to: erl_crash.dump Inconsistent, why isnt io reported? Abnormal termination -------------------------- end: log tcp_test.erl -------------------------- It might have something to do with the socket error enfile 'file table overflow' but I guess it should not simply crash the emulator!? Searching google for 'Inconsistent, why isnt io reported?' just gives one hit to Erlang's source code. I can provide the crash dump if needed. Just did not want to spam the whole list with big attachments. Spawning only 500 processes (tcp_test:test(500).) usually leads to a crash, spawning only 200 seems to work. Problem #2: ########### Now let's try the same with a server answering to port 2222: Just take the code from the trapexit tutorial 'Building a Non-blocking TCP server using OTP principles' http://trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles Start it first and then our test module in a different erlang node as described above. Now, usually the client survives (have seen crashes as well!) and the server crashes in a similar way. Sometimes it survives and in very rare cases you will see the following logs in the erlang server instance: -------------------------- start: log server -------------------------- =ERROR REPORT==== 12-Sep-2008::12:58:56 === File operation error: system_limit. Function: get_cwd. Process: code_server. =ERROR REPORT==== 12-Sep-2008::12:58:56 === Error in async accept: {async_accept,"file table overflow"}. =ERROR REPORT==== 12-Sep-2008::12:58:56 === ** Generic server tcp_listener terminating ** Last message in was {inet_async,#Port<0.109>,1019,{ok,#Port<0.2141>}} ** When Server state == {state,#Port<0.109>,1019,tcp_echo_fsm} ** Reason for termination == ** {async_accept,"file table overflow"} [...] -------------------------- end: log server -------------------------- Can anyone help? Thank you! Regards, Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From icfp.publicity@REDACTED Fri Sep 12 16:18:39 2008 From: icfp.publicity@REDACTED (Matthew Fluet (ICFP Publicity Chair)) Date: Fri, 12 Sep 2008 09:18:39 -0500 Subject: [erlang-questions] Workshop on Generic Programming: Call for Participation (co-located w/ ICFP08) Message-ID: <53ff55480809120718h55b73536i148ffcf3b97dd4a9@mail.gmail.com> Dear all, the Workshop on Generic Programming is only a few days away: 20th September 2008 (http://www.regmaster.com/conf/icfp2008.html). ==> Invited talk: The Generic Paradigm ==> Lambert Meertens (Utrecht University) ==> We have reserved 20 minutes for *lightning talks*. If you plan to ==> attend and if you would like to give a short talk (about half-baked, ==> exciting, new stuff) please drop me a short note. Slots will be ==> reserved on a first-come-first-serve basis. Looking forward to seeing you in Victoria, Ralf Hinze ============================================================================ CALL FOR PARTICIPATION Workshop on Generic Programming 2008 Victoria, Canada, 20th September 2008 http://www.comlab.ox.ac.uk/ralf.hinze/wgp2008/cfp.{html,pdf,ps,txt} The Workshop on Generic Programming is sponsored by ACM SIGPLAN and forms part of ICFP 2008. Previous Workshops on Generic Programming have been held in Marstrand (affiliated with MPC), Ponte de Lima (affiliated with MPC), Nottingham (informal workshop), Dagstuhl (IFIP WG2.1 Working Conference), Oxford (informal workshop), Utrecht (informal workshop), and Portland (affiliated with ICFP). ============================================================================ Preliminary program ------------------- 9:00 - 10:00, Session Chair: Ralf Hinze (University of Oxford) Welcome Invited talk: The Generic Paradigm Lambert Meertens (Utrecht University) 10:30 - 12:00, Session Chair: Jeremy Gibbons (University of Oxford) A Functional Model-View-Controller Software Architecture for Command-oriented Programs Alley Stoughton (Kansas State University) A Lightweight Approach to Datatype-Generic Rewriting Thomas van Noort (Radboud University Nijmegen), Alexey Rodriguez, Stefan Holdermans (Utrecht University), Johan Jeuring (Utrecht University and Open University of the Netherlands), Bastiaan Heeren (Open University of the Netherlands) Lightning talks 13:30 - 15:00, Session Chair: Ralf Hinze (University of Oxford) Report from the program chair Ralf Hinze (University of Oxford) Scala for Generic Programmers Bruno C. d. S. Oliveira, Jeremy Gibbons (University of Oxford) A Comparison of C++ Concepts and Haskell Type Classes Jean-Philippe Bernardy, Patrik Jansson, Marcin Zalewski, Sibylle Schupp, Andreas Priesnitz (Chalmers University of Technology and University of Gothenburg) Lightning talks 15:30 - 17:30, Session Chair: Patrik Jansson (Chalmers University of Technology and University of Gothenburg) Polytypic Programming in Coq Wendy Verbruggen, Edsko de Vries, Arthur Hughes (Trinity College Dublin) Bialgebra Views: A Way for Polytypic Programming to Cohabit with Data Abstraction Pablo Nogueira, Juan Jose Moreno-Navarro (Universidad Politecnica de Madrid) Discussion ============================================================================ From mog-lists@REDACTED Fri Sep 12 16:30:16 2008 From: mog-lists@REDACTED (mog) Date: Fri, 12 Sep 2008 09:30:16 -0500 Subject: [erlang-questions] How to show non-ascii charaters correctly in erlang shell? In-Reply-To: References: Message-ID: <20080912143016.GE4420@metalman.digium.internal> On Fri, Sep 12, 2008 at 10:38:06AM +0800, devdoer bird wrote: > HI: > > We have chinese words input /output in erlang shell,and we want to show > them correctly in terminal ,but the erlang shell only show the integer > number . > Eg. If we input "????" in the shell,it will appear as : > 9> "\326\320\316\304". > "\326\320\316\304" Currently ssh, telnet, and shell drivers, escape anything but ascii sequences. I assumed this was for security / cleanliness issues. It is easy to go alter this, I have a patch on erlang-bugs list that did just that to allow for ^L to be typed and followed correctly in the shell. Mog -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: Digital signature URL: From joelr1@REDACTED Fri Sep 12 16:33:46 2008 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 12 Sep 2008 15:33:46 +0100 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <20080912142902.D78F42406E@relay.gooddata.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <20080912142902.D78F42406E@relay.gooddata.com> Message-ID: <4F676E1D-EA89-4791-A4AD-3D1A651ED715@gmail.com> On Sep 12, 2008, at 3:29 PM, Hynek Vychodil wrote: > I can't see it clearly. How much requests per second did serve your > server or how fast your bots sends requests? I can't see it clearly either. How would I properly measure the # of requests per second? I tried to relieve the server by spreading the load and making each bot wait a random amount of time before replying to a bet request. It didn't improve the situation much. -- wagerlabs.com From devdoer2@REDACTED Fri Sep 12 17:28:20 2008 From: devdoer2@REDACTED (devdoer bird) Date: Fri, 12 Sep 2008 23:28:20 +0800 Subject: [erlang-questions] How to show non-ascii charaters correctly in erlang shell? In-Reply-To: <20080912143016.GE4420@metalman.digium.internal> References: <20080912143016.GE4420@metalman.digium.internal> Message-ID: Thanks .Can you give me the link? 2008/9/12 mog > On Fri, Sep 12, 2008 at 10:38:06AM +0800, devdoer bird wrote: > > HI: > > > > We have chinese words input /output in erlang shell,and we want to show > > them correctly in terminal ,but the erlang shell only show the integer > > number . > > Eg. If we input "????" in the shell,it will appear as : > > 9> "\326\320\316\304". > > "\326\320\316\304" > > Currently ssh, telnet, and shell drivers, escape anything but ascii > sequences. I assumed this was for security / cleanliness issues. It is > easy to go alter this, I have a patch on erlang-bugs list that did just that > to allow for ^L to be typed and followed correctly in the shell. > > Mog > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > > iEYEARECAAYFAkjKfPgACgkQeq+tARrxhnvaKQCggoAkZae9fjxcAEuHJUF6dlIo > ek8Ani+S0Jw5imG3/acJae75dFNHV6UO > =b0kC > -----END PGP SIGNATURE----- > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Fri Sep 12 17:55:57 2008 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 12 Sep 2008 16:55:57 +0100 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <20080912145221.B4A892407D@relay.gooddata.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <20080912142902.D78F42406E@relay.gooddata.com> <4F676E1D-EA89-4791-A4AD-3D1A651ED715@gmail.com> <20080912145221.B4A892407D@relay.gooddata.com> Message-ID: <7C36263B-0475-47A4-AC24-8A34D2818B2A@gmail.com> On Sep 12, 2008, at 3:52 PM, Hynek Vychodil wrote: > Count served requests during some longer period (from minutes, better > quarter of hour up to day(s)) under some "almost constant" load? > Goal is to avoid dynamic load leveling. Here are the stats from a 1k game run with a total of ~5k players, collected on a 10s timer. Elapsed time between collections is always a little over 10 seconds. The first report covers game startup. Lots of requests! Things level off once games start and the load increases again once games start to end and I need to update player balances and things. What does this tell you? Thanks, Joel --- Simulating gameplay with 1000 games... Waiting for games to end... 50 games started, 262 players 100 games started, 504 players ... 950 games started, 4777 players 1000 games started, 5066 players =INFO REPORT==== 12-Sep-2008::16:34:34 === requests: 12132 bytes: 333257 requests_per_second: 1213 bytes_per_second: 33322 =INFO REPORT==== 12-Sep-2008::16:34:44 === requests: 2012 bytes: 27082 requests_per_second: 200 bytes_per_second: 2702 =INFO REPORT==== 12-Sep-2008::16:34:54 === requests: 3054 bytes: 41990 requests_per_second: 300 bytes_per_second: 4134 =INFO REPORT==== 12-Sep-2008::16:35:39 === requests: 2009 bytes: 30349 requests_per_second: 197 bytes_per_second: 2980 =INFO REPORT==== 12-Sep-2008::16:35:39 === requests: 4161 bytes: 35942 requests_per_second: 415 bytes_per_second: 3592 =INFO REPORT==== 12-Sep-2008::16:35:39 === requests: 5452 bytes: 48210 requests_per_second: 543 bytes_per_second: 4808 =INFO REPORT==== 12-Sep-2008::16:35:44 === requests: 7662 bytes: 53124 requests_per_second: 765 bytes_per_second: 5304 -- wagerlabs.com From joelr1@REDACTED Fri Sep 12 18:02:30 2008 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 12 Sep 2008 17:02:30 +0100 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <20080912145221.B4A892407D@relay.gooddata.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <20080912142902.D78F42406E@relay.gooddata.com> <4F676E1D-EA89-4791-A4AD-3D1A651ED715@gmail.com> <20080912145221.B4A892407D@relay.gooddata.com> Message-ID: <00B45E8B-784A-420E-AE7F-29A0F096725A@gmail.com> I forgo to mention that these are JSON requests and that I'm using LShift's library to encode and decode requests: http://www.lshift.net/blog/2007/02/17/json-and-json-rpc-for-erlang -- wagerlabs.com From psa@REDACTED Fri Sep 12 18:04:55 2008 From: psa@REDACTED (=?ISO-8859-1?Q?Paulo_S=E9rgio_Almeida?=) Date: Fri, 12 Sep 2008 17:04:55 +0100 Subject: [erlang-questions] Combining ets and mnesia operations for extremeperformance In-Reply-To: <48CA7163.4000201@ericsson.com> References: <48C95E0A.2010907@di.uminho.pt> <48CA7163.4000201@ericsson.com> Message-ID: <48CA9327.5080605@di.uminho.pt> Hi Ulf, Thanks for the prompt reply. See below. Ulf Wiger (TN/EAB) wrote: > > Perhaps you'd want to consider using ram_copies and dumping > to disk using mnesia:dump_tables(Tabs)? There is not much information about this operation. Does it provide atomicity? What happens if there is a crash in the middle of it? I have not made it clear, but I need to persist the updates on several tables as an atomic operation. Bit even if that was the case, there would be a problem of performance, because the whole ets table would have to be dumped. Using mnesia I could enjoy the transactional nature while having incremental writes. For example, a "transaction" could update only, say 1/100 of each table, and using mnesia, each DCL would grow slowly and the full ets table could be dumped much less frequently (as I wished, according to dc_dump_limit), say, each 50 transactions. > I assume from your description that the table isn't replicated? Sure. It is weird enough for the non-replicated case. >> Basically, it has been working for me. But as I am doing something I >> shouldn't (updating the ets tables directly), I ask what could go >> wrong. I thought a bit and could only see one potential problem: that >> mnesia dumps the ets table to the DCD file when I already started a >> subsequent aggregation and have already done some ets operations >> myself. >> >> Therefore I ask: when exactly does mnesia try to see whether to dump >> a table or not (according to dc_dump_limit)? Can it be after a >> mnesia:transaction finished? How long after? > > You could mess with the dump limit, but if you were to use > mnesia for some other tasks in your application, this might > come back and bite you. Yes. This is not good. This makes one think that it could be interesting to have a finer grain, per table dc_dump_limit, and not only a global one. > Log dump is a background job, and it's scheduled as soon > as the time or write threshold is exceeded. If it's a write > threshold, the number of committed writes is what triggers it. These thresholds are for dumping the global log to the DCL files. I will imagine the test for dumping the ets tables to the DCD files happens immediately after the dump to the DCL. Is it? > If you have no particular need for some mnesia functions, it > would seem as if just using an ets table and calling ets:tab2file/2 > would seem to be sufficient for what you've described. This would not give me atomicity of updates in several tables ... Regards, Paulo From als@REDACTED Fri Sep 12 18:08:04 2008 From: als@REDACTED (Anthony Shipman) Date: Sat, 13 Sep 2008 02:08:04 +1000 Subject: [erlang-questions] encapsulating types and dialyzer In-Reply-To: <48CA16A9.1050202@it.uu.se> References: <200809120145.30587.als@iinet.net.au> <48C94DB1.1040202@cs.ntua.gr> <48CA16A9.1050202@it.uu.se> Message-ID: <200809130208.04813.als@iinet.net.au> On Fri, 12 Sep 2008 05:13:45 pm Tobias Lindahl wrote: > > PS. I should point out that the language of types and -spec declarations > > ? ? ?is currently an EEP. ?Officially, it is not part of Erlang yet. Why do some of the types in the Erlang source have extra parentheses around them? -type(digraph() :: any()). Is there any use for this or is it just an ornament? > > As Kostis points out, you are allowed to declare these remote types, but > ? currently they are not used. Of course, this will change in the future. > > Tobias What could be useful to include is a "new type" feature like in Ada or Haskell. E.g. -type new length() :: float(). -type new area() :: float(). Then although they are both implemented as floats you can't pass one as another without an error or warning. The change to the type checking algorithm might be quite small. When comparing two types, if they are both new then the names must match as well as the structure, otherwise only do structural matching. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From erlang-questions_efine@REDACTED Fri Sep 12 18:14:28 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Fri, 12 Sep 2008 12:14:28 -0400 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <7C36263B-0475-47A4-AC24-8A34D2818B2A@gmail.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <20080912142902.D78F42406E@relay.gooddata.com> <4F676E1D-EA89-4791-A4AD-3D1A651ED715@gmail.com> <20080912145221.B4A892407D@relay.gooddata.com> <7C36263B-0475-47A4-AC24-8A34D2818B2A@gmail.com> Message-ID: <6c2563b20809120914o1218bcf2qcd99fe0ece1abc69@mail.gmail.com> Joel, What is your hardware configuration? How many cores are available? The reason I ask is because some people have seen better performance in certain clustering-type Erlang applications by running one VM per core, each VM running in +S 1 (non-SMP) mode, instead of using SMP. Have you tried this? I couldn't figure that out from what you wrote. Regards, Edwin On Fri, Sep 12, 2008 at 11:55 AM, Joel Reymont wrote: > > On Sep 12, 2008, at 3:52 PM, Hynek Vychodil wrote: > > > Count served requests during some longer period (from minutes, better > > quarter of hour up to day(s)) under some "almost constant" load? > > Goal is to avoid dynamic load leveling. > > Here are the stats from a 1k game run with a total of ~5k players, > collected on a 10s timer. > > Elapsed time between collections is always a little over 10 seconds. > > The first report covers game startup. Lots of requests! > > Things level off once games start and the load increases again once > games start to end and I need to update player balances and things. > > What does this tell you? > > Thanks, Joel > > --- > > Simulating gameplay with 1000 games... > Waiting for games to end... > 50 games started, 262 players > 100 games started, 504 players > ... > 950 games started, 4777 players > 1000 games started, 5066 players > > =INFO REPORT==== 12-Sep-2008::16:34:34 === > requests: 12132 > bytes: 333257 > requests_per_second: 1213 > bytes_per_second: 33322 > > =INFO REPORT==== 12-Sep-2008::16:34:44 === > requests: 2012 > bytes: 27082 > requests_per_second: 200 > bytes_per_second: 2702 > > =INFO REPORT==== 12-Sep-2008::16:34:54 === > requests: 3054 > bytes: 41990 > requests_per_second: 300 > bytes_per_second: 4134 > > =INFO REPORT==== 12-Sep-2008::16:35:39 === > requests: 2009 > bytes: 30349 > requests_per_second: 197 > bytes_per_second: 2980 > > =INFO REPORT==== 12-Sep-2008::16:35:39 === > requests: 4161 > bytes: 35942 > requests_per_second: 415 > bytes_per_second: 3592 > > =INFO REPORT==== 12-Sep-2008::16:35:39 === > requests: 5452 > bytes: 48210 > requests_per_second: 543 > bytes_per_second: 4808 > > =INFO REPORT==== 12-Sep-2008::16:35:44 === > requests: 7662 > bytes: 53124 > requests_per_second: 765 > bytes_per_second: 5304 > > > -- > wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Fri Sep 12 18:17:47 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Fri, 12 Sep 2008 12:17:47 -0400 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <6c2563b20809120914o1218bcf2qcd99fe0ece1abc69@mail.gmail.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <20080912142902.D78F42406E@relay.gooddata.com> <4F676E1D-EA89-4791-A4AD-3D1A651ED715@gmail.com> <20080912145221.B4A892407D@relay.gooddata.com> <7C36263B-0475-47A4-AC24-8A34D2818B2A@gmail.com> <6c2563b20809120914o1218bcf2qcd99fe0ece1abc69@mail.gmail.com> Message-ID: <6c2563b20809120917h3ea113d9p48df3ec17a7e6a6c@mail.gmail.com> Oh, I see it now, I missed it. An 8-core Mac. Sorry. On Fri, Sep 12, 2008 at 12:14 PM, Edwin Fine wrote: > Joel, > > What is your hardware configuration? How many cores are available? The > reason I ask is because some people have seen better performance in certain > clustering-type Erlang applications by running one VM per core, each VM > running in +S 1 (non-SMP) mode, instead of using SMP. Have you tried this? I > couldn't figure that out from what you wrote. > > Regards, > Edwin > > > On Fri, Sep 12, 2008 at 11:55 AM, Joel Reymont wrote: > >> >> On Sep 12, 2008, at 3:52 PM, Hynek Vychodil wrote: >> >> > Count served requests during some longer period (from minutes, better >> > quarter of hour up to day(s)) under some "almost constant" load? >> > Goal is to avoid dynamic load leveling. >> >> Here are the stats from a 1k game run with a total of ~5k players, >> collected on a 10s timer. >> >> Elapsed time between collections is always a little over 10 seconds. >> >> The first report covers game startup. Lots of requests! >> >> Things level off once games start and the load increases again once >> games start to end and I need to update player balances and things. >> >> What does this tell you? >> >> Thanks, Joel >> >> --- >> >> Simulating gameplay with 1000 games... >> Waiting for games to end... >> 50 games started, 262 players >> 100 games started, 504 players >> ... >> 950 games started, 4777 players >> 1000 games started, 5066 players >> >> =INFO REPORT==== 12-Sep-2008::16:34:34 === >> requests: 12132 >> bytes: 333257 >> requests_per_second: 1213 >> bytes_per_second: 33322 >> >> =INFO REPORT==== 12-Sep-2008::16:34:44 === >> requests: 2012 >> bytes: 27082 >> requests_per_second: 200 >> bytes_per_second: 2702 >> >> =INFO REPORT==== 12-Sep-2008::16:34:54 === >> requests: 3054 >> bytes: 41990 >> requests_per_second: 300 >> bytes_per_second: 4134 >> >> =INFO REPORT==== 12-Sep-2008::16:35:39 === >> requests: 2009 >> bytes: 30349 >> requests_per_second: 197 >> bytes_per_second: 2980 >> >> =INFO REPORT==== 12-Sep-2008::16:35:39 === >> requests: 4161 >> bytes: 35942 >> requests_per_second: 415 >> bytes_per_second: 3592 >> >> =INFO REPORT==== 12-Sep-2008::16:35:39 === >> requests: 5452 >> bytes: 48210 >> requests_per_second: 543 >> bytes_per_second: 4808 >> >> =INFO REPORT==== 12-Sep-2008::16:35:44 === >> requests: 7662 >> bytes: 53124 >> requests_per_second: 765 >> bytes_per_second: 5304 >> >> >> -- >> wagerlabs.com >> >> >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Fri Sep 12 18:45:48 2008 From: erlang@REDACTED (Dominic Williams) Date: Fri, 12 Sep 2008 18:45:48 +0200 Subject: [erlang-questions] Paris ErlLounge Message-ID: <48CA9CBC.1040805@dominicwilliams.net> Hello, We are holding an ErlLounge in Paris, on Wednesday 1st October, at Carr's Pub, 1 rue du Mont Thabor, 75001 Paris. I hope to see many new and old Erlangers there ! If possible send me an email if you plan to come, so that I can book enough space... Cheers, Dominic Williams From michael.regen@REDACTED Fri Sep 12 19:39:19 2008 From: michael.regen@REDACTED (Michael Regen) Date: Fri, 12 Sep 2008 19:39:19 +0200 Subject: [erlang-questions] Erlang crash gen_tcp related (probably only under Windows) In-Reply-To: <6c2563b20809120932hc19ff72u1c41ae83bbecdade@mail.gmail.com> References: <9b59d0270809120700l67787190v7cb1a4c0e670589a@mail.gmail.com> <6c2563b20809120932hc19ff72u1c41ae83bbecdade@mail.gmail.com> Message-ID: <9b59d0270809121039j5313d1d9odb995f37f4ccd0ef@mail.gmail.com> Hi Edwin, It is possible that both issues have a similar source but I do not see many reasons why there must be a common source. I was running my tests on a 32bit single core Windows XP SP2 system just by running werl.exe -boot start_sasl or werl.exe and did nothing fancy. My R12B-3 version is self compiled, R12B-4 is out of the erlang.org box. Client and server tests where done by starting two different instances of werl. Furthermore my tcp_test:test does not care whether results from gen_tcp:connect are correct or not. It just assumes {ok, Socket} and crashes the process if otherwise. Of course it was a surprise that under some circumstances the whole emulator crashes. By the way, the crash dump slogan is unspectecular: 'Slogan: Inconsistent, why isnt io reported?' UPDATE: I got some more observations which puzzle me even more: Just did some more of the same tests but this time by starting: erl.exe application:start(tcp_server). and erl.exe tcp_test:test(1000). There seems to be a difference between erl.exe and werl.exe. This time results are pretty different: Now it is much harder to crash the emulator. It takes significant more processes / tries until something bad happens: client only (tcp_test:test(5000)) crashes eventually in the same way but Window's cmd.exe now follows with a: The exception unknown software exception (0x40000015) occured in the application at location 0x008fff86 after the 'Crash dump was written to: erl_crash.dump / Inconsistent, why isnt io reported?' message and the crash dump file. The exception seems to always occure at the same location. A lot more error messages are printed now (as expected) until the crash. Besides the {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} I can now also watch lots of {{badmatch,{error,eaddrinuse}},[{tcp_test,test_con,0}]} and {{badmatch,{error,system_limit}},[{tcp_test,test_con,0}]} errors. The good message: During tests together with the server backend I was not able to crash the server. But I am not convinced that erl.exe solves everthing server side. Regards, Michael On Fri, Sep 12, 2008 at 6:32 PM, Edwin Fine wrote: > Please be aware that I reported a bug a while ago on erlang-bugs, where > attempting to connect to a socket that is not being listened on will > sometimes return an actual success return, but subsequent operations will > fail. Here is an excerpt from that bug report. > > When calling gen_tcp:connect/3 or /4 on a host/port that does not have a > running program listening on it, at random intervals gen_tcp:connect returns > an {ok, Sock} instead of the expected {error, econnrefused}. If > > gen_tcp:recv(Sock, 0) is called immediately using the socket just returned, > it returns an {error, econnrefused}. Connection options used were [binary, > {packet, raw}, {active, false}]. It should be noted that the gen_tcp:connect > > succeeds when there is a program listening on that sane host/port, so it's > unlikely to be a firewall issue. > > See http://www.erlang.org/pipermail/erlang-bugs/2008-August/000931.html > > This bug is still present in R12B-4. Could this be affecting you? > > Regards, > Edwin Fine > > 2008/9/12 Michael Regen > >> Hi, >> >> I got a series of troubles with gen_tcp all eventually resulting in >> crashes. I tested this under Windows XP and with R12B-3 as well as R12B-4. >> Under Linux it seems to work but I am not perfectly sure since the crash >> happens sporadically and seems to be timing related. >> >> The two problems below lead me to a couple of questions: >> a) What is the real cause? Is it the socket error enfile? Do both problems >> have the same root cause? >> b) Is there a bug in Erlang? I guess this should not lead to a crash. >> c) How do you avoid this problem on systems you do not control yourself? >> >> >> Problem #1: >> ########### >> >> Just compile the following code and run it with sasl enabled and the >> following command: >> tcp_test:test(1000). >> and - yes - without anything listening on port 2222. And sometimes you >> have to try two times! >> >> -------------------------- start: tcp_test.erl -------------------------- >> -module(tcp_test). >> >> -export([test/1, test_con/0]). >> >> -define(DEF_PORT, 2222). >> -define(DEF_IP, {127,0,0,1}). >> >> test(0) -> ok; >> test(HowManyProcs) -> >> spawn(?MODULE, test_con, []), >> test(HowManyProcs-1). >> >> test_con() -> >> {ok,S} = gen_tcp:connect(?DEF_IP, ?DEF_PORT,[]), >> gen_tcp:send(S,<<0,5,65,66,67,68,69>>), >> receive >> {tcp_closed, _Socket} -> ok; >> _Msg -> gen_tcp:close(S) >> after 500 -> >> gen_tcp:close(S) >> end. >> -------------------------- end: tcp_test.erl -------------------------- >> >> It just spawns a bunch of processes all trying to connect to a currently >> closed port and sending some garbage there. This is what happens: >> >> -------------------------- start: log tcp_test.erl >> -------------------------- >> =ERROR REPORT==== 12-Sep-2008::15:28:47 === >> Error in process <0.41.0> with exit value: >> {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} >> >> [... a couple of them but usually between 1 and 20.] >> >> =ERROR REPORT==== 12-Sep-2008::15:28:47 === >> Error in process <0.103.0> with exit value: >> {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} >> >> >> Crash dump was written to: erl_crash.dump >> Inconsistent, why isnt io reported? >> >> Abnormal termination >> -------------------------- end: log tcp_test.erl >> -------------------------- >> >> It might have something to do with the socket error enfile 'file table >> overflow' but I guess it should not simply crash the emulator!? >> Searching google for 'Inconsistent, why isnt io reported?' just gives one >> hit to Erlang's source code. >> I can provide the crash dump if needed. Just did not want to spam the >> whole list with big attachments. >> Spawning only 500 processes (tcp_test:test(500).) usually leads to a >> crash, spawning only 200 seems to work. >> >> >> Problem #2: >> ########### >> >> Now let's try the same with a server answering to port 2222: Just take the >> code from the trapexit tutorial 'Building a Non-blocking TCP server using >> OTP principles' >> http://trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles >> Start it first and then our test module in a different erlang node as >> described above. Now, usually the client survives (have seen crashes as >> well!) and the server crashes in a similar way. Sometimes it survives and in >> very rare cases you will see the following logs in the erlang server >> instance: >> >> -------------------------- start: log server -------------------------- >> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >> File operation error: system_limit. Function: get_cwd. Process: >> code_server. >> >> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >> Error in async accept: {async_accept,"file table overflow"}. >> >> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >> ** Generic server tcp_listener terminating >> ** Last message in was {inet_async,#Port<0.109>,1019,{ok,#Port<0.2141>}} >> ** When Server state == {state,#Port<0.109>,1019,tcp_echo_fsm} >> ** Reason for termination == >> ** {async_accept,"file table overflow"} >> >> [...] >> -------------------------- end: log server -------------------------- >> >> Can anyone help? Thank you! >> >> Regards, >> Michael >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Fri Sep 12 19:41:10 2008 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 12 Sep 2008 18:41:10 +0100 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <20080912163524.A818524081@relay.gooddata.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <20080912142902.D78F42406E@relay.gooddata.com> <4F676E1D-EA89-4791-A4AD-3D1A651ED715@gmail.com> <20080912145221.B4A892407D@relay.gooddata.com> <7C36263B-0475-47A4-AC24-8A34D2818B2A@gmail.com> <20080912163524.A818524081@relay.gooddata.com> Message-ID: On Sep 12, 2008, at 5:35 PM, Hynek Vychodil wrote: > It not seems as good as I realize from your previous messages. It > looks like you can get less than 1kreq/s. Right. > I don't know if it is load which you can manage for example 5, > 10, ... minutes. Yes and no, see below. > You can serve 15k concurrent players. Sound it still to much bad for > you? 15K concurrent players would be excellent. The stats I posted before don't paint the full picture, though. The part that I didn't post looks like this... Simulating gameplay with 1000 games... Waiting for games to end... 50 games started, 262 players 100 games started, 504 players ... 950 games started, 4777 players 1000 games started, 5066 players 4 Mnesia overloaded error reports =ERROR REPORT x 4==== 12-Sep-2008::16:34:40 === Mnesia('1@REDACTED'): ** WARNING ** Mnesia is overloaded: {dump_log, write_threshold} And 11 more =ERROR REPORT x 11 ==== 12-Sep-2008::16:34:44 === Mnesia('1@REDACTED'): ** WARNING ** Mnesia is overloaded: {dump_log, write_threshold} And then the real bummer, a whole lot of these: =ERROR REPORT ==== 12-Sep-2008::16:35:01 === ** State machine <0.9390.0> terminating ** Last timer event in was 'CHECK' ** When State == dispatch ... ** Reason for termination = ** {timeout,{gen_server,call,[<0.9391.0>,{'SEATS',119}]}} The above says that even with just 5K players the card game FSM times out when requesting seats matching a certain mask, e.g. the reply takes longer than 5 seconds. The game bombs out at this point. I could increase the timeout or make the call just wait forever. I don't want to do this, though, as this timeout serves as a performance indicator. Thanks, Joel -- wagerlabs.com From joelr1@REDACTED Fri Sep 12 19:52:16 2008 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 12 Sep 2008 18:52:16 +0100 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <6c2563b20809120914o1218bcf2qcd99fe0ece1abc69@mail.gmail.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <20080912142902.D78F42406E@relay.gooddata.com> <4F676E1D-EA89-4791-A4AD-3D1A651ED715@gmail.com> <20080912145221.B4A892407D@relay.gooddata.com> <7C36263B-0475-47A4-AC24-8A34D2818B2A@gmail.com> <6c2563b20809120914o1218bcf2qcd99fe0ece1abc69@mail.gmail.com> Message-ID: On Sep 12, 2008, at 5:14 PM, Edwin Fine wrote: > What is your hardware configuration? How many cores are available? The > reason I ask is because some people have seen better performance in > certain > clustering-type Erlang applications by running one VM per core, each > VM > running in +S 1 (non-SMP) mode, instead of using SMP. Have you tried > this? I ran the same test with +S 1. It doesn't look like SMP affects things too much in terms of # requests per second. The big difference is that the test runs through to the end, no gen_server timeouts. It starts timing out with 2k games and ~7K players, though. =INFO REPORT==== 12-Sep-2008::18:42:55 === requests: 910 bytes: 24558 requests_per_second: 90 bytes_per_second: 2455 =INFO REPORT==== 12-Sep-2008::18:43:05 === requests: 11222 bytes: 308699 requests_per_second: 1122 bytes_per_second: 30867 10 Mnesia overloaded reports (x10). =ERROR REPORT x10 ==== 12-Sep-2008::18:43:09 === Mnesia('1@REDACTED'): ** WARNING ** Mnesia is overloaded: {dump_log, write_threshold} =INFO REPORT==== 12-Sep-2008::18:43:15 === requests: 4461 bytes: 60746 requests_per_second: 442 bytes_per_second: 6025 =ERROR REPORT x6 ==== 12-Sep-2008::18:43:16 === Mnesia('1@REDACTED'): ** WARNING ** Mnesia is overloaded: {dump_log, write_threshold} =INFO REPORT==== 12-Sep-2008::18:43:25 === requests: 1874 bytes: 24746 requests_per_second: 187 bytes_per_second: 2470 =INFO REPORT==== 12-Sep-2008::18:43:35 === requests: 3864 bytes: 55476 requests_per_second: 384 bytes_per_second: 5516 =ERROR REPORT x4 ==== 12-Sep-2008::18:43:38 === Mnesia('1@REDACTED'): ** WARNING ** Mnesia is overloaded: {dump_log, write_threshold} =INFO REPORT==== 12-Sep-2008::18:43:45 === requests: 9752 bytes: 84331 requests_per_second: 974 bytes_per_second: 8425 =ERROR REPORT x7 ==== 12-Sep-2008::18:43:47 === Mnesia('1@REDACTED'): ** WARNING ** Mnesia is overloaded: {dump_log, write_threshold} 1000 games finished Elapsed: 59.147214s, Average run time: 0.059147214 seconds Mb exited successfully, 59.148019 seconds elapsed ok (1@REDACTED)3> =INFO REPORT==== 12-Sep-2008::18:43:55 === requests: 10950 bytes: 74516 requests_per_second: 1094 bytes_per_second: 7450 -- wagerlabs.com From goofyheadedpunk@REDACTED Fri Sep 12 19:52:38 2008 From: goofyheadedpunk@REDACTED (Brian Troutwine) Date: Fri, 12 Sep 2008 10:52:38 -0700 Subject: [erlang-questions] Problems Creating First Target System In-Reply-To: References: <971980cc0809101601v56c798e1sc0bdca2abddbe7df@mail.gmail.com> <971980cc0809101605n475d6d43j6714f444f43966ab@mail.gmail.com> Message-ID: <971980cc0809121052m6e1363b1o34e066de0aaa5364@mail.gmail.com> On further inspection I was missing {mod, {Module, Args}}. Thanks, Brian On Wed, Sep 10, 2008 at 8:27 PM, Chandru wrote: > 2008/9/11 Brian Troutwine >> >> Slight addendum: On further inspection aule is started, though the >> remaining applications are not. > > what do the commands application:info() and application:which_applications() > show? > > Also, can you send the SASL reports you get when you startup the node? > Given that 'aule' is started, indicates that the node would've atleast tried > to start the apps before it. When you say you can start them manually, does > it mean you can start them using the application:start/1 command or some > other means? If that is the case, it means you are missing the {mod, > {Module, Args}} directive in the .app file of those apps. > > cheers > Chandru > >> >> >> On Wed, Sep 10, 2008 at 4:01 PM, Brian Troutwine >> wrote: >> > I'm following the OTP Design Principles document in creating my first >> > release, but am having difficulties getting the system to boot >> > properly. I would appreciate help in fixing my errors. Here is my .rel >> > file: >> > >> > {release, {"Aule", "production-1"}, {erts, "5.6.3"}, >> > [{kernel, "2.12.3"}, >> > {stdlib, "1.15.3"}, >> > {sasl, "2.1.5.3"}, >> > {inets, "5.0.9"}, >> > {ecouch, "0.1"}, >> > {parse_app, "0.0.1"}, >> > {dispatch, "0.0.1"}, >> > {warehouse, "0.0.1"}, >> > {a_interface, "0.0.1"}, >> > {aule, "0.0.1"}]}. >> > >> > Following the guide I issue >> > >> >> systools:make_script("aule", [local]). >> > >> > and receive an aule.boot file. I then run >> > >> > $ erl -pa dispatch/ebin/ a_interface/ebin/ aule/ebin/ parse/ebin/ >> > warehouse/ebin/ ../ecouch/ebin boot aule >> > >> > but only inets, ecouch, stdlib and kernel start. My custom >> > applications (parse_app, dispatch, warehouse, a_interface and aule) do >> > not start, though nothing stops me from starting them manually. When >> > started manually the system runs appropriately. I do not understand >> > why this has failed. >> > >> > Thanks, >> > Brian >> > >> >> >> >> -- >> Brian >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > From erlang-questions_efine@REDACTED Fri Sep 12 19:54:46 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Fri, 12 Sep 2008 13:54:46 -0400 Subject: [erlang-questions] Erlang crash gen_tcp related (probably only under Windows) In-Reply-To: <9b59d0270809121039j5313d1d9odb995f37f4ccd0ef@mail.gmail.com> References: <9b59d0270809120700l67787190v7cb1a4c0e670589a@mail.gmail.com> <6c2563b20809120932hc19ff72u1c41ae83bbecdade@mail.gmail.com> <9b59d0270809121039j5313d1d9odb995f37f4ccd0ef@mail.gmail.com> Message-ID: <6c2563b20809121054p23afa167macccc9a73e0cb860@mail.gmail.com> Michael, I've always felt that the Windows version of Erlang is a bit flaky. Then again, I think Windows itself is more than a bit flaky, so maybe it's not Erlang's fault ;) I wonder if running on SP4 would improve things? On Fri, Sep 12, 2008 at 1:39 PM, Michael Regen wrote: > Hi Edwin, > > It is possible that both issues have a similar source but I do not see many > reasons why there must be a common source. > I was running my tests on a 32bit single core Windows XP SP2 system just by > running > werl.exe -boot start_sasl > or > werl.exe > > and did nothing fancy. My R12B-3 version is self compiled, R12B-4 is out of > the erlang.org box. > Client and server tests where done by starting two different instances of > werl. > Furthermore my tcp_test:test does not care whether results from > gen_tcp:connect are correct or not. It just assumes {ok, Socket} and crashes > the process if otherwise. Of course it was a surprise that under some > circumstances the whole emulator crashes. > > By the way, the crash dump slogan is unspectecular: 'Slogan: Inconsistent, > why isnt io reported?' > > UPDATE: I got some more observations which puzzle me even more: > > Just did some more of the same tests but this time by starting: > erl.exe > application:start(tcp_server). > and > erl.exe > tcp_test:test(1000). > > There seems to be a difference between erl.exe and werl.exe. > > This time results are pretty different: > Now it is much harder to crash the emulator. It takes significant more > processes / tries until something bad happens: > > client only (tcp_test:test(5000)) crashes eventually in the same way but > Window's cmd.exe now follows with a: > The exception unknown software exception (0x40000015) occured in the > application at location 0x008fff86 > > after the 'Crash dump was written to: erl_crash.dump / Inconsistent, why > isnt io reported?' message and the crash dump file. > > The exception seems to always occure at the same location. > > A lot more error messages are printed now (as expected) until the crash. > Besides the {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} I can > now also watch lots of > {{badmatch,{error,eaddrinuse}},[{tcp_test,test_con,0}]} > and > {{badmatch,{error,system_limit}},[{tcp_test,test_con,0}]} > errors. > > The good message: During tests together with the server backend I was not > able to crash the server. But I am not convinced that erl.exe solves > everthing server side. > > Regards, > Michael > > > On Fri, Sep 12, 2008 at 6:32 PM, Edwin Fine wrote: > >> Please be aware that I reported a bug a while ago on erlang-bugs, where >> attempting to connect to a socket that is not being listened on will >> sometimes return an actual success return, but subsequent operations will >> fail. Here is an excerpt from that bug report. >> >> When calling gen_tcp:connect/3 or /4 on a host/port that does not have a >> running program listening on it, at random intervals gen_tcp:connect returns >> an {ok, Sock} instead of the expected {error, econnrefused}. If >> >> >> gen_tcp:recv(Sock, 0) is called immediately using the socket just returned, >> it returns an {error, econnrefused}. Connection options used were [binary, >> {packet, raw}, {active, false}]. It should be noted that the gen_tcp:connect >> >> >> succeeds when there is a program listening on that sane host/port, so it's >> unlikely to be a firewall issue. >> >> See http://www.erlang.org/pipermail/erlang-bugs/2008-August/000931.html >> >> This bug is still present in R12B-4. Could this be affecting you? >> >> Regards, >> Edwin Fine >> >> 2008/9/12 Michael Regen >> >>> Hi, >>> >>> I got a series of troubles with gen_tcp all eventually resulting in >>> crashes. I tested this under Windows XP and with R12B-3 as well as R12B-4. >>> Under Linux it seems to work but I am not perfectly sure since the crash >>> happens sporadically and seems to be timing related. >>> >>> The two problems below lead me to a couple of questions: >>> a) What is the real cause? Is it the socket error enfile? Do both >>> problems have the same root cause? >>> b) Is there a bug in Erlang? I guess this should not lead to a crash. >>> c) How do you avoid this problem on systems you do not control yourself? >>> >>> >>> Problem #1: >>> ########### >>> >>> Just compile the following code and run it with sasl enabled and the >>> following command: >>> tcp_test:test(1000). >>> and - yes - without anything listening on port 2222. And sometimes you >>> have to try two times! >>> >>> -------------------------- start: tcp_test.erl -------------------------- >>> -module(tcp_test). >>> >>> -export([test/1, test_con/0]). >>> >>> -define(DEF_PORT, 2222). >>> -define(DEF_IP, {127,0,0,1}). >>> >>> test(0) -> ok; >>> test(HowManyProcs) -> >>> spawn(?MODULE, test_con, []), >>> test(HowManyProcs-1). >>> >>> test_con() -> >>> {ok,S} = gen_tcp:connect(?DEF_IP, ?DEF_PORT,[]), >>> gen_tcp:send(S,<<0,5,65,66,67,68,69>>), >>> receive >>> {tcp_closed, _Socket} -> ok; >>> _Msg -> gen_tcp:close(S) >>> after 500 -> >>> gen_tcp:close(S) >>> end. >>> -------------------------- end: tcp_test.erl -------------------------- >>> >>> It just spawns a bunch of processes all trying to connect to a currently >>> closed port and sending some garbage there. This is what happens: >>> >>> -------------------------- start: log tcp_test.erl >>> -------------------------- >>> =ERROR REPORT==== 12-Sep-2008::15:28:47 === >>> Error in process <0.41.0> with exit value: >>> {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} >>> >>> [... a couple of them but usually between 1 and 20.] >>> >>> =ERROR REPORT==== 12-Sep-2008::15:28:47 === >>> Error in process <0.103.0> with exit value: >>> {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} >>> >>> >>> Crash dump was written to: erl_crash.dump >>> Inconsistent, why isnt io reported? >>> >>> Abnormal termination >>> -------------------------- end: log tcp_test.erl >>> -------------------------- >>> >>> It might have something to do with the socket error enfile 'file table >>> overflow' but I guess it should not simply crash the emulator!? >>> Searching google for 'Inconsistent, why isnt io reported?' just gives one >>> hit to Erlang's source code. >>> I can provide the crash dump if needed. Just did not want to spam the >>> whole list with big attachments. >>> Spawning only 500 processes (tcp_test:test(500).) usually leads to a >>> crash, spawning only 200 seems to work. >>> >>> >>> Problem #2: >>> ########### >>> >>> Now let's try the same with a server answering to port 2222: Just take >>> the code from the trapexit tutorial 'Building a Non-blocking TCP server >>> using OTP principles' >>> http://trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles >>> Start it first and then our test module in a different erlang node as >>> described above. Now, usually the client survives (have seen crashes as >>> well!) and the server crashes in a similar way. Sometimes it survives and in >>> very rare cases you will see the following logs in the erlang server >>> instance: >>> >>> -------------------------- start: log server -------------------------- >>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>> File operation error: system_limit. Function: get_cwd. Process: >>> code_server. >>> >>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>> Error in async accept: {async_accept,"file table overflow"}. >>> >>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>> ** Generic server tcp_listener terminating >>> ** Last message in was {inet_async,#Port<0.109>,1019,{ok,#Port<0.2141>}} >>> ** When Server state == {state,#Port<0.109>,1019,tcp_echo_fsm} >>> ** Reason for termination == >>> ** {async_accept,"file table overflow"} >>> >>> [...] >>> -------------------------- end: log server -------------------------- >>> >>> Can anyone help? Thank you! >>> >>> Regards, >>> Michael >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From johnswolter@REDACTED Fri Sep 12 20:11:09 2008 From: johnswolter@REDACTED (john s wolter) Date: Fri, 12 Sep 2008 14:11:09 -0400 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <762B727D-125A-4739-B599-4114C0460869@gmail.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> Message-ID: <24bcf1860809121111m30568174s95e07fb80cc55da4@mail.gmail.com> Joel, Like any technical project you are dealt a hand and you have to play it. On Fri, Sep 12, 2008 at 9:52 AM, Joel Reymont wrote: > I sell a poker server written in Erlang. It's supposed to be super- > robust and super-scalable. I'm about to move to the next level by > adding the missing features, e.g. tournaments and a Flash client. > > I appreciate everything that the Erlang/OTP is doing but I thought I > would vent a few of my recent frustrations with Erlang. I'm in a good > mood after spending a day with OCaml and I have calmed down. Still, > prepare yourself for a long rant ahead! > > My development workstation is a Mac Pro 2x2.8Ghz Quad Xeon, 12Gb of > memory, one 250Gb and two more drives 500Gb each, all 7200RPM SATA. I > use R12B3, SMP and kernel poll, i.e. > > Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:8] [async- > threads:0] [kernel-poll:true] > > My overwhelming frustration is the opacity of a running Erlang system. > There are no decent tools for peering inside. No usable ones whatsoever! > > With any other language you can profile, make changes, evaluate > performance and make a judgement but not with Erlang. > > I first wrote OpenPoker using OTP everywhere. My players, games, pots, > limits, hands, decks, etc. were all gen_server processes. I used > Mnesia transactions everywhere and I used them often. > > Then I discovered that I cannot scale past 2-3k concurrent players > under heavy use. > > I have a test harness that launches bots which connect to the server > and play by the script. The bots don't wait before replying to bet > requests and so launching a few thousand bots heavily loads the server. > > I don't want just a few thousand concurrent bots, though! I want at > least 10k on a single VM and hundreds of thousands on a cluster, so I > set to optimize my poker server. > > The Erlang Efficiency Guide recommends fprof as the tool. I ran fprof > on my test harness and discovered that the result set cannot be > processed in my 12Gb of memory. I made this discovery after leaving > fprof running for a couple of days and realized this because the fprof > data files were approaching 100Gb and my machine became unusable due > to heavy swapping. > > fprof usets ets tables to analyze the trace results and ets tables > must fit in memory. > > I shortened my test run and was able to see the output of the fprof > trace analysis. To say that it's dense would be an understatement! I > realize that dumping out tuples is easy but aren't computers suppose > to help us humans? > > The final output from fprof is still too raw for me to analyze. > There's absolutely, positively, definitely no way to get a picture of > a running system by reading through it. I understand that I can infer > from the analysis that certain functions take a lot of time but what > if there are none? > > The bulk of the time in my system was taken by various OTP functions > and processes, Mnesia and unknown functions. All I could infer from it > is that perhaps I have too many processes. > > Another thing that I inferred is that the normal method of writing > gen_server code doesn't work for profiling. > > I had to rewrite the gen_server clauses to immediately dispatch to > functions, e.g. > > handle_cast('LOGOUT', Data) -> > handle_cast_logout(Data); > > handle_cast('DISCONNECT', Data) -> > handle_cast_disconnect(Data); > > otherwise all the clauses of a gen_server are squashed together, > regardless of the message pattern. I don't know if there's a better > way to tackle this. > > Next, I rewrote most of my gen_servers as data structures, e.g. pot, > limit, deck, etc. A deck of cards can take a message to draw a card > but the message can just as well be a function call. The deck > structure will need to be modified regardless and the tuple will be > duplicated anyway. There didn't seem to be any advantage in using a > process here, much less a gen_server. > > Next I carefully went trough my Mnesia schema and split some tables > into smaller tables. I made sure that only the absolutely necessary > tables were disk-based. I wish I could run without updating Mnesia > tables during a game but this is impossible since player balances and > status need to be updated when players join or leave a game, as well > as when a game finishes. > > All my hard work paid off and I was able to get close to 10K players, > with kernel poll enabled, of course. Then I ran out of ETS tables. > > I don't create ETS tables on the fly but, apparently, Mnesia does. For > every transaction!!! > > This prompted me to go through the server again and use dirty_read, > dirty_write wherever possible. I also placed balanced in two separate > "counter" tables, integers to be divided by 10000 to get 4 decimal > points of precision. This is so that I could use dirty_update_counter > instead of a regular read, bump, write pattern. > > My frustration kept increasing but I gained more concurrent players. I > can now safely run up to 8K bots before timeouts start to appear. > > These are gen_server call timeouts when requests for game information > take longer than the default 5 seconds. I have an average of 5 players > per game so this is not because a large number of processes are trying > to access the game. > > I suppose this is a reflection of the load on the system, although CPU > usage never goes past 300% which tells me that no more than 3 cores > are used by Erlang. > > The straw that broke my back was when stopping a bot's matching player > gen_server by returning {stop, ... } started causing my observer > process to receive tcp_close and exit. I could repeat this like > clockwork. Only spawning a separate process to send player a stop > message would fix this. > > Then I changed the way I represent cards started seeing this behavior > again, in just one of my tests. What do cards have to do with > tcp_close? I don't know and dbg tracer is my best friend! What I know > is what git tells me and git says cards were the only difference. > > Anyway, I don't think I have fully recovered yet. I may need a weekend > just to regain my sanity. I will try to spread the load among several > VMs but my hunch is that my distributed 100k players target is far far > away. I'll may have to keep flying blind, with only traces and > printouts to my rescue. > > Thanks for listening, Joel > > -- > wagerlabs.com > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- John S. Wolter President Wolter Works Mailto:johnswolter@REDACTED Desk 1-734-665-1263 Cell: 1-734-904-8433 -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Fri Sep 12 20:13:59 2008 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 12 Sep 2008 19:13:59 +0100 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <24bcf1860809121111m30568174s95e07fb80cc55da4@mail.gmail.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <24bcf1860809121111m30568174s95e07fb80cc55da4@mail.gmail.com> Message-ID: On Sep 12, 2008, at 7:11 PM, john s wolter wrote: > Like any technical project you are dealt a hand and you have to play > it. Aye! Rest assured, I'm not giving up. -- wagerlabs.com From sunyin51@REDACTED Fri Sep 12 20:17:16 2008 From: sunyin51@REDACTED (yin sun) Date: Fri, 12 Sep 2008 14:17:16 -0400 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <20080912142902.D78F42406E@relay.gooddata.com> <4F676E1D-EA89-4791-A4AD-3D1A651ED715@gmail.com> <20080912145221.B4A892407D@relay.gooddata.com> <7C36263B-0475-47A4-AC24-8A34D2818B2A@gmail.com> <6c2563b20809120914o1218bcf2qcd99fe0ece1abc69@mail.gmail.com> Message-ID: <8196381f0809121117v4bf22f75q9ffd0fd241f575da@mail.gmail.com> Erlang needs to implement performance counters similar to Dtrace. /Yin On Fri, Sep 12, 2008 at 1:52 PM, Joel Reymont wrote: > > On Sep 12, 2008, at 5:14 PM, Edwin Fine wrote: > > > What is your hardware configuration? How many cores are available? The > > reason I ask is because some people have seen better performance in > > certain > > clustering-type Erlang applications by running one VM per core, each > > VM > > running in +S 1 (non-SMP) mode, instead of using SMP. Have you tried > > this? > > I ran the same test with +S 1. It doesn't look like SMP affects things > too much in terms of # requests per second. > > The big difference is that the test runs through to the end, no > gen_server timeouts. It starts timing out with 2k games and ~7K > players, though. > > =INFO REPORT==== 12-Sep-2008::18:42:55 === > requests: 910 > bytes: 24558 > requests_per_second: 90 > bytes_per_second: 2455 > > =INFO REPORT==== 12-Sep-2008::18:43:05 === > requests: 11222 > bytes: 308699 > requests_per_second: 1122 > bytes_per_second: 30867 > > 10 Mnesia overloaded reports (x10). > > =ERROR REPORT x10 ==== 12-Sep-2008::18:43:09 === > Mnesia('1@REDACTED'): ** WARNING ** Mnesia is overloaded: {dump_log, > > write_threshold} > > =INFO REPORT==== 12-Sep-2008::18:43:15 === > requests: 4461 > bytes: 60746 > requests_per_second: 442 > bytes_per_second: 6025 > > =ERROR REPORT x6 ==== 12-Sep-2008::18:43:16 === > Mnesia('1@REDACTED'): ** WARNING ** Mnesia is overloaded: {dump_log, > > write_threshold} > > =INFO REPORT==== 12-Sep-2008::18:43:25 === > requests: 1874 > bytes: 24746 > requests_per_second: 187 > bytes_per_second: 2470 > > =INFO REPORT==== 12-Sep-2008::18:43:35 === > requests: 3864 > bytes: 55476 > requests_per_second: 384 > bytes_per_second: 5516 > > =ERROR REPORT x4 ==== 12-Sep-2008::18:43:38 === > Mnesia('1@REDACTED'): ** WARNING ** Mnesia is overloaded: {dump_log, > > write_threshold} > =INFO REPORT==== 12-Sep-2008::18:43:45 === > requests: 9752 > bytes: 84331 > requests_per_second: 974 > bytes_per_second: 8425 > > =ERROR REPORT x7 ==== 12-Sep-2008::18:43:47 === > Mnesia('1@REDACTED'): ** WARNING ** Mnesia is overloaded: {dump_log, > > write_threshold} > 1000 games finished > Elapsed: 59.147214s, Average run time: 0.059147214 seconds > Mb exited successfully, 59.148019 seconds elapsed > ok > (1@REDACTED)3> > > =INFO REPORT==== 12-Sep-2008::18:43:55 === > requests: 10950 > bytes: 74516 > requests_per_second: 1094 > bytes_per_second: 7450 > > > -- > wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.regen@REDACTED Fri Sep 12 20:47:31 2008 From: michael.regen@REDACTED (Michael Regen) Date: Fri, 12 Sep 2008 20:47:31 +0200 Subject: [erlang-questions] Erlang crash gen_tcp related (probably only under Windows) In-Reply-To: <6c2563b20809121054p23afa167macccc9a73e0cb860@mail.gmail.com> References: <9b59d0270809120700l67787190v7cb1a4c0e670589a@mail.gmail.com> <6c2563b20809120932hc19ff72u1c41ae83bbecdade@mail.gmail.com> <9b59d0270809121039j5313d1d9odb995f37f4ccd0ef@mail.gmail.com> <6c2563b20809121054p23afa167macccc9a73e0cb860@mail.gmail.com> Message-ID: <9b59d0270809121147tfda819eg8df3ce7712fe85e7@mail.gmail.com> Just tested it on another machine with SP3 installed. No difference. Same problem. Yes, Windows is flaky and I personally would like to be able to say I would rather go to hell than installing a server on Windows which is expected to run robust. But well, either Erlang is robust on Windows as well or no Erlang on Windows. :( Regards, Michael -- Quote from a >3000 employees IT centric company's CIO I had the pleasure to witness four weeks ago: 'For the messaging back end? No, we can't use Java. Java is too slow.' On Fri, Sep 12, 2008 at 7:54 PM, Edwin Fine wrote: > Michael, > > I've always felt that the Windows version of Erlang is a bit flaky. Then > again, I think Windows itself is more than a bit flaky, so maybe it's not > Erlang's fault ;) > I wonder if running on SP4 would improve things? > > > On Fri, Sep 12, 2008 at 1:39 PM, Michael Regen wrote: > >> Hi Edwin, >> >> It is possible that both issues have a similar source but I do not see >> many reasons why there must be a common source. >> I was running my tests on a 32bit single core Windows XP SP2 system just >> by running >> werl.exe -boot start_sasl >> or >> werl.exe >> >> and did nothing fancy. My R12B-3 version is self compiled, R12B-4 is out >> of the erlang.org box. >> Client and server tests where done by starting two different instances of >> werl. >> Furthermore my tcp_test:test does not care whether results from >> gen_tcp:connect are correct or not. It just assumes {ok, Socket} and crashes >> the process if otherwise. Of course it was a surprise that under some >> circumstances the whole emulator crashes. >> >> By the way, the crash dump slogan is unspectecular: 'Slogan: Inconsistent, >> why isnt io reported?' >> >> UPDATE: I got some more observations which puzzle me even more: >> >> Just did some more of the same tests but this time by starting: >> erl.exe >> application:start(tcp_server). >> and >> erl.exe >> tcp_test:test(1000). >> >> There seems to be a difference between erl.exe and werl.exe. >> >> This time results are pretty different: >> Now it is much harder to crash the emulator. It takes significant more >> processes / tries until something bad happens: >> >> client only (tcp_test:test(5000)) crashes eventually in the same way but >> Window's cmd.exe now follows with a: >> The exception unknown software exception (0x40000015) occured in the >> application at location 0x008fff86 >> >> after the 'Crash dump was written to: erl_crash.dump / Inconsistent, why >> isnt io reported?' message and the crash dump file. >> >> The exception seems to always occure at the same location. >> >> A lot more error messages are printed now (as expected) until the crash. >> Besides the {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} I >> can now also watch lots of >> {{badmatch,{error,eaddrinuse}},[{tcp_test,test_con,0}]} >> and >> {{badmatch,{error,system_limit}},[{tcp_test,test_con,0}]} >> errors. >> >> The good message: During tests together with the server backend I was not >> able to crash the server. But I am not convinced that erl.exe solves >> everthing server side. >> >> Regards, >> Michael >> >> >> On Fri, Sep 12, 2008 at 6:32 PM, Edwin Fine wrote: >> >>> Please be aware that I reported a bug a while ago on erlang-bugs, where >>> attempting to connect to a socket that is not being listened on will >>> sometimes return an actual success return, but subsequent operations will >>> fail. Here is an excerpt from that bug report. >>> >>> When calling gen_tcp:connect/3 or /4 on a host/port that does not have a >>> running program listening on it, at random intervals gen_tcp:connect returns >>> an {ok, Sock} instead of the expected {error, econnrefused}. If >>> >>> >>> >>> gen_tcp:recv(Sock, 0) is called immediately using the socket just returned, >>> it returns an {error, econnrefused}. Connection options used were [binary, >>> {packet, raw}, {active, false}]. It should be noted that the gen_tcp:connect >>> >>> >>> >>> succeeds when there is a program listening on that sane host/port, so it's >>> unlikely to be a firewall issue. >>> >>> See http://www.erlang.org/pipermail/erlang-bugs/2008-August/000931.html >>> >>> This bug is still present in R12B-4. Could this be affecting you? >>> >>> Regards, >>> Edwin Fine >>> >>> 2008/9/12 Michael Regen >>> >>>> Hi, >>>> >>>> I got a series of troubles with gen_tcp all eventually resulting in >>>> crashes. I tested this under Windows XP and with R12B-3 as well as R12B-4. >>>> Under Linux it seems to work but I am not perfectly sure since the crash >>>> happens sporadically and seems to be timing related. >>>> >>>> The two problems below lead me to a couple of questions: >>>> a) What is the real cause? Is it the socket error enfile? Do both >>>> problems have the same root cause? >>>> b) Is there a bug in Erlang? I guess this should not lead to a crash. >>>> c) How do you avoid this problem on systems you do not control yourself? >>>> >>>> >>>> Problem #1: >>>> ########### >>>> >>>> Just compile the following code and run it with sasl enabled and the >>>> following command: >>>> tcp_test:test(1000). >>>> and - yes - without anything listening on port 2222. And sometimes you >>>> have to try two times! >>>> >>>> -------------------------- start: tcp_test.erl >>>> -------------------------- >>>> -module(tcp_test). >>>> >>>> -export([test/1, test_con/0]). >>>> >>>> -define(DEF_PORT, 2222). >>>> -define(DEF_IP, {127,0,0,1}). >>>> >>>> test(0) -> ok; >>>> test(HowManyProcs) -> >>>> spawn(?MODULE, test_con, []), >>>> test(HowManyProcs-1). >>>> >>>> test_con() -> >>>> {ok,S} = gen_tcp:connect(?DEF_IP, ?DEF_PORT,[]), >>>> gen_tcp:send(S,<<0,5,65,66,67,68,69>>), >>>> receive >>>> {tcp_closed, _Socket} -> ok; >>>> _Msg -> gen_tcp:close(S) >>>> after 500 -> >>>> gen_tcp:close(S) >>>> end. >>>> -------------------------- end: tcp_test.erl -------------------------- >>>> >>>> It just spawns a bunch of processes all trying to connect to a currently >>>> closed port and sending some garbage there. This is what happens: >>>> >>>> -------------------------- start: log tcp_test.erl >>>> -------------------------- >>>> =ERROR REPORT==== 12-Sep-2008::15:28:47 === >>>> Error in process <0.41.0> with exit value: >>>> {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} >>>> >>>> [... a couple of them but usually between 1 and 20.] >>>> >>>> =ERROR REPORT==== 12-Sep-2008::15:28:47 === >>>> Error in process <0.103.0> with exit value: >>>> {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} >>>> >>>> >>>> Crash dump was written to: erl_crash.dump >>>> Inconsistent, why isnt io reported? >>>> >>>> Abnormal termination >>>> -------------------------- end: log tcp_test.erl >>>> -------------------------- >>>> >>>> It might have something to do with the socket error enfile 'file table >>>> overflow' but I guess it should not simply crash the emulator!? >>>> Searching google for 'Inconsistent, why isnt io reported?' just gives >>>> one hit to Erlang's source code. >>>> I can provide the crash dump if needed. Just did not want to spam the >>>> whole list with big attachments. >>>> Spawning only 500 processes (tcp_test:test(500).) usually leads to a >>>> crash, spawning only 200 seems to work. >>>> >>>> >>>> Problem #2: >>>> ########### >>>> >>>> Now let's try the same with a server answering to port 2222: Just take >>>> the code from the trapexit tutorial 'Building a Non-blocking TCP server >>>> using OTP principles' >>>> http://trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles >>>> Start it first and then our test module in a different erlang node as >>>> described above. Now, usually the client survives (have seen crashes as >>>> well!) and the server crashes in a similar way. Sometimes it survives and in >>>> very rare cases you will see the following logs in the erlang server >>>> instance: >>>> >>>> -------------------------- start: log server -------------------------- >>>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>>> File operation error: system_limit. Function: get_cwd. Process: >>>> code_server. >>>> >>>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>>> Error in async accept: {async_accept,"file table overflow"}. >>>> >>>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>>> ** Generic server tcp_listener terminating >>>> ** Last message in was {inet_async,#Port<0.109>,1019,{ok,#Port<0.2141>}} >>>> ** When Server state == {state,#Port<0.109>,1019,tcp_echo_fsm} >>>> ** Reason for termination == >>>> ** {async_accept,"file table overflow"} >>>> >>>> [...] >>>> -------------------------- end: log server -------------------------- >>>> >>>> Can anyone help? Thank you! >>>> >>>> Regards, >>>> Michael >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>> >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ibaird@REDACTED Fri Sep 12 20:54:27 2008 From: ibaird@REDACTED (Ian Baird) Date: Fri, 12 Sep 2008 11:54:27 -0700 Subject: [erlang-questions] My frustration with Erlang Message-ID: > Erlang needs to implement performance counters similar to Dtrace. > > /Yin Actually, a dtrace-enabled version of the erlang interpreter would be pretty sweet, and useful for people running on Solaris, *BSD, or OS X. Is this in the works? - Ian From vances@REDACTED Fri Sep 12 21:00:34 2008 From: vances@REDACTED (Vance Shipley) Date: Fri, 12 Sep 2008 15:00:34 -0400 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: References: Message-ID: <20080912190034.GD272@h216-235-12-173.host.egate.net> On Fri, Sep 12, 2008 at 11:54:27AM -0700, Ian Baird wrote: } Actually, a dtrace-enabled version of the erlang interpreter would be } pretty sweet, and useful for people running on Solaris, *BSD, or OS X. } Is this in the works? http://groups.google.com/group/erlang-dtrace -Vance From erlang-questions_efine@REDACTED Fri Sep 12 21:01:10 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Fri, 12 Sep 2008 15:01:10 -0400 Subject: [erlang-questions] Erlang crash gen_tcp related (probably only under Windows) In-Reply-To: <9b59d0270809121147tfda819eg8df3ce7712fe85e7@mail.gmail.com> References: <9b59d0270809120700l67787190v7cb1a4c0e670589a@mail.gmail.com> <6c2563b20809120932hc19ff72u1c41ae83bbecdade@mail.gmail.com> <9b59d0270809121039j5313d1d9odb995f37f4ccd0ef@mail.gmail.com> <6c2563b20809121054p23afa167macccc9a73e0cb860@mail.gmail.com> <9b59d0270809121147tfda819eg8df3ce7712fe85e7@mail.gmail.com> Message-ID: <6c2563b20809121201r57e64301hf017b63e10069ab5@mail.gmail.com> I hear you :). When I've got some time I will try out my R12B-3 installation on SP4 with your program, but can't right now. I am interested to see what happens. Rgds, Ed On Fri, Sep 12, 2008 at 2:47 PM, Michael Regen wrote: > Just tested it on another machine with SP3 installed. No difference. Same > problem. > > Yes, Windows is flaky and I personally would like to be able to say I would > rather go to hell than installing a server on Windows which is expected to > run robust. > But well, either Erlang is robust on Windows as well or no Erlang on > Windows. :( > > Regards, > Michael > > -- > Quote from a >3000 employees IT centric company's CIO I had the pleasure to > witness four weeks ago: 'For the messaging back end? No, we can't use Java. > Java is too slow.' > > > > > On Fri, Sep 12, 2008 at 7:54 PM, Edwin Fine < > erlang-questions_efine@REDACTED> wrote: > >> Michael, >> >> I've always felt that the Windows version of Erlang is a bit flaky. Then >> again, I think Windows itself is more than a bit flaky, so maybe it's not >> Erlang's fault ;) >> I wonder if running on SP4 would improve things? >> >> >> On Fri, Sep 12, 2008 at 1:39 PM, Michael Regen wrote: >> >>> Hi Edwin, >>> >>> It is possible that both issues have a similar source but I do not see >>> many reasons why there must be a common source. >>> I was running my tests on a 32bit single core Windows XP SP2 system just >>> by running >>> werl.exe -boot start_sasl >>> or >>> werl.exe >>> >>> and did nothing fancy. My R12B-3 version is self compiled, R12B-4 is out >>> of the erlang.org box. >>> Client and server tests where done by starting two different instances of >>> werl. >>> Furthermore my tcp_test:test does not care whether results from >>> gen_tcp:connect are correct or not. It just assumes {ok, Socket} and crashes >>> the process if otherwise. Of course it was a surprise that under some >>> circumstances the whole emulator crashes. >>> >>> By the way, the crash dump slogan is unspectecular: 'Slogan: >>> Inconsistent, why isnt io reported?' >>> >>> UPDATE: I got some more observations which puzzle me even more: >>> >>> Just did some more of the same tests but this time by starting: >>> erl.exe >>> application:start(tcp_server). >>> and >>> erl.exe >>> tcp_test:test(1000). >>> >>> There seems to be a difference between erl.exe and werl.exe. >>> >>> This time results are pretty different: >>> Now it is much harder to crash the emulator. It takes significant more >>> processes / tries until something bad happens: >>> >>> client only (tcp_test:test(5000)) crashes eventually in the same way but >>> Window's cmd.exe now follows with a: >>> The exception unknown software exception (0x40000015) occured in the >>> application at location 0x008fff86 >>> >>> after the 'Crash dump was written to: erl_crash.dump / Inconsistent, why >>> isnt io reported?' message and the crash dump file. >>> >>> The exception seems to always occure at the same location. >>> >>> A lot more error messages are printed now (as expected) until the crash. >>> Besides the {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} I >>> can now also watch lots of >>> {{badmatch,{error,eaddrinuse}},[{tcp_test,test_con,0}]} >>> and >>> {{badmatch,{error,system_limit}},[{tcp_test,test_con,0}]} >>> errors. >>> >>> The good message: During tests together with the server backend I was not >>> able to crash the server. But I am not convinced that erl.exe solves >>> everthing server side. >>> >>> Regards, >>> Michael >>> >>> >>> On Fri, Sep 12, 2008 at 6:32 PM, Edwin Fine wrote: >>> >>>> Please be aware that I reported a bug a while ago on erlang-bugs, where >>>> attempting to connect to a socket that is not being listened on will >>>> sometimes return an actual success return, but subsequent operations will >>>> fail. Here is an excerpt from that bug report. >>>> >>>> When calling gen_tcp:connect/3 or /4 on a host/port that does not have a >>>> running program listening on it, at random intervals gen_tcp:connect returns >>>> an {ok, Sock} instead of the expected {error, econnrefused}. If >>>> >>>> >>>> >>>> >>>> gen_tcp:recv(Sock, 0) is called immediately using the socket just returned, >>>> it returns an {error, econnrefused}. Connection options used were [binary, >>>> {packet, raw}, {active, false}]. It should be noted that the gen_tcp:connect >>>> >>>> >>>> >>>> >>>> succeeds when there is a program listening on that sane host/port, so it's >>>> unlikely to be a firewall issue. >>>> >>>> See http://www.erlang.org/pipermail/erlang-bugs/2008-August/000931.html >>>> >>>> This bug is still present in R12B-4. Could this be affecting you? >>>> >>>> Regards, >>>> Edwin Fine >>>> >>>> 2008/9/12 Michael Regen >>>> >>>>> Hi, >>>>> >>>>> I got a series of troubles with gen_tcp all eventually resulting in >>>>> crashes. I tested this under Windows XP and with R12B-3 as well as R12B-4. >>>>> Under Linux it seems to work but I am not perfectly sure since the crash >>>>> happens sporadically and seems to be timing related. >>>>> >>>>> The two problems below lead me to a couple of questions: >>>>> a) What is the real cause? Is it the socket error enfile? Do both >>>>> problems have the same root cause? >>>>> b) Is there a bug in Erlang? I guess this should not lead to a crash. >>>>> c) How do you avoid this problem on systems you do not control >>>>> yourself? >>>>> >>>>> >>>>> Problem #1: >>>>> ########### >>>>> >>>>> Just compile the following code and run it with sasl enabled and the >>>>> following command: >>>>> tcp_test:test(1000). >>>>> and - yes - without anything listening on port 2222. And sometimes you >>>>> have to try two times! >>>>> >>>>> -------------------------- start: tcp_test.erl >>>>> -------------------------- >>>>> -module(tcp_test). >>>>> >>>>> -export([test/1, test_con/0]). >>>>> >>>>> -define(DEF_PORT, 2222). >>>>> -define(DEF_IP, {127,0,0,1}). >>>>> >>>>> test(0) -> ok; >>>>> test(HowManyProcs) -> >>>>> spawn(?MODULE, test_con, []), >>>>> test(HowManyProcs-1). >>>>> >>>>> test_con() -> >>>>> {ok,S} = gen_tcp:connect(?DEF_IP, ?DEF_PORT,[]), >>>>> gen_tcp:send(S,<<0,5,65,66,67,68,69>>), >>>>> receive >>>>> {tcp_closed, _Socket} -> ok; >>>>> _Msg -> gen_tcp:close(S) >>>>> after 500 -> >>>>> gen_tcp:close(S) >>>>> end. >>>>> -------------------------- end: tcp_test.erl -------------------------- >>>>> >>>>> It just spawns a bunch of processes all trying to connect to a >>>>> currently closed port and sending some garbage there. This is what happens: >>>>> >>>>> -------------------------- start: log tcp_test.erl >>>>> -------------------------- >>>>> =ERROR REPORT==== 12-Sep-2008::15:28:47 === >>>>> Error in process <0.41.0> with exit value: >>>>> {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} >>>>> >>>>> [... a couple of them but usually between 1 and 20.] >>>>> >>>>> =ERROR REPORT==== 12-Sep-2008::15:28:47 === >>>>> Error in process <0.103.0> with exit value: >>>>> {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} >>>>> >>>>> >>>>> Crash dump was written to: erl_crash.dump >>>>> Inconsistent, why isnt io reported? >>>>> >>>>> Abnormal termination >>>>> -------------------------- end: log tcp_test.erl >>>>> -------------------------- >>>>> >>>>> It might have something to do with the socket error enfile 'file table >>>>> overflow' but I guess it should not simply crash the emulator!? >>>>> Searching google for 'Inconsistent, why isnt io reported?' just gives >>>>> one hit to Erlang's source code. >>>>> I can provide the crash dump if needed. Just did not want to spam the >>>>> whole list with big attachments. >>>>> Spawning only 500 processes (tcp_test:test(500).) usually leads to a >>>>> crash, spawning only 200 seems to work. >>>>> >>>>> >>>>> Problem #2: >>>>> ########### >>>>> >>>>> Now let's try the same with a server answering to port 2222: Just take >>>>> the code from the trapexit tutorial 'Building a Non-blocking TCP server >>>>> using OTP principles' >>>>> http://trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles >>>>> Start it first and then our test module in a different erlang node as >>>>> described above. Now, usually the client survives (have seen crashes as >>>>> well!) and the server crashes in a similar way. Sometimes it survives and in >>>>> very rare cases you will see the following logs in the erlang server >>>>> instance: >>>>> >>>>> -------------------------- start: log server -------------------------- >>>>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>>>> File operation error: system_limit. Function: get_cwd. Process: >>>>> code_server. >>>>> >>>>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>>>> Error in async accept: {async_accept,"file table overflow"}. >>>>> >>>>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>>>> ** Generic server tcp_listener terminating >>>>> ** Last message in was >>>>> {inet_async,#Port<0.109>,1019,{ok,#Port<0.2141>}} >>>>> ** When Server state == {state,#Port<0.109>,1019,tcp_echo_fsm} >>>>> ** Reason for termination == >>>>> ** {async_accept,"file table overflow"} >>>>> >>>>> [...] >>>>> -------------------------- end: log server -------------------------- >>>>> >>>>> Can anyone help? Thank you! >>>>> >>>>> Regards, >>>>> Michael >>>>> >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>>> >>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ibaird@REDACTED Fri Sep 12 21:01:38 2008 From: ibaird@REDACTED (Ian Baird) Date: Fri, 12 Sep 2008 12:01:38 -0700 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <20080912190034.GD272@h216-235-12-173.host.egate.net> References: <20080912190034.GD272@h216-235-12-173.host.egate.net> Message-ID: Sweet - thanks. - Ian On Sep 12, 2008, at 12:00 PM, Vance Shipley wrote: > On Fri, Sep 12, 2008 at 11:54:27AM -0700, Ian Baird wrote: > } Actually, a dtrace-enabled version of the erlang interpreter > would be > } pretty sweet, and useful for people running on Solaris, *BSD, or > OS X. > } Is this in the works? > > http://groups.google.com/group/erlang-dtrace > > -Vance From erlang-questions_efine@REDACTED Fri Sep 12 21:08:31 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Fri, 12 Sep 2008 15:08:31 -0400 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <20080912142902.D78F42406E@relay.gooddata.com> <4F676E1D-EA89-4791-A4AD-3D1A651ED715@gmail.com> <20080912145221.B4A892407D@relay.gooddata.com> <7C36263B-0475-47A4-AC24-8A34D2818B2A@gmail.com> <20080912163524.A818524081@relay.gooddata.com> Message-ID: <6c2563b20809121208g663d202eub0d67d163aa14ee4@mail.gmail.com> I'd be interested in seeing the output of vmstat over a period of time. Because only 3 of the 8 CPUs are being used, it sounds as if either the app is suffering from some sort of lock contention, or is I/O bound. If it's IO bound, then putting the database tables on heavily-memory-cached RAID or SAN hardware like EMC could make a huge difference. I know that probably doesn't help because if you're like most people, you don't have the megabucks one needs for such a device. However, maybe a lower-end (but still fast) RAID would be useful. Is there any way you could run the app for 15 minutes under full load and capture the system performance using vmstat? Ed On Fri, Sep 12, 2008 at 1:41 PM, Joel Reymont wrote: > > On Sep 12, 2008, at 5:35 PM, Hynek Vychodil wrote: > > > It not seems as good as I realize from your previous messages. It > > looks like you can get less than 1kreq/s. > > Right. > > > I don't know if it is load which you can manage for example 5, > > 10, ... minutes. > > Yes and no, see below. > > > You can serve 15k concurrent players. Sound it still to much bad for > > you? > > 15K concurrent players would be excellent. The stats I posted before > don't paint the full picture, though. The part that I didn't post > looks like this... > > Simulating gameplay with 1000 games... > Waiting for games to end... > 50 games started, 262 players > 100 games started, 504 players > ... > 950 games started, 4777 players > 1000 games started, 5066 players > > 4 Mnesia overloaded error reports > > =ERROR REPORT x 4==== 12-Sep-2008::16:34:40 === > Mnesia('1@REDACTED'): ** WARNING ** Mnesia is overloaded: {dump_log, > > write_threshold} > > And 11 more > > =ERROR REPORT x 11 ==== 12-Sep-2008::16:34:44 === > Mnesia('1@REDACTED'): ** WARNING ** Mnesia is overloaded: {dump_log, > > write_threshold} > > And then the real bummer, a whole lot of these: > > =ERROR REPORT ==== 12-Sep-2008::16:35:01 === > ** State machine <0.9390.0> terminating > ** Last timer event in was 'CHECK' > ** When State == dispatch > ... > ** Reason for termination = > ** {timeout,{gen_server,call,[<0.9391.0>,{'SEATS',119}]}} > > The above says that even with just 5K players the card game FSM times > out when requesting seats matching a certain mask, e.g. the reply > takes longer than 5 seconds. The game bombs out at this point. > > I could increase the timeout or make the call just wait forever. I > don't want to do this, though, as this timeout serves as a performance > indicator. > > Thanks, Joel > > -- > wagerlabs.com > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nc@REDACTED Fri Sep 12 21:33:46 2008 From: nc@REDACTED (Nicolas Charpentier) Date: Fri, 12 Sep 2008 21:33:46 +0200 Subject: [erlang-questions] Paris ErlLounge In-Reply-To: <48CA9CBC.1040805@dominicwilliams.net> References: <48CA9CBC.1040805@dominicwilliams.net> Message-ID: <48CAC41A.8030500@charpi.net> Dominic Williams wrote: > Hello, > > We are holding an ErlLounge in Paris, on Wednesday 1st > October, at Carr's Pub, 1 rue du Mont Thabor, 75001 Paris. > > I hope to see many new and old Erlangers there ! > > If possible send me an email if you plan to come, so that I > can book enough space... I'll be there hoping to see new Erlangers from Paris too :-) --- Nicolas http://charpi.net From vances@REDACTED Fri Sep 12 21:34:14 2008 From: vances@REDACTED (Vance Shipley) Date: Fri, 12 Sep 2008 15:34:14 -0400 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <762B727D-125A-4739-B599-4114C0460869@gmail.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> Message-ID: <20080912193414.GE272@h216-235-12-173.host.egate.net> On Fri, Sep 12, 2008 at 02:52:07PM +0100, Joel Reymont wrote: } Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:8] [async- } threads:0] [kernel-poll:true] Joel, Have you tried adding a thread pool? If you are IO bound on disk that should help quite a bit. It doesn't help with TCP/IP however as the inet drivers are not threaded. Maybe they should be. -Vance From raould@REDACTED Fri Sep 12 21:46:41 2008 From: raould@REDACTED (Raoul Duke) Date: Fri, 12 Sep 2008 12:46:41 -0700 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <20080912193414.GE272@h216-235-12-173.host.egate.net> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <20080912193414.GE272@h216-235-12-173.host.egate.net> Message-ID: <91a2ba3e0809121246x6bf6bfb4y470a646337e88cc0@mail.gmail.com> cool! lots of very useful info coming across the wire here from kind experienced folks. would be neat if it were available on the wiki, or (as folks have suggested) were supported by tools like dtrace. > Have you tried adding a thread pool? If you are IO bound on disk > that should help quite a bit. It doesn't help with TCP/IP however > as the inet drivers are not threaded. Maybe they should be. From joelr1@REDACTED Fri Sep 12 21:53:13 2008 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 12 Sep 2008 20:53:13 +0100 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <20080912193414.GE272@h216-235-12-173.host.egate.net> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <20080912193414.GE272@h216-235-12-173.host.egate.net> Message-ID: <5AAF4B1A-691C-4060-A648-C3E67B95AF8E@gmail.com> On Sep 12, 2008, at 8:34 PM, Vance Shipley wrote: > Have you tried adding a thread pool? If you are IO bound on disk > that should help quite a bit. Tried 5 async threads and got a much higher rate of "Mnesia overloaded" messages. Didn't help much otherwise, I still get the dreaded gen_server timeout. Thanks, Joel -- wagerlabs.com From paulrbrown@REDACTED Fri Sep 12 23:03:39 2008 From: paulrbrown@REDACTED (Paul Brown) Date: Fri, 12 Sep 2008 14:03:39 -0700 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <762B727D-125A-4739-B599-4114C0460869@gmail.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> Message-ID: <4578F860-B86E-42F2-9B9F-668A7A2D91F2@gmail.com> On Sep 12, 2008, at 6:52 AM, Joel Reymont wrote: > [...] > I suppose this is a reflection of the load on the system, although CPU > usage never goes past 300% which tells me that no more than 3 cores > are used by Erlang. > [...] You know, my own experience with R12B on Mac OS X (analogous machine to yours, 8 cores, buncha RAM, fast disks, etc.) was similar: http://is.gd/2y0j = http://mult.ifario.us/p/use-the-cores-erl http://is.gd/2y0g = http://www.erlang.org/pipermail/erlang-questions/2008-January/032386.html I'll chalk it up to something like the preemption timing or other low- level characteristics of MacOS. You need to head to a larger number of OS processes running Erlang VMs to get your utilization up, and this seems like a sensible reality for multicore in general, as OS scheduling and Erlang scheduling are two independent behaviors from which you need to select the happy medium. Cheers. Paul Brown paulrbrown@REDACTED From michael.regen@REDACTED Fri Sep 12 23:42:21 2008 From: michael.regen@REDACTED (Michael Regen) Date: Fri, 12 Sep 2008 23:42:21 +0200 Subject: [erlang-questions] Erlang crash gen_tcp related (probably only under Windows) In-Reply-To: <6c2563b20809121201r57e64301hf017b63e10069ab5@mail.gmail.com> References: <9b59d0270809120700l67787190v7cb1a4c0e670589a@mail.gmail.com> <6c2563b20809120932hc19ff72u1c41ae83bbecdade@mail.gmail.com> <9b59d0270809121039j5313d1d9odb995f37f4ccd0ef@mail.gmail.com> <6c2563b20809121054p23afa167macccc9a73e0cb860@mail.gmail.com> <9b59d0270809121147tfda819eg8df3ce7712fe85e7@mail.gmail.com> <6c2563b20809121201r57e64301hf017b63e10069ab5@mail.gmail.com> Message-ID: <9b59d0270809121442v57adf399q4782d4b3f32eeb82@mail.gmail.com> I would be very interested to hear about some tests from others! And Edwin, I guess you mean SP3. Windows XP SP3 is the most recent service pack. SP4 is if at all a giant trojan, isn't it? ;) Regards, Michael On Fri, Sep 12, 2008 at 9:01 PM, Edwin Fine wrote: > I hear you :). > > When I've got some time I will try out my R12B-3 installation on SP4 with > your program, but can't right now. I am interested to see what happens. > > Rgds, > Ed > > > On Fri, Sep 12, 2008 at 2:47 PM, Michael Regen wrote: > >> Just tested it on another machine with SP3 installed. No difference. Same >> problem. >> >> Yes, Windows is flaky and I personally would like to be able to say I >> would rather go to hell than installing a server on Windows which is >> expected to run robust. >> But well, either Erlang is robust on Windows as well or no Erlang on >> Windows. :( >> >> Regards, >> Michael >> >> -- >> Quote from a >3000 employees IT centric company's CIO I had the pleasure >> to witness four weeks ago: 'For the messaging back end? No, we can't use >> Java. Java is too slow.' >> >> >> >> >> On Fri, Sep 12, 2008 at 7:54 PM, Edwin Fine < >> erlang-questions_efine@REDACTED> wrote: >> >>> Michael, >>> >>> I've always felt that the Windows version of Erlang is a bit flaky. Then >>> again, I think Windows itself is more than a bit flaky, so maybe it's not >>> Erlang's fault ;) >>> I wonder if running on SP4 would improve things? >>> >>> >>> On Fri, Sep 12, 2008 at 1:39 PM, Michael Regen wrote: >>> >>>> Hi Edwin, >>>> >>>> It is possible that both issues have a similar source but I do not see >>>> many reasons why there must be a common source. >>>> I was running my tests on a 32bit single core Windows XP SP2 system just >>>> by running >>>> werl.exe -boot start_sasl >>>> or >>>> werl.exe >>>> >>>> and did nothing fancy. My R12B-3 version is self compiled, R12B-4 is out >>>> of the erlang.org box. >>>> Client and server tests where done by starting two different instances >>>> of werl. >>>> Furthermore my tcp_test:test does not care whether results from >>>> gen_tcp:connect are correct or not. It just assumes {ok, Socket} and crashes >>>> the process if otherwise. Of course it was a surprise that under some >>>> circumstances the whole emulator crashes. >>>> >>>> By the way, the crash dump slogan is unspectecular: 'Slogan: >>>> Inconsistent, why isnt io reported?' >>>> >>>> UPDATE: I got some more observations which puzzle me even more: >>>> >>>> Just did some more of the same tests but this time by starting: >>>> erl.exe >>>> application:start(tcp_server). >>>> and >>>> erl.exe >>>> tcp_test:test(1000). >>>> >>>> There seems to be a difference between erl.exe and werl.exe. >>>> >>>> This time results are pretty different: >>>> Now it is much harder to crash the emulator. It takes significant more >>>> processes / tries until something bad happens: >>>> >>>> client only (tcp_test:test(5000)) crashes eventually in the same way but >>>> Window's cmd.exe now follows with a: >>>> The exception unknown software exception (0x40000015) occured in the >>>> application at location 0x008fff86 >>>> >>>> after the 'Crash dump was written to: erl_crash.dump / Inconsistent, why >>>> isnt io reported?' message and the crash dump file. >>>> >>>> The exception seems to always occure at the same location. >>>> >>>> A lot more error messages are printed now (as expected) until the crash. >>>> Besides the {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} I >>>> can now also watch lots of >>>> {{badmatch,{error,eaddrinuse}},[{tcp_test,test_con,0}]} >>>> and >>>> {{badmatch,{error,system_limit}},[{tcp_test,test_con,0}]} >>>> errors. >>>> >>>> The good message: During tests together with the server backend I was >>>> not able to crash the server. But I am not convinced that erl.exe solves >>>> everthing server side. >>>> >>>> Regards, >>>> Michael >>>> >>>> >>>> On Fri, Sep 12, 2008 at 6:32 PM, Edwin Fine wrote: >>>> >>>>> Please be aware that I reported a bug a while ago on erlang-bugs, where >>>>> attempting to connect to a socket that is not being listened on will >>>>> sometimes return an actual success return, but subsequent operations will >>>>> fail. Here is an excerpt from that bug report. >>>>> >>>>> When calling gen_tcp:connect/3 or /4 on a host/port that does not have a >>>>> running program listening on it, at random intervals gen_tcp:connect returns >>>>> an {ok, Sock} instead of the expected {error, econnrefused}. If >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> gen_tcp:recv(Sock, 0) is called immediately using the socket just returned, >>>>> it returns an {error, econnrefused}. Connection options used were [binary, >>>>> {packet, raw}, {active, false}]. It should be noted that the gen_tcp:connect >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> succeeds when there is a program listening on that sane host/port, so it's >>>>> unlikely to be a firewall issue. >>>>> >>>>> See >>>>> http://www.erlang.org/pipermail/erlang-bugs/2008-August/000931.html >>>>> >>>>> This bug is still present in R12B-4. Could this be affecting you? >>>>> >>>>> Regards, >>>>> Edwin Fine >>>>> >>>>> 2008/9/12 Michael Regen >>>>> >>>>>> Hi, >>>>>> >>>>>> I got a series of troubles with gen_tcp all eventually resulting in >>>>>> crashes. I tested this under Windows XP and with R12B-3 as well as R12B-4. >>>>>> Under Linux it seems to work but I am not perfectly sure since the crash >>>>>> happens sporadically and seems to be timing related. >>>>>> >>>>>> The two problems below lead me to a couple of questions: >>>>>> a) What is the real cause? Is it the socket error enfile? Do both >>>>>> problems have the same root cause? >>>>>> b) Is there a bug in Erlang? I guess this should not lead to a crash. >>>>>> c) How do you avoid this problem on systems you do not control >>>>>> yourself? >>>>>> >>>>>> >>>>>> Problem #1: >>>>>> ########### >>>>>> >>>>>> Just compile the following code and run it with sasl enabled and the >>>>>> following command: >>>>>> tcp_test:test(1000). >>>>>> and - yes - without anything listening on port 2222. And sometimes you >>>>>> have to try two times! >>>>>> >>>>>> -------------------------- start: tcp_test.erl >>>>>> -------------------------- >>>>>> -module(tcp_test). >>>>>> >>>>>> -export([test/1, test_con/0]). >>>>>> >>>>>> -define(DEF_PORT, 2222). >>>>>> -define(DEF_IP, {127,0,0,1}). >>>>>> >>>>>> test(0) -> ok; >>>>>> test(HowManyProcs) -> >>>>>> spawn(?MODULE, test_con, []), >>>>>> test(HowManyProcs-1). >>>>>> >>>>>> test_con() -> >>>>>> {ok,S} = gen_tcp:connect(?DEF_IP, ?DEF_PORT,[]), >>>>>> gen_tcp:send(S,<<0,5,65,66,67,68,69>>), >>>>>> receive >>>>>> {tcp_closed, _Socket} -> ok; >>>>>> _Msg -> gen_tcp:close(S) >>>>>> after 500 -> >>>>>> gen_tcp:close(S) >>>>>> end. >>>>>> -------------------------- end: tcp_test.erl >>>>>> -------------------------- >>>>>> >>>>>> It just spawns a bunch of processes all trying to connect to a >>>>>> currently closed port and sending some garbage there. This is what happens: >>>>>> >>>>>> -------------------------- start: log tcp_test.erl >>>>>> -------------------------- >>>>>> =ERROR REPORT==== 12-Sep-2008::15:28:47 === >>>>>> Error in process <0.41.0> with exit value: >>>>>> {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} >>>>>> >>>>>> [... a couple of them but usually between 1 and 20.] >>>>>> >>>>>> =ERROR REPORT==== 12-Sep-2008::15:28:47 === >>>>>> Error in process <0.103.0> with exit value: >>>>>> {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} >>>>>> >>>>>> >>>>>> Crash dump was written to: erl_crash.dump >>>>>> Inconsistent, why isnt io reported? >>>>>> >>>>>> Abnormal termination >>>>>> -------------------------- end: log tcp_test.erl >>>>>> -------------------------- >>>>>> >>>>>> It might have something to do with the socket error enfile 'file table >>>>>> overflow' but I guess it should not simply crash the emulator!? >>>>>> Searching google for 'Inconsistent, why isnt io reported?' just gives >>>>>> one hit to Erlang's source code. >>>>>> I can provide the crash dump if needed. Just did not want to spam the >>>>>> whole list with big attachments. >>>>>> Spawning only 500 processes (tcp_test:test(500).) usually leads to a >>>>>> crash, spawning only 200 seems to work. >>>>>> >>>>>> >>>>>> Problem #2: >>>>>> ########### >>>>>> >>>>>> Now let's try the same with a server answering to port 2222: Just take >>>>>> the code from the trapexit tutorial 'Building a Non-blocking TCP server >>>>>> using OTP principles' >>>>>> http://trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles >>>>>> Start it first and then our test module in a different erlang node as >>>>>> described above. Now, usually the client survives (have seen crashes as >>>>>> well!) and the server crashes in a similar way. Sometimes it survives and in >>>>>> very rare cases you will see the following logs in the erlang server >>>>>> instance: >>>>>> >>>>>> -------------------------- start: log server >>>>>> -------------------------- >>>>>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>>>>> File operation error: system_limit. Function: get_cwd. Process: >>>>>> code_server. >>>>>> >>>>>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>>>>> Error in async accept: {async_accept,"file table overflow"}. >>>>>> >>>>>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>>>>> ** Generic server tcp_listener terminating >>>>>> ** Last message in was >>>>>> {inet_async,#Port<0.109>,1019,{ok,#Port<0.2141>}} >>>>>> ** When Server state == {state,#Port<0.109>,1019,tcp_echo_fsm} >>>>>> ** Reason for termination == >>>>>> ** {async_accept,"file table overflow"} >>>>>> >>>>>> [...] >>>>>> -------------------------- end: log server -------------------------- >>>>>> >>>>>> Can anyone help? Thank you! >>>>>> >>>>>> Regards, >>>>>> Michael >>>>>> >>>>>> _______________________________________________ >>>>>> erlang-questions mailing list >>>>>> erlang-questions@REDACTED >>>>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>>>> >>>>> >>>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Sat Sep 13 00:20:14 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Fri, 12 Sep 2008 18:20:14 -0400 Subject: [erlang-questions] Erlang crash gen_tcp related (probably only under Windows) In-Reply-To: <9b59d0270809121442v57adf399q4782d4b3f32eeb82@mail.gmail.com> References: <9b59d0270809120700l67787190v7cb1a4c0e670589a@mail.gmail.com> <6c2563b20809120932hc19ff72u1c41ae83bbecdade@mail.gmail.com> <9b59d0270809121039j5313d1d9odb995f37f4ccd0ef@mail.gmail.com> <6c2563b20809121054p23afa167macccc9a73e0cb860@mail.gmail.com> <9b59d0270809121147tfda819eg8df3ce7712fe85e7@mail.gmail.com> <6c2563b20809121201r57e64301hf017b63e10069ab5@mail.gmail.com> <9b59d0270809121442v57adf399q4782d4b3f32eeb82@mail.gmail.com> Message-ID: <6c2563b20809121520l6ce73ed6wf3632c01d8ed7c1f@mail.gmail.com> My mistake, thanks. On Fri, Sep 12, 2008 at 5:42 PM, Michael Regen wrote: > I would be very interested to hear about some tests from others! And Edwin, > I guess you mean SP3. Windows XP SP3 is the most recent service pack. SP4 is > if at all a giant trojan, isn't it? ;) > > Regards, > Michael > > > On Fri, Sep 12, 2008 at 9:01 PM, Edwin Fine < > erlang-questions_efine@REDACTED> wrote: > >> I hear you :). >> >> When I've got some time I will try out my R12B-3 installation on SP4 with >> your program, but can't right now. I am interested to see what happens. >> >> Rgds, >> Ed >> >> >> On Fri, Sep 12, 2008 at 2:47 PM, Michael Regen wrote: >> >>> Just tested it on another machine with SP3 installed. No difference. Same >>> problem. >>> >>> Yes, Windows is flaky and I personally would like to be able to say I >>> would rather go to hell than installing a server on Windows which is >>> expected to run robust. >>> But well, either Erlang is robust on Windows as well or no Erlang on >>> Windows. :( >>> >>> Regards, >>> Michael >>> >>> -- >>> Quote from a >3000 employees IT centric company's CIO I had the pleasure >>> to witness four weeks ago: 'For the messaging back end? No, we can't use >>> Java. Java is too slow.' >>> >>> >>> >>> >>> On Fri, Sep 12, 2008 at 7:54 PM, Edwin Fine < >>> erlang-questions_efine@REDACTED> wrote: >>> >>>> Michael, >>>> >>>> I've always felt that the Windows version of Erlang is a bit flaky. Then >>>> again, I think Windows itself is more than a bit flaky, so maybe it's not >>>> Erlang's fault ;) >>>> I wonder if running on SP4 would improve things? >>>> >>>> >>>> On Fri, Sep 12, 2008 at 1:39 PM, Michael Regen >>> > wrote: >>>> >>>>> Hi Edwin, >>>>> >>>>> It is possible that both issues have a similar source but I do not see >>>>> many reasons why there must be a common source. >>>>> I was running my tests on a 32bit single core Windows XP SP2 system >>>>> just by running >>>>> werl.exe -boot start_sasl >>>>> or >>>>> werl.exe >>>>> >>>>> and did nothing fancy. My R12B-3 version is self compiled, R12B-4 is >>>>> out of the erlang.org box. >>>>> Client and server tests where done by starting two different instances >>>>> of werl. >>>>> Furthermore my tcp_test:test does not care whether results from >>>>> gen_tcp:connect are correct or not. It just assumes {ok, Socket} and crashes >>>>> the process if otherwise. Of course it was a surprise that under some >>>>> circumstances the whole emulator crashes. >>>>> >>>>> By the way, the crash dump slogan is unspectecular: 'Slogan: >>>>> Inconsistent, why isnt io reported?' >>>>> >>>>> UPDATE: I got some more observations which puzzle me even more: >>>>> >>>>> Just did some more of the same tests but this time by starting: >>>>> erl.exe >>>>> application:start(tcp_server). >>>>> and >>>>> erl.exe >>>>> tcp_test:test(1000). >>>>> >>>>> There seems to be a difference between erl.exe and werl.exe. >>>>> >>>>> This time results are pretty different: >>>>> Now it is much harder to crash the emulator. It takes significant more >>>>> processes / tries until something bad happens: >>>>> >>>>> client only (tcp_test:test(5000)) crashes eventually in the same way >>>>> but Window's cmd.exe now follows with a: >>>>> The exception unknown software exception (0x40000015) occured in the >>>>> application at location 0x008fff86 >>>>> >>>>> after the 'Crash dump was written to: erl_crash.dump / Inconsistent, >>>>> why isnt io reported?' message and the crash dump file. >>>>> >>>>> The exception seems to always occure at the same location. >>>>> >>>>> A lot more error messages are printed now (as expected) until the >>>>> crash. >>>>> Besides the {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} I >>>>> can now also watch lots of >>>>> {{badmatch,{error,eaddrinuse}},[{tcp_test,test_con,0}]} >>>>> and >>>>> {{badmatch,{error,system_limit}},[{tcp_test,test_con,0}]} >>>>> errors. >>>>> >>>>> The good message: During tests together with the server backend I was >>>>> not able to crash the server. But I am not convinced that erl.exe solves >>>>> everthing server side. >>>>> >>>>> Regards, >>>>> Michael >>>>> >>>>> >>>>> On Fri, Sep 12, 2008 at 6:32 PM, Edwin Fine wrote: >>>>> >>>>>> Please be aware that I reported a bug a while ago on erlang-bugs, >>>>>> where attempting to connect to a socket that is not being listened on will >>>>>> sometimes return an actual success return, but subsequent operations will >>>>>> fail. Here is an excerpt from that bug report. >>>>>> >>>>>> When calling gen_tcp:connect/3 or /4 on a host/port that does not have a >>>>>> running program listening on it, at random intervals gen_tcp:connect returns >>>>>> an {ok, Sock} instead of the expected {error, econnrefused}. If >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> gen_tcp:recv(Sock, 0) is called immediately using the socket just returned, >>>>>> it returns an {error, econnrefused}. Connection options used were [binary, >>>>>> {packet, raw}, {active, false}]. It should be noted that the gen_tcp:connect >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> succeeds when there is a program listening on that sane host/port, so it's >>>>>> unlikely to be a firewall issue. >>>>>> >>>>>> See >>>>>> http://www.erlang.org/pipermail/erlang-bugs/2008-August/000931.html >>>>>> >>>>>> This bug is still present in R12B-4. Could this be affecting you? >>>>>> >>>>>> Regards, >>>>>> Edwin Fine >>>>>> >>>>>> 2008/9/12 Michael Regen >>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> I got a series of troubles with gen_tcp all eventually resulting in >>>>>>> crashes. I tested this under Windows XP and with R12B-3 as well as R12B-4. >>>>>>> Under Linux it seems to work but I am not perfectly sure since the crash >>>>>>> happens sporadically and seems to be timing related. >>>>>>> >>>>>>> The two problems below lead me to a couple of questions: >>>>>>> a) What is the real cause? Is it the socket error enfile? Do both >>>>>>> problems have the same root cause? >>>>>>> b) Is there a bug in Erlang? I guess this should not lead to a crash. >>>>>>> c) How do you avoid this problem on systems you do not control >>>>>>> yourself? >>>>>>> >>>>>>> >>>>>>> Problem #1: >>>>>>> ########### >>>>>>> >>>>>>> Just compile the following code and run it with sasl enabled and the >>>>>>> following command: >>>>>>> tcp_test:test(1000). >>>>>>> and - yes - without anything listening on port 2222. And sometimes >>>>>>> you have to try two times! >>>>>>> >>>>>>> -------------------------- start: tcp_test.erl >>>>>>> -------------------------- >>>>>>> -module(tcp_test). >>>>>>> >>>>>>> -export([test/1, test_con/0]). >>>>>>> >>>>>>> -define(DEF_PORT, 2222). >>>>>>> -define(DEF_IP, {127,0,0,1}). >>>>>>> >>>>>>> test(0) -> ok; >>>>>>> test(HowManyProcs) -> >>>>>>> spawn(?MODULE, test_con, []), >>>>>>> test(HowManyProcs-1). >>>>>>> >>>>>>> test_con() -> >>>>>>> {ok,S} = gen_tcp:connect(?DEF_IP, ?DEF_PORT,[]), >>>>>>> gen_tcp:send(S,<<0,5,65,66,67,68,69>>), >>>>>>> receive >>>>>>> {tcp_closed, _Socket} -> ok; >>>>>>> _Msg -> gen_tcp:close(S) >>>>>>> after 500 -> >>>>>>> gen_tcp:close(S) >>>>>>> end. >>>>>>> -------------------------- end: tcp_test.erl >>>>>>> -------------------------- >>>>>>> >>>>>>> It just spawns a bunch of processes all trying to connect to a >>>>>>> currently closed port and sending some garbage there. This is what happens: >>>>>>> >>>>>>> -------------------------- start: log tcp_test.erl >>>>>>> -------------------------- >>>>>>> =ERROR REPORT==== 12-Sep-2008::15:28:47 === >>>>>>> Error in process <0.41.0> with exit value: >>>>>>> {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} >>>>>>> >>>>>>> [... a couple of them but usually between 1 and 20.] >>>>>>> >>>>>>> =ERROR REPORT==== 12-Sep-2008::15:28:47 === >>>>>>> Error in process <0.103.0> with exit value: >>>>>>> {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} >>>>>>> >>>>>>> >>>>>>> Crash dump was written to: erl_crash.dump >>>>>>> Inconsistent, why isnt io reported? >>>>>>> >>>>>>> Abnormal termination >>>>>>> -------------------------- end: log tcp_test.erl >>>>>>> -------------------------- >>>>>>> >>>>>>> It might have something to do with the socket error enfile 'file >>>>>>> table overflow' but I guess it should not simply crash the emulator!? >>>>>>> Searching google for 'Inconsistent, why isnt io reported?' just gives >>>>>>> one hit to Erlang's source code. >>>>>>> I can provide the crash dump if needed. Just did not want to spam the >>>>>>> whole list with big attachments. >>>>>>> Spawning only 500 processes (tcp_test:test(500).) usually leads to a >>>>>>> crash, spawning only 200 seems to work. >>>>>>> >>>>>>> >>>>>>> Problem #2: >>>>>>> ########### >>>>>>> >>>>>>> Now let's try the same with a server answering to port 2222: Just >>>>>>> take the code from the trapexit tutorial 'Building a Non-blocking TCP server >>>>>>> using OTP principles' >>>>>>> http://trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles >>>>>>> Start it first and then our test module in a different erlang node as >>>>>>> described above. Now, usually the client survives (have seen crashes as >>>>>>> well!) and the server crashes in a similar way. Sometimes it survives and in >>>>>>> very rare cases you will see the following logs in the erlang server >>>>>>> instance: >>>>>>> >>>>>>> -------------------------- start: log server >>>>>>> -------------------------- >>>>>>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>>>>>> File operation error: system_limit. Function: get_cwd. Process: >>>>>>> code_server. >>>>>>> >>>>>>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>>>>>> Error in async accept: {async_accept,"file table overflow"}. >>>>>>> >>>>>>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>>>>>> ** Generic server tcp_listener terminating >>>>>>> ** Last message in was >>>>>>> {inet_async,#Port<0.109>,1019,{ok,#Port<0.2141>}} >>>>>>> ** When Server state == {state,#Port<0.109>,1019,tcp_echo_fsm} >>>>>>> ** Reason for termination == >>>>>>> ** {async_accept,"file table overflow"} >>>>>>> >>>>>>> [...] >>>>>>> -------------------------- end: log server -------------------------- >>>>>>> >>>>>>> Can anyone help? Thank you! >>>>>>> >>>>>>> Regards, >>>>>>> Michael >>>>>>> >>>>>>> _______________________________________________ >>>>>>> erlang-questions mailing list >>>>>>> erlang-questions@REDACTED >>>>>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>>>>> >>>>>> >>>>>> >>>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yoursurrogategod@REDACTED Sat Sep 13 04:02:16 2008 From: yoursurrogategod@REDACTED (YourSurrogateGod) Date: Fri, 12 Sep 2008 19:02:16 -0700 (PDT) Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <4578F860-B86E-42F2-9B9F-668A7A2D91F2@gmail.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <4578F860-B86E-42F2-9B9F-668A7A2D91F2@gmail.com> Message-ID: <5afd8606-392d-4770-8e22-51f4d4be02cc@m45g2000hsb.googlegroups.com> I don't want to sound like an ass, but what about leasing server storage and processing power? Most do a decent job at dealing with the hardware side of things, all that you have to focus on is the code. From yoursurrogategod@REDACTED Sat Sep 13 04:04:39 2008 From: yoursurrogategod@REDACTED (YourSurrogateGod) Date: Fri, 12 Sep 2008 19:04:39 -0700 (PDT) Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <4578F860-B86E-42F2-9B9F-668A7A2D91F2@gmail.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <4578F860-B86E-42F2-9B9F-668A7A2D91F2@gmail.com> Message-ID: <8fb0985e-3a6f-4b31-bdb9-70cc9f61faea@c58g2000hsc.googlegroups.com> I don't want to sound like an ass, but what about leasing a server from a provider? They do a decent job on the hardware end and all that you have to do is focus on the software. From yoursurrogategod@REDACTED Sat Sep 13 04:11:32 2008 From: yoursurrogategod@REDACTED (YourSurrogateGod) Date: Fri, 12 Sep 2008 19:11:32 -0700 (PDT) Subject: [erlang-questions] Using a queue In-Reply-To: References: <712a16e2-b15f-4c63-b6ec-7c86c1767179@8g2000hse.googlegroups.com> <24d4f39c0808251717k3a74bdcdu91ebeb1c99b1df6c@mail.gmail.com> <17648_1219712605_m7Q13MV3031162_b282b94a-2545-4b88-b4db-2167ba22cfce@a1g2000hsb.googlegroups.com> Message-ID: <7f3d9351-1b24-4ed9-baf9-c26b9044adce@k30g2000hse.googlegroups.com> Thanks for your help. From erlang-questions_efine@REDACTED Sat Sep 13 05:49:14 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Fri, 12 Sep 2008 23:49:14 -0400 Subject: [erlang-questions] Erlang crash gen_tcp related (probably only under Windows) In-Reply-To: <6c2563b20809121520l6ce73ed6wf3632c01d8ed7c1f@mail.gmail.com> References: <9b59d0270809120700l67787190v7cb1a4c0e670589a@mail.gmail.com> <6c2563b20809120932hc19ff72u1c41ae83bbecdade@mail.gmail.com> <9b59d0270809121039j5313d1d9odb995f37f4ccd0ef@mail.gmail.com> <6c2563b20809121054p23afa167macccc9a73e0cb860@mail.gmail.com> <9b59d0270809121147tfda819eg8df3ce7712fe85e7@mail.gmail.com> <6c2563b20809121201r57e64301hf017b63e10069ab5@mail.gmail.com> <9b59d0270809121442v57adf399q4782d4b3f32eeb82@mail.gmail.com> <6c2563b20809121520l6ce73ed6wf3632c01d8ed7c1f@mail.gmail.com> Message-ID: <6c2563b20809122049m5df42747v342945b102c53d5e@mail.gmail.com> Micheal, I was able to duplicate your problem on WIndwos XP *SP3* ;) on an Intel E6600 dual-core system in 32-bit mode with 4 GB of RAM, Erlang R12B-3, but it took more processes than 1000 (I used 10000), at which point the emulator crashed with the same error message you reported. It crashed in the second test, but I didn't try to get the first test to crash after that. At the very least, this should be reported as a bug to erlang-bugs because the crash dump report is unhelpful. I wonder if you are running into an ephemeral port starvation (TIME_WAIT) problem? if you run netstat in a command window you will most likely see many ports in a TIME_WAIT state. One way to find out is to increase the number of ephemeral ports and see if that delays or eliminates the problem unless you run with more processes, or run more often. A good explanation about the TIME_WAIT state can be found at http://www.developerweb.net/forum/showthread.php?t=2941 On Linux: # Set TIME_WAIT timeout to 30 seconds instead of 120 /sbin/sysctl -w net.ipv4.tcp_fin_timeout=30 On Windows: In the registry, under HKEY_LOCAL_MACHINE\SYSTEM\ CurrentControlSet\Services\Tcpip\Parameters - Add DWORD MaxUserPort = 65534 (decimal). - Add TcpTimedWaitDelay = 60 (decimal) Explanation: The default maximum number of ephemeral TCP ports is 5000. Increase the maximum number of ephemeral ports (MaxUserPort) to 65534 (decimal). This parameter controls the maximum port number that is used when a program requests any available user port from the system. Typically , ephemeral(short-lived) ports are allocated between the values of 1024 and 5000 inclusive. This parameter determines the time that a connection stays in the TIME_WAIT state when it is closing. As long as a connection is in the TIME_WAIT state, the socket pair cannot be re-used. This is also known as the "2MSL" state. According to RFC793, the value should be two times the maximum segment lifetime on the network. See RFC793 for more information. However, in fast LAN environments (same-segment 1GB/sec, for example), this can be lowered to 60 or less. TcpTimedWaitDelay - Set to 60 Key: Tcpip\Parameters Value Type: REG_DWORD - Time in seconds Valid Range: 30-300 (decimal) Hope this helps. On Fri, Sep 12, 2008 at 6:20 PM, Edwin Fine wrote: > My mistake, thanks. > > > On Fri, Sep 12, 2008 at 5:42 PM, Michael Regen wrote: > >> I would be very interested to hear about some tests from others! And >> Edwin, I guess you mean SP3. Windows XP SP3 is the most recent service pack. >> SP4 is if at all a giant trojan, isn't it? ;) >> >> Regards, >> Michael >> >> >> On Fri, Sep 12, 2008 at 9:01 PM, Edwin Fine < >> erlang-questions_efine@REDACTED> wrote: >> >>> I hear you :). >>> >>> When I've got some time I will try out my R12B-3 installation on SP4 with >>> your program, but can't right now. I am interested to see what happens. >>> >>> Rgds, >>> Ed >>> >>> >>> On Fri, Sep 12, 2008 at 2:47 PM, Michael Regen wrote: >>> >>>> Just tested it on another machine with SP3 installed. No difference. >>>> Same problem. >>>> >>>> Yes, Windows is flaky and I personally would like to be able to say I >>>> would rather go to hell than installing a server on Windows which is >>>> expected to run robust. >>>> But well, either Erlang is robust on Windows as well or no Erlang on >>>> Windows. :( >>>> >>>> Regards, >>>> Michael >>>> >>>> -- >>>> Quote from a >3000 employees IT centric company's CIO I had the pleasure >>>> to witness four weeks ago: 'For the messaging back end? No, we can't use >>>> Java. Java is too slow.' >>>> >>>> >>>> >>>> >>>> On Fri, Sep 12, 2008 at 7:54 PM, Edwin Fine < >>>> erlang-questions_efine@REDACTED> wrote: >>>> >>>>> Michael, >>>>> >>>>> I've always felt that the Windows version of Erlang is a bit flaky. >>>>> Then again, I think Windows itself is more than a bit flaky, so maybe it's >>>>> not Erlang's fault ;) >>>>> I wonder if running on SP4 would improve things? >>>>> >>>>> >>>>> On Fri, Sep 12, 2008 at 1:39 PM, Michael Regen < >>>>> michael.regen@REDACTED> wrote: >>>>> >>>>>> Hi Edwin, >>>>>> >>>>>> It is possible that both issues have a similar source but I do not see >>>>>> many reasons why there must be a common source. >>>>>> I was running my tests on a 32bit single core Windows XP SP2 system >>>>>> just by running >>>>>> werl.exe -boot start_sasl >>>>>> or >>>>>> werl.exe >>>>>> >>>>>> and did nothing fancy. My R12B-3 version is self compiled, R12B-4 is >>>>>> out of the erlang.org box. >>>>>> Client and server tests where done by starting two different instances >>>>>> of werl. >>>>>> Furthermore my tcp_test:test does not care whether results from >>>>>> gen_tcp:connect are correct or not. It just assumes {ok, Socket} and crashes >>>>>> the process if otherwise. Of course it was a surprise that under some >>>>>> circumstances the whole emulator crashes. >>>>>> >>>>>> By the way, the crash dump slogan is unspectecular: 'Slogan: >>>>>> Inconsistent, why isnt io reported?' >>>>>> >>>>>> UPDATE: I got some more observations which puzzle me even more: >>>>>> >>>>>> Just did some more of the same tests but this time by starting: >>>>>> erl.exe >>>>>> application:start(tcp_server). >>>>>> and >>>>>> erl.exe >>>>>> tcp_test:test(1000). >>>>>> >>>>>> There seems to be a difference between erl.exe and werl.exe. >>>>>> >>>>>> This time results are pretty different: >>>>>> Now it is much harder to crash the emulator. It takes significant more >>>>>> processes / tries until something bad happens: >>>>>> >>>>>> client only (tcp_test:test(5000)) crashes eventually in the same way >>>>>> but Window's cmd.exe now follows with a: >>>>>> The exception unknown software exception (0x40000015) occured in the >>>>>> application at location 0x008fff86 >>>>>> >>>>>> after the 'Crash dump was written to: erl_crash.dump / Inconsistent, >>>>>> why isnt io reported?' message and the crash dump file. >>>>>> >>>>>> The exception seems to always occure at the same location. >>>>>> >>>>>> A lot more error messages are printed now (as expected) until the >>>>>> crash. >>>>>> Besides the {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} >>>>>> I can now also watch lots of >>>>>> {{badmatch,{error,eaddrinuse}},[{tcp_test,test_con,0}]} >>>>>> and >>>>>> {{badmatch,{error,system_limit}},[{tcp_test,test_con,0}]} >>>>>> errors. >>>>>> >>>>>> The good message: During tests together with the server backend I was >>>>>> not able to crash the server. But I am not convinced that erl.exe solves >>>>>> everthing server side. >>>>>> >>>>>> Regards, >>>>>> Michael >>>>>> >>>>>> >>>>>> On Fri, Sep 12, 2008 at 6:32 PM, Edwin Fine wrote: >>>>>> >>>>>>> Please be aware that I reported a bug a while ago on erlang-bugs, >>>>>>> where attempting to connect to a socket that is not being listened on will >>>>>>> sometimes return an actual success return, but subsequent operations will >>>>>>> fail. Here is an excerpt from that bug report. >>>>>>> >>>>>>> When calling gen_tcp:connect/3 or /4 on a host/port that does not have a >>>>>>> running program listening on it, at random intervals gen_tcp:connect returns >>>>>>> an {ok, Sock} instead of the expected {error, econnrefused}. If >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> gen_tcp:recv(Sock, 0) is called immediately using the socket just returned, >>>>>>> it returns an {error, econnrefused}. Connection options used were [binary, >>>>>>> {packet, raw}, {active, false}]. It should be noted that the gen_tcp:connect >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> succeeds when there is a program listening on that sane host/port, so it's >>>>>>> unlikely to be a firewall issue. >>>>>>> >>>>>>> See >>>>>>> http://www.erlang.org/pipermail/erlang-bugs/2008-August/000931.html >>>>>>> >>>>>>> This bug is still present in R12B-4. Could this be affecting you? >>>>>>> >>>>>>> Regards, >>>>>>> Edwin Fine >>>>>>> >>>>>>> 2008/9/12 Michael Regen >>>>>>> >>>>>>>> Hi, >>>>>>>> >>>>>>>> I got a series of troubles with gen_tcp all eventually resulting in >>>>>>>> crashes. I tested this under Windows XP and with R12B-3 as well as R12B-4. >>>>>>>> Under Linux it seems to work but I am not perfectly sure since the crash >>>>>>>> happens sporadically and seems to be timing related. >>>>>>>> >>>>>>>> The two problems below lead me to a couple of questions: >>>>>>>> a) What is the real cause? Is it the socket error enfile? Do both >>>>>>>> problems have the same root cause? >>>>>>>> b) Is there a bug in Erlang? I guess this should not lead to a >>>>>>>> crash. >>>>>>>> c) How do you avoid this problem on systems you do not control >>>>>>>> yourself? >>>>>>>> >>>>>>>> >>>>>>>> Problem #1: >>>>>>>> ########### >>>>>>>> >>>>>>>> Just compile the following code and run it with sasl enabled and the >>>>>>>> following command: >>>>>>>> tcp_test:test(1000). >>>>>>>> and - yes - without anything listening on port 2222. And sometimes >>>>>>>> you have to try two times! >>>>>>>> >>>>>>>> -------------------------- start: tcp_test.erl >>>>>>>> -------------------------- >>>>>>>> -module(tcp_test). >>>>>>>> >>>>>>>> -export([test/1, test_con/0]). >>>>>>>> >>>>>>>> -define(DEF_PORT, 2222). >>>>>>>> -define(DEF_IP, {127,0,0,1}). >>>>>>>> >>>>>>>> test(0) -> ok; >>>>>>>> test(HowManyProcs) -> >>>>>>>> spawn(?MODULE, test_con, []), >>>>>>>> test(HowManyProcs-1). >>>>>>>> >>>>>>>> test_con() -> >>>>>>>> {ok,S} = gen_tcp:connect(?DEF_IP, ?DEF_PORT,[]), >>>>>>>> gen_tcp:send(S,<<0,5,65,66,67,68,69>>), >>>>>>>> receive >>>>>>>> {tcp_closed, _Socket} -> ok; >>>>>>>> _Msg -> gen_tcp:close(S) >>>>>>>> after 500 -> >>>>>>>> gen_tcp:close(S) >>>>>>>> end. >>>>>>>> -------------------------- end: tcp_test.erl >>>>>>>> -------------------------- >>>>>>>> >>>>>>>> It just spawns a bunch of processes all trying to connect to a >>>>>>>> currently closed port and sending some garbage there. This is what happens: >>>>>>>> >>>>>>>> -------------------------- start: log tcp_test.erl >>>>>>>> -------------------------- >>>>>>>> =ERROR REPORT==== 12-Sep-2008::15:28:47 === >>>>>>>> Error in process <0.41.0> with exit value: >>>>>>>> {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} >>>>>>>> >>>>>>>> [... a couple of them but usually between 1 and 20.] >>>>>>>> >>>>>>>> =ERROR REPORT==== 12-Sep-2008::15:28:47 === >>>>>>>> Error in process <0.103.0> with exit value: >>>>>>>> {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} >>>>>>>> >>>>>>>> >>>>>>>> Crash dump was written to: erl_crash.dump >>>>>>>> Inconsistent, why isnt io reported? >>>>>>>> >>>>>>>> Abnormal termination >>>>>>>> -------------------------- end: log tcp_test.erl >>>>>>>> -------------------------- >>>>>>>> >>>>>>>> It might have something to do with the socket error enfile 'file >>>>>>>> table overflow' but I guess it should not simply crash the emulator!? >>>>>>>> Searching google for 'Inconsistent, why isnt io reported?' just >>>>>>>> gives one hit to Erlang's source code. >>>>>>>> I can provide the crash dump if needed. Just did not want to spam >>>>>>>> the whole list with big attachments. >>>>>>>> Spawning only 500 processes (tcp_test:test(500).) usually leads to a >>>>>>>> crash, spawning only 200 seems to work. >>>>>>>> >>>>>>>> >>>>>>>> Problem #2: >>>>>>>> ########### >>>>>>>> >>>>>>>> Now let's try the same with a server answering to port 2222: Just >>>>>>>> take the code from the trapexit tutorial 'Building a Non-blocking TCP server >>>>>>>> using OTP principles' >>>>>>>> http://trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles >>>>>>>> Start it first and then our test module in a different erlang node >>>>>>>> as described above. Now, usually the client survives (have seen crashes as >>>>>>>> well!) and the server crashes in a similar way. Sometimes it survives and in >>>>>>>> very rare cases you will see the following logs in the erlang server >>>>>>>> instance: >>>>>>>> >>>>>>>> -------------------------- start: log server >>>>>>>> -------------------------- >>>>>>>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>>>>>>> File operation error: system_limit. Function: get_cwd. Process: >>>>>>>> code_server. >>>>>>>> >>>>>>>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>>>>>>> Error in async accept: {async_accept,"file table overflow"}. >>>>>>>> >>>>>>>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>>>>>>> ** Generic server tcp_listener terminating >>>>>>>> ** Last message in was >>>>>>>> {inet_async,#Port<0.109>,1019,{ok,#Port<0.2141>}} >>>>>>>> ** When Server state == {state,#Port<0.109>,1019,tcp_echo_fsm} >>>>>>>> ** Reason for termination == >>>>>>>> ** {async_accept,"file table overflow"} >>>>>>>> >>>>>>>> [...] >>>>>>>> -------------------------- end: log server >>>>>>>> -------------------------- >>>>>>>> >>>>>>>> Can anyone help? Thank you! >>>>>>>> >>>>>>>> Regards, >>>>>>>> Michael >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> erlang-questions mailing list >>>>>>>> erlang-questions@REDACTED >>>>>>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Sat Sep 13 08:44:53 2008 From: joelr1@REDACTED (Joel Reymont) Date: Sat, 13 Sep 2008 07:44:53 +0100 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <5afd8606-392d-4770-8e22-51f4d4be02cc@m45g2000hsb.googlegroups.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <4578F860-B86E-42F2-9B9F-668A7A2D91F2@gmail.com> <5afd8606-392d-4770-8e22-51f4d4be02cc@m45g2000hsb.googlegroups.com> Message-ID: <0749C3BA-B32F-4C5E-A8E9-141748D863C4@gmail.com> On Sep 13, 2008, at 3:02 AM, YourSurrogateGod wrote: > I don't want to sound like an ass, but what about leasing server > storage and processing power? Most do a decent job at dealing with the > hardware side of things, all that you have to focus on is the code. I do lease a server at Joyent. I'll post the metrics in a little while so that we have a chance to compare. -- wagerlabs.com From webaccounts@REDACTED Sat Sep 13 15:59:11 2008 From: webaccounts@REDACTED (Dan Rubino) Date: Sat, 13 Sep 2008 14:59:11 +0100 Subject: [erlang-questions] Bi-directional Java/Erlang socket communication? Message-ID: <1221314351.6065.15.camel@linux-box> Hi all, I have an Erlang process which uses gen_tcp:listen/recv/send. Now I can send/receive messages Erlang<->Erlang but if I use a Java process I can only send messages to Erlang from Java and not vice versa. The Java used to send and receive is pretty simple: Socket s = new Socket(host, 2345); System.out.println("Connected to socket on: " + host + ":" + 2345); DataOutputStream os = new DataOutputStream(s.getOutputStream()); String a = "Hello, world |23|24|26."; os.write(a.getBytes()); BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream())); System.out.println("echo: " + in.readLine()); The Erlang code which works (broken down but in reality is across multiple modules): {ok, Listen} = gen_tcp:listen(Port, [binary, {packet, 0}, {reuseaddr, true}, {active, false}]), Which leads to: receive true -> {ok, Socket} = gen_tcp:accept(Listen), try gen_tcp:accept(Listen) of {ok, Socket} -> spawn(fun() -> parallel_loop(Listen, CallBackMod) end), CallBackMod:handle_call({socket,Socket}), which leads to: handle_call({socket, Socket}) -> case gen_tcp:recv(Socket, 0) of {ok, Data} -> io:format("Data received: ~p~n", [Data]), gen_tcp:send(Socket, term_to_binary("Test String")), handle_call({socket, Socket}); {error, closed} -> io:format("Socket closed.~n"), ok; Val -> io:format("Val: ~p~n", [Val]) end. Like I say, the Erlang process can read the data sent from the Java process too it but for some reason which I am not totally sure of - the java process is unable to pickup the data being sent back from the Erlang process using gen_tcp:send() Has anyone here got any experience performing socket communication between Erlang and Java? There doesnt seem to be any useful articles on the Net around this unfortunately. Any help greatly appreciated - a java example would be great! Thanks From pablo.polvorin@REDACTED Sat Sep 13 17:20:29 2008 From: pablo.polvorin@REDACTED (Pablo Polvorin) Date: Sat, 13 Sep 2008 12:20:29 -0300 Subject: [erlang-questions] Bi-directional Java/Erlang socket communication? In-Reply-To: <1221314351.6065.15.camel@linux-box> References: <1221314351.6065.15.camel@linux-box> Message-ID: <1ffe809c0809130820x5ba9207cs9f92848051950a22@mail.gmail.com> I guess readLine() is blocked waiting to receive a line.., isn't it? also, gen_tcp:send(Socket,<<"Test String">>) is probably what you want instead of using term_to_binary/1 2008/9/13 Dan Rubino > Hi all, > > I have an Erlang process which uses gen_tcp:listen/recv/send. > > Now I can send/receive messages Erlang<->Erlang but if I use a Java > process I can only send messages to Erlang from Java and not vice versa. > > The Java used to send and receive is pretty simple: > > Socket s = new Socket(host, 2345); > > System.out.println("Connected to socket on: " + host + ":" + 2345); > > DataOutputStream os = new DataOutputStream(s.getOutputStream()); > > String a = "Hello, world |23|24|26."; > > os.write(a.getBytes()); > > BufferedReader in = new BufferedReader(new > InputStreamReader(s.getInputStream())); > > System.out.println("echo: " + in.readLine()); > > > The Erlang code which works (broken down but in reality is across > multiple modules): > > {ok, Listen} = gen_tcp:listen(Port, [binary, {packet, 0}, {reuseaddr, > true}, {active, false}]), > > Which leads to: > > receive > true -> > {ok, Socket} = gen_tcp:accept(Listen), > try gen_tcp:accept(Listen) of > {ok, Socket} -> > spawn(fun() -> parallel_loop(Listen, CallBackMod) end), > CallBackMod:handle_call({socket,Socket}), > > which leads to: > > handle_call({socket, Socket}) -> > case gen_tcp:recv(Socket, 0) of > {ok, Data} -> > io:format("Data received: ~p~n", [Data]), > gen_tcp:send(Socket, term_to_binary("Test String")), > handle_call({socket, Socket}); > {error, closed} -> > io:format("Socket closed.~n"), > ok; > Val -> > io:format("Val: ~p~n", [Val]) > end. > > Like I say, the Erlang process can read the data sent from the Java process > too it but for some reason > which I am not totally sure of - the java process is unable to pickup the > data being sent back from the > Erlang process using gen_tcp:send() > > Has anyone here got any experience performing socket communication between > Erlang and Java? > > There doesnt seem to be any useful articles on the Net around this > unfortunately. > > Any help greatly appreciated - a java example would be great! > > Thanks > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- -- pablo http://ppolv.wordpress.com ---- -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.regen@REDACTED Sat Sep 13 17:33:24 2008 From: michael.regen@REDACTED (Michael Regen) Date: Sat, 13 Sep 2008 17:33:24 +0200 Subject: [erlang-questions] Erlang crash gen_tcp related (probably only under Windows) In-Reply-To: <6c2563b20809122049m5df42747v342945b102c53d5e@mail.gmail.com> References: <9b59d0270809120700l67787190v7cb1a4c0e670589a@mail.gmail.com> <6c2563b20809120932hc19ff72u1c41ae83bbecdade@mail.gmail.com> <9b59d0270809121039j5313d1d9odb995f37f4ccd0ef@mail.gmail.com> <6c2563b20809121054p23afa167macccc9a73e0cb860@mail.gmail.com> <9b59d0270809121147tfda819eg8df3ce7712fe85e7@mail.gmail.com> <6c2563b20809121201r57e64301hf017b63e10069ab5@mail.gmail.com> <9b59d0270809121442v57adf399q4782d4b3f32eeb82@mail.gmail.com> <6c2563b20809121520l6ce73ed6wf3632c01d8ed7c1f@mail.gmail.com> <6c2563b20809122049m5df42747v342945b102c53d5e@mail.gmail.com> Message-ID: <9b59d0270809130833k406b7c21wc80b9ec251e1ecbf@mail.gmail.com> Hi Edwin, On my main test machine I already had set the MaxUserPort to 60000 from a former unrelated test. It does not change the problem. The crashes occure way before all ephemeral ports are in TIME_WAIT. So, I am still able to crash: a) the client application when run without server b) the client when run together with the server c) the server when run together with the client d) even both at the same time started under erl.exe it takes significant more processes than started under werl.exe. I will send a mail to erlang-bugs. Thank you for taking the time and helping me! Regards, Michael On Sat, Sep 13, 2008 at 5:49 AM, Edwin Fine wrote: > Micheal, > > I was able to duplicate your problem on WIndwos XP *SP3* ;) on an Intel > E6600 dual-core system in 32-bit mode with 4 GB of RAM, Erlang R12B-3, but > it took more processes than 1000 (I used 10000), at which point the emulator > crashed with the same error message you reported. It crashed in the second > test, but I didn't try to get the first test to crash after that. > > At the very least, this should be reported as a bug to erlang-bugs because > the crash dump report is unhelpful. > > I wonder if you are running into an ephemeral port starvation (TIME_WAIT) > problem? if you run netstat in a command window you will most likely see > many ports in a TIME_WAIT state. One way to find out is to increase the > number of ephemeral ports and see if that delays or eliminates the problem > unless you run with more processes, or run more often. > > A good explanation about the TIME_WAIT state can be found at > > http://www.developerweb.net/forum/showthread.php?t=2941 > > On Linux: > # Set TIME_WAIT timeout to 30 seconds instead of 120 > /sbin/sysctl -w net.ipv4.tcp_fin_timeout=30 > > On Windows: > In the registry, under HKEY_LOCAL_MACHINE\SYSTEM\ > CurrentControlSet\Services\Tcpip\Parameters > > - Add DWORD MaxUserPort = 65534 (decimal). > - Add TcpTimedWaitDelay = 60 (decimal) > > Explanation: > > The default maximum number of ephemeral TCP ports is 5000. Increase the > maximum number of ephemeral ports (MaxUserPort) to 65534 (decimal). This > parameter controls the maximum port number that is used when a program > requests any available user port from the system. Typically , ephemeral(short-lived) ports are allocated between the values of 1024 and 5000 > inclusive. This parameter determines the time that a connection stays in the > TIME_WAIT state when it is closing. As long as a connection is in the > TIME_WAIT state, the socket pair cannot be re-used. This is also known as > the "2MSL" state. According to RFC793, the value should be two times the > maximum segment lifetime on the network. See RFC793 for more information. > However, in fast LAN environments (same-segment 1GB/sec, for example), this > can be lowered to 60 or less. > > TcpTimedWaitDelay - Set to 60 > Key: Tcpip\Parameters > Value Type: REG_DWORD - Time in seconds > Valid Range: 30-300 (decimal) > > Hope this helps. > > > On Fri, Sep 12, 2008 at 6:20 PM, Edwin Fine < > erlang-questions_efine@REDACTED> wrote: > >> My mistake, thanks. >> >> >> On Fri, Sep 12, 2008 at 5:42 PM, Michael Regen wrote: >> >>> I would be very interested to hear about some tests from others! And >>> Edwin, I guess you mean SP3. Windows XP SP3 is the most recent service pack. >>> SP4 is if at all a giant trojan, isn't it? ;) >>> >>> Regards, >>> Michael >>> >>> >>> On Fri, Sep 12, 2008 at 9:01 PM, Edwin Fine < >>> erlang-questions_efine@REDACTED> wrote: >>> >>>> I hear you :). >>>> >>>> When I've got some time I will try out my R12B-3 installation on SP4 >>>> with your program, but can't right now. I am interested to see what happens. >>>> >>>> Rgds, >>>> Ed >>>> >>>> >>>> On Fri, Sep 12, 2008 at 2:47 PM, Michael Regen >>> > wrote: >>>> >>>>> Just tested it on another machine with SP3 installed. No difference. >>>>> Same problem. >>>>> >>>>> Yes, Windows is flaky and I personally would like to be able to say I >>>>> would rather go to hell than installing a server on Windows which is >>>>> expected to run robust. >>>>> But well, either Erlang is robust on Windows as well or no Erlang on >>>>> Windows. :( >>>>> >>>>> Regards, >>>>> Michael >>>>> >>>>> -- >>>>> Quote from a >3000 employees IT centric company's CIO I had the >>>>> pleasure to witness four weeks ago: 'For the messaging back end? No, we >>>>> can't use Java. Java is too slow.' >>>>> >>>>> >>>>> >>>>> >>>>> On Fri, Sep 12, 2008 at 7:54 PM, Edwin Fine < >>>>> erlang-questions_efine@REDACTED> wrote: >>>>> >>>>>> Michael, >>>>>> >>>>>> I've always felt that the Windows version of Erlang is a bit flaky. >>>>>> Then again, I think Windows itself is more than a bit flaky, so maybe it's >>>>>> not Erlang's fault ;) >>>>>> I wonder if running on SP4 would improve things? >>>>>> >>>>>> >>>>>> On Fri, Sep 12, 2008 at 1:39 PM, Michael Regen < >>>>>> michael.regen@REDACTED> wrote: >>>>>> >>>>>>> Hi Edwin, >>>>>>> >>>>>>> It is possible that both issues have a similar source but I do not >>>>>>> see many reasons why there must be a common source. >>>>>>> I was running my tests on a 32bit single core Windows XP SP2 system >>>>>>> just by running >>>>>>> werl.exe -boot start_sasl >>>>>>> or >>>>>>> werl.exe >>>>>>> >>>>>>> and did nothing fancy. My R12B-3 version is self compiled, R12B-4 is >>>>>>> out of the erlang.org box. >>>>>>> Client and server tests where done by starting two different >>>>>>> instances of werl. >>>>>>> Furthermore my tcp_test:test does not care whether results from >>>>>>> gen_tcp:connect are correct or not. It just assumes {ok, Socket} and crashes >>>>>>> the process if otherwise. Of course it was a surprise that under some >>>>>>> circumstances the whole emulator crashes. >>>>>>> >>>>>>> By the way, the crash dump slogan is unspectecular: 'Slogan: >>>>>>> Inconsistent, why isnt io reported?' >>>>>>> >>>>>>> UPDATE: I got some more observations which puzzle me even more: >>>>>>> >>>>>>> Just did some more of the same tests but this time by starting: >>>>>>> erl.exe >>>>>>> application:start(tcp_server). >>>>>>> and >>>>>>> erl.exe >>>>>>> tcp_test:test(1000). >>>>>>> >>>>>>> There seems to be a difference between erl.exe and werl.exe. >>>>>>> >>>>>>> This time results are pretty different: >>>>>>> Now it is much harder to crash the emulator. It takes significant >>>>>>> more processes / tries until something bad happens: >>>>>>> >>>>>>> client only (tcp_test:test(5000)) crashes eventually in the same way >>>>>>> but Window's cmd.exe now follows with a: >>>>>>> The exception unknown software exception (0x40000015) occured in >>>>>>> the application at location 0x008fff86 >>>>>>> >>>>>>> after the 'Crash dump was written to: erl_crash.dump / Inconsistent, >>>>>>> why isnt io reported?' message and the crash dump file. >>>>>>> >>>>>>> The exception seems to always occure at the same location. >>>>>>> >>>>>>> A lot more error messages are printed now (as expected) until the >>>>>>> crash. >>>>>>> Besides the {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} >>>>>>> I can now also watch lots of >>>>>>> {{badmatch,{error,eaddrinuse}},[{tcp_test,test_con,0}]} >>>>>>> and >>>>>>> {{badmatch,{error,system_limit}},[{tcp_test,test_con,0}]} >>>>>>> errors. >>>>>>> >>>>>>> The good message: During tests together with the server backend I was >>>>>>> not able to crash the server. But I am not convinced that erl.exe solves >>>>>>> everthing server side. >>>>>>> >>>>>>> Regards, >>>>>>> Michael >>>>>>> >>>>>>> >>>>>>> On Fri, Sep 12, 2008 at 6:32 PM, Edwin Fine wrote: >>>>>>> >>>>>>>> Please be aware that I reported a bug a while ago on erlang-bugs, >>>>>>>> where attempting to connect to a socket that is not being listened on will >>>>>>>> sometimes return an actual success return, but subsequent operations will >>>>>>>> fail. Here is an excerpt from that bug report. >>>>>>>> >>>>>>>> When calling gen_tcp:connect/3 or /4 on a host/port that does not have a >>>>>>>> running program listening on it, at random intervals gen_tcp:connect returns >>>>>>>> an {ok, Sock} instead of the expected {error, econnrefused}. If >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> gen_tcp:recv(Sock, 0) is called immediately using the socket just returned, >>>>>>>> it returns an {error, econnrefused}. Connection options used were [binary, >>>>>>>> {packet, raw}, {active, false}]. It should be noted that the gen_tcp:connect >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> succeeds when there is a program listening on that sane host/port, so it's >>>>>>>> unlikely to be a firewall issue. >>>>>>>> >>>>>>>> See >>>>>>>> http://www.erlang.org/pipermail/erlang-bugs/2008-August/000931.html >>>>>>>> >>>>>>>> This bug is still present in R12B-4. Could this be affecting you? >>>>>>>> >>>>>>>> Regards, >>>>>>>> Edwin Fine >>>>>>>> >>>>>>>> 2008/9/12 Michael Regen >>>>>>>> >>>>>>>>> Hi, >>>>>>>>> >>>>>>>>> I got a series of troubles with gen_tcp all eventually resulting in >>>>>>>>> crashes. I tested this under Windows XP and with R12B-3 as well as R12B-4. >>>>>>>>> Under Linux it seems to work but I am not perfectly sure since the crash >>>>>>>>> happens sporadically and seems to be timing related. >>>>>>>>> >>>>>>>>> The two problems below lead me to a couple of questions: >>>>>>>>> a) What is the real cause? Is it the socket error enfile? Do both >>>>>>>>> problems have the same root cause? >>>>>>>>> b) Is there a bug in Erlang? I guess this should not lead to a >>>>>>>>> crash. >>>>>>>>> c) How do you avoid this problem on systems you do not control >>>>>>>>> yourself? >>>>>>>>> >>>>>>>>> >>>>>>>>> Problem #1: >>>>>>>>> ########### >>>>>>>>> >>>>>>>>> Just compile the following code and run it with sasl enabled and >>>>>>>>> the following command: >>>>>>>>> tcp_test:test(1000). >>>>>>>>> and - yes - without anything listening on port 2222. And sometimes >>>>>>>>> you have to try two times! >>>>>>>>> >>>>>>>>> -------------------------- start: tcp_test.erl >>>>>>>>> -------------------------- >>>>>>>>> -module(tcp_test). >>>>>>>>> >>>>>>>>> -export([test/1, test_con/0]). >>>>>>>>> >>>>>>>>> -define(DEF_PORT, 2222). >>>>>>>>> -define(DEF_IP, {127,0,0,1}). >>>>>>>>> >>>>>>>>> test(0) -> ok; >>>>>>>>> test(HowManyProcs) -> >>>>>>>>> spawn(?MODULE, test_con, []), >>>>>>>>> test(HowManyProcs-1). >>>>>>>>> >>>>>>>>> test_con() -> >>>>>>>>> {ok,S} = gen_tcp:connect(?DEF_IP, ?DEF_PORT,[]), >>>>>>>>> gen_tcp:send(S,<<0,5,65,66,67,68,69>>), >>>>>>>>> receive >>>>>>>>> {tcp_closed, _Socket} -> ok; >>>>>>>>> _Msg -> gen_tcp:close(S) >>>>>>>>> after 500 -> >>>>>>>>> gen_tcp:close(S) >>>>>>>>> end. >>>>>>>>> -------------------------- end: tcp_test.erl >>>>>>>>> -------------------------- >>>>>>>>> >>>>>>>>> It just spawns a bunch of processes all trying to connect to a >>>>>>>>> currently closed port and sending some garbage there. This is what happens: >>>>>>>>> >>>>>>>>> -------------------------- start: log tcp_test.erl >>>>>>>>> -------------------------- >>>>>>>>> =ERROR REPORT==== 12-Sep-2008::15:28:47 === >>>>>>>>> Error in process <0.41.0> with exit value: >>>>>>>>> {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} >>>>>>>>> >>>>>>>>> [... a couple of them but usually between 1 and 20.] >>>>>>>>> >>>>>>>>> =ERROR REPORT==== 12-Sep-2008::15:28:47 === >>>>>>>>> Error in process <0.103.0> with exit value: >>>>>>>>> {{badmatch,{error,econnrefused}},[{tcp_test,test_con,0}]} >>>>>>>>> >>>>>>>>> >>>>>>>>> Crash dump was written to: erl_crash.dump >>>>>>>>> Inconsistent, why isnt io reported? >>>>>>>>> >>>>>>>>> Abnormal termination >>>>>>>>> -------------------------- end: log tcp_test.erl >>>>>>>>> -------------------------- >>>>>>>>> >>>>>>>>> It might have something to do with the socket error enfile 'file >>>>>>>>> table overflow' but I guess it should not simply crash the emulator!? >>>>>>>>> Searching google for 'Inconsistent, why isnt io reported?' just >>>>>>>>> gives one hit to Erlang's source code. >>>>>>>>> I can provide the crash dump if needed. Just did not want to spam >>>>>>>>> the whole list with big attachments. >>>>>>>>> Spawning only 500 processes (tcp_test:test(500).) usually leads to >>>>>>>>> a crash, spawning only 200 seems to work. >>>>>>>>> >>>>>>>>> >>>>>>>>> Problem #2: >>>>>>>>> ########### >>>>>>>>> >>>>>>>>> Now let's try the same with a server answering to port 2222: Just >>>>>>>>> take the code from the trapexit tutorial 'Building a Non-blocking TCP server >>>>>>>>> using OTP principles' >>>>>>>>> http://trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles >>>>>>>>> Start it first and then our test module in a different erlang node >>>>>>>>> as described above. Now, usually the client survives (have seen crashes as >>>>>>>>> well!) and the server crashes in a similar way. Sometimes it survives and in >>>>>>>>> very rare cases you will see the following logs in the erlang server >>>>>>>>> instance: >>>>>>>>> >>>>>>>>> -------------------------- start: log server >>>>>>>>> -------------------------- >>>>>>>>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>>>>>>>> File operation error: system_limit. Function: get_cwd. Process: >>>>>>>>> code_server. >>>>>>>>> >>>>>>>>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>>>>>>>> Error in async accept: {async_accept,"file table overflow"}. >>>>>>>>> >>>>>>>>> =ERROR REPORT==== 12-Sep-2008::12:58:56 === >>>>>>>>> ** Generic server tcp_listener terminating >>>>>>>>> ** Last message in was >>>>>>>>> {inet_async,#Port<0.109>,1019,{ok,#Port<0.2141>}} >>>>>>>>> ** When Server state == {state,#Port<0.109>,1019,tcp_echo_fsm} >>>>>>>>> ** Reason for termination == >>>>>>>>> ** {async_accept,"file table overflow"} >>>>>>>>> >>>>>>>>> [...] >>>>>>>>> -------------------------- end: log server >>>>>>>>> -------------------------- >>>>>>>>> >>>>>>>>> Can anyone help? Thank you! >>>>>>>>> >>>>>>>>> Regards, >>>>>>>>> Michael >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> erlang-questions mailing list >>>>>>>>> erlang-questions@REDACTED >>>>>>>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From igouy2@REDACTED Sat Sep 13 18:37:28 2008 From: igouy2@REDACTED (Isaac Gouy) Date: Sat, 13 Sep 2008 09:37:28 -0700 (PDT) Subject: [erlang-questions] fyi Which parallel problem would you add to the benchmarks game and why? Message-ID: <800574.32056.qm@web65403.mail.ac4.yahoo.com> "Which parallel problem would you add and why?" http://alioth.debian.org/forum/forum.php?thread_id=14502&forum_id=2840 "Ask Proggit: Which parallel problem would you add now The Computer Language Benchmarks Game is measured on quad-core hardware, and why?" http://www.reddit.com/r/programming/comments/718qf/ask_proggit_which_parallel_problem_would_you_add/ From webaccounts@REDACTED Sat Sep 13 19:38:47 2008 From: webaccounts@REDACTED (Dan Rubino) Date: Sat, 13 Sep 2008 18:38:47 +0100 Subject: [erlang-questions] Bi-directional Java/Erlang socket communication? In-Reply-To: <1ffe809c0809130820x5ba9207cs9f92848051950a22@mail.gmail.com> References: <1221314351.6065.15.camel@linux-box> <1ffe809c0809130820x5ba9207cs9f92848051950a22@mail.gmail.com> Message-ID: <1221327527.6065.16.camel@linux-box> Hi Pablo, Thanks I will give that a go! Still getting used to the Erlang libraries/API's. Thanks, Dan On Sat, 2008-09-13 at 12:20 -0300, Pablo Polvorin wrote: > I guess readLine() is blocked waiting to receive a line.., isn't it? > also, gen_tcp:send(Socket,<<"Test String">>) is probably what you want > instead of using term_to_binary/1 > > > > 2008/9/13 Dan Rubino > Hi all, > > I have an Erlang process which uses gen_tcp:listen/recv/send. > > Now I can send/receive messages Erlang<->Erlang but if I use a > Java > process I can only send messages to Erlang from Java and not > vice versa. > > The Java used to send and receive is pretty simple: > > Socket s = new Socket(host, 2345); > > System.out.println("Connected to socket on: " + host + > ":" + 2345); > > DataOutputStream os = new > DataOutputStream(s.getOutputStream()); > > String a = "Hello, world |23|24|26."; > > os.write(a.getBytes()); > > BufferedReader in = new BufferedReader(new > InputStreamReader(s.getInputStream())); > > System.out.println("echo: " + in.readLine()); > > > The Erlang code which works (broken down but in reality is > across > multiple modules): > > {ok, Listen} = gen_tcp:listen(Port, [binary, {packet, 0}, > {reuseaddr, > true}, {active, false}]), > > Which leads to: > > receive > true -> > {ok, Socket} = gen_tcp:accept(Listen), > try gen_tcp:accept(Listen) of > {ok, Socket} -> > spawn(fun() -> parallel_loop(Listen, > CallBackMod) end), > CallBackMod:handle_call({socket,Socket}), > > which leads to: > > handle_call({socket, Socket}) -> > case gen_tcp:recv(Socket, 0) of > {ok, Data} -> > io:format("Data received: ~p~n", [Data]), > gen_tcp:send(Socket, term_to_binary("Test > String")), > handle_call({socket, Socket}); > {error, closed} -> > io:format("Socket closed.~n"), > ok; > Val -> > io:format("Val: ~p~n", [Val]) > end. > > Like I say, the Erlang process can read the data sent from the > Java process too it but for some reason > which I am not totally sure of - the java process is unable to > pickup the data being sent back from the > Erlang process using gen_tcp:send() > > Has anyone here got any experience performing socket > communication between Erlang and Java? > > There doesnt seem to be any useful articles on the Net around > this unfortunately. > > Any help greatly appreciated - a java example would be great! > > Thanks > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -- > -- > pablo > http://ppolv.wordpress.com > ---- > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From pfisher@REDACTED Fri Sep 12 17:00:19 2008 From: pfisher@REDACTED (Paul Fisher) Date: Fri, 12 Sep 2008 10:00:19 -0500 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <762B727D-125A-4739-B599-4114C0460869@gmail.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> Message-ID: <48CA8403.3070907@alertlogic.net> Joel Reymont wrote: > These are gen_server call timeouts when requests for game information > take longer than the default 5 seconds. I have an average of 5 players > per game so this is not because a large number of processes are trying > to access the game. > > I suppose this is a reflection of the load on the system, although CPU > usage never goes past 300% which tells me that no more than 3 cores > are used by Erlang. We have a system with a completely different workload profile, but our initial testing has indicated a SMP scaling barrier, such that scaling beyond 4 cores (on x86-64 linux 2.6.24 w/R12-3) deteriorate quickly. My very preliminary in investigations indicated a substantial number of futex system calls (which should happen only on contended locks which need kernel arbitrartion) as the work scaled toward 4 cores. I had initially thought that this was related to the amount of work we perform in linked in drivers via async threads, but some more current information indicates that this might be more core scheduler related. Can anyone with experiences running a sufficiently complex system on 8+ core systems share your experiences? I would love to hear from someone intimate with the SMP implementation on the state of affairs and possible future directions. -- paul From pfisher@REDACTED Fri Sep 12 18:48:22 2008 From: pfisher@REDACTED (Paul Fisher) Date: Fri, 12 Sep 2008 11:48:22 -0500 Subject: [erlang-questions] Combining ets and mnesia operations for extremeperformance In-Reply-To: <48CA9327.5080605@di.uminho.pt> References: <48C95E0A.2010907@di.uminho.pt> <48CA7163.4000201@ericsson.com> <48CA9327.5080605@di.uminho.pt> Message-ID: <48CA9D56.1070800@alertlogic.net> Paulo S?rgio Almeida wrote: > Hi Ulf, > > Thanks for the prompt reply. See below. > > Ulf Wiger (TN/EAB) wrote: >> Perhaps you'd want to consider using ram_copies and dumping >> to disk using mnesia:dump_tables(Tabs)? > > There is not much information about this operation. Does it provide > atomicity? What happens if there is a crash in the middle of it? I have > not made it clear, but I need to persist the updates on several tables > as an atomic operation. As a general strategy for this type of thing I will do the dump (usually ets tables with ets:tab2file/1) and one the operation is complete i will rename the file from .tmp to in order to "commit" the operation for later recovery. -- paul From joelr1@REDACTED Sat Sep 13 20:59:30 2008 From: joelr1@REDACTED (Joel Reymont) Date: Sat, 13 Sep 2008 19:59:30 +0100 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <48CA8403.3070907@alertlogic.net> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <48CA8403.3070907@alertlogic.net> Message-ID: <1DFCF703-3AD6-4D23-B3C1-F29D79B76F10@gmail.com> I thought of running etop on another node to figure out what's going on at peak load. Sadly, etop crashes '1 @mothership ' 17:19:03 Load: cpu 90 Memory: total 1309096 binary 1302 procs 21259 processes 1185824 code 6406 runq 0 atom 961 ets 52340 Pid Name or Initial Func Time Reds Memory MsgQ Current Function ---------------------------------------------------------------------------------------- <5624.3952.0> proc_lib:init_p/5 '-' 1046280 1113656 0 gen_server:loop/6 <5624.0.0> init '-' 576618 26320 0 init:loop/1 <5624.3941.0> portServer3000 '-' 183416 88336 0 tcp_server:socket_lo <5624.3956.0> inet_gethost_native '-' 178043 6864 0 inet_gethost_native: <5624.73.0> proc_lib:init_p/5 '-' 89051 688680 0 disk_log:loop/1 <5624.3937.0> proc_lib:init_p/5 '-' 68600 24520 0 gen_server:loop/6 <5624.3938.0> portServer6000 '-' 27716 418544 0 tcp_server:socket_lo <5624.30.0> group:server/3 '-' 20382 24520 0 group:server_loop/3 <5624.25.0> file_server_2 '-' 7192 88400 0 gen_server:loop/6 <5624.16494.0> proc_lib:init_p/5 '-' 4770 8688 0 gen_server:loop/6 = = = = = = = = = = = = = = = = ======================================================================== Output server crashed: connection_lost Another issue with etop: Erlang top got garbage {trace_ts,<5623.28.0>,out, {user_drv,server_loop,5}, {1221,332097,210811}} Erlang top got garbage {trace_ts,<5623.25.0>,out, {gen_server,loop,6}, {1221,332097,267093}} Erlang top got garbage {trace_ts,<5623.4.0>,out, {gen_event,fetch_msg,5}, {1221,332097,340833}} I'm not doing any tracing myself so I really don't know where these traces come from. The easiest way to reproduce is to connect etop and then start Mnesia. -- wagerlabs.com From mikpe@REDACTED Sat Sep 13 21:22:03 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Sat, 13 Sep 2008 21:22:03 +0200 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <48CA8403.3070907@alertlogic.net> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <48CA8403.3070907@alertlogic.net> Message-ID: <18636.4827.423901.725733@harpo.it.uu.se> Paul Fisher writes: > Joel Reymont wrote: > > These are gen_server call timeouts when requests for game information > > take longer than the default 5 seconds. I have an average of 5 players > > per game so this is not because a large number of processes are trying > > to access the game. > > > > I suppose this is a reflection of the load on the system, although CPU > > usage never goes past 300% which tells me that no more than 3 cores > > are used by Erlang. > > > We have a system with a completely different workload profile, but our > initial testing has indicated a SMP scaling barrier, such that scaling > beyond 4 cores (on x86-64 linux 2.6.24 w/R12-3) deteriorate quickly. > > My very preliminary in investigations indicated a substantial number of > futex system calls (which should happen only on contended locks which > need kernel arbitrartion) as the work scaled toward 4 cores. I had > initially thought that this was related to the amount of work we perform > in linked in drivers via async threads, but some more current > information indicates that this might be more core scheduler related. You might get more help debugging this if you provided code which triggers the problem. Obviously not your proprietary code, but something that stresses the Erlang system in the same way. The Erlang system doesn't do any explicit futex ops on it's own. But glibc's pthread lock ops will do futex ops in their slow paths. From rapsey@REDACTED Sat Sep 13 21:36:32 2008 From: rapsey@REDACTED (Rapsey) Date: Sat, 13 Sep 2008 21:36:32 +0200 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <1DFCF703-3AD6-4D23-B3C1-F29D79B76F10@gmail.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <48CA8403.3070907@alertlogic.net> <1DFCF703-3AD6-4D23-B3C1-F29D79B76F10@gmail.com> Message-ID: <97619b170809131236i5b313d1fu293f249bc6b71913@mail.gmail.com> How many mnesia transactions do you have left? From what I tested, transactions are slow as hell. I'm sure you would get much better performance, if a gen_server was in charge of a table and all queries were dirty and went through that process. Unless you need transactions for more than just thread safety. Then this method won't work of course. Sergej On Sat, Sep 13, 2008 at 8:59 PM, Joel Reymont wrote: > I thought of running etop on another node to figure out what's going > on at peak load. Sadly, etop crashes > > > '1 > @mothership > ' 17:19:03 > Load: cpu 90 Memory: total 1309096 > binary 1302 > procs 21259 processes 1185824 > code 6406 > runq 0 atom 961 > ets 52340 > > Pid Name or Initial Func Time Reds Memory MsgQ > Current Function > > ---------------------------------------------------------------------------------------- > <5624.3952.0> proc_lib:init_p/5 '-' 1046280 1113656 0 > gen_server:loop/6 > <5624.0.0> init '-' 576618 26320 0 > init:loop/1 > <5624.3941.0> portServer3000 '-' 183416 88336 0 > tcp_server:socket_lo > <5624.3956.0> inet_gethost_native '-' 178043 6864 0 > inet_gethost_native: > <5624.73.0> proc_lib:init_p/5 '-' 89051 688680 0 > disk_log:loop/1 > <5624.3937.0> proc_lib:init_p/5 '-' 68600 24520 0 > gen_server:loop/6 > <5624.3938.0> portServer6000 '-' 27716 418544 0 > tcp_server:socket_lo > <5624.30.0> group:server/3 '-' 20382 24520 0 > group:server_loop/3 > <5624.25.0> file_server_2 '-' 7192 88400 0 > gen_server:loop/6 > <5624.16494.0> proc_lib:init_p/5 '-' 4770 8688 0 > gen_server:loop/6 > = > = > = > = > = > = > = > = > = > = > = > = > = > = > = > = > ======================================================================== > > Output server crashed: connection_lost > > Another issue with etop: > > Erlang top got garbage {trace_ts,<5623.28.0>,out, > {user_drv,server_loop,5}, > {1221,332097,210811}} > Erlang top got garbage {trace_ts,<5623.25.0>,out, > {gen_server,loop,6}, > {1221,332097,267093}} > Erlang top got garbage {trace_ts,<5623.4.0>,out, > {gen_event,fetch_msg,5}, > {1221,332097,340833}} > > I'm not doing any tracing myself so I really don't know where these > traces come from. The easiest way to reproduce is to connect etop and > then start Mnesia. > > -- > wagerlabs.com > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Sat Sep 13 22:09:53 2008 From: joelr1@REDACTED (Joel Reymont) Date: Sat, 13 Sep 2008 21:09:53 +0100 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <97619b170809131236i5b313d1fu293f249bc6b71913@mail.gmail.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <48CA8403.3070907@alertlogic.net> <1DFCF703-3AD6-4D23-B3C1-F29D79B76F10@gmail.com> <97619b170809131236i5b313d1fu293f249bc6b71913@mail.gmail.com> Message-ID: <3274A42C-8E91-42DE-81F5-004BB2F3356B@gmail.com> On Sep 13, 2008, at 8:36 PM, Rapsey wrote: > How many mnesia transactions do you have left? No idea. Is there anything in the etop output that makes you think transactions are a problem? I think I only have one transaction in my code, everything else is dirty ops. > From what I tested, > transactions are slow as hell. I'm sure you would get much better > performance, if a gen_server was in charge of a table and all > queries were dirty and went through that process. I also tried making all the tables ram_copies, just for the sake of it. I still get gen_server timeouts. I'm trying to profile with eprof now. I started profiling but my test harness hangs waiting for the games that will never finish. I thought I'd try to connect to the node, find that test process and kill it. erl -remsh 1@REDACTED Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:8] [async- threads:0] [kernel-poll:false] *** ERROR: Shell process terminated! (^G to start new job) *** User switch command --> r '1@REDACTED' --> j 2* {'1@REDACTED',shell,start,[]} --> c 2 *** ERROR: Shell process terminated! (^G to start new job) *** Tools are failing me and the saga continues! -- wagerlabs.com From jan@REDACTED Sat Sep 13 22:11:49 2008 From: jan@REDACTED (Jan Lehnardt) Date: Sat, 13 Sep 2008 22:11:49 +0200 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <48CA8403.3070907@alertlogic.net> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <48CA8403.3070907@alertlogic.net> Message-ID: <8C9FD937-8F0C-4D87-B6D8-DD4BA6998C86@apache.org> On Sep 12, 2008, at 17:00, Paul Fisher wrote: > Can anyone with experiences running a sufficiently complex system on > 8+ > core systems share your experiences? I would love to hear from > someone > intimate with the SMP implementation on the state of affairs and > possible future directions. I don't claim any experience in this field but I did a few tests with CouchDB on a 32 core machine. I've seen linear performance increase up to 14 cores with a CPU utilisation of ~22% and no disk I/O (makes sense, little data, loads of RAM). I tested with increasing +S parameters for `erl`. We ran the results by some friends at Sun who suggested that this might be a bottleneck in the networking layer. Something might have a per-CPU (not per-core) bottleneck. Some kernel tuning in Solaris and possibly better NIC-programming could solve this one, but I only had access to the box for a short time and had no chance to change any boot-parameters, let alone hardware specs. Profiling showed that Erlang was mostly waiting for network I/O which further underlines the Solaris config problem theory. Cheers Jan -- From joelr1@REDACTED Sat Sep 13 22:12:36 2008 From: joelr1@REDACTED (Joel Reymont) Date: Sat, 13 Sep 2008 21:12:36 +0100 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <3274A42C-8E91-42DE-81F5-004BB2F3356B@gmail.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <48CA8403.3070907@alertlogic.net> <1DFCF703-3AD6-4D23-B3C1-F29D79B76F10@gmail.com> <97619b170809131236i5b313d1fu293f249bc6b71913@mail.gmail.com> <3274A42C-8E91-42DE-81F5-004BB2F3356B@gmail.com> Message-ID: <5846A09C-2525-4CD3-A282-F28FB88C7750@gmail.com> Foot in mouth. I forgot to supply the node name. 'erl -sname 2 -remsh 1@REDACTED' works fine. On Sep 13, 2008, at 9:09 PM, Joel Reymont wrote: > I thought I'd try to connect to the node, find that test process and > kill it. > > erl -remsh 1@REDACTED > Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:8] > [async-threads:0] [kernel-poll:false] > > *** ERROR: Shell process terminated! (^G to start new job) *** -- wagerlabs.com From vances@REDACTED Sat Sep 13 22:37:49 2008 From: vances@REDACTED (Vance Shipley) Date: Sat, 13 Sep 2008 16:37:49 -0400 Subject: [erlang-questions] Error building R12B-4 on SPARC T1 Message-ID: <20080913203749.GS272@h216-235-12-173.host.egate.net> Building R12B-4 is failing for me on a Sun T1000 server: gcc -g -O3 -fomit-frame-pointer -I/usr/local/src/otp_src_R12B-4/erts/sparc-sun-solaris2.10 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DERTS_SMP -DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -Wa,-xarch=v8plusa -Ibeam -Isys/unix -Isys/common -Isparc-sun-solaris2.10/opt/smp -Isparc-sun-solaris2.10 -Izlib -Ipcre -Ihipe -I../include/internal -I../include/internal/sparc-sun-solaris2.10 -c beam/erl_bif_info.c -o obj/sparc-sun-solaris2.10/opt/smp/erl_bif_info.o gcc: Internal error: Segmentation Fault (program cg) Please submit a full bug report to . make[3]: *** [obj/sparc-sun-solaris2.10/opt/smp/erl_bif_info.o] Error 1 make[3]: Leaving directory `/usr/local/src/otp_src_R12B-4/erts/emulator' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/usr/local/src/otp_src_R12B-4/erts/emulator' make[1]: *** [smp] Error 2 make[1]: Leaving directory `/usr/local/src/otp_src_R12B-4/erts' gmake: *** [emulator] Error 2 This is using SUNWgccfss v4.2.0 although it failed identically with v4.0.3. I did submit a bug report to Sun as suggested. -Vance From erlang-questions_efine@REDACTED Sat Sep 13 22:56:21 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 13 Sep 2008 16:56:21 -0400 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <5846A09C-2525-4CD3-A282-F28FB88C7750@gmail.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <48CA8403.3070907@alertlogic.net> <1DFCF703-3AD6-4D23-B3C1-F29D79B76F10@gmail.com> <97619b170809131236i5b313d1fu293f249bc6b71913@mail.gmail.com> <3274A42C-8E91-42DE-81F5-004BB2F3356B@gmail.com> <5846A09C-2525-4CD3-A282-F28FB88C7750@gmail.com> Message-ID: <6c2563b20809131356i73bd5a71ra5f0ef8a42159f4@mail.gmail.com> Joel, I have mentioned this before on this list, but I'm getting the feeling that folks on this list must think it's a really stupid idea, or not worth looking into because I am new to Erlang or some other reason - maybe I say lots of dumb things - because I have had virtually no responses. Or maybe it is worth looking into, but could be a big can of worms. EIther way, there is something nagging at me that won't allow me to let this go until I know a bit more about it. Here's the stupid idea: Run one +S 1 VM per core instead of N +S N VMS. You'd probably have to partition the load to round-robin across the individual VMs, possibly using some front-end load-balancing hardware. This is why I keep harping on this: some time ago I put the system I am working on under heavy load to test the maximum possible throughput. There was no appreciable disk I/O. The kicker is that I did not see an even distribution of load across the 4 cores of my box. In fact, it looked as if one or maybe two cores were being used at 100% and the rest were idle. When I re-ran the test on a whim, using only 1 non-SMP (+S 1) node, I actually got better performance. This seemed counter-intuitive and against the "Erlang SMP scales linearly for CPU-intensive loads" idea. I have not done a lot of investigation into this because I have other fish to fry right now, but the folks over at LShift (RabbitMQ) - assuming I did not misunderstand them - wrote that they had seen similar behavior when running clustered Rabbit nodes (i.e. better performance from N single-CPU nodes than N +S N nodes). However, they, like me, are not ready to come out and state this bluntly as a fact because (I believe) they feel not enough investigation has been done to make this a conclusive case. It looks, though, like you are in a very good position to see if this makes any difference, and perhaps bring to light a hitherto-unknown flaw (or at least hitch) in the SMP implementation, which will benefit everyone if there is something there and it gets resolved. What do you think? Is the newbie smoking something, or is there maybe something to it? Regards, Edwin Fine On Sat, Sep 13, 2008 at 4:12 PM, Joel Reymont wrote: > Foot in mouth. I forgot to supply the node name. > > 'erl -sname 2 -remsh 1@REDACTED' works fine. > > On Sep 13, 2008, at 9:09 PM, Joel Reymont wrote: > > > I thought I'd try to connect to the node, find that test process and > > kill it. > > > > erl -remsh 1@REDACTED > > Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:8] > > [async-threads:0] [kernel-poll:false] > > > > *** ERROR: Shell process terminated! (^G to start new job) *** > > -- > wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Sat Sep 13 23:15:41 2008 From: joelr1@REDACTED (Joel Reymont) Date: Sat, 13 Sep 2008 22:15:41 +0100 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <6c2563b20809131356i73bd5a71ra5f0ef8a42159f4@mail.gmail.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <48CA8403.3070907@alertlogic.net> <1DFCF703-3AD6-4D23-B3C1-F29D79B76F10@gmail.com> <97619b170809131236i5b313d1fu293f249bc6b71913@mail.gmail.com> <3274A42C-8E91-42DE-81F5-004BB2F3356B@gmail.com> <5846A09C-2525-4CD3-A282-F28FB88C7750@gmail.com> <6c2563b20809131356i73bd5a71ra5f0ef8a42159f4@mail.gmail.com> Message-ID: <33958DCD-3097-4967-A7D9-F24BDEA744F5@gmail.com> On Sep 13, 2008, at 9:56 PM, Edwin Fine wrote: > Here's the stupid idea: Run one +S 1 VM per core instead of N +S N > VMS. > [...] > What do you think? Is the newbie smoking something, or is there maybe > something to it? There's definitely something to it and I'll try it just as soon as I'm able to make my test harness a distributed one. It's designed to launch everything on a single node right now. There's something that's nagging at me as well, which is why I haven't been in a rush to rewrite the test harness. I want to know why my gen_server calls start to timeout! I even killed the VM upon the first timeout to get a crash dump. Lo and behold, there were no processes with lengthy message queues. The distribution among the 21234 processes goes like this: 0, 1, 2, 3, 4, 5, 6, 7 (20), 8 (18), 9 (28), 10 (36), 11 (19), 12 (24), 13 (8), 14 (8), 15, 26, 32, 33 The # of processes with this queue length is in parenthesis and is 1 where there are none. Perhaps I should pay attention to the counts over 5 or 10. The complication is that most of the gen_servers look like this in the crash dump... =proc:<0.4093.0> State: Waiting Spawned as: proc_lib:init_p/5 Spawned by: <0.4001.0> Started: Sat Sep 13 18:36:39 2008 Message queue length: 0 Number of heap fragments: 0 Heap fragment data: 0 Link list: [#Port<0.5677>] Reductions: 3422 Stack+heap: 2584 OldHeap: 377 Heap unused: 1800 OldHeap unused: 377 Program counter: 0x0000000144d3c748 (gen_server:loop/6 + 288) CP: 0x0000000144cfe458 (proc_lib:init_p/5 + 400) arity = 0 Note that the current function is gen_server:loop/6, they were (obviously) spawned by proc_lib:init_p/5 and the processes are unnamed. There's more info in the crash dump on every process, e.g. process dictionary, stack and heap (below). I'm able to deduce that this is a bot process but I'm still scratching my head over jumping from this to identifying the gen_server timeouts. =proc_dictionary:<0.4093.0> H10B4D30 H10B4D48 =proc_stack:<0.4093.0> 0x000000015e0fc498:SReturn addr 0x44CFE458 (proc_lib:init_p/5 + 400) y0:N y1:A8:infinity y2:A3:bot y3:H5E0F8C30 y4:P<0.4093.0> y5:P<0.4093.0> 0x000000015e0fc4d0:SReturn addr 0x1A9D28 () y0:SCatch 0x44CFE478 (proc_lib:init_p/5 + 432) y1:A3:gen y2:A7:init_it y3:H10B4D20 =proc_heap:<0.4093.0> 5E0F8C30 :tD:A3 :bot ,H10B4DB0,I14,I3,p<0.5677>,H10B4FA0,N,I1150,I2,I797372250,A5:false,I1,I0 10B4FA0:lA5:CHECK|H10B4FB0 10B4FB0:lA5:CHECK|H10B4FC0 10B4FC0:lA4:FOLD|H10B4FD0 10B4FD0:lA3:nil|N 10B4DB0:YhE:6B6D616E2F373937333732323530 10B4D20:lAA:gen_server|H10B4DE8 10B4DE8:lP<0.4001.0>|H10B4E48 10B4E48:lA4:self|H10B4E88 10B4E88:lA3:bot|H10B4EC0 10B4EC0:lH10B4EE0|H10B4EF0 10B4EE0:lH10B4DB0|H10B4F10 10B4F10:lI797372250|H10B4F30 10B4F30:lI2|H10B4F50 10B4F50:lI1160|N 10B4EF0:lN|N 10B4D30:t2:AD:$initial_call,H10B4DF8 10B4DF8:t3:A3:gen,A7:init_it,H10B4D20 10B4D48:t2:AA:$ancestors,H10B4E18 10B4E18:lP<0.4001.0>|H10B4E58 10B4E58:lP<0.37.0>|N -- wagerlabs.com From kevin@REDACTED Sun Sep 14 00:07:39 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Sat, 13 Sep 2008 15:07:39 -0700 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <6c2563b20809131356i73bd5a71ra5f0ef8a42159f4@mail.gmail.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <48CA8403.3070907@alertlogic.net> <1DFCF703-3AD6-4D23-B3C1-F29D79B76F10@gmail.com> <97619b170809131236i5b313d1fu293f249bc6b71913@mail.gmail.com> <3274A42C-8E91-42DE-81F5-004BB2F3356B@gmail.com> <5846A09C-2525-4CD3-A282-F28FB88C7750@gmail.com> <6c2563b20809131356i73bd5a71ra5f0ef8a42159f4@mail.gmail.com> Message-ID: <7BDEFDC8-9159-423A-804D-A125DD477F35@scaldeferri.com> On Sep 13, 2008, at 1:56 PM, Edwin Fine wrote: > You'd probably have to partition the load to round-robin across the > individual VMs, possibly using some front-end load-balancing > hardware. This is why I keep harping on this: some time ago I put > the system I am working on under heavy load to test the maximum > possible throughput. There was no appreciable disk I/O. The kicker > is that I did not see an even distribution of load across the 4 > cores of my box. In fact, it looked as if one or maybe two cores > were being used at 100% and the rest were idle. When I re-ran the > test on a whim, using only 1 non-SMP (+S 1) node, I actually got > better performance. > > This seemed counter-intuitive and against the "Erlang SMP scales > linearly for CPU-intensive loads" idea. I have not done a lot of > investigation into this because I have other fish to fry right now, > but the folks over at LShift (RabbitMQ) - assuming I did not > misunderstand them - wrote that they had seen similar behavior when > running clustered Rabbit nodes (i.e. better performance from N > single-CPU nodes than N +S N nodes). However, they, like me, are not > ready to come out and state this bluntly as a fact because (I > believe) they feel not enough investigation has been done to make > this a conclusive case. I've also been seeing similar behavior trying to parallelize the alioth shootout code, fwiw. I'd also say it's premature to draw any concrete conclusions, but another anecdotal point. (Also, on the particular OS & hardware the benchmarks run on, the total CPU usage nearly doubles for the parallel implementations. On my 2-core mac, though, I see no more than a 10% increase in total CPU usage, and a near 100% improvement in the wall-time, as one should expect on the embarrassingly parallel problems. Dunno, if this is related to the OS, the chip (Core 2 Duo vs Core 2 Quad), HiPE, or what.) -kevin From kenji.rikitake@REDACTED Sun Sep 14 04:20:20 2008 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Sun, 14 Sep 2008 11:20:20 +0900 Subject: [erlang-questions] calendar:local_time_to_universal_time_dst/1 - what this is for? Message-ID: <20080914022020.GA8536@k2r.org> I found a bug when I was playing around with mochiweb on R12B4. It's not mochiweb's bug, but rather the Erlang/OTP time function bug. See http://www.erlang.org/pipermail/erlang-bugs/2008-September/000994.html if you don't want to read ahead. (Summary: the "universaltime" in Erlang/OTP was not really the one if the wall clock is aware of leap seconds.) I am writing this to ask a set of question about the following issue I was thinking last night. When I tried to perform "gmake test" on one of my systems (yeah, it's FreeBSD, so GNU make is gmake), I faced a condition (in mochiweb_cookies:test/0) that httpd_util:rfc1123_date/1 returned a [] (null list). I further tracked it down and found calendar:local_time_to_universal_time_dst/1 (quoted below) was the source of the null list. (I found that erlang:universaltime_to_localtime/1 and the corresponding C function univ_to_local() in erts/emulator/beam/erl_time_sup.c caused the problem, by NOT properly handling leap-second correction.) I was wondering what this function calendar:local_time_to_universal_time_dst/1 was for and how this conversion function to be used. I have the following questions: * Why you need to double-check the whole time difference? * In what situation should the results of this function really matter? * What kind of action should an application program take if this function returns a list of two possible UTC values for one DST localtime value? Maybe I'm perplexed just because I've never tried hard to code DST handling programs (Japan has no DST since 1950s). BTW I'd like to say thanks to mochiweb developers for making me aware of these rather non-trivial issues. Regards, Kenji Rikitake %% quoted from lib/stdlib-1.15.4/src/calendar.erl %% begin -spec local_time_to_universal_time_dst(t_datetime1970()) -> [t_datetime1970()]. local_time_to_universal_time_dst(DateTime) -> UtDst = erlang:localtime_to_universaltime(DateTime, true), Ut = erlang:localtime_to_universaltime(DateTime, false), %% Reverse check the universal times LtDst = erlang:universaltime_to_localtime(UtDst), Lt = erlang:universaltime_to_localtime(Ut), %% Return the valid universal times case {LtDst,Lt} of {DateTime,DateTime} when UtDst =/= Ut -> [UtDst,Ut]; {DateTime,_} -> [UtDst]; {_,DateTime} -> [Ut]; {_,_} -> [] end. %% end From o.pernet@REDACTED Sun Sep 14 09:04:18 2008 From: o.pernet@REDACTED (Olivier Pernet) Date: Sun, 14 Sep 2008 08:04:18 +0100 Subject: [erlang-questions] String handling & regexp Message-ID: <28276cf00809140004g2468f551x5a3dd46ce32baf60@mail.gmail.com> Hi all, I'm new to Erlang, and trying not to reinvent the wheel to do some basic string processing. I'm reading a line that has a room name and a message, separated by one (or more) whitespace characters, and terminated by . Is there a way to tell regexp:split() to please give me back the groups matched by the regexp ? Here's my first attempt : regexp:split(" \t \t room \t hello world \r\n", "[ \t]*([^\s\t\r\n]+)[ \t]+([^\r\n]*)\r\n"). I'd like to get back something like ["room", "hello world "] with this example. Thanks for your help, Olivier Pernet We are the knights who say echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq'|dc From mikpe@REDACTED Sun Sep 14 10:31:11 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Sun, 14 Sep 2008 10:31:11 +0200 Subject: [erlang-questions] Error building R12B-4 on SPARC T1 In-Reply-To: <20080913203749.GS272@h216-235-12-173.host.egate.net> References: <20080913203749.GS272@h216-235-12-173.host.egate.net> Message-ID: <18636.52175.46327.277642@harpo.it.uu.se> Vance Shipley writes: > Building R12B-4 is failing for me on a Sun T1000 server: > > gcc -g -O3 -fomit-frame-pointer > -I/usr/local/src/otp_src_R12B-4/erts/sparc-sun-solaris2.10 > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DERTS_SMP -DHAVE_CONFIG_H > -Wall -Wstrict-prototypes -Wmissing-prototypes > -Wdeclaration-after-statement -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT > -D_POSIX_PTHREAD_SEMANTICS -Wa,-xarch=v8plusa -Ibeam -Isys/unix > -Isys/common -Isparc-sun-solaris2.10/opt/smp -Isparc-sun-solaris2.10 > -Izlib -Ipcre -Ihipe -I../include/internal > -I../include/internal/sparc-sun-solaris2.10 -c beam/erl_bif_info.c -o > obj/sparc-sun-solaris2.10/opt/smp/erl_bif_info.o > gcc: Internal error: Segmentation Fault (program cg) > Please submit a full bug report to > . > make[3]: *** [obj/sparc-sun-solaris2.10/opt/smp/erl_bif_info.o] Error 1 > make[3]: Leaving directory `/usr/local/src/otp_src_R12B-4/erts/emulator' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory `/usr/local/src/otp_src_R12B-4/erts/emulator' > make[1]: *** [smp] Error 2 > make[1]: Leaving directory `/usr/local/src/otp_src_R12B-4/erts' > gmake: *** [emulator] Error 2 > > This is using SUNWgccfss v4.2.0 although it failed identically with v4.0.3. > I did submit a bug report to Sun as suggested. I've just built R12B-4 on Solaris/SPARC with gcc-4.3.2, gcc-4.2.4, and gcc-4.0.4, and none of them ICEd like your GCCs do. However: - I compiled my GCCs myself from vanilla release tarballs - our departmental Suns run Solaris 9 not 10 as your T1000 does - after years of usage we know our Suns have good HW The breakage could be in SUNWgccfss, or Solaris 10 (do you have all OS updates?), or your T1000 might have developed a HW problem like bad RAM or broken cache. You could test with the same SUNWgccfss on a different machine. If the ICEs persist then you can rule out a HW problem. /Mikael From erlang-questions_efine@REDACTED Sun Sep 14 10:39:40 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sun, 14 Sep 2008 04:39:40 -0400 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <009501c9163a$96b50610$6401a8c0@moneymaker2> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <48CA8403.3070907@alertlogic.net> <1DFCF703-3AD6-4D23-B3C1-F29D79B76F10@gmail.com> <97619b170809131236i5b313d1fu293f249bc6b71913@mail.gmail.com> <3274A42C-8E91-42DE-81F5-004BB2F3356B@gmail.com> <5846A09C-2525-4CD3-A282-F28FB88C7750@gmail.com> <6c2563b20809131356i73bd5a71ra5f0ef8a42159f4@mail.gmail.com> <7BDEFDC8-9159-423A-804D-A125DD477F35@scaldeferri.com> <009501c9163a$96b50610$6401a8c0@moneymaker2> Message-ID: <6c2563b20809140139s5fec4a5eie81af90409249191@mail.gmail.com> I think you have misunderstood my reasoning here. If you have 8 Erlang VMs going, each with +S 1, how exactly does this defeat the purpose of having a multi-core machine? Long before threading models came into vogue, multiple processes were taking advantage of multi-CPU systems simply by letting the OS scheduler choose which CPU on which to run the next runnable process. Since Erlang threads are "green" threads, they don't individually use the threading model of the underlying operating system anyway. Each VM, other than for I/O operations on files (controleld by +A, I believe), uses AFAIK one O/S thread per scheduler. So +S 8 will use 8 O/S threads. When you have 8 threads sharing something (which they will when running SMP), there is a risk of contention slowing things down. I wonder what happens when Erlang processes running on the scheduler thread of one core send lots of messages to Erlang processes running on a scheduler on a different core? There HAS to be a lock there somewhere while the message moves from the memory space of the first process to the second one, or if shared memory is being used (more likely scenario), there is going to be some locking of shared data structures. Now if there are thousands of processes sending in aggregate hundreds of thousands of messages, I believe this will not scale well if the messages cross scheduler boundaries. I could be wrong, but it fits the anecdotal data. It would be very interesting to see the effect of designing an application so that processes that send lots of messages to each other run on the same scheduler, sort of "clustering" the messages so that they stay within the same VM's memory space. Using multiple VMs with +S 1 would force this to happen because there IS only one scheduler thread, so hopefully the VM doesn't use any SMP locks/mutexes under those conditions. This is in contrast to assuming a uniform model where the cost of sending messages is the same regardless of the fact that it may be going to a different process space and incurring the cost of a lock. The locks used are Posix semaphores, IIRC, and they are not cheap. I guess what I am trying to say is that the basic assumption Erlang applications seem to have been designed on top of up to now, knowing that the cost of sending a message is extremely low, is perhaps not as true as it used to be when using SMP. I would be very interested in hearing from Joe Armstrong about this. I seem to recall that he wrote something about the cost of what a process does needing to be much greater than the cost of starting a process or sending a message to it in order to scale. This is true of any IPC, even cheap IPC like Erlang. On top of that, things that use shared structures like ETS heavily, for example Mnesia transactions, are possibly going to suffer in the SMP context. All of this is just conjecture based on my own work and anecdotal evidence presented by some others, but I feel in my bones that there is something to this. Look at is this way: Erlang got its major performance from eliminating locks. Running on a 1024 processor system in SMP mode and treating it like it's one big uniform processor is going to backfire badly. I haven't seen much discussion about this. Maybe it's too obvious to mention. There is an interesting discussion ( http://www.erlang.org/pipermail/erlang-questions/2008-January/032273.html) about assigning individual +S 1 Erlang VMs to a given CPU using processor affinity. This could help considerably by leaving more of a VM's running state cached in the processor code and data caches than if the VM's thread were to be switched between CPUs by the OS. I plan Real Soon Now ;-) to do some extensive research into this to see if there is merit to it. Just as soon as I get over the hump in a current project. Anyway, hopefully this clarifies my thinking to you and you have less of an issue with it. On Sun, Sep 14, 2008 at 3:21 AM, Valentin Micic wrote: > I havent read the whole correspndance (it seems to be going on for a way > too long), but like to add my 2c worth... > > While SMP (+S1) approach may solve some problems, it defeats the purpose of > having a multi-core machine. Please note that multi-core machines have lower > clock speeds, thus should run generally slower per given CPU core. IMHO, if > +S 1 solves your problem, maybe you should revisit your code -- I think that > it is wrong to expect that the same code would work better on SMP just > because you had such expectations. For example, it is known fact that ETS > works slower in SMP environment. > Also, one should not forget to use +A in addition to +S -- although you do > not have any disk I/O, I think this parameter is relevant for PORT > scheduling, therefore improving performance of your I/O. > > V. > > > ----- Original Message ----- From: "Kevin Scaldeferri" < > kevin@REDACTED> > To: "Edwin Fine" > Cc: "erlang-questions Questions" > Sent: Sunday, September 14, 2008 12:07 AM > Subject: Re: [erlang-questions] My frustration with Erlang > > > >> On Sep 13, 2008, at 1:56 PM, Edwin Fine wrote: >> >> You'd probably have to partition the load to round-robin across the >>> individual VMs, possibly using some front-end load-balancing >>> hardware. This is why I keep harping on this: some time ago I put >>> the system I am working on under heavy load to test the maximum >>> possible throughput. There was no appreciable disk I/O. The kicker >>> is that I did not see an even distribution of load across the 4 >>> cores of my box. In fact, it looked as if one or maybe two cores >>> were being used at 100% and the rest were idle. When I re-ran the >>> test on a whim, using only 1 non-SMP (+S 1) node, I actually got >>> better performance. >>> >>> This seemed counter-intuitive and against the "Erlang SMP scales >>> linearly for CPU-intensive loads" idea. I have not done a lot of >>> investigation into this because I have other fish to fry right now, >>> but the folks over at LShift (RabbitMQ) - assuming I did not >>> misunderstand them - wrote that they had seen similar behavior when >>> running clustered Rabbit nodes (i.e. better performance from N >>> single-CPU nodes than N +S N nodes). However, they, like me, are not >>> ready to come out and state this bluntly as a fact because (I >>> believe) they feel not enough investigation has been done to make >>> this a conclusive case. >>> >> >> I've also been seeing similar behavior trying to parallelize the >> alioth shootout code, fwiw. I'd also say it's premature to draw any >> concrete conclusions, but another anecdotal point. >> >> (Also, on the particular OS & hardware the benchmarks run on, the >> total CPU usage nearly doubles for the parallel implementations. On >> my 2-core mac, though, I see no more than a 10% increase in total CPU >> usage, and a near 100% improvement in the wall-time, as one should >> expect on the embarrassingly parallel problems. Dunno, if this is >> related to the OS, the chip (Core 2 Duo vs Core 2 Quad), HiPE, or what.) >> >> >> -kevin >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Sun Sep 14 10:42:53 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sun, 14 Sep 2008 04:42:53 -0400 Subject: [erlang-questions] String handling & regexp In-Reply-To: <28276cf00809140004g2468f551x5a3dd46ce32baf60@mail.gmail.com> References: <28276cf00809140004g2468f551x5a3dd46ce32baf60@mail.gmail.com> Message-ID: <6c2563b20809140142l848e92aj7f02e7d2134783ae@mail.gmail.com> Take a look at the re module. It has exactly what you need. On Sun, Sep 14, 2008 at 3:04 AM, Olivier Pernet wrote: > Hi all, > > I'm new to Erlang, and trying not to reinvent the wheel to do some > basic string processing. > I'm reading a line that has a room name and a message, separated by > one (or more) whitespace characters, and terminated by . > Is there a way to tell regexp:split() to please give me back the > groups matched by the regexp ? > Here's my first attempt : > regexp:split(" \t \t room \t hello world \r\n", "[ > \t]*([^\s\t\r\n]+)[ \t]+([^\r\n]*)\r\n"). > I'd like to get back something like ["room", "hello world "] with this > example. > > Thanks for your help, > Olivier Pernet > > We are the knights who say > echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq'|dc > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Sun Sep 14 11:34:31 2008 From: joelr1@REDACTED (Joel Reymont) Date: Sun, 14 Sep 2008 10:34:31 +0100 Subject: [erlang-questions] possible fprof bug? Message-ID: <2A61C744-163E-4E4C-9767-9A82F4D964A8@gmail.com> End of erroneous trace! {error, {incorrect_trace_data,fprof,1689, [{trace_ts,<5963.5490.0>,send_to_non_existing_process, {find_server,none}, <5963.4014.0>, {1221,355910,508354}}]}} fprof:profile/0 stops here. I would love it to continue. -- wagerlabs.com From joelr1@REDACTED Sun Sep 14 12:33:06 2008 From: joelr1@REDACTED (Joel Reymont) Date: Sun, 14 Sep 2008 11:33:06 +0100 Subject: [erlang-questions] erlang:trace and bad argument Message-ID: <95C35166-9BBD-4C4A-B709-9E3666697B09@gmail.com> What am I doing wrong here? 20> erlang:trace(self(), false, [send]). 1 21> erlang:trace(self(), true, [send]). ** exception error: bad argument in function erlang:trace/3 called as erlang:trace(<0.93.0>,true,[send]) 22> erlang:trace(self(), true, [call]). ** exception error: bad argument in function erlang:trace/3 called as erlang:trace(<0.99.0>,true,[call]) Thanks, Joel -- wagerlabs.com From vances@REDACTED Sun Sep 14 16:47:29 2008 From: vances@REDACTED (Vance Shipley) Date: Sun, 14 Sep 2008 10:47:29 -0400 Subject: [erlang-questions] Error building R12B-4 on SPARC T1 In-Reply-To: <18636.52175.46327.277642@harpo.it.uu.se> References: <20080913203749.GS272@h216-235-12-173.host.egate.net> <18636.52175.46327.277642@harpo.it.uu.se> Message-ID: <20080914144729.GV272@h216-235-12-173.host.egate.net> On Sun, Sep 14, 2008 at 10:31:11AM +0200, Mikael Pettersson wrote: } The breakage could be in SUNWgccfss, or Solaris 10 (do you have } all OS updates?) Mikael, It would seem to be a problem with SUNWgccfss from the error: gcc: Internal error: Segmentation Fault (program cg) Please submit a full bug report to . I was able to build R12B-3 successfully however. -Vance From thomasl_erlang@REDACTED Sun Sep 14 16:58:12 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sun, 14 Sep 2008 07:58:12 -0700 (PDT) Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <6c2563b20809140139s5fec4a5eie81af90409249191@mail.gmail.com> Message-ID: <217349.77552.qm@web38803.mail.mud.yahoo.com> For what it's worth, I basically agree with Edwin's reasoning: letting the cores run nodes rather than SMP/threads in essence means there will be "minimal" contention (mediated by the kernel) and "minimal" synchronization (mediated by sockets). That said, te reasons for running threads rather than nodes might be: - easier to setup and change (porting to 16 cores is "+S 16", or perhaps "+S 20") - easier to load-balance - less costly messages and cheaper table access than remote operations - less memory used due to sharing inside VM - perhaps better memory performance, again due to sharing A further technical limitation of nodes, once pointed out to me by Sean Hinde, is that sockets can't be sent between nodes today. Best, Thomas --- On Sun, 9/14/08, Edwin Fine wrote: > From: Edwin Fine > Subject: Re: [erlang-questions] My frustration with Erlang > To: "Valentin Micic" > Cc: "erlang-questions Questions" > Date: Sunday, September 14, 2008, 10:39 AM > I think you have misunderstood my reasoning here. If you > have 8 Erlang VMs > going, each with +S 1, how exactly does this defeat the > purpose of having a > multi-core machine? Long before threading models came into > vogue, multiple > processes were taking advantage of multi-CPU systems simply > by letting the > OS scheduler choose which CPU on which to run the next > runnable process. > Since Erlang threads are "green" threads, they > don't individually use the > threading model of the underlying operating system anyway. > Each VM, other > than for I/O operations on files (controleld by +A, I > believe), uses AFAIK > one O/S thread per scheduler. So +S 8 will use 8 O/S > threads. When you have > 8 threads sharing something (which they will when running > SMP), there is a > risk of contention slowing things down. > > I wonder what happens when Erlang processes running on the > scheduler thread > of one core send lots of messages to Erlang processes > running on a scheduler > on a different core? There HAS to be a lock there somewhere > while the > message moves from the memory space of the first process to > the second one, > or if shared memory is being used (more likely scenario), > there is going to > be some locking of shared data structures. Now if there are > thousands of > processes sending in aggregate hundreds of thousands of > messages, I believe > this will not scale well if the messages cross scheduler > boundaries. I could > be wrong, but it fits the anecdotal data. It would be very > interesting to > see the effect of designing an application so that > processes that send lots > of messages to each other run on the same scheduler, sort > of "clustering" > the messages so that they stay within the same VM's > memory space. Using > multiple VMs with +S 1 would force this to happen because > there IS only one > scheduler thread, so hopefully the VM doesn't use any > SMP locks/mutexes > under those conditions. This is in contrast to assuming a > uniform model > where the cost of sending messages is the same regardless > of the fact that > it may be going to a different process space and incurring > the cost of a > lock. The locks used are Posix semaphores, IIRC, and they > are not cheap. > > I guess what I am trying to say is that the basic > assumption Erlang > applications seem to have been designed on top of up to > now, knowing that > the cost of sending a message is extremely low, is perhaps > not as true as it > used to be when using SMP. I would be very interested in > hearing from Joe > Armstrong about this. I seem to recall that he wrote > something about the > cost of what a process does needing to be much greater than > the cost of > starting a process or sending a message to it in order to > scale. This is > true of any IPC, even cheap IPC like Erlang. On top of > that, things that use > shared structures like ETS heavily, for example Mnesia > transactions, are > possibly going to suffer in the SMP context. All of this is > just conjecture > based on my own work and anecdotal evidence presented by > some others, but I > feel in my bones that there is something to this. Look at > is this way: > Erlang got its major performance from eliminating locks. > Running on a 1024 > processor system in SMP mode and treating it like it's > one big uniform > processor is going to backfire badly. I haven't seen > much discussion about > this. Maybe it's too obvious to mention. > > There is an interesting discussion ( > http://www.erlang.org/pipermail/erlang-questions/2008-January/032273.html) > about assigning individual +S 1 Erlang VMs to a given CPU > using processor > affinity. This could help considerably by leaving more of a > VM's running > state cached in the processor code and data caches than if > the VM's thread > were to be switched between CPUs by the OS. > > I plan Real Soon Now ;-) to do some extensive research into > this to see if > there is merit to it. Just as soon as I get over the hump > in a current > project. > > Anyway, hopefully this clarifies my thinking to you and you > have less of an > issue with it. > > > On Sun, Sep 14, 2008 at 3:21 AM, Valentin Micic > wrote: > > > I havent read the whole correspndance (it seems to be > going on for a way > > too long), but like to add my 2c worth... > > > > While SMP (+S1) approach may solve some problems, it > defeats the purpose of > > having a multi-core machine. Please note that > multi-core machines have lower > > clock speeds, thus should run generally slower per > given CPU core. IMHO, if > > +S 1 solves your problem, maybe you should revisit > your code -- I think that > > it is wrong to expect that the same code would work > better on SMP just > > because you had such expectations. For example, it is > known fact that ETS > > works slower in SMP environment. > > Also, one should not forget to use +A in addition to > +S -- although you do > > not have any disk I/O, I think this parameter is > relevant for PORT > > scheduling, therefore improving performance of your > I/O. > > > > V. > > > > > > ----- Original Message ----- From: "Kevin > Scaldeferri" < > > kevin@REDACTED> > > To: "Edwin Fine" > > > Cc: "erlang-questions Questions" > > > Sent: Sunday, September 14, 2008 12:07 AM > > Subject: Re: [erlang-questions] My frustration with > Erlang > > > > > > > >> On Sep 13, 2008, at 1:56 PM, Edwin Fine wrote: > >> > >> You'd probably have to partition the load to > round-robin across the > >>> individual VMs, possibly using some front-end > load-balancing > >>> hardware. This is why I keep harping on this: > some time ago I put > >>> the system I am working on under heavy load to > test the maximum > >>> possible throughput. There was no appreciable > disk I/O. The kicker > >>> is that I did not see an even distribution of > load across the 4 > >>> cores of my box. In fact, it looked as if one > or maybe two cores > >>> were being used at 100% and the rest were > idle. When I re-ran the > >>> test on a whim, using only 1 non-SMP (+S 1) > node, I actually got > >>> better performance. > >>> > >>> This seemed counter-intuitive and against the > "Erlang SMP scales > >>> linearly for CPU-intensive loads" idea. I > have not done a lot of > >>> investigation into this because I have other > fish to fry right now, > >>> but the folks over at LShift (RabbitMQ) - > assuming I did not > >>> misunderstand them - wrote that they had seen > similar behavior when > >>> running clustered Rabbit nodes (i.e. better > performance from N > >>> single-CPU nodes than N +S N nodes). However, > they, like me, are not > >>> ready to come out and state this bluntly as a > fact because (I > >>> believe) they feel not enough investigation > has been done to make > >>> this a conclusive case. > >>> > >> > >> I've also been seeing similar behavior trying > to parallelize the > >> alioth shootout code, fwiw. I'd also say > it's premature to draw any > >> concrete conclusions, but another anecdotal point. > >> > >> (Also, on the particular OS & hardware the > benchmarks run on, the > >> total CPU usage nearly doubles for the parallel > implementations. On > >> my 2-core mac, though, I see no more than a 10% > increase in total CPU > >> usage, and a near 100% improvement in the > wall-time, as one should > >> expect on the embarrassingly parallel problems. > Dunno, if this is > >> related to the OS, the chip (Core 2 Duo vs Core 2 > Quad), HiPE, or what.) > >> > >> > >> -kevin > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> > http://www.erlang.org/mailman/listinfo/erlang-questions > >> > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From uwe@REDACTED Sun Sep 14 15:16:38 2008 From: uwe@REDACTED (Uwe Dauernheim) Date: Sun, 14 Sep 2008 15:16:38 +0200 Subject: [erlang-questions] Compiling Erlang for the iPhone Message-ID: <5A017A52-FFE7-4DE7-A9AD-64183CF8DBDD@dauernheim.net> Hi all, I'd like to compile Erlang for the iPhone. Since I read in the Readme (and could already do it myself) it is possible to compile it for Mac OS X. So I thought compiling it for the iPhone should also be possible. But I don't get it to work. I tried cross compiling it on my Mac and also direct compile it on the iPhone. Neither method works. Maybe I don't know what to change, to make it iPhone compatible. Below you can see my testing script. Maybe someone find the missing value or the error? Thanks in advance. Regards, Uwe. == #!/bin/bash -x srcfolder=~/Desktop srcname=otp_src_R12B-4 binfolder=~/Desktop binname=otp_bin_R12B-4 prefix=/usr/libexec/erlang iphoneip=192.168.178.5 # Temporarily change to temp directory pushd /tmp # Remove old compiling tries rm -Rf $srcname # (Download and) unpack sourcefiles #curl http://www.erlang.org/download/$srcname.tar.gz | tar -xz cat $srcfolder/$srcname.tar.gz | tar -xz # Change to source directory cd $srcname # Remove any "historic" files ./otp_build remove_prebuilt_files # Configure Part ./configure --target=arm-apple-darwin --disable-hipe --disable-smp- support --with-ssl --prefix=$prefix make noboot make install # Remove unneccessary files rm -Rf $prefix/lib/erlang/lib/cos* rm -Rf $prefix/lib/erlang/lib/et-* rm -Rf $prefix/lib/erlang/lib/gs-* rm -Rf $prefix/lib/erlang/lib/megaco-* rm -Rf $prefix/lib/erlang/lib/orber-* rm -Rf $prefix/lib/erlang/lib/toolbar-* # Create a compress file of the compiled binaries tar -cf $binname.tar $prefix gzip $binname.tar mv $binname.tar.gz $binfolder/$binname.tar.gz # Clean-up rm -Rf $srcname rm -Rf $prefix # Go back to where we came from popd # Transfer to iPhone scp $binfolder/$binname.tar.gz root@$iphoneip:/ # Decompress on iPhone ssh root@$iphoneip "cd / ; tar -xzf $binname.tar.gz" # Test it on the iPhone ssh root@$iphoneip "/usr/libexec/erlang/bin/erl" From o.pernet@REDACTED Sun Sep 14 18:52:33 2008 From: o.pernet@REDACTED (Olivier Pernet) Date: Sun, 14 Sep 2008 17:52:33 +0100 Subject: [erlang-questions] String handling & regexp In-Reply-To: <6c2563b20809140142l848e92aj7f02e7d2134783ae@mail.gmail.com> References: <28276cf00809140004g2468f551x5a3dd46ce32baf60@mail.gmail.com> <6c2563b20809140142l848e92aj7f02e7d2134783ae@mail.gmail.com> Message-ID: <28276cf00809140952p68f8aefao463ddb0bd3311973@mail.gmail.com> Thanks, re looks just about right. I was hoping for a standard library solution at first... How fast do the OTP libraries evolve ? Any chance of this being included someday ? Olivier On Sun, Sep 14, 2008 at 9:42 AM, Edwin Fine wrote: > Take a look at the re module. It has exactly what you need. > > On Sun, Sep 14, 2008 at 3:04 AM, Olivier Pernet wrote: >> >> Hi all, >> >> I'm new to Erlang, and trying not to reinvent the wheel to do some >> basic string processing. >> I'm reading a line that has a room name and a message, separated by >> one (or more) whitespace characters, and terminated by . >> Is there a way to tell regexp:split() to please give me back the >> groups matched by the regexp ? >> Here's my first attempt : >> regexp:split(" \t \t room \t hello world \r\n", "[ >> \t]*([^\s\t\r\n]+)[ \t]+([^\r\n]*)\r\n"). >> I'd like to get back something like ["room", "hello world "] with this >> example. >> >> Thanks for your help, >> Olivier Pernet >> >> We are the knights who say >> echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq'|dc >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > From uwe@REDACTED Sun Sep 14 18:49:13 2008 From: uwe@REDACTED (Uwe Dauernheim) Date: Sun, 14 Sep 2008 18:49:13 +0200 Subject: [erlang-questions] Compiling Erlang for the iPhone In-Reply-To: References: <5A017A52-FFE7-4DE7-A9AD-64183CF8DBDD@dauernheim.net> Message-ID: Hej Chris, of course I'll do so, if I can deliver a benefit to the community. By the way: Anyone expierenced in the error message >>"lib/cpp" fails sanity check< On Sun, Sep 14, 2008 at 9:16 AM, Uwe Dauernheim > wrote: >> I'd like to compile Erlang for the iPhone. > > Uwe, > > I'm sorry I can't be helpful with an answer to your question, but I am > very interested in your result. Please keep us posted on this list if > you have success! > > Thanks, > Chris > > -- > Chris Anderson > http://jchris.mfdz.com From ulf.wiger@REDACTED Sun Sep 14 19:30:03 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Sun, 14 Sep 2008 19:30:03 +0200 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <762B727D-125A-4739-B599-4114C0460869@gmail.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> Message-ID: <48CD4A1B.7080406@ericsson.com> Joel Reymont skrev: > > All my hard work paid off and I was able to get close to 10K players, > with kernel poll enabled, of course. Then I ran out of ETS tables. > > I don't create ETS tables on the fly but, apparently, Mnesia does. > For every transaction!!! > > This prompted me to go through the server again and use dirty_read, > dirty_write wherever possible. I also placed balanced in two > separate "counter" tables, integers to be divided by 10000 to get 4 > decimal points of precision. This is so that I could use > dirty_update_counter instead of a regular read, bump, write pattern. Did you try increasing the maximum number of ETS tables? This is done using the environment variable ERL_MAX_ETS_TABLES It can be set to a number considerably higher than the default (1400 tables). BR, Ulf W From joelr1@REDACTED Sun Sep 14 19:40:19 2008 From: joelr1@REDACTED (Joel Reymont) Date: Sun, 14 Sep 2008 18:40:19 +0100 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <48CD4A1B.7080406@ericsson.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <48CD4A1B.7080406@ericsson.com> Message-ID: <8A576D4C-B5E6-424B-923A-C1D8DABBB320@gmail.com> On Sep 14, 2008, at 6:30 PM, Ulf Wiger (TN/EAB) wrote: > Did you try increasing the maximum number of ETS tables? > > This is done using the environment variable ERL_MAX_ETS_TABLES That would have been the easy way out :-). No, I just combed through the code and switched to dirty mnesia ops whenever possible. I'm very close to figuring out my issue I'm almost certain that it's mine to fix. I'll post again next week, explaining what I did to pinpoint the problem and how I did it (tracing, crash dump analysis). I'll also post new throughput statistics. Thanks, Joel -- wagerlabs.com From o.pernet@REDACTED Sun Sep 14 20:01:59 2008 From: o.pernet@REDACTED (Olivier Pernet) Date: Sun, 14 Sep 2008 19:01:59 +0100 Subject: [erlang-questions] String handling & regexp In-Reply-To: <65b2728e0809141034w7d744d68h5635679161a443a5@mail.gmail.com> References: <28276cf00809140004g2468f551x5a3dd46ce32baf60@mail.gmail.com> <6c2563b20809140142l848e92aj7f02e7d2134783ae@mail.gmail.com> <28276cf00809140952p68f8aefao463ddb0bd3311973@mail.gmail.com> <65b2728e0809141034w7d744d68h5635679161a443a5@mail.gmail.com> Message-ID: <28276cf00809141101s7e12aa07w45d33332c6f565f@mail.gmail.com> Neat! But... I'm running R12-4, and looking at the /usr/local/lib/erlang/releases/R12B/start.script I can see the re module. But it doesn't seem to be accessible from the erl prompt, even though application:which_applications() lists stdlib as started. I'm confused... Olivier Pernet We are the knights who say echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq'|dc On Sun, Sep 14, 2008 at 6:34 PM, Steve Vinoski wrote: > re is in R12B-4, the latest release, so it's already included. > > On 9/14/08, Olivier Pernet wrote: >> Thanks, re looks just about right. I was hoping for a standard library >> solution at first... How fast do the OTP libraries evolve ? Any chance >> of this being included someday ? >> >> Olivier >> >> On Sun, Sep 14, 2008 at 9:42 AM, Edwin Fine >> wrote: >> > Take a look at the re module. It has exactly what you need. >> > >> > On Sun, Sep 14, 2008 at 3:04 AM, Olivier Pernet wrote: >> >> >> >> Hi all, >> >> >> >> I'm new to Erlang, and trying not to reinvent the wheel to do some >> >> basic string processing. >> >> I'm reading a line that has a room name and a message, separated by >> >> one (or more) whitespace characters, and terminated by . >> >> Is there a way to tell regexp:split() to please give me back the >> >> groups matched by the regexp ? >> >> Here's my first attempt : >> >> regexp:split(" \t \t room \t hello world \r\n", "[ >> >> \t]*([^\s\t\r\n]+)[ \t]+([^\r\n]*)\r\n"). >> >> I'd like to get back something like ["room", "hello world "] with this >> >> example. >> >> >> >> Thanks for your help, >> >> Olivier Pernet >> >> >> >> We are the knights who say >> >> echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq'|dc >> >> _______________________________________________ >> >> erlang-questions mailing list >> >> erlang-questions@REDACTED >> >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> >> > >> > >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > From peterdanielsmith@REDACTED Sun Sep 14 20:30:55 2008 From: peterdanielsmith@REDACTED (Peter Smith) Date: Sun, 14 Sep 2008 11:30:55 -0700 Subject: [erlang-questions] port program -- how to start it and use it? Message-ID: I'm looking at the Erlang Interoperability Tutorial, and using it for my own little bit of interoperability -- and I Just Don't Get something: I can see the 'start' and 'foo' and 'bar' and 'stop' functions, and I even think I understand them. What I want to do is make a "unit test" that does a start, calls some 'foo' and checks the results, and then calls 'stop'. I've made a module that works with my own program (which was really quite simple -- certainly five times easier than Perl), and from the shell I can type in the commands 'start', 'foo', and 'stop' with no problem. But I can't make a unit test! When I try this: g() -> textstat:start(), textstat:enum(ascii), textstat:stop(). I just get an error as if from the 'enum' (my version of 'foo') that implies that the start hasn't actually finished starting yet. And in any event, won't the return from 'g' really be the results of the 'stop' when I really want it to be the result of the 'enum(ascii)'? Thanks, Peter -------------- next part -------------- An HTML attachment was scrubbed... URL: From lestat@REDACTED Sun Sep 14 20:46:59 2008 From: lestat@REDACTED (Tamas Nagy) Date: Sun, 14 Sep 2008 19:46:59 +0100 Subject: [erlang-questions] Mnesia tables go out of sync in one node? Message-ID: Hi Mnesia Gurus! In one of my projects running mnesia:restore/1 seemingly finishes perfectly. The data is usable after restoration. But if I restart the node some tables loose a lot of data without any warning. Because the problem is reproducible I did some further testing and it seems that the data which disappears is never written to the disc that's why it disappears after a node restart. Is there any know limitation how big file mnesia:restore/1 can handle? Mine is around 300 Mb. Did the memory and disc data got of sync for anybody else before (not just during restoration)? The system is using R12B1 and consist of only one node. I've checked the release notes for R12B2 - R12B4 and there is nothing about this. As a side note: Does anyone now which hash function is used for building index tables? We had to change our unique identifier because building the index table for 1000000 rows took 2 and a half hours. Regards, Tamas From o.pernet@REDACTED Sun Sep 14 21:14:22 2008 From: o.pernet@REDACTED (Olivier Pernet) Date: Sun, 14 Sep 2008 20:14:22 +0100 Subject: [erlang-questions] String handling & regexp In-Reply-To: <28276cf00809141101s7e12aa07w45d33332c6f565f@mail.gmail.com> References: <28276cf00809140004g2468f551x5a3dd46ce32baf60@mail.gmail.com> <6c2563b20809140142l848e92aj7f02e7d2134783ae@mail.gmail.com> <28276cf00809140952p68f8aefao463ddb0bd3311973@mail.gmail.com> <65b2728e0809141034w7d744d68h5635679161a443a5@mail.gmail.com> <28276cf00809141101s7e12aa07w45d33332c6f565f@mail.gmail.com> Message-ID: <28276cf00809141214u163412e8r1cb57f8919125da7@mail.gmail.com> I just read about the two different modes of the code server (embedded/interactive). This explains why I couldn't see a loaded re module. For the list archives: in interactive mode (the default), only some modules are pre-loaded, and the others are loaded on demand. So they won't show up in code:all_modules() or in the autocompletion until they're explicitely used. Olivier Pernet We are the knights who say echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq'|dc On Sun, Sep 14, 2008 at 7:01 PM, Olivier Pernet wrote: > Neat! But... > I'm running R12-4, and looking at the > /usr/local/lib/erlang/releases/R12B/start.script I can see the re > module. But it doesn't seem to be accessible from the erl prompt, even > though application:which_applications() lists stdlib as started. I'm > confused... > > Olivier Pernet > > We are the knights who say > echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq'|dc > > > > On Sun, Sep 14, 2008 at 6:34 PM, Steve Vinoski wrote: >> re is in R12B-4, the latest release, so it's already included. >> >> On 9/14/08, Olivier Pernet wrote: >>> Thanks, re looks just about right. I was hoping for a standard library >>> solution at first... How fast do the OTP libraries evolve ? Any chance >>> of this being included someday ? >>> >>> Olivier >>> >>> On Sun, Sep 14, 2008 at 9:42 AM, Edwin Fine >>> wrote: >>> > Take a look at the re module. It has exactly what you need. >>> > >>> > On Sun, Sep 14, 2008 at 3:04 AM, Olivier Pernet wrote: >>> >> >>> >> Hi all, >>> >> >>> >> I'm new to Erlang, and trying not to reinvent the wheel to do some >>> >> basic string processing. >>> >> I'm reading a line that has a room name and a message, separated by >>> >> one (or more) whitespace characters, and terminated by . >>> >> Is there a way to tell regexp:split() to please give me back the >>> >> groups matched by the regexp ? >>> >> Here's my first attempt : >>> >> regexp:split(" \t \t room \t hello world \r\n", "[ >>> >> \t]*([^\s\t\r\n]+)[ \t]+([^\r\n]*)\r\n"). >>> >> I'd like to get back something like ["room", "hello world "] with this >>> >> example. >>> >> >>> >> Thanks for your help, >>> >> Olivier Pernet >>> >> >>> >> We are the knights who say >>> >> echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq'|dc >>> >> _______________________________________________ >>> >> erlang-questions mailing list >>> >> erlang-questions@REDACTED >>> >> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >> >>> > >>> > >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >> > From erlang-questions_efine@REDACTED Sun Sep 14 21:18:51 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sun, 14 Sep 2008 15:18:51 -0400 Subject: [erlang-questions] String handling & regexp In-Reply-To: <28276cf00809141101s7e12aa07w45d33332c6f565f@mail.gmail.com> References: <28276cf00809140004g2468f551x5a3dd46ce32baf60@mail.gmail.com> <6c2563b20809140142l848e92aj7f02e7d2134783ae@mail.gmail.com> <28276cf00809140952p68f8aefao463ddb0bd3311973@mail.gmail.com> <65b2728e0809141034w7d744d68h5635679161a443a5@mail.gmail.com> <28276cf00809141101s7e12aa07w45d33332c6f565f@mail.gmail.com> Message-ID: <6c2563b20809141218k6ba4f0b4u856bf1f42ebd9528@mail.gmail.com> Well, it's in R12B-3, and here's part of my session: 14> {ok, RE} = re:compile("^ *(\\d{4})/(\\d{1,2})/(\\d{1,2}) *$"). {ok,{re_pattern,3,0, <<69,82,67,80,103,0,0,0,16,0,0,0,5,0,0,0,3,0,0,0,0,0,47, ...>>}} 15> re:run("2008/09/14", RE, [{capture, all_but_first, list}]). {match,["2008","09","14"]} All I did from the command line was type in erl, nothing else. HTH Edwin On Sun, Sep 14, 2008 at 2:01 PM, Olivier Pernet wrote: > Neat! But... > I'm running R12-4, and looking at the > /usr/local/lib/erlang/releases/R12B/start.script I can see the re > module. But it doesn't seem to be accessible from the erl prompt, even > though application:which_applications() lists stdlib as started. I'm > confused... > > Olivier Pernet > > We are the knights who say > echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq'|dc > > > > On Sun, Sep 14, 2008 at 6:34 PM, Steve Vinoski wrote: > > re is in R12B-4, the latest release, so it's already included. > > > > On 9/14/08, Olivier Pernet wrote: > >> Thanks, re looks just about right. I was hoping for a standard library > >> solution at first... How fast do the OTP libraries evolve ? Any chance > >> of this being included someday ? > >> > >> Olivier > >> > >> On Sun, Sep 14, 2008 at 9:42 AM, Edwin Fine > >> wrote: > >> > Take a look at the re module. It has exactly what you need. > >> > > >> > On Sun, Sep 14, 2008 at 3:04 AM, Olivier Pernet > wrote: > >> >> > >> >> Hi all, > >> >> > >> >> I'm new to Erlang, and trying not to reinvent the wheel to do some > >> >> basic string processing. > >> >> I'm reading a line that has a room name and a message, separated by > >> >> one (or more) whitespace characters, and terminated by . > >> >> Is there a way to tell regexp:split() to please give me back the > >> >> groups matched by the regexp ? > >> >> Here's my first attempt : > >> >> regexp:split(" \t \t room \t hello world \r\n", "[ > >> >> \t]*([^\s\t\r\n]+)[ \t]+([^\r\n]*)\r\n"). > >> >> I'd like to get back something like ["room", "hello world "] with > this > >> >> example. > >> >> > >> >> Thanks for your help, > >> >> Olivier Pernet > >> >> > >> >> We are the knights who say > >> >> echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq'|dc > >> >> _______________________________________________ > >> >> erlang-questions mailing list > >> >> erlang-questions@REDACTED > >> >> http://www.erlang.org/mailman/listinfo/erlang-questions > >> >> > >> > > >> > > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Sun Sep 14 21:19:49 2008 From: rvirding@REDACTED (Robert Virding) Date: Sun, 14 Sep 2008 21:19:49 +0200 Subject: [erlang-questions] Clojure Message-ID: <3dbc6d1c0809141219w3512a7c4h2b3eadff9724dd64@mail.gmail.com> I was flirting a bit with the ??? and looking at Clojure. While I am not that impressed (LFE is better :-)) there was some interesting stuff in the Rationale: Object Orientation is overrated + Born of simulation, now used for everything, even when inappropriate - Encouraged by Java/C# in all situations, due to their lack of (idiomatic) support for anything else + Mutable stateful objects are the new spaghetti code - Hard to understand, test, reason about - Concurrency disaster + Inheritance is *not* the only way to do polymorphism + "It is better to have 100 functions operate on one data structure than to have 10 functions operate on 10 data structures." - Alan J. Perlis + Clojure models its data structures as immutable objects represented by interfaces, and otherwise does not offer its own class system. + Many functions defined on few primary data structures (seq, map, vector, set). + Write Java in Java, consume and extend Java from Clojure. Couldn't have said it better myself, except for the Java bit and the end. Of course deciding to base it on the JVM has introduced some strange things for a functional language, for example the lack of (guaranteed) last-call optimisation means they have a recur form for recursion. This only works for recursion and not general jumping around. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From karol.skocik@REDACTED Sun Sep 14 23:26:53 2008 From: karol.skocik@REDACTED (karol skocik) Date: Sun, 14 Sep 2008 23:26:53 +0200 Subject: [erlang-questions] [BUG] in httpd doc & strange esslerrssl error Message-ID: Hi, first, there seems to be a bug in httpd documentation - option socket_type should be fixed to com_type, as that's what is checked in httpd_conf:config/1 (12B4). Seems like artefact from old Apache-like configuration. Now, having this configuration: [{bind_address, {0, 0, 0, 0}}, {port, 9234}, {server_name, "localhost"}, {server_root, "priv/log/"}, {document_root, "priv/htdocs/"}, {com_type, ssl}, {ssl_certificate_file, "priv/cert/mars.uk.crt"}, {ssl_certificate_key_file, "priv/cert/mars.uk.private.key"}, %% {ssl_verify_client, 2}, %% {ssl_verify_depth, 2}, {modules, [mod_log, mod_esi]}, {erl_script_alias, {"/secure", [webssl]}}, {erl_script_nocache, true}, {error_log, "httpd_ssl_error.log"}, {security_log, "httpd_ssl_security.log"}, {transfer_log, "httpd_ssl_transfer.log"}] httpd runs the service properly: =PROGRESS REPORT==== 14-Sep-2008::23:00:31 === supervisor: {local,httpd_acc_sup__0_0_0_0__9234} started: [{pid,<0.164.0>}, {name,{httpd_acceptor,{0,0,0,0},9234}}, {mfa, {httpd_acceptor,start_link, [<0.160.0>, {ssl, [{certfile, "/home/md/tactix/netskin/priv/cert/mars.uk.crt"}, {keyfile, "/home/md/tactix/netskin/priv/cert/mars.uk.private.key"}]}, {0,0,0,0}, 9234,httpd_conf__0_0_0_0__9234,15000]}}, {restart_type,permanent}, {shutdown,1000}, {child_type,worker}] but when I actually want to make a GET request, it fails with esslerrssl error: =ERROR REPORT==== 14-Sep-2008::23:00:42 === Accept error: esslerrssl =CRASH REPORT==== 14-Sep-2008::23:00:42 === crasher: pid: <0.164.0> registered_name: [] exception exit: {accept_failed,"Accept error: esslerrssl"} in function httpd_acceptor:accept_failed/2 in call from httpd_acceptor:acceptor_loop/5 initial call: httpd_acceptor:acceptor_init(<0.158.0>,<0.160.0>, {ssl, [{certfile, "/home/md/tactix/netskin/priv/cert/mars.uk.crt"}, {keyfile, "/home/md/tactix/netskin/priv/cert/mars.uk.private.key"}]}, {0,0,0,0}, 9234,httpd_conf__0_0_0_0__9234, 15000) ancestors: [httpd_acc_sup__0_0_0_0__9234, httpd_instance_sup__0_0_0_0__9234,httpd_sup,inets_sup, <0.59.0>] messages: [] links: [<0.165.0>,<0.158.0>] dictionary: [] trap_exit: false status: running heap_size: 987 stack_size: 23 reductions: 1760 neighbours: =SUPERVISOR REPORT==== 14-Sep-2008::23:00:42 === Supervisor: {local,httpd_acc_sup__0_0_0_0__9234} Context: child_terminated Reason: {accept_failed,"Accept error: esslerrssl"} Offender: [{pid,<0.164.0>}, {name,{httpd_acceptor,{0,0,0,0},9234}}, {mfa, {httpd_acceptor,start_link, [<0.160.0>, {ssl, [{certfile, "/home/md/tactix/netskin/priv/cert/mars.uk.crt"}, {keyfile, "/home/md/tactix/netskin/priv/cert/mars.uk.private.key"}]}, {0,0,0,0}, 9234,httpd_conf__0_0_0_0__9234,15000]}}, {restart_type,permanent}, {shutdown,1000}, {child_type,worker}] =PROGRESS REPORT==== 14-Sep-2008::23:00:42 === supervisor: {local,httpd_acc_sup__0_0_0_0__9234} started: [{pid,<0.187.0>}, {name,{httpd_acceptor,{0,0,0,0},9234}}, {mfa, {httpd_acceptor,start_link, [<0.160.0>, {ssl, [{certfile, "/home/md/tactix/netskin/priv/cert/mars.uk.crt"}, {keyfile, "/home/md/tactix/netskin/priv/cert/mars.uk.private.key"}]}, {0,0,0,0}, 9234,httpd_conf__0_0_0_0__9234,15000]}}, {restart_type,permanent}, {shutdown,1000}, {child_type,worker}] Do I understand correctly that this kind of error is directly from OpenSSL stack? Any ideas how to debug that? Or is there something wrong with the configuration? Thanks, Karol From thomaswhitcomb@REDACTED Mon Sep 15 02:58:24 2008 From: thomaswhitcomb@REDACTED (Tom Whitcomb) Date: Sun, 14 Sep 2008 17:58:24 -0700 (PDT) Subject: [erlang-questions] re-attaching to a runtime instance Message-ID: <919639.25770.qm@web42107.mail.mud.yahoo.com> I am using the "-detach" option with "erl". Works great but I would like to be able to reconnect an Erlang shell to the existing runtime instance. Is there a way to do it? Tom From vances@REDACTED Mon Sep 15 04:30:44 2008 From: vances@REDACTED (Vance Shipley) Date: Sun, 14 Sep 2008 22:30:44 -0400 Subject: [erlang-questions] re-attaching to a runtime instance In-Reply-To: <919639.25770.qm@web42107.mail.mud.yahoo.com> References: <919639.25770.qm@web42107.mail.mud.yahoo.com> Message-ID: <20080915023043.GD61536@h216-235-12-173.host.egate.net> Tom, You can do that a number of ways. It sounds like what you should really be doing is running as an embedded system: http://www.erlang.org/doc/embedded/part_frame.html In that scenario you have the emulator started by run_erl and you can reattach using to_erl: http://www.erlang.org/doc/man/run_erl.html You can also just start another erlang shell and use shell break mode (Ctrl-G) to start a remote shell on the detached node. This assumes you started both as distributed systems. And lastly you can start an ssh server on the first node and use ssh to connect to it. http://www.erlang.org/doc/apps/ssh/ref_man_frame.html -Vance On Sun, Sep 14, 2008 at 05:58:24PM -0700, Tom Whitcomb wrote: } I am using the "-detach" option with "erl". Works great but I would like to be able to reconnect an Erlang shell to the existing runtime instance. Is there a way to do it? From jay@REDACTED Mon Sep 15 05:01:54 2008 From: jay@REDACTED (Jay Nelson) Date: Sun, 14 Sep 2008 20:01:54 -0700 Subject: [erlang-questions] Erlounge in Los Angeles Message-ID: Luke Gorrie, the itinerant programmer, is temporarily based in Los Angeles. In his honor, we will finally set up the erlounge that we've been planning for months. I am expecting the Dukes of Erl and a few others working at startups around town to attend. Where: downtown LA near a subway stop or at a Korean BarBQ in Korea town. When: Anytime in the next 4 weeks, except the first week of October Contact me to vote for location and time. I will post the time when I have a few votes. jay From ok@REDACTED Mon Sep 15 05:51:33 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 15 Sep 2008 15:51:33 +1200 Subject: [erlang-questions] String handling & regexp In-Reply-To: <21325_1221376606_m8E7Gi3p013713_28276cf00809140004g2468f551x5a3dd46ce32baf60@mail.gmail.com> References: <21325_1221376606_m8E7Gi3p013713_28276cf00809140004g2468f551x5a3dd46ce32baf60@mail.gmail.com> Message-ID: <43901187-F50C-4EF8-A2BA-BCC33D0D105F@cs.otago.ac.nz> On 14 Sep 2008, at 7:04 pm, Olivier Pernet wrote: Brian Marick has some lovely stickers; he was kind enough to send me a couple. I have "to be less wrong than yesterday" on my door. The one I want now is the one that reads An example would be useful about now. > I'm reading a line that has a room name and a message, separated by > one (or more) whitespace characters, and terminated by . I assume that this means ::= * + * \r\n where may contain white space but not start or end with it, and may not contain white space. % The following code assumes that white space characters are % precisely those with codes 0..32 inclusive. This is right % for ASCII and Latin1 &c, but wrong for Unicode. This was % done to concentrate on the main issues. drop_while_white_space([C|Cs]) when C =< 32 -> drop_while_white_space(Cs); drop_while_white_space(Cs) -> Cs. take_until_white_space([C|Cs]) when C > 32 -> [C|take_until_white_space(Cs)]; take_until_white_space(_) -> []. drop_until_white_space([C|Cs]) when C > 32 -> drop_until_white_space(Cs); drop_until_white_space(Cs) -> Cs. Now put them together. room_and_message_from_line(Line) -> Line1 = drop_while_white_space(Line), Room = take_until_white_space(Line1), Line2 = drop_until_white_space(Line1), Message = lists:reverse(drop_while_white_space( lists:reverse(drop_while_white_space( Line2)))), {Room, Message}. I think that for *fixed* patterns it is often better to program at this level than to use regular expressions, which really shine as run-time data. For example, in the pattern "[ > \t]*([^\s\t\r\n]+)[ \t]+([^\r\n]*)\r\n"). ([^\r\n]*)\r\n does not mean what your *words* would require it to mean. According to your *words*, if the input was "foo bar\rugh\nzoo\r\n" the embedded \r and \n should NOT end the message (only the sequence \r\n was said to do that). Your pattern will fail on that string. It was easier for me to write the Erlang code above than to fix your regexp. From bengt.kleberg@REDACTED Mon Sep 15 07:57:42 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 15 Sep 2008 07:57:42 +0200 Subject: [erlang-questions] port program -- how to start it and use it? In-Reply-To: References: Message-ID: <1221458262.5912.2.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Greetings, Your last problem (returning the right thing) is the simplest: Result = textstat:enum(ascii), textstat:stop(), Result. As for your first problem, with things not having started yet, you have to wait a while. Either until they have started (loop with a test if things have started) or just wait a while (timer:sleep( 1000 )). bengt On Sun, 2008-09-14 at 11:30 -0700, Peter Smith wrote: > I'm looking at the Erlang Interoperability Tutorial, and using it for > my own little bit of interoperability -- and I Just Don't Get > something: > > > I can see the 'start' and 'foo' and 'bar' and 'stop' functions, and I > even think I understand them. What I want to do is make a "unit test" > that does a start, calls some 'foo' and checks the results, and then > calls 'stop'. I've made a module that works with my own program > (which was really quite simple -- certainly five times easier than > Perl), and from the shell I can type in the commands 'start', 'foo', > and 'stop' with no problem. > > > But I can't make a unit test! When I try this: > > > g() -> > textstat:start(), > textstat:enum(ascii), > textstat:stop(). > > > I just get an error as if from the 'enum' (my version of 'foo') that > implies that the start hasn't actually finished starting yet. And in > any event, won't the return from 'g' really be the results of the > 'stop' when I really want it to be the result of the 'enum(ascii)'? > > > Thanks, > Peter > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From bengt.kleberg@REDACTED Mon Sep 15 08:17:20 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 15 Sep 2008 08:17:20 +0200 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <24bcf1860809121111m30568174s95e07fb80cc55da4@mail.gmail.com> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <24bcf1860809121111m30568174s95e07fb80cc55da4@mail.gmail.com> Message-ID: <1221459440.5912.5.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Greetings, Sometimes it is possible to ask for new cards. bengt On Fri, 2008-09-12 at 14:11 -0400, john s wolter wrote: > Joel, > > > Like any technical project you are dealt a hand and you have to play > it. > > On Fri, Sep 12, 2008 at 9:52 AM, Joel Reymont > wrote: > I sell a poker server written in Erlang. It's supposed to be > super- > robust and super-scalable. I'm about to move to the next level > by > adding the missing features, e.g. tournaments and a Flash > client. > > I appreciate everything that the Erlang/OTP is doing but I > thought I > would vent a few of my recent frustrations with Erlang. I'm in > a good > mood after spending a day with OCaml and I have calmed down. > Still, > prepare yourself for a long rant ahead! > > My development workstation is a Mac Pro 2x2.8Ghz Quad Xeon, > 12Gb of > memory, one 250Gb and two more drives 500Gb each, all 7200RPM > SATA. I > use R12B3, SMP and kernel poll, i.e. > > Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:8] > [async- > threads:0] [kernel-poll:true] > > My overwhelming frustration is the opacity of a running Erlang > system. > There are no decent tools for peering inside. No usable ones > whatsoever! > > With any other language you can profile, make changes, > evaluate > performance and make a judgement but not with Erlang. > > I first wrote OpenPoker using OTP everywhere. My players, > games, pots, > limits, hands, decks, etc. were all gen_server processes. I > used > Mnesia transactions everywhere and I used them often. > > Then I discovered that I cannot scale past 2-3k concurrent > players > under heavy use. > > I have a test harness that launches bots which connect to the > server > and play by the script. The bots don't wait before replying to > bet > requests and so launching a few thousand bots heavily loads > the server. > > I don't want just a few thousand concurrent bots, though! I > want at > least 10k on a single VM and hundreds of thousands on a > cluster, so I > set to optimize my poker server. > > The Erlang Efficiency Guide recommends fprof as the tool. I > ran fprof > on my test harness and discovered that the result set cannot > be > processed in my 12Gb of memory. I made this discovery after > leaving > fprof running for a couple of days and realized this because > the fprof > data files were approaching 100Gb and my machine became > unusable due > to heavy swapping. > > fprof usets ets tables to analyze the trace results and ets > tables > must fit in memory. > > I shortened my test run and was able to see the output of the > fprof > trace analysis. To say that it's dense would be an > understatement! I > realize that dumping out tuples is easy but aren't computers > suppose > to help us humans? > > The final output from fprof is still too raw for me to > analyze. > There's absolutely, positively, definitely no way to get a > picture of > a running system by reading through it. I understand that I > can infer > from the analysis that certain functions take a lot of time > but what > if there are none? > > The bulk of the time in my system was taken by various OTP > functions > and processes, Mnesia and unknown functions. All I could infer > from it > is that perhaps I have too many processes. > > Another thing that I inferred is that the normal method of > writing > gen_server code doesn't work for profiling. > > I had to rewrite the gen_server clauses to immediately > dispatch to > functions, e.g. > > handle_cast('LOGOUT', Data) -> > handle_cast_logout(Data); > > handle_cast('DISCONNECT', Data) -> > handle_cast_disconnect(Data); > > otherwise all the clauses of a gen_server are squashed > together, > regardless of the message pattern. I don't know if there's a > better > way to tackle this. > > Next, I rewrote most of my gen_servers as data structures, > e.g. pot, > limit, deck, etc. A deck of cards can take a message to draw a > card > but the message can just as well be a function call. The deck > structure will need to be modified regardless and the tuple > will be > duplicated anyway. There didn't seem to be any advantage in > using a > process here, much less a gen_server. > > Next I carefully went trough my Mnesia schema and split some > tables > into smaller tables. I made sure that only the absolutely > necessary > tables were disk-based. I wish I could run without updating > Mnesia > tables during a game but this is impossible since player > balances and > status need to be updated when players join or leave a game, > as well > as when a game finishes. > > All my hard work paid off and I was able to get close to 10K > players, > with kernel poll enabled, of course. Then I ran out of ETS > tables. > > I don't create ETS tables on the fly but, apparently, Mnesia > does. For > every transaction!!! > > This prompted me to go through the server again and use > dirty_read, > dirty_write wherever possible. I also placed balanced in two > separate > "counter" tables, integers to be divided by 10000 to get 4 > decimal > points of precision. This is so that I could use > dirty_update_counter > instead of a regular read, bump, write pattern. > > My frustration kept increasing but I gained more concurrent > players. I > can now safely run up to 8K bots before timeouts start to > appear. > > These are gen_server call timeouts when requests for game > information > take longer than the default 5 seconds. I have an average of 5 > players > per game so this is not because a large number of processes > are trying > to access the game. > > I suppose this is a reflection of the load on the system, > although CPU > usage never goes past 300% which tells me that no more than 3 > cores > are used by Erlang. > > The straw that broke my back was when stopping a bot's > matching player > gen_server by returning {stop, ... } started causing my > observer > process to receive tcp_close and exit. I could repeat this > like > clockwork. Only spawning a separate process to send player a > stop > message would fix this. > > Then I changed the way I represent cards started seeing this > behavior > again, in just one of my tests. What do cards have to do with > tcp_close? I don't know and dbg tracer is my best friend! What > I know > is what git tells me and git says cards were the only > difference. > > Anyway, I don't think I have fully recovered yet. I may need a > weekend > just to regain my sanity. I will try to spread the load among > several > VMs but my hunch is that my distributed 100k players target is > far far > away. I'll may have to keep flying blind, with only traces and > printouts to my rescue. > > Thanks for listening, Joel > > -- > wagerlabs.com > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -- > John S. Wolter President > Wolter Works > Mailto:johnswolter@REDACTED > Desk 1-734-665-1263 > Cell: 1-734-904-8433 > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From tobias.lindahl@REDACTED Mon Sep 15 09:26:07 2008 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Mon, 15 Sep 2008 09:26:07 +0200 Subject: [erlang-questions] encapsulating types and dialyzer In-Reply-To: <200809130208.04813.als@iinet.net.au> References: <200809120145.30587.als@iinet.net.au> <48C94DB1.1040202@cs.ntua.gr> <48CA16A9.1050202@it.uu.se> <200809130208.04813.als@iinet.net.au> Message-ID: <48CE0E0F.8080904@kreditor.se> Anthony Shipman wrote: > On Fri, 12 Sep 2008 05:13:45 pm Tobias Lindahl wrote: >>> PS. I should point out that the language of types and -spec declarations >>> is currently an EEP. Officially, it is not part of Erlang yet. > > Why do some of the types in the Erlang source have extra parentheses around > them? > -type(digraph() :: any()). > Is there any use for this or is it just an ornament? This used to be the only way to declare them. The declaration without parenthesis is brand new. > What could be useful to include is a "new type" feature like in Ada or > Haskell. E.g. > > -type new length() :: float(). > -type new area() :: float(). > > Then although they are both implemented as floats you can't pass one as > another without an error or warning. In Erlang the types are nothing but aliases as there are no type constructors apart from the primitive ones. In runtime, there are no length() and area(), but only float(). -type length() :: float(). -type area() :: float(). works just fine. You might want to have a look at http://user.it.uu.se/~tobiasl/publications/succ_types.pdf for more description of what is happening under the hood. We are looking at having opaque types that are not allowed to be inspected which would be more close to what you seem to expect from the type declarations, but the nature of Erlang (dynamic typing, hot code loading, etc) makes it hard to do proper type checking without changing the language quite extensively. Instead, we have chosen to loosen up the type inference/checking quite a bit to better suit Erlang's programming idiom. Tobias > > The change to the type checking algorithm might be quite small. When comparing > two types, if they are both new then the names must match as well as the > structure, otherwise only do structural matching. From kode@REDACTED Mon Sep 15 10:49:31 2008 From: kode@REDACTED (Bhasker Kode) Date: Mon, 15 Sep 2008 14:19:31 +0530 Subject: [erlang-questions] My frustration with Erlang Message-ID: <3935b63b0809150149w7919c50as811cf89adfd279ef@mail.gmail.com> Hey Joel, >4 Mnesia overloaded error reports > ** WARNING ** Mnesia is overloaded: {dump_log,write_threshold} > e.g. the reply takes longer than 5 seconds. The game bombs out at this point. > I could increase the timeout or make the call just wait forever. I don't want to do this, though, as this timeout serves as a performance indicator. I've had the same exact same two reports causing all kinds of unexpected behaviour. While setting infinity with gen_server call's worked with me, i think setting a higher timeout value (than the default 5 seconds ) is your best best, and thats what worked with us. We had some python<->erlang logic happening in one of the gen_server calls, and used to consistently timeout until i came to know of the 5 second default value. IMHO , perhaps you can also move the 'performance analysis' to another part of the poker server, rather than mixign it with the decks, poker logic. In that case , having gen_server calls as infinite may not seem a bad idea. Regarding the mnesia dump_threshold calls, we did two things : #1 If latency is'nt an issue take a whole bunch of writes , write them to a file, then on a trial-and-error basis configure that after every N entries, do a mnesia:load_textfile(Dump). This way all those N entries get written in one transaction. One thing to look at though is that at the time of loading, permissions to access mnesia . In our case since we access mnesia only through Yaws , so no rwx permission errors throw up , and also made sure that mnesia already knows where to distribute the newly loaded data ( in our case a 4-node cluster currently). If latency is critical, then why do you need mnesia in the first place, just message pass (but i suppose that you still need to archive them even if it behaves like a messaging system) #2 creating user specific tables. i know most normalization/db guru's out there might raise an eyebrow . As much as we're used to pattern matching all rows from a table where user matches X, we just created seperate tables for each user, and know exactly to look. Now we can take maybe a much higher factor of the load into a table , without even considering Fragmentation. btw, Thanks for pointing out the default max ets tables, will have to look into that. jut FYI, the third biggest error we used to get on our logs was the {error,open} message "yaws failed to bind socket error", and we spent a long time figuring out if it was related to the timeout. turned out that yaws.conf has a little property that sets "Fail completely when yaws fails to bind socket = true " by default. Switched it to false, and that's the last time we saw those error,open reports 8 ) ~ Keep Clicking, Bhasker V Kode | bosky101 hover.in From lestat@REDACTED Mon Sep 15 12:35:17 2008 From: lestat@REDACTED (Tamas Nagy) Date: Mon, 15 Sep 2008 11:35:17 +0100 Subject: [erlang-questions] Mnesia tables go out of sync in one node? In-Reply-To: References: Message-ID: <687CA6B6-2D46-4E1D-BBEC-72BF679D371B@elte.hu> Hi Everyone! If this is really an mnesia bug this a major flow, because this breaks atomicity. Could anyone advise on how to progress where to look? Regards, Tamas On 14 Sep 2008, at 19:46, Tamas Nagy wrote: > Hi Mnesia Gurus! > > In one of my projects running mnesia:restore/1 seemingly finishes > perfectly. > The data is usable after restoration. But if I restart the node some > tables loose a lot of data without any warning. > > Because the problem is reproducible I did some further testing and it > seems that the data which disappears is never written to the disc > that's why it disappears after a node restart. > > Is there any know limitation how big file mnesia:restore/1 can handle? > Mine is around 300 Mb. > Did the memory and disc data got of sync for anybody else before (not > just during restoration)? > > The system is using R12B1 and consist of only one node. I've checked > the release notes for R12B2 - R12B4 and there is nothing about this. > > As a side note: Does anyone now which hash function is used for > building index tables? We had to change our unique identifier because > building the index table for 1000000 rows took 2 and a half hours. > > Regards, > Tamas > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From valentin@REDACTED Sun Sep 14 09:21:41 2008 From: valentin@REDACTED (Valentin Micic) Date: Sun, 14 Sep 2008 09:21:41 +0200 Subject: [erlang-questions] My frustration with Erlang References: <762B727D-125A-4739-B599-4114C0460869@gmail.com><48CA8403.3070907@alertlogic.net><1DFCF703-3AD6-4D23-B3C1-F29D79B76F10@gmail.com><97619b170809131236i5b313d1fu293f249bc6b71913@mail.gmail.com><3274A42C-8E91-42DE-81F5-004BB2F3356B@gmail.com><5846A09C-2525-4CD3-A282-F28FB88C7750@gmail.com><6c2563b20809131356i73bd5a71ra5f0ef8a42159f4@mail.gmail.com> <7BDEFDC8-9159-423A-804D-A125DD477F35@scaldeferri.com> Message-ID: <009501c9163a$96b50610$6401a8c0@moneymaker2> I havent read the whole correspndance (it seems to be going on for a way too long), but like to add my 2c worth... While SMP (+S1) approach may solve some problems, it defeats the purpose of having a multi-core machine. Please note that multi-core machines have lower clock speeds, thus should run generally slower per given CPU core. IMHO, if +S 1 solves your problem, maybe you should revisit your code -- I think that it is wrong to expect that the same code would work better on SMP just because you had such expectations. For example, it is known fact that ETS works slower in SMP environment. Also, one should not forget to use +A in addition to +S -- although you do not have any disk I/O, I think this parameter is relevant for PORT scheduling, therefore improving performance of your I/O. V. ----- Original Message ----- From: "Kevin Scaldeferri" To: "Edwin Fine" Cc: "erlang-questions Questions" Sent: Sunday, September 14, 2008 12:07 AM Subject: Re: [erlang-questions] My frustration with Erlang > > On Sep 13, 2008, at 1:56 PM, Edwin Fine wrote: > >> You'd probably have to partition the load to round-robin across the >> individual VMs, possibly using some front-end load-balancing >> hardware. This is why I keep harping on this: some time ago I put >> the system I am working on under heavy load to test the maximum >> possible throughput. There was no appreciable disk I/O. The kicker >> is that I did not see an even distribution of load across the 4 >> cores of my box. In fact, it looked as if one or maybe two cores >> were being used at 100% and the rest were idle. When I re-ran the >> test on a whim, using only 1 non-SMP (+S 1) node, I actually got >> better performance. >> >> This seemed counter-intuitive and against the "Erlang SMP scales >> linearly for CPU-intensive loads" idea. I have not done a lot of >> investigation into this because I have other fish to fry right now, >> but the folks over at LShift (RabbitMQ) - assuming I did not >> misunderstand them - wrote that they had seen similar behavior when >> running clustered Rabbit nodes (i.e. better performance from N >> single-CPU nodes than N +S N nodes). However, they, like me, are not >> ready to come out and state this bluntly as a fact because (I >> believe) they feel not enough investigation has been done to make >> this a conclusive case. > > I've also been seeing similar behavior trying to parallelize the > alioth shootout code, fwiw. I'd also say it's premature to draw any > concrete conclusions, but another anecdotal point. > > (Also, on the particular OS & hardware the benchmarks run on, the > total CPU usage nearly doubles for the parallel implementations. On > my 2-core mac, though, I see no more than a 10% increase in total CPU > usage, and a near 100% improvement in the wall-time, as one should > expect on the embarrassingly parallel problems. Dunno, if this is > related to the OS, the chip (Core 2 Duo vs Core 2 Quad), HiPE, or what.) > > > -kevin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From raimo+erlang-questions@REDACTED Mon Sep 15 14:11:16 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 15 Sep 2008 14:11:16 +0200 Subject: [erlang-questions] calendar:local_time_to_universal_time_dst/1 - what this is for? In-Reply-To: <20080914022020.GA8536@k2r.org> References: <20080914022020.GA8536@k2r.org> Message-ID: <20080915121116.GA17553@erix.ericsson.se> On Sun, Sep 14, 2008 at 11:20:20AM +0900, Kenji Rikitake wrote: > I found a bug when I was playing around with mochiweb on R12B4. It's > not mochiweb's bug, but rather the Erlang/OTP time function bug. See > > http://www.erlang.org/pipermail/erlang-bugs/2008-September/000994.html > > if you don't want to read ahead. (Summary: the "universaltime" in > Erlang/OTP was not really the one if the wall clock is aware of leap > seconds.) > > I am writing this to ask a set of question about the following issue I > was thinking last night. > > When I tried to perform "gmake test" on one of my systems (yeah, it's > FreeBSD, so GNU make is gmake), I faced a condition (in > mochiweb_cookies:test/0) that httpd_util:rfc1123_date/1 returned a [] > (null list). I further tracked it down and found > calendar:local_time_to_universal_time_dst/1 (quoted below) was the > source of the null list. (I found that > erlang:universaltime_to_localtime/1 and the corresponding C function > univ_to_local() in erts/emulator/beam/erl_time_sup.c caused the problem, > by NOT properly handling leap-second correction.) > > I was wondering what this function > calendar:local_time_to_universal_time_dst/1 was for and how this > conversion function to be used. I have the following questions: It is rather clear in the manual: http://www.erlang.org/doc/man/calendar.html To flesh out,... When you switch from normal time to daylight saving time everyone skips an hour. Usually (always?) the hour 02.00-03.00, so instead of 02.00 the local time becomes 03.00. One hour disappears in the spring. Everyone rises from bed one hour earlier during the summer since it is already sunlight then and the sun sets later, making the usable day longer, especially the month after switch to DST (Daylight Saving Time) and the month before switch from DST, for us closer to an earth pole. So if you try to find which time 02.17 March 30 2008 CET corresponds in UTC you will notice that that time never happened. The whole hour was skipped. Local time. In the autumn when you go from DST you repeat the hour 02.00 to 03.00. So 02.34 Oct 26 2008 CET will happen twice, and if you want to convert it to UTC you will have to know which one it is. > > * Why you need to double-check the whole time difference? I do not understand this questions. > > * In what situation should the results of this function really matter? When your program needs to know the correct UTC time you try to calculate from a local time. (?) > > * What kind of action should an application program take if this > function returns a list of two possible UTC values for one DST > localtime value? > To correctly calculate the UTC it must know if the point in time is the one before the switch from DST or the one after. > Maybe I'm perplexed just because I've never tried hard to code DST > handling programs (Japan has no DST since 1950s). Lucky you. > > BTW I'd like to say thanks to mochiweb developers for making me aware of > these rather non-trivial issues. > > Regards, > Kenji Rikitake > > %% quoted from lib/stdlib-1.15.4/src/calendar.erl > %% begin > > -spec local_time_to_universal_time_dst(t_datetime1970()) -> [t_datetime1970()]. > local_time_to_universal_time_dst(DateTime) -> > UtDst = erlang:localtime_to_universaltime(DateTime, true), > Ut = erlang:localtime_to_universaltime(DateTime, false), > %% Reverse check the universal times > LtDst = erlang:universaltime_to_localtime(UtDst), > Lt = erlang:universaltime_to_localtime(Ut), > %% Return the valid universal times > case {LtDst,Lt} of > {DateTime,DateTime} when UtDst =/= Ut -> > [UtDst,Ut]; > {DateTime,_} -> > [UtDst]; > {_,DateTime} -> > [Ut]; > {_,_} -> > [] > end. > > %% end > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From valentin@REDACTED Sun Sep 14 17:14:50 2008 From: valentin@REDACTED (Valentin Micic) Date: Sun, 14 Sep 2008 17:14:50 +0200 Subject: [erlang-questions] My frustration with Erlang References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <48CA8403.3070907@alertlogic.net> <1DFCF703-3AD6-4D23-B3C1-F29D79B76F10@gmail.com> <97619b170809131236i5b313d1fu293f249bc6b71913@mail.gmail.com> <3274A42C-8E91-42DE-81F5-004BB2F3356B@gmail.com> <5846A09C-2525-4CD3-A282-F28FB88C7750@gmail.com> <6c2563b20809131356i73bd5a71ra5f0ef8a42159f4@mail.gmail.com> <7BDEFDC8-9159-423A-804D-A125DD477F35@scaldeferri.com> <009501c9163a$96b50610$6401a8c0@moneymaker2> <6c2563b20809140139s5fec4a5eie81af90409249191@mail.gmail.com> Message-ID: <00ab01c9167c$a4bff890$6401a8c0@moneymaker2> > Long before threading models came into vogue, multiple processes > were taking advantage of multi-CPU systems simply by letting > the OS scheduler choose which CPU on which to run the next > runnable process. Well... a single process would never exceed a capacity of a single CPU. Therefore, if you had, say, 4 CPUs, one process shall never exceed more than 25% of the overall system capacity. In a case of SOLARIS, this may be true even if you create multiple threads (e.g. if thread were created as bound threads, they will still be scheduled using the same light-weight process, but that is another matter alltogether). > Since Erlang threads are "green" threads, they don't individually use > the threading model of the underlying operating system anyway. > Each VM, other than for I/O operations on files (controleld by +A, I believe), > uses AFAIK one O/S thread per scheduler. So +S 8 will use 8 O/S threads. > When you have 8 threads sharing something (which they will when running SMP), > there is a risk of contention slowing things down. That is why I'm saying that one should look at the code, and ensure that code is written to take advantage of SMP environment. If you going to use SMP machine and then use it as a "normal" multi-CPU machine, you would be better off staying with a multi-CPU machine which has a faster clock. In my experience so far, one should stay clear from servers that are doing a lot of processing per request -- clock is slower, clearly indicating that server will be slower, and yet we have more schedulers resulting in more requests being generated. One may experiment with different priorities and change server to higher priority, which is, I suspect, what one should do for the code that was written for non-SMP machines. My preference, however, would be to write another kind of server, that would spawn a new process for each request, which will in turn report back to the caller bypassing the server. V. -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimo+erlang-questions@REDACTED Mon Sep 15 14:30:08 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 15 Sep 2008 14:30:08 +0200 Subject: [erlang-questions] possible fprof bug? In-Reply-To: <2A61C744-163E-4E4C-9767-9A82F4D964A8@gmail.com> References: <2A61C744-163E-4E4C-9767-9A82F4D964A8@gmail.com> Message-ID: <20080915123008.GB17553@erix.ericsson.se> On Sun, Sep 14, 2008 at 10:34:31AM +0100, Joel Reymont wrote: > End of erroneous trace! > {error, > {incorrect_trace_data,fprof,1689, > [{trace_ts,<5963.5490.0>,send_to_non_existing_process, > {find_server,none}, > <5963.4014.0>, > {1221,355910,508354}}]}} > > fprof:profile/0 stops here. I would love it to continue. It seems someone (at OTP) has added a trace message to the 'send' trace flag, and not thought of fprof. Try this diff (not even compiled...): *** /clearcase/otp/erts/lib/tools/src/fprof.erl 2008-09-01 14:51:36.000000000 +0200 --- tmp/fprof.erl 2008-09-15 14:26:17.105958000 +0200 *************** *** 1671,1677 **** TS; %% %% send ! trace_handler({trace_ts, Pid, send, _OtherPid, _Msg, TS} = Trace, _Table, _, Dump) -> dump_stack(Dump, get(Pid), Trace), TS; --- 1671,1682 ---- TS; %% %% send ! trace_handler({trace_ts, Pid, send_to_non_existing_process, ! _Msg, _OtherPid, TS} = Trace, ! _Table, _, Dump) -> ! dump_stack(Dump, get(Pid), Trace), ! TS; ! trace_handler({trace_ts, Pid, send, _Msg, _OtherPid, TS} = Trace, _Table, _, Dump) -> dump_stack(Dump, get(Pid), Trace), TS; > > -- > wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From raimo+erlang-questions@REDACTED Mon Sep 15 14:33:07 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 15 Sep 2008 14:33:07 +0200 Subject: [erlang-questions] erlang:trace and bad argument In-Reply-To: <95C35166-9BBD-4C4A-B709-9E3666697B09@gmail.com> References: <95C35166-9BBD-4C4A-B709-9E3666697B09@gmail.com> Message-ID: <20080915123307.GC17553@erix.ericsson.se> On Sun, Sep 14, 2008 at 11:33:06AM +0100, Joel Reymont wrote: > What am I doing wrong here? > > 20> erlang:trace(self(), false, [send]). > 1 > 21> erlang:trace(self(), true, [send]). > ** exception error: bad argument > in function erlang:trace/3 > called as erlang:trace(<0.93.0>,true,[send]) > 22> erlang:trace(self(), true, [call]). > ** exception error: bad argument > in function erlang:trace/3 > called as erlang:trace(<0.99.0>,true,[call]) I think it is that you do not give a {tracer,Tracer} flag, and the default is {tracer,self()}, which is not allowed for arg1 = self(). You can not trace yourself. > > Thanks, Joel > > -- > wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From kenji.rikitake@REDACTED Mon Sep 15 15:08:27 2008 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Mon, 15 Sep 2008 22:08:27 +0900 Subject: [erlang-questions] calendar:local_time_to_universal_time_dst/1 - what this is for? In-Reply-To: <20080915121116.GA17553@erix.ericsson.se> References: <20080914022020.GA8536@k2r.org> <20080915121116.GA17553@erix.ericsson.se> Message-ID: <20080915130827.GA36451@k2r.org> Raimo and all: In the message <20080915121116.GA17553@REDACTED> dated Mon, Sep 15, 2008 at 02:10:53PM +0200, Raimo Niskanen writes: > It is rather clear in the manual: > http://www.erlang.org/doc/man/calendar.html Thanks Raimo for your time. I should have read the erl_time_sup.c more thoroughly. So the following four cases may actually happen for calendar:local_time_to_universal_time_dst/1 results: 1) UTC UtDst is local non-DST DateTime (when in non-DST) returning [DateTimeUTC] ([UtDst]) 2) UTC Ut is local DST DateTime (when in DST) returning [DateTimeUTC] ([Ut]) 3) UTC UtDst is local DST DateTime or UTC Ut is local non-DST DateTime (when switching from DST to non-DST) returning [DstDateTimeUTC, DateTimeUTC] ([UtDst, Ut]) 4) no UTC mapping for a local DST DateTime (when switching from non-DST to DST) returning [] I was only thinking about mapping from UTC to a local time, so I was confused. > > * Why you need to double-check the whole time difference? > > I do not understand this questions. I was trying to ask why you needed to convert from the local time to UTC and to convert back from UTC to the local time. I now understand it was to find out the four possible matching cases of non-DST and DST. BTW > > Maybe I'm perplexed just because I've never tried hard to code DST > > handling programs (Japan has no DST since 1950s). > > Lucky you. Japan was actually implementing "summer time" during 1948 to 1952, but the older people (I was born in 1960s) told me they had to work one hour longer and that was it :-p And I should confess I once lived in Colorado, USA so I should have known what the DST was. My apologies. Regards, Kenji Rikitake From kenji.rikitake@REDACTED Mon Sep 15 15:16:18 2008 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Mon, 15 Sep 2008 22:16:18 +0900 Subject: [erlang-questions] calendar:local_time_to_universal_time_dst/1 - what this is for? In-Reply-To: <20080915130827.GA36451@k2r.org> References: <20080914022020.GA8536@k2r.org> <20080915121116.GA17553@erix.ericsson.se> <20080915130827.GA36451@k2r.org> Message-ID: <20080915131618.GA37553@k2r.org> In the message <20080915130827.GA36451@REDACTED> dated Mon, Sep 15, 2008 at 10:08:04PM +0900, Kenji Rikitake writes: > So the following four cases may actually happen for > calendar:local_time_to_universal_time_dst/1 results: My mistakes. The correct one: 1) UTC Ut is local DST DateTime (when in DST) returning [DateTimeUTC] ([UtDst]) 2) UTC UtDst is local non-DST DateTime (when in non-DST) returning [DateTimeUTC] ([Ut]) > 3) UTC UtDst is local DST DateTime > or > UTC Ut is local non-DST DateTime > (when switching from DST to non-DST) > returning [DstDateTimeUTC, DateTimeUTC] ([UtDst, Ut]) > > 4) no UTC mapping for a local DST DateTime > (when switching from non-DST to DST) > returning [] Regards, Kenji Rikitake From ttmrichter@REDACTED Mon Sep 15 15:48:14 2008 From: ttmrichter@REDACTED (Michael T. Richter) Date: Mon, 15 Sep 2008 21:48:14 +0800 Subject: [erlang-questions] Error building R12B-4 on Ubuntu 8.04 Message-ID: <1221486494.24037.5.camel@isolde> === Entering application hipe make[3]: Entering directory `/home/michael/Development/junk/lib/hipe/rtl' erlc -W +debug_info +warn_obsolete_guard +inline -o../ebin hipe_rtl_arch.erl /home/michael/Development/junk/lib/hipe/rtl/../ebin/hipe_rtl_arch.bea#: error writing file make[3]: *** [../ebin/hipe_rtl_arch.beam] Error 1 make[3]: Leaving directory `/home/michael/Development/junk/lib/hipe/rtl' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/home/michael/Development/junk/lib/hipe' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/home/michael/Development/junk/lib' make: *** [secondary_bootstrap_build] Error 2 I'm not sure how to interpret this. The environment's a pretty vanilla install (I reinstalled it just a few days ago). Any clues on how to get around this and have a functioning build? -- Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) Theory is knowledge that doesn't work. Practice is when everything works and you don't know why. (Hermann Hesse) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From justin@REDACTED Mon Sep 15 15:53:46 2008 From: justin@REDACTED (Justin Sheehy) Date: Mon, 15 Sep 2008 09:53:46 -0400 Subject: [erlang-questions] distributerl-0.1 (with improved Merkle trees) Message-ID: Hello All, (erlang-questions is on the CC list because there was interest in this topic before and I do not know of a general announcement list for such things) This is the second release of distributerl. The first had no version number, and was mainly intended to get the code into the hands of other potential users and experimenters as quickly as possible -- motivated by requests for such code by projects including but not limited to the Kai project. The distributerl-0.1 release is driven by two improvements to the Merkle Tree module: 1. User-specified keys for objects are now arbitrary terms instead of being restricted to 160b binaries. 2. A bug that caused incorrect diff/2 results has been fixed. Due to item #2, any systems making use of merkerl.erl should upgrade. A couple of smaller handy features were also added: 1. New function merkerl:delete/2 means that items can be deleted from trees. 2. New function merkerl:allkeys/1 will return the keys for all objects in a tree. (The vclock and chash modules are unchanged in this release) Future releases will include generic versioned objects, gossip protocol, and proper packaging of the modules. The project can be found at http://code.google.com/p/distributerl/ If you have any thoughts or questions about this, just drop me a line. Cheers, -Justin From raimo+erlang-questions@REDACTED Mon Sep 15 16:18:08 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 15 Sep 2008 16:18:08 +0200 Subject: [erlang-questions] Error building R12B-4 on Ubuntu 8.04 In-Reply-To: <1221486494.24037.5.camel@isolde> References: <1221486494.24037.5.camel@isolde> Message-ID: <20080915141808.GB19404@erix.ericsson.se> On Mon, Sep 15, 2008 at 09:48:14PM +0800, Michael T. Richter wrote: > * PGP Signed by an unknown key > > === Entering application hipe > make[3]: Entering directory > `/home/michael/Development/junk/lib/hipe/rtl' > erlc -W +debug_info +warn_obsolete_guard +inline -o../ebin > hipe_rtl_arch.erl > /home/michael/Development/junk/lib/hipe/rtl/../ebin/hipe_rtl_arch.bea#: > error writing file > make[3]: *** [../ebin/hipe_rtl_arch.beam] Error 1 > make[3]: Leaving directory `/home/michael/Development/junk/lib/hipe/rtl' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory `/home/michael/Development/junk/lib/hipe' > make[1]: *** [opt] Error 2 > make[1]: Leaving directory `/home/michael/Development/junk/lib' > make: *** [secondary_bootstrap_build] Error 2 > > I'm not sure how to interpret this. The environment's a pretty vanilla > install (I reinstalled it just a few days ago). Any clues on how to get > around this and have a functioning build? > (cd /home/michael/Development/junk/lib/hipe/rtl && \ erlc -W +debug_info +warn_obsolete_guard +inline -o../ebin hipe_rtl_arch.erl) That is, run the command manually and see if you get better error printouts. If that fails, add "strace -fo strace.log" before "erlc -W" and see if that log says anything interesting about why the file write fails. Is your /home/michael filesystem full? It seems the erlc compiler cannot write a temp file, and it is during compilation of the Hipe compiler. > -- > Michael T. Richter (GoogleTalk: > ttmrichter@REDACTED) > Theory is knowledge that doesn't work. Practice is when everything works > and you don't know why. (Hermann Hesse) > > * Unknown Key > * 0xA550E784 > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > * PGP Signed by an unknown key > * text/plain body > * Unknown Key > * 0xA550E784 -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From mikpe@REDACTED Mon Sep 15 16:29:47 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Mon, 15 Sep 2008 16:29:47 +0200 Subject: [erlang-questions] Error building R12B-4 on Ubuntu 8.04 In-Reply-To: <1221486494.24037.5.camel@isolde> References: <1221486494.24037.5.camel@isolde> Message-ID: <18638.29019.585168.42327@harpo.it.uu.se> Michael T. Richter wrote: >=== Entering application hipe >make[3]: Entering directory >`/home/michael/Development/junk/lib/hipe/rtl' >erlc -W +debug_info +warn_obsolete_guard +inline -o../ebin >hipe_rtl_arch.erl >/home/michael/Development/junk/lib/hipe/rtl/../ebin/hipe_rtl_arch.bea#: >error writing file >make[3]: *** [../ebin/hipe_rtl_arch.beam] Error 1 >make[3]: Leaving directory `/home/michael/Development/junk/lib/hipe/rtl' >make[2]: *** [opt] Error 2 >make[2]: Leaving directory `/home/michael/Development/junk/lib/hipe' >make[1]: *** [opt] Error 2 >make[1]: Leaving directory `/home/michael/Development/junk/lib' >make: *** [secondary_bootstrap_build] Error 2 > >I'm not sure how to interpret this. The environment's a pretty vanilla >install (I reinstalled it just a few days ago). Any clues on how to get >around this and have a functioning build? I've seen this error only due to these two causes: 1. the target directory (lib/hipe/ebin/) doesn't exist, this can happen if e.g. cvs export nukes an empty directory 2. the partition you're doing the build on is full, or you've exceeded your quota From joelr1@REDACTED Mon Sep 15 16:30:12 2008 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 15 Sep 2008 15:30:12 +0100 Subject: [erlang-questions] pickler combinators + closure fetching from ets vs process registry Message-ID: Has anyone benchmarked the speed of fetching a closure from ETS vs a process-based registry (gen_server + gb_trees)? I implemented closure-based serialization [1] based on Andrew Kennedy's pickle combinators which lets me define both the pickler and the unpickler for a record like this: test_start_game() -> record(test_start_game, { game_type(), expected_players(), limit(), start_delay(), player_timeout(), cards() }). I can then marshall data into an io list with with pickle(test_start_game(), Data) and get a record back with unpickle(test_start_game(), Bin). The problem is that a "command code" needs to be stored into the binary to make it possible to unpickle a proper record. This requires a mapping from record tag to command code and pickler as well as a mapping from command code to unpickler. I have these mappings implemented as functions, e.g. write(R) when is_record(R, bad) -> [?PP_BAD|pickle(bad(), R)]; and read(<>) -> unpickle(bad(), Bin); The two issues here for me are the long list of write and read clauses and the closured generated by bad() on every packet read and write. I'm thinking of storing the tag to pickler and command code mappings in ETS or a process-based registry. This will both store pickler closures once and drastically trim the amount of code by getting rid of the write/read clauses. Has anyone benchmarked ETS vs a process-based registry for retrieval of function closures? Thanks, Joel P.S. I would appreciate comments or suggestions on how the pickler code could be further optimized. [1] http://wagerlabs.com/erlang/pickle.erl -- wagerlabs.com From ttmrichter@REDACTED Mon Sep 15 16:46:39 2008 From: ttmrichter@REDACTED (Michael T. Richter) Date: Mon, 15 Sep 2008 22:46:39 +0800 Subject: [erlang-questions] Error building R12B-4 on Ubuntu 8.04 In-Reply-To: <20080915141808.GB19404@erix.ericsson.se> References: <1221486494.24037.5.camel@isolde> <20080915141808.GB19404@erix.ericsson.se> Message-ID: <1221489999.24037.13.camel@isolde> On Mon, 2008-09-15 at 16:18 +0200, Raimo Niskanen wrote: > (cd /home/michael/Development/junk/lib/hipe/rtl && \ > erlc -W +debug_info +warn_obsolete_guard +inline -o../ebin hipe_rtl_arch.erl) > That is, run the command manually and see if you get better > error printouts. No difference in output at all. > If that fails, add "strace -fo strace.log" before "erlc -W" and see > if that log says anything interesting about why the file write fails. Here's the snippets that seem relevant. ---8<--- 2140 stat64("./hipe_rtl_arch.erl", {st_mode=S_IFREG|0644, st_size=18214, ...}) = 0 2140 open("./hipe_rtl_arch.erl", O_RDONLY|O_LARGEFILE) = 7 ---8<--- 2140 stat64("/home/michael/Development/junk/lib/hipe/rtl/../ebin/hipe_rtl_arch.bea#", 0xbfe548d0) = -1 ENOENT (No such file or directory) 2140 open("/home/michael/Development/junk/lib/hipe/rtl/../ebin/hipe_rtl_arch.bea#", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = -1 ENOENT (No such file or directory) 2140 stat64("./io_lib_format.beam", 0xbfe548d0) = -1 ENOENT (No such file or directory) 2140 open("./io_lib_format.beam", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) 2140 stat64("/home/michael/Development/junk/bootstrap/lib/kernel/ebin/io_lib_format.beam", 0xbfe548d0) = -1 ENOENT (No such file or directory) 2140 open("/home/michael/Development/junk/bootstrap/lib/kernel/ebin/io_lib_format.beam", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) 2140 stat64("/home/michael/Development/junk/bootstrap/lib/stdlib/ebin/io_lib_format.beam", {st_mode=S_IFREG|0644, st_size=25504, ...}) = 0 2140 open("/home/michael/Development/junk/bootstrap/lib/stdlib/ebin/io_lib_format.beam", O_RDONLY|O_LARGEFILE) = 7 2140 read(7, "FOR1\0\0c\230BEAMAtom\0\0\3.\0\0\0]\rio_lib_"..., 25504) = 25504 2140 close(7) = 0 2140 getcwd("/home/michael/Development/junk/lib/hipe/rtl", 8191) = 44 2140 writev(1, [{"", 0}, {"/home/michael/Development/junk/l"..., 91}], 2) = 91 2140 munmap(0xb756c000, 970752) = 0 ---8<--- 2140 fcntl64(0, F_GETFL) = 0x2 (flags O_RDWR) 2140 fcntl64(0, F_SETFL, O_RDWR) = 0 2140 exit_group(1) = ? 2144 <... futex resumed> ) = ? ERESTART_RESTARTBLOCK (To be restarted) > Is your /home/michael filesystem full? 38GB free. > It seems the erlc compiler cannot write a temp file, > and it is during compilation of the Hipe compiler. It's looking like it can't even open said file, despite the O_CREAT, O_TRUNCATE pairing. Very odd. I can create the file by touching it, though, so something else is wrong here. -- Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) Politics is the art of looking for trouble, finding it whether it exists or not, diagnosing it incorrectly, and applying the wrong remedy. (Ernest Benn) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From ttmrichter@REDACTED Mon Sep 15 16:49:52 2008 From: ttmrichter@REDACTED (Michael T. Richter) Date: Mon, 15 Sep 2008 22:49:52 +0800 Subject: [erlang-questions] Error building R12B-4 on Ubuntu 8.04 (SOLVED) In-Reply-To: <18638.29019.585168.42327@harpo.it.uu.se> References: <1221486494.24037.5.camel@isolde> <18638.29019.585168.42327@harpo.it.uu.se> Message-ID: <1221490192.24037.16.camel@isolde> On Mon, 2008-09-15 at 16:29 +0200, Mikael Pettersson wrote: > I've seen this error only due to these two causes: > 1. the target directory (lib/hipe/ebin/) doesn't exist, > this can happen if e.g. cvs export nukes an empty directory > 2. the partition you're doing the build on is full, > or you've exceeded your quota #1 was it. My revision control system nuked the empty directory. Thanks, Mikael. If I patched the Makefiles to actually create the output directories, would the patch be accepted? -- Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) The only reason some people get lost in thought is because it's unfamiliar territory. (Paul Fix) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From davies.liu@REDACTED Mon Sep 15 17:07:56 2008 From: davies.liu@REDACTED (Davies Liu) Date: Mon, 15 Sep 2008 23:07:56 +0800 Subject: [erlang-questions] distributerl-0.1 (with improved Merkle trees) In-Reply-To: References: Message-ID: <988881390809150807p392944cbwd2c2d85dbe4301dd@mail.gmail.com> I care about the Space-efficient of Merkle Tree, how many keys (with length 20 bytes) can been stored in 1G memory? Thank you. Best regards, Davies Liu On Mon, Sep 15, 2008 at 9:53 PM, Justin Sheehy wrote: > Hello All, > > (erlang-questions is on the CC list because there was interest in this > topic > before and I do not know of a general announcement list for such things) > > This is the second release of distributerl. The first had no version > number, > and was mainly intended to get the code into the hands of other potential > users and experimenters as quickly as possible -- motivated by requests for > such code by projects including but not limited to the Kai project. The > distributerl-0.1 release is driven by two improvements to the Merkle Tree > module: > > 1. User-specified keys for objects are now arbitrary terms > instead of being restricted to 160b binaries. > 2. A bug that caused incorrect diff/2 results has been fixed. > > Due to item #2, any systems making use of merkerl.erl should upgrade. > > A couple of smaller handy features were also added: > > 1. New function merkerl:delete/2 means that items can be > deleted from trees. > 2. New function merkerl:allkeys/1 will return the keys for > all objects in a tree. > > (The vclock and chash modules are unchanged in this release) > > Future releases will include generic versioned objects, gossip protocol, > and > proper packaging of the modules. > > The project can be found at http://code.google.com/p/distributerl/ > > If you have any thoughts or questions about this, just drop me a line. > > Cheers, > > -Justin > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikpe@REDACTED Mon Sep 15 17:18:57 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Mon, 15 Sep 2008 17:18:57 +0200 Subject: [erlang-questions] Error building R12B-4 on Ubuntu 8.04 (SOLVED) In-Reply-To: <1221490192.24037.16.camel@isolde> References: <1221486494.24037.5.camel@isolde> <18638.29019.585168.42327@harpo.it.uu.se> <1221490192.24037.16.camel@isolde> Message-ID: <18638.31969.657918.218123@harpo.it.uu.se> Michael T. Richter wrote: >On Mon, 2008-09-15 at 16:29 +0200, Mikael Pettersson wrote: > >> I've seen this error only due to these two causes: >> 1. the target directory (lib/hipe/ebin/) doesn't exist, >> this can happen if e.g. cvs export nukes an empty directory >> 2. the partition you're doing the build on is full, >> or you've exceeded your quota > > >#1 was it. My revision control system nuked the empty directory. >Thanks, Mikael. > >If I patched the Makefiles to actually create the output directories, >would the patch be accepted? I can't say, that's an issue for the OTP team to deal with. Personally I like that solution. Traditionally we (as in HiPE) have dealt with this by adding .cvsignore files to otherwise empty directories (when needed to avoid the build breaking). /Mikael From rec@REDACTED Mon Sep 15 17:21:02 2008 From: rec@REDACTED (Roger Critchlow) Date: Mon, 15 Sep 2008 09:21:02 -0600 Subject: [erlang-questions] Error building R12B-4 on Ubuntu 8.04 In-Reply-To: <1221486494.24037.5.camel@isolde> References: <1221486494.24037.5.camel@isolde> Message-ID: <66d1c98f0809150821x2ac7a6edx790f88e3555a5bc8@mail.gmail.com> 2008/9/15 Michael T. Richter > === Entering application hipe > make[3]: Entering directory `/home/michael/Development/junk/lib/hipe/rtl' > *erlc -W +debug_info +warn_obsolete_guard +inline -o../ebin > hipe_rtl_arch.erl* > */home/michael/Development/junk/lib/hipe/rtl/../ebin/hipe_rtl_arch.bea#: > error writing file* > I just built R12B-4 from scratch on Ubuntu 8.04+updates. My make output over the same section was: === Entering application hipe make[3]: Entering directory `/usr/local/src/otp_src_R12B-4/lib/hipe/rtl' /usr/local/src/otp_src_R12B-4/bin/x86_64-unknown-linux-gnu/hipe_mkliterals -e > hipe_literals.hrl erlc -W +debug_info +warn_obsolete_guard +inline -o../ebin hipe_rtl_arch.erl erlc -W +debug_info +warn_obsolete_guard +inline -o../ebin hipe_tagscheme.erl I assume you have tried to configure and make from a clean copy? -- rec -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From justin@REDACTED Mon Sep 15 17:35:47 2008 From: justin@REDACTED (Justin Sheehy) Date: Mon, 15 Sep 2008 11:35:47 -0400 Subject: [erlang-questions] distributerl-0.1 (with improved Merkle trees) In-Reply-To: <988881390809150807p392944cbwd2c2d85dbe4301dd@mail.gmail.com> Message-ID: Hello Davies, Thanks for your interest. The current implementation does not yet make any attempt at space optimization only due to the fact that the single application it is actively used in does not happen to need very large trees in practice at this time. I know of a few ways we could reduce the space used; they just haven't been worthwhile to focus on yet. Also, the internal structure used for the trees right off was somewhat space-wasteful due to focusing the first swing more on being relatively easy to understand. We're certainly interested in improving efficiency at some point - if you care about it now, I'd welcome either private discussion or patches in the interest of improvement. Best, -Justin On 9/15/08 11:07 AM, "Davies Liu" wrote: I care about the Space-efficient of Merkle Tree, how many keys (with length 20 bytes) can been stored in 1G memory? Thank you. Best regards, Davies Liu On Mon, Sep 15, 2008 at 9:53 PM, Justin Sheehy wrote: Hello All, (erlang-questions is on the CC list because there was interest in this topic before and I do not know of a general announcement list for such things) This is the second release of distributerl. The first had no version number, and was mainly intended to get the code into the hands of other potential users and experimenters as quickly as possible -- motivated by requests for such code by projects including but not limited to the Kai project. The distributerl-0.1 release is driven by two improvements to the Merkle Tree module: 1. User-specified keys for objects are now arbitrary terms instead of being restricted to 160b binaries. 2. A bug that caused incorrect diff/2 results has been fixed. Due to item #2, any systems making use of merkerl.erl should upgrade. A couple of smaller handy features were also added: 1. New function merkerl:delete/2 means that items can be deleted from trees. 2. New function merkerl:allkeys/1 will return the keys for all objects in a tree. (The vclock and chash modules are unchanged in this release) Future releases will include generic versioned objects, gossip protocol, and proper packaging of the modules. The project can be found at http://code.google.com/p/distributerl/ If you have any thoughts or questions about this, just drop me a line. Cheers, -Justin _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From psa@REDACTED Mon Sep 15 18:05:43 2008 From: psa@REDACTED (=?ISO-8859-1?Q?Paulo_S=E9rgio_Almeida?=) Date: Mon, 15 Sep 2008 17:05:43 +0100 Subject: [erlang-questions] Combining ets and mnesia operations for extremeperformance In-Reply-To: <48CA9D56.1070800@alertlogic.net> References: <48C95E0A.2010907@di.uminho.pt> <48CA7163.4000201@ericsson.com> <48CA9327.5080605@di.uminho.pt> <48CA9D56.1070800@alertlogic.net> Message-ID: <48CE87D7.70707@di.uminho.pt> Paul Fisher wrote: > Paulo S?rgio Almeida wrote: >> There is not much information about this operation. Does it provide >> atomicity? What happens if there is a crash in the middle of it? I have >> not made it clear, but I need to persist the updates on several tables >> as an atomic operation. > > As a general strategy for this type of thing I will do the dump (usually > ets tables with ets:tab2file/1) and one the operation is complete i will > rename the file from .tmp to in order to "commit" the > operation for later recovery. Yes. This works for a single table. My needs include atomicity involving several tables. Also I want to be able to postpone the dumping of the full table, which leads to an incremental log-based dumping of operations, like what mnesia does. This is tempting me to write a module tailored to what I need: persisting ets tables while ensuring some transactional properties, namely atomic updates involving several tables, from the durability point of view. It would have no distribution or concurrency control. As a bonus it would support more general ets tables, not being restricted to the fixed-length record based ones from mnesia. Sometimes it feels like a waste having a field for the record name when I just want a key-value mapping, or having to have at least 2 fields when I want to simulate a set and the key is enough. But the important thing is it will give me orders of magnitude more efficiency than what I am allowed to do "officially" with mnesia. It promises to be fun. Cheers, Paulo From devdoer2@REDACTED Mon Sep 15 19:09:03 2008 From: devdoer2@REDACTED (devdoer bird) Date: Tue, 16 Sep 2008 01:09:03 +0800 Subject: [erlang-questions] How to show non-ascii charaters correctly in erlang shell? In-Reply-To: References: <20080912143016.GE4420@metalman.digium.internal> Message-ID: HI: I can't find the patch.Would you please tell me where it is? Many thanks. 2008/9/12 devdoer bird > Thanks .Can you give me the link? > > 2008/9/12 mog > >> On Fri, Sep 12, 2008 at 10:38:06AM +0800, devdoer bird wrote: >> > HI: >> > >> > We have chinese words input /output in erlang shell,and we want to show >> > them correctly in terminal ,but the erlang shell only show the integer >> > number . >> > Eg. If we input "????" in the shell,it will appear as : >> > 9> "\326\320\316\304". >> > "\326\320\316\304" >> >> Currently ssh, telnet, and shell drivers, escape anything but ascii >> sequences. I assumed this was for security / cleanliness issues. It is >> easy to go alter this, I have a patch on erlang-bugs list that did just that >> to allow for ^L to be typed and followed correctly in the shell. >> >> Mog >> >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v1.4.9 (GNU/Linux) >> >> iEYEARECAAYFAkjKfPgACgkQeq+tARrxhnvaKQCggoAkZae9fjxcAEuHJUF6dlIo >> ek8Ani+S0Jw5imG3/acJae75dFNHV6UO >> =b0kC >> -----END PGP SIGNATURE----- >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony@REDACTED Mon Sep 15 21:22:56 2008 From: tony@REDACTED (Tony Rogvall) Date: Mon, 15 Sep 2008 21:22:56 +0200 Subject: [erlang-questions] SSL_CTX_set_info_callback Message-ID: Hi! I have a slight build problem with R12B-4 on Mac OS X (10.5.4) For some reason it fails to link esock_ssl with the reason: Undefined symbols: "_SSL_CTX_set_info_callback", referenced from: _set_ssl_parameters in esock_openssl.o ld: symbol(s) not found If I comment away that call (it's just debugging anyway) everything works fine. I have checked what ever can be checked (include paths etc) everything looks fine. Any one else seen this? Thanks /Tony From yoursurrogategod@REDACTED Mon Sep 15 23:16:06 2008 From: yoursurrogategod@REDACTED (YourSurrogateGod) Date: Mon, 15 Sep 2008 14:16:06 -0700 (PDT) Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <00ab01c9167c$a4bff890$6401a8c0@moneymaker2> References: <762B727D-125A-4739-B599-4114C0460869@gmail.com> <48CA8403.3070907@alertlogic.net> <1DFCF703-3AD6-4D23-B3C1-F29D79B76F10@gmail.com> <97619b170809131236i5b313d1fu293f249bc6b71913@mail.gmail.com> <3274A42C-8E91-42DE-81F5-004BB2F3356B@gmail.com> <5846A09C-2525-4CD3-A282-F28FB88C7750@gmail.com> <6c2563b20809131356i73bd5a71ra5f0ef8a42159f4@mail.gmail.com> <7BDEFDC8-9159-423A-804D-A125DD477F35@scaldeferri.com> <009501c9163a$96b50610$6401a8c0@moneymaker2> <6c2563b20809140139s5fec4a5eie81af90409249191@mail.gmail.com> <00ab01c9167c$a4bff890$6401a8c0@moneymaker2> Message-ID: <51efa26c-b033-4bb8-9669-6bdf7d0331b1@k37g2000hsf.googlegroups.com> I'll admit that I'm highly inexperienced when it comes to Erlang. However, I'm surprised that there is such a barrier. From what I understood, Erlang's way of handling messages is *very* efficient. Just what percentage of overall processing is done by the process that's responsible for passing messages around? As opposed to other processes which can do actual work. I might have a suggestion. At my job, we've used CORBA. Although not exactly the same, in principle, it's similar. We had an issue with lots of messages getting passed around and gumming up the works, causing messages to get delivered late (our software had requirements to deliver the messages within a certain amount of time). The biggest problem was that there were lots of small messages getting sent around. Which meant, behind the scenes, a lot of connections openned and closed, which takes time, during which less productive processing (on the CPU) is done. We tried 2 solutions: 1) Turn the small messages into large, long ones. That way, you just have one massive message sent. Combine them. 2) Collect pieces of information into a buffer and then send it out once the buffer has reached a limit. Say you do: receive Message1 -> .... Message2 -> .... Message3 -> .... Message4 -> .... end. But you change it to: receive LargeMessage -> end. Also, I have a question. Isn't it possible to simulate multiple CPU's with Erlang's virtual machine? If so, then wouldn't creating lots of these virtual CPUs emulate the said problem and make it easier to see on the horizon? etop seems like a tool that might answer this question, too bad it crashes so often :( . From ok@REDACTED Tue Sep 16 02:19:59 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 16 Sep 2008 12:19:59 +1200 Subject: [erlang-questions] encapsulating types and dialyzer In-Reply-To: <18059_1221464244_m8F7bL2o023628_48CE0E0F.8080904@kreditor.se> References: <200809120145.30587.als@iinet.net.au> <48C94DB1.1040202@cs.ntua.gr> <48CA16A9.1050202@it.uu.se> <200809130208.04813.als@iinet.net.au> <18059_1221464244_m8F7bL2o023628_48CE0E0F.8080904@kreditor.se> Message-ID: <599DF2A0-FD9E-42D6-8813-B459638A5D5B@cs.otago.ac.nz> On 15 Sep 2008, at 7:26 pm, Tobias Lindahl wrote: > This used to be the only way to declare them. The declaration without > parenthesis is brand new. English spelling follows Greek here: one parenthesIs, two parenthesEs one crisIs, two crisEs one arsIs, two arsEs (arsis = ictus) > We are looking at having opaque types that are not allowed to be > inspected which would be more close to what you seem to expect from > the > type declarations, but the nature of Erlang (dynamic typing, hot code > loading, etc) makes it hard to do proper type checking without > changing > the language quite extensively. Instead, we have chosen to loosen up > the > type inference/checking quite a bit to better suit Erlang's > programming > idiom. Of course, nothing stops someone defining a strongly typed language that (after type checking) is mapped down to Erlang. That might be an interesting project for someone. It's easy to see that the process dictionary should probably be treated the way mutable variables are in SML, but since processes can simulate variables, that raises questions about polymorphism and message passing. From yoursurrogategod@REDACTED Tue Sep 16 03:51:22 2008 From: yoursurrogategod@REDACTED (YourSurrogateGod) Date: Mon, 15 Sep 2008 18:51:22 -0700 (PDT) Subject: [erlang-questions] A better shell. Message-ID: I'm used to working with Bash and Z-shell on my Linux PC. They're both great at what they do. I can hit the Home and End keys and go either the front or back of the command. Is there a way to replicate the same behavior in the Erlang shell? It does some neat things, but having those features really make it come alive. Thoughts? From dhbaird@REDACTED Tue Sep 16 04:17:08 2008 From: dhbaird@REDACTED (David Baird) Date: Mon, 15 Sep 2008 20:17:08 -0600 Subject: [erlang-questions] A better shell. In-Reply-To: References: Message-ID: <440abda90809151917h2360467h293300fe899364e2@mail.gmail.com> (sorry if you get this multiple times, I didn't reply to the list on the first try) On Mon, Sep 15, 2008 at 7:51 PM, YourSurrogateGod wrote: > I'm used to working with Bash and Z-shell on my Linux PC. They're both > great at what they do. I can hit the Home and End keys and go either > the front or back of the command. Is there a way to replicate the same > behavior in the Erlang shell? It does some neat things, but having > those features really make it come alive. > > Thoughts? Have you tried rlwrap already? -David From vlm@REDACTED Tue Sep 16 05:59:23 2008 From: vlm@REDACTED (Lev Walkin) Date: Mon, 15 Sep 2008 20:59:23 -0700 Subject: [erlang-questions] A better shell. In-Reply-To: References: Message-ID: <48CF2F1B.3070003@lionet.info> YourSurrogateGod wrote: > I'm used to working with Bash and Z-shell on my Linux PC. They're both > great at what they do. I can hit the Home and End keys and go either > the front or back of the command. Is there a way to replicate the same > behavior in the Erlang shell? It does some neat things, but having > those features really make it come alive. > > Thoughts? I think in Bash you better use Cmd+A (beginning of the string) and Cmd+E (End of the string), this way you won't notice a difference between Erlang shell and Bash. -- vlm From dhbaird@REDACTED Tue Sep 16 07:26:45 2008 From: dhbaird@REDACTED (David Baird) Date: Mon, 15 Sep 2008 23:26:45 -0600 Subject: [erlang-questions] A better shell. In-Reply-To: <440abda90809151917h2360467h293300fe899364e2@mail.gmail.com> References: <440abda90809151917h2360467h293300fe899364e2@mail.gmail.com> Message-ID: <440abda90809152226u6f646ab2k2902ba756da0d527@mail.gmail.com> > On Mon, Sep 15, 2008 at 7:51 PM, YourSurrogateGod > Thoughts? On Mon, Sep 15, 2008 at 8:17 PM, David Baird wrote: > Have you tried rlwrap already? Scratch that thought. I just tried rlwrap. Doesn't seem to work. Lev's suggestion is better :-) From ahmed.nawras@REDACTED Tue Sep 16 10:21:04 2008 From: ahmed.nawras@REDACTED (Ahmed Ali) Date: Tue, 16 Sep 2008 12:21:04 +0400 Subject: [erlang-questions] A better shell. In-Reply-To: References: Message-ID: Hi, Eralng shell uses some Emacs commands for editing code. I'm not sure if all of these work in Windows shell, but it works in linux. Ctrl-A: takes you to the beginning of the line Ctrl-E: takes you to the end of the line And while we're at it, Alt-F: takes you 1 word forward Alt-B: takes you 1 word backwords Alt-D: deletes 1 word forwards Alt-: deletes 1 word backwords Ctrl-K: Deletes everything until the end of the line On Tue, Sep 16, 2008 at 5:51 AM, YourSurrogateGod wrote: > I'm used to working with Bash and Z-shell on my Linux PC. They're both > great at what they do. I can hit the Home and End keys and go either > the front or back of the command. Is there a way to replicate the same > behavior in the Erlang shell? It does some neat things, but having > those features really make it come alive. > > Thoughts? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From kenneth.lundin@REDACTED Tue Sep 16 11:34:03 2008 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Tue, 16 Sep 2008 11:34:03 +0200 Subject: [erlang-questions] Some facts about Erlang and SMP Message-ID: Here are some short facts about how the Erlang SMP implementation works and how it relates to performance and scalability. There will be a more detailed description of how multi core works and on the future plans available in a couple of weeks. I plan to include some of this in my presentation at the ICFP2008, Erlang Workshop in Victoria BC, September 27 The Erlang VM without SMP support has 1 scheduler which runs in the main process thread. The scheduler picks runnable Erlang processes and IO-jobs from the run-queue and there is no need to lock data structures since there is only one thread accessing them. The Erlang VM with SMP support can have 1 to many schedulers which are run in 1 thread each. The schedulers pick runnable Erlang processes and IO-jobs from one common run-queue. In the SMP VM all shared data structures are protected with locks, the run-queue is one example of a data structure protected with locks. >From OTP R12B the SMP version of the VM is automatically started as default if the OS reports more than 1 CPU (or Core) and with the same number of schedulers as CPU's or Cores. You can see what was chosen at the first line of printout from the "erl" command. E.g. Erlang (BEAM) emulator version 5.6.4 [source] [smp:4] [asynch-threads:0] ..... The "[smp:4]" above tells that the SMP VM is run and with 4 schedulers. The default behaviour can be overridden with the "-smp [enable|disable|auto]" auto is default and to set the number of schedulers, if smp is set to enable or auto "+S Number" where Number is the number of schedulers (1..1024) Note ! that it is normally nothing to gain from running with more schedulers than the number of CPU's or Cores. Note2 ! On some operating systems the number of CPU's or Cores to be used by a process can be restricted with commands. For example on Linux the command "taskset" can be used for this. The Erlang VM will currently only detect number of available CPU's or Cores and will not take the mask set by "taskset" into account. Because of this it can happen and has happened that e.g. only 2 Cores are used even if the Erlang VM runs with 4 schedulers. It is the OS that limits this because it take the mask from "taskset" into account. The schedulers in the Erlang VM are run on one OS-thread each and it is the OS that decides if the threads are executed on different Cores. Normally the OS will do this just fine and will also keep the thread on the same Core throughout the execution. The Erlang processes will be run by different schedulers because they are picked from a common run-queue by the first scheduler that becomes available. Performance and scalability ------------------------------------ - The SMP VM with only one scheduler is slightly slower than the non SMP VM. The SMP VM need to to use all the locks inside but as long as there are no lock-conflicts the overhead caused by locking is not significant (it is the lock conflicts that takes time). This explains why it in some cases can be more efficient to run several SMP VM's with one scheduler each instead on one SMP VM with several schedulers. Of course the running of several VM's require that the application can run in many parallel tasks which has no or very little communication with each other. - If a program scale well with the SMP VM over many cores depends very much on the characteristics of the program, some programs scale linearly up to 8 and even 16 cores while other programs barely scale at all even on 2 cores. This might sound bad, but in practice many real programs scale well on the number of cores that are common on the market today, see below. - Real telecoms products supporting a massive number if simultaneously ongoing "calls" represented as one or several Erlang processes per core have shown very good scalability on dual and quad core processors. Note, that these products was written in the normal Erlang style long before the SMP VM and multi core processors where available and they could benefit from the Erlang SMP VM without changes and even without need to recompile the code. SMP performance is continually improved ------------------------------------------------------ The SMP implementation is continually improved in order to get better performance and scalability. In each service release R12B-1, 2, 3, 4, 5 , ..., R13B etc. you will find new optimizations. Some known bottlenecks --------------------------------- - The single common run-queue will become a dominant bottleneck when the number of CPU's or Cores increase. Will be visible from 4 cores and upwards, but 4 cores will probably still give ok performance for many applications. We are working on a solution with one run-queue per scheduler as the most important improvement right now. - Ets tables involves locking. Before R12B-4 there was 2 locks involved in every access to an ets-table, but in R12B-4 the locking of the meta-table is optimized to reduce the conflicts significantly (as mentioned earlier it is the conflicts that are expensive). If many Erlang processes access the same table there will be a lot of lock conflicts causing bad performance especially if these processes spend a majority of their work accessing ets-tables. The locking is on table-level not on record level. Note! that this will have impact on Mnesia as well since Mnesia is a heavy user of ets-tables. ... Our strategy with SMP ----------------------------- Already from the beginning when we started implementation of the SMP VM we decided on the strategy: "First make it work, then measure, then optimize". We are still following this strategy consistently since the first stable working SMP VM that we released in May 2006 (R11B). There are more known things to improve and we address them one by one taking the one we think gives most performance per implementation effort first and so on. We are putting most focus on getting consistent better scaling on many cores (more than 4). Best in class ----------------- Even if there are a number of known bottlenecks the SMP system already has good overall performance and scalability and I believe we are best in class when it comes to letting the programmer utilize multi -core machines in an easy productive way. /Kenneth Erlang/OTP team, Ericsson From vladdu55@REDACTED Tue Sep 16 12:05:10 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 16 Sep 2008 12:05:10 +0200 Subject: [erlang-questions] Fwd: Some facts about Erlang and SMP In-Reply-To: References: <95be1d3b0809160255r27763574le022e21589555820@mail.gmail.com> Message-ID: <95be1d3b0809160305y422f5674k44f6aac8373a8e84@mail.gmail.com> Sorry, this should have gone to the list... Thanks, Kenneth! /Vlad On Tue, Sep 16, 2008 at 11:55 AM, Vlad Dumitrescu wrote: > On Tue, Sep 16, 2008 at 11:34, Kenneth Lundin wrote: >> Here are some short facts about how the Erlang SMP implementation >> works and how it >> relates to performance and scalability. > > Hi and thank you for the detailed explanations! > > This may be a silly question, but does SMP interact with the async thread pool? > > best regards, > Vlad Hi, The async thread pool works exactly the same in both the SMP VM and the non SMP VM i.e I suppose you can say that they don't interact. The asynch thread pool is only used by the file driver in the code we deliver but there is a documented interface where you as a user can implement your own driver which also used the asynch thread pool. /Kenneth From francesca@REDACTED Tue Sep 16 12:33:55 2008 From: francesca@REDACTED (Francesca Gangemi) Date: Tue, 16 Sep 2008 12:33:55 +0200 Subject: [erlang-questions] A better shell. In-Reply-To: References: Message-ID: <48CF8B93.1080306@erlang-consulting.com> Hi, Ahmed Ali wrote: > Hi, > > Eralng shell uses some Emacs commands for editing code. I'm not sure > if all of these work in Windows shell, but it works in linux. > > Ctrl-A: takes you to the beginning of the line > Ctrl-E: takes you to the end of the line > > And while we're at it, > Alt-F: takes you 1 word forward > Alt-B: takes you 1 word backwords > Alt-D: deletes 1 word forwards > Alt-: deletes 1 word backwords > Ctrl-K: Deletes everything until the end of the line > The last three commands are a "cut" rather than "delete". You can then copy it by typing Ctrl-y Kind regards Francesca From yoursurrogategod@REDACTED Tue Sep 16 13:02:36 2008 From: yoursurrogategod@REDACTED (YourSurrogateGod) Date: Tue, 16 Sep 2008 04:02:36 -0700 (PDT) Subject: [erlang-questions] A better shell. In-Reply-To: <440abda90809151917h2360467h293300fe899364e2@mail.gmail.com> References: <440abda90809151917h2360467h293300fe899364e2@mail.gmail.com> Message-ID: <8a054054-c31c-494b-8ea9-e625312fa25d@x41g2000hsb.googlegroups.com> I've never heard of it up until now. What is it? On Sep 15, 10:17?pm, "David Baird" wrote: > (sorry if you get this multiple times, I didn't reply to the list on > the first try) > > On Mon, Sep 15, 2008 at 7:51 PM, YourSurrogateGod > > wrote: > > I'm used to working with Bash and Z-shell on my Linux PC. They're both > > great at what they do. I can hit the Home and End keys and go either > > the front or back of the command. Is there a way to replicate the same > > behavior in the Erlang shell? It does some neat things, but having > > those features really make it come alive. > > > Thoughts? > > Have you tried rlwrap already? > > -David > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From yoursurrogategod@REDACTED Tue Sep 16 13:04:03 2008 From: yoursurrogategod@REDACTED (YourSurrogateGod) Date: Tue, 16 Sep 2008 04:04:03 -0700 (PDT) Subject: [erlang-questions] A better shell. In-Reply-To: <48CF2F1B.3070003@lionet.info> References: <48CF2F1B.3070003@lionet.info> Message-ID: <2ae3549f-f1cb-4e3c-b7e3-d805c6de372a@m36g2000hse.googlegroups.com> Yeh, but I should be able to customize it as I see fit and bend it to my will. I don't want to come across as whining, but it seems silly that you can't have the program behave as you see fit. On Sep 15, 11:59?pm, Lev Walkin wrote: > YourSurrogateGod wrote: > > I'm used to working with Bash and Z-shell on my Linux PC. They're both > > great at what they do. I can hit the Home and End keys and go either > > the front or back of the command. Is there a way to replicate the same > > behavior in the Erlang shell? It does some neat things, but having > > those features really make it come alive. > > > Thoughts? > > I think in Bash you better use Cmd+A (beginning of the string) > and Cmd+E (End of the string), this way you won't notice a difference > between Erlang shell and Bash. > > -- > vlm > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From yoursurrogategod@REDACTED Tue Sep 16 13:05:41 2008 From: yoursurrogategod@REDACTED (YourSurrogateGod) Date: Tue, 16 Sep 2008 04:05:41 -0700 (PDT) Subject: [erlang-questions] A better shell. In-Reply-To: <48CF8B93.1080306@erlang-consulting.com> References: <48CF8B93.1080306@erlang-consulting.com> Message-ID: <38ce60df-fcc6-4da8-a07c-069da79aebb1@p25g2000hsf.googlegroups.com> Thanks for your suggestions Ahmed and Francesca. I looked around in my home directory (Ubuntu 8.04 is my OS) to look for something that might stick out as a config file to mess with... no luck. On Sep 16, 6:33?am, Francesca Gangemi wrote: > Hi, > > > > > > Ahmed Ali wrote: > > Hi, > > > Eralng shell uses some Emacs commands for editing code. I'm not sure > > if all of these work in Windows shell, but it works in linux. > > > Ctrl-A: takes you to the beginning of the line > > Ctrl-E: takes you to the end of the line > > > And while we're at it, > > Alt-F: takes you 1 word forward > > Alt-B: takes you 1 word backwords > > Alt-D: deletes 1 word forwards > > Alt-: deletes 1 word backwords > > Ctrl-K: Deletes everything until the end of the line > > The last three commands are a "cut" rather than "delete". > You can then copy it by typing Ctrl-y > > Kind regards > Francesca > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From dhbaird@REDACTED Tue Sep 16 16:48:01 2008 From: dhbaird@REDACTED (David Baird) Date: Tue, 16 Sep 2008 08:48:01 -0600 Subject: [erlang-questions] A better shell. In-Reply-To: <8a054054-c31c-494b-8ea9-e625312fa25d@x41g2000hsb.googlegroups.com> References: <440abda90809151917h2360467h293300fe899364e2@mail.gmail.com> <8a054054-c31c-494b-8ea9-e625312fa25d@x41g2000hsb.googlegroups.com> Message-ID: <440abda90809160748s1ef589d8o4a2152be00454d42@mail.gmail.com> rlwrap is a readline adapter that is able to bestow readline capabilities (history searching, editing) upon shells that otherwise don't have readline support. It works great for some shells, such as csi (chicken scheme). Btw, you might want to also read about top posting and inline posting (there are some Wikipedia articles) - this will result in threaded messages that are easier to read. Good luck, David On Tue, Sep 16, 2008 at 5:02 AM, YourSurrogateGod wrote: > I've never heard of it up until now. What is it? > > On Sep 15, 10:17 pm, "David Baird" wrote: >> (sorry if you get this multiple times, I didn't reply to the list on >> the first try) >> >> On Mon, Sep 15, 2008 at 7:51 PM, YourSurrogateGod >> >> wrote: >> > I'm used to working with Bash and Z-shell on my Linux PC. They're both >> > great at what they do. I can hit the Home and End keys and go either >> > the front or back of the command. Is there a way to replicate the same >> > behavior in the Erlang shell? It does some neat things, but having >> > those features really make it come alive. >> >> > Thoughts? >> >> Have you tried rlwrap already? >> >> -David >> _______________________________________________ >> erlang-questions mailing list >> erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From jarrod@REDACTED Tue Sep 16 18:04:51 2008 From: jarrod@REDACTED (Jarrod Roberson) Date: Tue, 16 Sep 2008 12:04:51 -0400 Subject: [erlang-questions] A better shell. In-Reply-To: <440abda90809160748s1ef589d8o4a2152be00454d42@mail.gmail.com> References: <440abda90809151917h2360467h293300fe899364e2@mail.gmail.com> <8a054054-c31c-494b-8ea9-e625312fa25d@x41g2000hsb.googlegroups.com> <440abda90809160748s1ef589d8o4a2152be00454d42@mail.gmail.com> Message-ID: On Tue, Sep 16, 2008 at 10:48 AM, David Baird wrote: > rlwrap is a readline adapter that is able to bestow readline > capabilities (history searching, editing) upon shells that otherwise > don't have readline support. It works great for some shells, such as > csi (chicken scheme). > > Btw, you might want to also read about top posting and inline posting > (there are some Wikipedia articles) - this will result in threaded > messages that are easier to read. > > Good luck, > David > > On Tue, Sep 16, 2008 at 5:02 AM, YourSurrogateGod > wrote: > > I've never heard of it up until now. What is it? > > > > On Sep 15, 10:17 pm, "David Baird" wrote: > >> (sorry if you get this multiple times, I didn't reply to the list on > >> the first try) > >> << snipped a lot of useless text >> David, you do realize you are top posting as well? -------------- next part -------------- An HTML attachment was scrubbed... URL: From dhbaird@REDACTED Tue Sep 16 18:40:59 2008 From: dhbaird@REDACTED (David Baird) Date: Tue, 16 Sep 2008 10:40:59 -0600 Subject: [erlang-questions] A better shell. In-Reply-To: References: <440abda90809151917h2360467h293300fe899364e2@mail.gmail.com> <8a054054-c31c-494b-8ea9-e625312fa25d@x41g2000hsb.googlegroups.com> <440abda90809160748s1ef589d8o4a2152be00454d42@mail.gmail.com> Message-ID: <440abda90809160940l23a92cc6gde5bf4650b7f1474@mail.gmail.com> 2008/9/16 Jarrod Roberson : > > On Tue, Sep 16, 2008 at 10:48 AM, David Baird wrote: >> Btw, you might want to also read about top posting and inline posting >> (there are some Wikipedia articles) - this will result in threaded >> messages that are easier to read. > > David, you do realize you are top posting as well? Yes :-) From kevin@REDACTED Tue Sep 16 19:04:41 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Tue, 16 Sep 2008 13:04:41 -0400 Subject: [erlang-questions] Some facts about Erlang and SMP In-Reply-To: References: Message-ID: On Sep 16, 2008, at 5:34 AM, Kenneth Lundin wrote: > Here are some short facts about how the Erlang SMP implementation > works and how it > relates to performance and scalability. ... Kenneth, Do you have any insight into why I might be seeing much higher CPU cost for SMP on linux vs. Mac? Is there some difference in the lock implementations that might be relevant? -kevin From vlm@REDACTED Tue Sep 16 19:43:55 2008 From: vlm@REDACTED (Lev Walkin) Date: Tue, 16 Sep 2008 10:43:55 -0700 Subject: [erlang-questions] A better shell. In-Reply-To: <2ae3549f-f1cb-4e3c-b7e3-d805c6de372a@m36g2000hse.googlegroups.com> References: <48CF2F1B.3070003@lionet.info> <2ae3549f-f1cb-4e3c-b7e3-d805c6de372a@m36g2000hse.googlegroups.com> Message-ID: <48CFF05B.90401@lionet.info> YourSurrogateGod wrote: > Yeh, but I should be able to customize it as I see fit and bend it to > my will. I don't want to come across as whining, but it seems silly > that you can't have the program behave as you see fit. Good luck adding Cmd+A / Cmd+A sequences to Microsoft Word :) > On Sep 15, 11:59 pm, Lev Walkin wrote: >> YourSurrogateGod wrote: >>> I'm used to working with Bash and Z-shell on my Linux PC. They're both >>> great at what they do. I can hit the Home and End keys and go either >>> the front or back of the command. Is there a way to replicate the same >>> behavior in the Erlang shell? It does some neat things, but having >>> those features really make it come alive. >>> Thoughts? >> I think in Bash you better use Cmd+A (beginning of the string) >> and Cmd+E (End of the string), this way you won't notice a difference >> between Erlang shell and Bash. >> >> -- >> vlm >> _______________________________________________ >> erlang-questions mailing list >> erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dizzyd@REDACTED Tue Sep 16 19:56:13 2008 From: dizzyd@REDACTED (Dave Smith) Date: Tue, 16 Sep 2008 11:56:13 -0600 Subject: [erlang-questions] Some facts about Erlang and SMP In-Reply-To: References: Message-ID: On Tue, Sep 16, 2008 at 3:34 AM, Kenneth Lundin wrote: > Even if there are a number of known bottlenecks > the SMP system already has good overall performance and scalability > and I believe we are best in class > when it comes to letting the programmer utilize multi -core machines > in an easy productive way. +1000. Erlang (and the SMP VM in particular) really shines when it comes to building system that naturally scale out. It makes me so happy to see apps distribute reasonably evenly across 8 cores, without me having to spend a lot of time focused on locking/sharing/etc. It Just Works (TM). Thanks, Kenneth and the OTP team. Your hard work is much appreciated. :) D. From jason.ganetsky@REDACTED Tue Sep 16 20:24:46 2008 From: jason.ganetsky@REDACTED (Jason Ganetsky) Date: Tue, 16 Sep 2008 14:24:46 -0400 Subject: [erlang-questions] Trying to reduce Erlang memory consumption Message-ID: Hi, So, my beam process is taking up a good 1.7 GB. This is my erlang:memory() [{total,679986616}, {processes,250148809}, {processes_used,249859129}, {system,429837807}, {atom,770041}, {atom_used,740322}, {binary,95868397}, {code,8424485}, {ets,295126080}] I'm trying to reduce this. The strange thing is how high my numbers are for processes and processes_used. I ran erlang:process_info() on every process in erlang:processes(), and found that my processes shouldn't be taking up much memory at all. I only have 121 running, the largest heap_size is 6765 (and most are under 1000).. and the largest stack_size is 21. What am I missing here? -------------- next part -------------- An HTML attachment was scrubbed... URL: From yoursurrogategod@REDACTED Tue Sep 16 22:13:29 2008 From: yoursurrogategod@REDACTED (YourSurrogateGod) Date: Tue, 16 Sep 2008 13:13:29 -0700 (PDT) Subject: [erlang-questions] A better shell. In-Reply-To: <48CFF05B.90401@lionet.info> References: <48CF2F1B.3070003@lionet.info> <2ae3549f-f1cb-4e3c-b7e3-d805c6de372a@m36g2000hse.googlegroups.com> <48CFF05B.90401@lionet.info> Message-ID: <15b6a55b-956f-45c8-b412-76751fe630ab@e53g2000hsa.googlegroups.com> On Sep 16, 1:43?pm, Lev Walkin wrote: > YourSurrogateGod wrote: > > Yeh, but I should be able to customize it as I see fit and bend it to > > my will. I don't want to come across as whining, but it seems silly > > that you can't have the program behave as you see fit. > > Good luck adding Cmd+A / Cmd+A sequences to Microsoft Word :) > > > > > > > On Sep 15, 11:59 pm, Lev Walkin wrote: > >> YourSurrogateGod wrote: > >>> I'm used to working with Bash and Z-shell on my Linux PC. They're both > >>> great at what they do. I can hit the Home and End keys and go either > >>> the front or back of the command. Is there a way to replicate the same > >>> behavior in the Erlang shell? It does some neat things, but having > >>> those features really make it come alive. > >>> Thoughts? > >> I think in Bash you better use Cmd+A (beginning of the string) > >> and Cmd+E (End of the string), this way you won't notice a difference > >> between Erlang shell and Bash. > > >> -- > >> vlm > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED > >http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions Now now, don't get me started ^_^. From erlang-questions_efine@REDACTED Tue Sep 16 22:59:10 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Tue, 16 Sep 2008 16:59:10 -0400 Subject: [erlang-questions] Some facts about Erlang and SMP In-Reply-To: References: Message-ID: <6c2563b20809161359x5448af06g50125c53ff956361@mail.gmail.com> Kenneth, Thank you very much for answering many, if not all, of my questions. It is extremely useful to get an authoritative answer like yours, upon which one can base objective performance-related decisions. For example, as you stated, >> Of course the running >> of several VM's require that the application can run >> in many parallel tasks which has no or very little communication with >> each other. If using -smp disable (not +S 1, which I mistakenly thought was equivalent to -smp disable), there are applications that could benefit considerably, such as those that have many thousands of concurrent TCP/IP-initiated processes (what Joe Armstrong calls "naturally concurrent") that are not related to each other and therefore have no significant cross-VM IPC. A non-database backed content-serving web site is one example. Partitioning what would amount to numerous HTTP GET requests across multiple Erlang -smp disabled VMs, one per core, using a hardware load balancer, is likely to show performance benefits over the homogeneous SMP approach. Note that this scenario is consistent with your requirements of (a) little or no cross-VM IPC and (b) little or no heavy Mnesia or ETS table sharing. One could potentially make good use of a CPU affinity command such as taskset (as you mentioned). This would have applicability where, for example, one wanted to "reserve" some CPUs for non-Erlang usage, such as to run some special-purpose high-priority application that would suffer performance-wise if it were to be preempted by the OS. If using -smp disable, then the single thread of a VM can safely be affinitied to a specific CPU or core and will not "migrate" to other processors. In addition, it is arguably possible that in this and similar scenarios, keeping a VM on a single core will benefit from improved processor and data cache hit rates and reduced or eliminated cache coherency storms. The part that is arguable is that if the VM itself is preempted, the contents of the processor cache may become invalidated anyway. This suggests that the VM should be run at an elevated priority and be kept busy so that it is always the top contender for the OS run queue and seldom gets rescheduled. Of course, this is advanced performance tweaking and will probably be unnecessary for the majority of Erlang applications. However, for those who are trying to wring the last iota of performance out of their applications, this information can be invaluable. In more common situations, this information can help Erlang-based system designers avoid lock contention by taking it into account when designing around database and ETS tables. In some cases it may make sense to have a process that owns a private table, and have all other processes interact with the table via this "gatekeeper". Careful measurement and thought will be needed to establish whether the bottleneck created by serializing access through an Erlang gen_server-style process is better or worse than the bottleneck created by serializing access through an ETS table lock, for example. One final thought is that whenever some product is invented for a specific purpose, and excels at that purpose, as it becomes more popular it begins to get used in ways that its original designers never anticipated. Some of these uses are in line with the original design intent, but push the envelope and need improvements to the product implementation, and others are simply stretching the capabilities of the product in inappropriate directions. This has been seen in numerous cases, and seems to stem from the desire to have one tool that can do everything, and not have to know and support multiple tools. Then we have a hammer, and the world starts to look like a collection of nails. As far as I can see, the answer is always the same: use the tool that is right for the job. Don't fall into the trap of "100% Pure Erlang" everywhere. It's less convenient, but if you want performance, offload the heavy crunching stuff to 'C' drivers. For example, instead of using xmerl for heavy XML processing, do what ejabberd does: use the 'C' expat parser via a linked-in driver. The Ruby community had exactly the same issue with XML parsing. Need heavy use of regular expressions? Use re, not regexp. Need heavy database processing? Maybe Mnesia is not the right tool for this particular job, although it may excel in the dimension for which it was designed: soft real-time telecomms applications. And so on. True, it is less convenient to have to step outside the environment in which one has become comfortable, and have architecture-specific applications (and risks to the robustness of the VM if the LID has any crashworthy bugs), but sometimes if you need the performance, and your algorithms are already appropriate, you have to use the right tool for the job and take the risks. As support for this argument, the AXD301 project has "a couple of million" lines of Erlang code, and at one point had over 1 million lines of C/C++ code. The exact numbers seem to be elusive or outdated (the Erlang FAQ is way out of date, and other documents I found are vague as to how much C/C++ is currently used); if someone (e.g. Ulf Wiger) could provide more accurate information I'd appreciate it. How much of the C/C++ code is used for device interfaces and is hence unavoidable, how much for efficiency considerations, and how much for other purposes is not known to me. Still, the point is that this is not a "100% pure Erlang" implementation, and I would be very surprised if at least some of that C/C++ code was not there for efficiency. Thank you again. Regards, Edwin Fine On Tue, Sep 16, 2008 at 5:34 AM, Kenneth Lundin wrote: > Here are some short facts about how the Erlang SMP implementation > works and how it > relates to performance and scalability. > > There will be a more detailed description of how multi core works and > on the future plans available > in a couple of weeks. I plan to include some of this in my > presentation at the ICFP2008, Erlang Workshop in Victoria BC, > September 27 > > The Erlang VM without SMP support has 1 scheduler which runs in the > main process thread. The scheduler > picks runnable Erlang processes and IO-jobs from the run-queue and > there is no need to lock data structures since > there is only one thread accessing them. > > The Erlang VM with SMP support can have 1 to many schedulers which are > run in 1 thread each. The schedulers pick runnable Erlang processes > and IO-jobs from one common run-queue. In the SMP VM all shared data > structures are > protected with locks, the run-queue is one example of a data structure > protected with locks. > > >From OTP R12B the SMP version of the VM is automatically started as > default if the OS reports more than 1 CPU (or Core) and with the same > number of schedulers as CPU's or Cores. > > You can see what was chosen at the first line of printout from the > "erl" command. E.g. > Erlang (BEAM) emulator version 5.6.4 [source] [smp:4] [asynch-threads:0] > ..... > > The "[smp:4]" above tells that the SMP VM is run and with 4 schedulers. > > The default behaviour can be overridden with the > "-smp [enable|disable|auto]" auto is default > and to set the number of schedulers, if smp is set to enable or auto > "+S Number" where Number is the number of schedulers (1..1024) > > Note ! that it is normally nothing to gain from running with more > schedulers than the number of CPU's or Cores. > Note2 ! On some operating systems the number of CPU's or Cores to be > used by a process can be restricted > with commands. For example on Linux the command "taskset" can be used > for this. The Erlang VM will > currently only detect number of available CPU's or Cores and will not > take the mask set by "taskset" into account. > Because of this it can happen and has happened that e.g. only 2 Cores > are used even if the Erlang VM > runs with 4 schedulers. It is the OS that limits this because it take > the mask from "taskset" into account. > > The schedulers in the Erlang VM are run on one OS-thread each and it > is the OS that decides if the threads are > executed on different Cores. Normally the OS will do this just fine > and will also keep the thread on the same Core throughout the > execution. > > The Erlang processes will be run by different schedulers because they > are picked from a common run-queue by > the first scheduler that becomes available. > > Performance and scalability > ------------------------------------ > > - The SMP VM with only one scheduler is slightly slower than the non > SMP VM. The SMP VM need to to use all the locks inside but as long as > there are no lock-conflicts the overhead caused by locking is not > significant (it is the lock conflicts that takes time). This explains > why it in some cases can be more efficient to run several SMP VM's > with one scheduler each > instead on one SMP VM with several schedulers. Of course the running > of several VM's require that the application can run > in many parallel tasks which has no or very little communication with > each other. > > - If a program scale well with the SMP VM over many cores depends very > much on the characteristics of the program, some programs scale > linearly up to 8 and even 16 cores while other programs barely scale > at all even on 2 cores. > This might sound bad, but in practice many real programs scale well on > the number of cores that are common on the > market today, see below. > > - Real telecoms products supporting a massive number if simultaneously > ongoing "calls" represented as one or several > Erlang processes per core have shown very good scalability on dual and > quad core processors. Note, that these products > was written in the normal Erlang style long before the SMP VM and > multi core processors where available and they > could benefit from the Erlang SMP VM without changes and even without > need to recompile the code. > > SMP performance is continually improved > ------------------------------------------------------ > > The SMP implementation is continually improved in order to get better > performance and scalability. In each service release > R12B-1, 2, 3, 4, 5 , ..., R13B etc. you will find new optimizations. > > Some known bottlenecks > --------------------------------- > > - The single common run-queue will become a dominant bottleneck when > the number of CPU's or Cores increase. > Will be visible from 4 cores and upwards, but 4 cores will probably > still give ok performance for many applications. > We are working on a solution with one run-queue per scheduler as the > most important improvement right now. > > - Ets tables involves locking. Before R12B-4 there was 2 locks > involved in every access to an ets-table, but > in R12B-4 the locking of the meta-table is optimized to reduce the > conflicts significantly (as mentioned earlier it is the conflicts that > are expensive). > If many Erlang processes access the same table there will be a lot of > lock conflicts causing bad performance especially if these processes > spend a majority of their work accessing ets-tables. > The locking is on table-level not on record level. > Note! that this will have impact on Mnesia as well since Mnesia is a > heavy user of ets-tables. > > ... > > Our strategy with SMP > ----------------------------- > > Already from the beginning when we started implementation of the SMP > VM we decided on the strategy: > "First make it work, then measure, then optimize". > We are still following this strategy consistently since the first > stable working SMP VM that we released in May 2006 (R11B). > > There are more known things to improve and we address them one by one > taking the one we think gives most > performance per implementation effort first and so on. > > We are putting most focus on getting consistent better scaling on many > cores (more than 4). > > Best in class > ----------------- > > Even if there are a number of known bottlenecks > the SMP system already has good overall performance and scalability > and I believe we are best in class > when it comes to letting the programmer utilize multi -core machines > in an easy productive way. > > /Kenneth Erlang/OTP team, Ericsson > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yoursurrogategod@REDACTED Tue Sep 16 23:40:47 2008 From: yoursurrogategod@REDACTED (YourSurrogateGod) Date: Tue, 16 Sep 2008 14:40:47 -0700 (PDT) Subject: [erlang-questions] A better shell. In-Reply-To: <15b6a55b-956f-45c8-b412-76751fe630ab@e53g2000hsa.googlegroups.com> References: <48CF2F1B.3070003@lionet.info> <2ae3549f-f1cb-4e3c-b7e3-d805c6de372a@m36g2000hse.googlegroups.com> <48CFF05B.90401@lionet.info> <15b6a55b-956f-45c8-b412-76751fe630ab@e53g2000hsa.googlegroups.com> Message-ID: <087d239c-07b5-47ef-9372-ae097ca12bcd@m45g2000hsb.googlegroups.com> Another annoyance is that I'm unable to use the Delete key. I have to use the Backspace key only if I want to take out an offending character. On Sep 16, 4:13?pm, YourSurrogateGod wrote: > On Sep 16, 1:43?pm, Lev Walkin wrote: > > > > > > > YourSurrogateGod wrote: > > > Yeh, but I should be able to customize it as I see fit and bend it to > > > my will. I don't want to come across as whining, but it seems silly > > > that you can't have the program behave as you see fit. > > > Good luck adding Cmd+A / Cmd+A sequences to Microsoft Word :) > > > > On Sep 15, 11:59 pm, Lev Walkin wrote: > > >> YourSurrogateGod wrote: > > >>> I'm used to working with Bash and Z-shell on my Linux PC. They're both > > >>> great at what they do. I can hit the Home and End keys and go either > > >>> the front or back of the command. Is there a way to replicate the same > > >>> behavior in the Erlang shell? It does some neat things, but having > > >>> those features really make it come alive. > > >>> Thoughts? > > >> I think in Bash you better use Cmd+A (beginning of the string) > > >> and Cmd+E (End of the string), this way you won't notice a difference > > >> between Erlang shell and Bash. > > > >> -- > > >> vlm > > >> _______________________________________________ > > >> erlang-questions mailing list > > >> erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questi...@REDACTED > > >http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions > > Now now, don't get me started ^_^. > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From rvirding@REDACTED Tue Sep 16 23:57:41 2008 From: rvirding@REDACTED (Robert Virding) Date: Tue, 16 Sep 2008 23:57:41 +0200 Subject: [erlang-questions] A better shell. In-Reply-To: <087d239c-07b5-47ef-9372-ae097ca12bcd@m45g2000hsb.googlegroups.com> References: <48CF2F1B.3070003@lionet.info> <2ae3549f-f1cb-4e3c-b7e3-d805c6de372a@m36g2000hse.googlegroups.com> <48CFF05B.90401@lionet.info> <15b6a55b-956f-45c8-b412-76751fe630ab@e53g2000hsa.googlegroups.com> <087d239c-07b5-47ef-9372-ae097ca12bcd@m45g2000hsb.googlegroups.com> Message-ID: <3dbc6d1c0809161457v2ed4f29bxe16bcc124dbf06f5@mail.gmail.com> Well, I suppose one answer is to go in and hack edlin.erl which is in stdlib. Then you can change the commands to be whatever you like. As long as you only use the already defined operations it is not difficult. Of course the alternative is to learn the emacs commands. :-) Robert P.S. Does anyone know how to make gmail/Firefox use emacs commands instead of the ones they do now? 2008/9/16 YourSurrogateGod > Another annoyance is that I'm unable to use the Delete key. I have to > use the Backspace key only if I want to take out an offending > character. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yoursurrogategod@REDACTED Wed Sep 17 00:18:09 2008 From: yoursurrogategod@REDACTED (YourSurrogateGod) Date: Tue, 16 Sep 2008 15:18:09 -0700 (PDT) Subject: [erlang-questions] A better shell. In-Reply-To: <3dbc6d1c0809161457v2ed4f29bxe16bcc124dbf06f5@mail.gmail.com> References: <48CF2F1B.3070003@lionet.info> <2ae3549f-f1cb-4e3c-b7e3-d805c6de372a@m36g2000hse.googlegroups.com> <48CFF05B.90401@lionet.info> <15b6a55b-956f-45c8-b412-76751fe630ab@e53g2000hsa.googlegroups.com> <087d239c-07b5-47ef-9372-ae097ca12bcd@m45g2000hsb.googlegroups.com> <3dbc6d1c0809161457v2ed4f29bxe16bcc124dbf06f5@mail.gmail.com> Message-ID: Actually, that sounds like a fun project after I feel confident enough with Erlang. On Sep 16, 5:57?pm, "Robert Virding" wrote: > Well, I suppose one answer is to go in and hack edlin.erl which is in > stdlib. Then you can change the commands to be whatever you like. As long as > you only use the already defined operations it is not difficult. > > Of course the alternative is to learn the emacs commands. :-) > > Robert > > P.S. Does anyone know how to make gmail/Firefox use emacs commands instead > of the ones they do now? > > 2008/9/16 YourSurrogateGod > > > > > Another annoyance is that I'm unable to use the Delete key. I have to > > use the Backspace key only if I want to take out an offending > > character. > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From gleber.p@REDACTED Wed Sep 17 00:47:47 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 17 Sep 2008 00:47:47 +0200 Subject: [erlang-questions] A better shell. In-Reply-To: <3dbc6d1c0809161457v2ed4f29bxe16bcc124dbf06f5@mail.gmail.com> References: <48CF2F1B.3070003@lionet.info> <2ae3549f-f1cb-4e3c-b7e3-d805c6de372a@m36g2000hse.googlegroups.com> <48CFF05B.90401@lionet.info> <15b6a55b-956f-45c8-b412-76751fe630ab@e53g2000hsa.googlegroups.com> <087d239c-07b5-47ef-9372-ae097ca12bcd@m45g2000hsb.googlegroups.com> <3dbc6d1c0809161457v2ed4f29bxe16bcc124dbf06f5@mail.gmail.com> Message-ID: <14f0e3620809161547x32377a37ke4c9abee0a8c41e1@mail.gmail.com> Check out Conkeror project (and old Conkeror extension for Firefox too). BR On 9/16/08, Robert Virding wrote: > Well, I suppose one answer is to go in and hack edlin.erl which is in > stdlib. Then you can change the commands to be whatever you like. As long as > you only use the already defined operations it is not difficult. > > Of course the alternative is to learn the emacs commands. :-) > > Robert > > P.S. Does anyone know how to make gmail/Firefox use emacs commands instead > of the ones they do now? > > 2008/9/16 YourSurrogateGod > >> Another annoyance is that I'm unable to use the Delete key. I have to >> use the Backspace key only if I want to take out an offending >> character. >> >> > -- Sent from Gmail for mobile | mobile.google.com Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From rvirding@REDACTED Wed Sep 17 01:43:39 2008 From: rvirding@REDACTED (Robert Virding) Date: Wed, 17 Sep 2008 01:43:39 +0200 Subject: [erlang-questions] A better shell. In-Reply-To: <14f0e3620809161547x32377a37ke4c9abee0a8c41e1@mail.gmail.com> References: <48CF2F1B.3070003@lionet.info> <2ae3549f-f1cb-4e3c-b7e3-d805c6de372a@m36g2000hse.googlegroups.com> <48CFF05B.90401@lionet.info> <15b6a55b-956f-45c8-b412-76751fe630ab@e53g2000hsa.googlegroups.com> <087d239c-07b5-47ef-9372-ae097ca12bcd@m45g2000hsb.googlegroups.com> <3dbc6d1c0809161457v2ed4f29bxe16bcc124dbf06f5@mail.gmail.com> <14f0e3620809161547x32377a37ke4c9abee0a8c41e1@mail.gmail.com> Message-ID: <3dbc6d1c0809161643t33fb3a80l7cb4b330333a1ef7@mail.gmail.com> Thanks for the tip. Only problem is that Conkeror is now a separate browser. However, you did get me searching and I found an add-on to Firefox (which I use) called Firemacs which gives a some of the common key bindings inside Firefox. I will check it out and see what I think. Robert 2008/9/17 Gleb Peregud > Check out Conkeror project (and old Conkeror extension for Firefox too). > > BR > > On 9/16/08, Robert Virding wrote: > > Well, I suppose one answer is to go in and hack edlin.erl which is in > > stdlib. Then you can change the commands to be whatever you like. As long > as > > you only use the already defined operations it is not difficult. > > > > Of course the alternative is to learn the emacs commands. :-) > > > > Robert > > > > P.S. Does anyone know how to make gmail/Firefox use emacs commands > instead > > of the ones they do now? > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tuncer.ayaz@REDACTED Wed Sep 17 11:44:05 2008 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Wed, 17 Sep 2008 11:44:05 +0200 Subject: [erlang-questions] A better shell. In-Reply-To: <3dbc6d1c0809161643t33fb3a80l7cb4b330333a1ef7@mail.gmail.com> References: <48CF2F1B.3070003@lionet.info> <2ae3549f-f1cb-4e3c-b7e3-d805c6de372a@m36g2000hse.googlegroups.com> <48CFF05B.90401@lionet.info> <15b6a55b-956f-45c8-b412-76751fe630ab@e53g2000hsa.googlegroups.com> <087d239c-07b5-47ef-9372-ae097ca12bcd@m45g2000hsb.googlegroups.com> <3dbc6d1c0809161457v2ed4f29bxe16bcc124dbf06f5@mail.gmail.com> <14f0e3620809161547x32377a37ke4c9abee0a8c41e1@mail.gmail.com> <3dbc6d1c0809161643t33fb3a80l7cb4b330333a1ef7@mail.gmail.com> Message-ID: <4ac8254d0809170244s4ebd31b1y4d0b361cdf3cb76f@mail.gmail.com> 2008/9/17 Robert Virding : > Thanks for the tip. Only problem is that Conkeror is now a separate browser. > However, you did get me searching and I found an add-on to Firefox (which I > use) called Firemacs which gives a some of the common key bindings inside > Firefox. I will check it out and see what I think. If you're on a Mac you can set the Accel key to Meta in about:config: ui.key.accelKey -> 224 If you're using Gtk+ you can switch Gtk+ to Emacs bindings in ~/.gtkrc-2.0: gtk-key-theme-name = "Emacs" All Vi fans could consider using the Vimperator extension. > Robert > > 2008/9/17 Gleb Peregud >> >> Check out Conkeror project (and old Conkeror extension for Firefox too). >> >> BR >> >> On 9/16/08, Robert Virding wrote: >> > Well, I suppose one answer is to go in and hack edlin.erl which is in >> > stdlib. Then you can change the commands to be whatever you like. As >> > long as >> > you only use the already defined operations it is not difficult. >> > >> > Of course the alternative is to learn the emacs commands. :-) >> > >> > Robert >> > >> > P.S. Does anyone know how to make gmail/Firefox use emacs commands >> > instead >> > of the ones they do now? >> > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From jerome@REDACTED Wed Sep 17 12:11:40 2008 From: jerome@REDACTED (=?ISO-8859-1?Q?J=E9r=F4me_Desquilbet?=) Date: Wed, 17 Sep 2008 12:11:40 +0200 Subject: [erlang-questions] Problem building OTP on OpenBSD Message-ID: <48D0D7DC.3010103@desquilbet.org> I get the following error while building OTP R12B-4 on OpenBSD 4.3. Any idea? Thanks a lot, J?r?me. === Entering application os_mon gmake[3]: Entering directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/src' gmake[3]: Nothing to be done for `opt'. gmake[3]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/src' gmake[3]: Entering directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gmake -f i386-unknown-openbsd4.3/Makefile TYPE=opt gmake[4]: Entering directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gcc -c -o ../priv/obj/i386-unknown-openbsd4.3/memsup.o -g -O2 -I/usr/tools/erlan g/otp_src_R12B-4/erts/i386-unknown-openbsd4.3 -DHAVE_CONFIG_H memsup.c memsup.c: In function `get_extended_mem': memsup.c:456: error: void value not ignored as it ought to be gmake[4]: *** [../priv/obj/i386-unknown-openbsd4.3/memsup.o] Error 1 gmake[4]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gmake[3]: *** [opt] Error 2 gmake[3]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gmake[2]: *** [opt] Error 2 gmake[2]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon' gmake[1]: *** [opt] Error 2 gmake[1]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib' gmake: *** [libs] Error 2 From als@REDACTED Wed Sep 17 16:23:23 2008 From: als@REDACTED (Anthony Shipman) Date: Thu, 18 Sep 2008 00:23:23 +1000 Subject: [erlang-questions] 12B4 dialyzer problem 5 Message-ID: <200809180023.23196.als@iinet.net.au> I had a -spec that read -spec getHandlerModule(string()) -> {ok, Module::atom(), StrmID::integer} | error. This caused code like case getHandlerModule(HName) of {ok, Mod, DefaultID} -> OptionMeta = Mod:optionMetadata(), checkForm(Sess, Arg, OptionMeta, createStream4(DefaultID, HName)); error -> returnError(text:get(invalidHandlerForm)) end. to result in the dialyzer message The pattern {'ok', Mod, DefaultID} can never match the type 'error' I can see where my typo is but I can't relate it the error message. I would expect that the pattern will always match and I'd get a type error further down-stream. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From als@REDACTED Wed Sep 17 16:36:33 2008 From: als@REDACTED (Anthony Shipman) Date: Thu, 18 Sep 2008 00:36:33 +1000 Subject: [erlang-questions] 12B4 ODBC bug Message-ID: <200809180036.33167.als@iinet.net.au> Environment: Erlang 12B4, unixODBC 2.2.11, postgresql-odbc 08.01.0200 Refer to odbcserver.c, line 551 and following. I ran an INSERT statement that violated a unique constraint. This resulted in the result code -1 = SQL_NULL_DATA and an error message [unixODBC]Error while executing the query (non-fatal);\nERROR: duplicate key violates unique constraint \"tfleet_config_fleet_id_key\" SQLSTATE IS: 00000 The code tries to recognise the ERROR at the beginning of the message but fails since it is on line 2. The execution then ends up at line 585 where it tries to encode a normal result. In encode_result() we get a fatal error at the DO_EXIT(EXIT_COLS); line. The Erlang code gets a connection_closed error. Two fixes are needed. 1. Look for ERROR using something like the gcc strcasestr() function. You may need to write your own for portability. 2. Handle the SQL_NULL_DATA result. I don't know what this code is supposed to mean. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From als@REDACTED Wed Sep 17 16:53:25 2008 From: als@REDACTED (Anthony Shipman) Date: Thu, 18 Sep 2008 00:53:25 +1000 Subject: [erlang-questions] Fwd: 12B4 ODBC bug Message-ID: <200809180053.25188.als@iinet.net.au> Further to my previous message. When the odbcserver exits the odbc application reports ODBC: received unexpected info: {tcp_closed,#Port<0.167>} which is untidy. Uglier is this stuff =SUPERVISOR REPORT==== 18-Sep-2008::00:47:49 === Supervisor: {local,odbc_sup} Context: child_terminated Reason: {port_exit,could_not_access_column_count} Offender: [{pid,<0.86.0>}, {name,[]}, {mfa,{odbc,start_link_sup,[[{client,<0.85.0>}]]}}, {restart_type,temporary}, {shutdown,7000}, {child_type,worker}] where could_not_access_column_count comes from the DO_EXIT(EXIT_COLS) ---------- Forwarded Message ---------- ............. Two fixes are needed. 1. Look for ERROR using something like the gcc strcasestr() function. You may need to write your own for portability. 2. Handle the SQL_NULL_DATA result. I don't know what this code is supposed to mean. ------------------------------------------------------- -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From kostis@REDACTED Wed Sep 17 16:56:54 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 17 Sep 2008 17:56:54 +0300 Subject: [erlang-questions] 12B4 dialyzer problem 5 In-Reply-To: <200809180023.23196.als@iinet.net.au> References: <200809180023.23196.als@iinet.net.au> Message-ID: <48D11AB6.6070802@cs.ntua.gr> Anthony Shipman wrote: > I had a -spec that read > > -spec getHandlerModule(string()) -> {ok, Module::atom(), StrmID::integer} | > error. You shouldn't have had ;-) To avoid typos like that, which sadly are very common, we _strongly_ recommend that you follow the convention of writing atoms quoted in spec declarations. I.e. that you write: -spec getHandlerModule(string()) -> {'ok', Module::atom(), StrmID::integer()} | 'error'. > This caused code like > > case getHandlerModule(HName) of > {ok, Mod, DefaultID} -> > OptionMeta = Mod:optionMetadata(), > checkForm(Sess, Arg, OptionMeta, createStream4(DefaultID, HName)); > error -> > returnError(text:get(invalidHandlerForm)) > end. > > to result in the dialyzer message > The pattern {'ok', Mod, DefaultID} can never match the type 'error' > > I can see where my typo is but I can't relate it the error message. I would > expect that the pattern will always match and I'd get a type error further > down-stream. You have a point, but that's not how it works. The inferred success typing of getHandlerModule/1 gets filtered by the spec declaration, so the {'ok', atom(), integer()} part of the success typing is thrown away (because it is not part of the specification of the function) and the only return value that remains for this function is the atom 'error'. Dialyzer has warning options which would provide more information in this case, but these options are off by default. I believe the option -Wunderspecs would have given you more clues. Kostis From kruegger@REDACTED Wed Sep 17 18:02:03 2008 From: kruegger@REDACTED (Stephen Han) Date: Thu, 18 Sep 2008 01:02:03 +0900 Subject: [erlang-questions] Yaws shows high memory usage and erlang:port_info shows 'undefined' Message-ID: <86f1f5350809170902r3761a336p654972b79d5daecb@mail.gmail.com> Hi I am running yaws server and I am seeing the memory is increased to 500M within a week. If I do, erlang:memory() command [{total,579289283}, {processes,6911229}, {processes_used,6902485}, {system,572378054}, {atom,560685}, {atom_used,545713}, {binary,560619647}, {code,4569203}, {ets,1805204}] I do see binary is using up that much. While try to debug this, I just ran the command [ erlang:port_info(X) || X <- erlang:ports() ]. I do see almost 1100+ 'undefined' entries shows up. Is this normal? Is there any relation with number of 'undefined' erlang ports and memory consumption issue? Can anyone point where the possible issues lie? thanks in advance... -------------- next part -------------- An HTML attachment was scrubbed... URL: From als@REDACTED Wed Sep 17 18:29:56 2008 From: als@REDACTED (Anthony Shipman) Date: Thu, 18 Sep 2008 02:29:56 +1000 Subject: [erlang-questions] 12B4 dialyzer problem 5 In-Reply-To: <48D11AB6.6070802@cs.ntua.gr> References: <200809180023.23196.als@iinet.net.au> <48D11AB6.6070802@cs.ntua.gr> Message-ID: <200809180229.56653.als@iinet.net.au> On Thu, 18 Sep 2008 12:56:54 am Kostis Sagonas wrote: > Thu Sep 18 00:56:54 2008 > ? > > Anthony Shipman wrote: > > I had a -spec that read > > > > -spec getHandlerModule(string()) -> {ok, Module::atom(), StrmID::integer} > > | error. > > You shouldn't have had ;-) > > To avoid typos like that, which sadly are very common, we _strongly_ > recommend that you follow the convention of writing atoms quoted in spec > declarations. ?I.e. that you write: > > -spec getHandlerModule(string()) -> > ????????{'ok', Module::atom(), StrmID::integer()} | 'error'. I think that that would only work well if dialyzer required it or warned when it found an unquoted atom. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From matthew@REDACTED Wed Sep 17 19:30:09 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Wed, 17 Sep 2008 10:30:09 -0700 Subject: [erlang-questions] Problem building OTP on OpenBSD In-Reply-To: <48D0D7DC.3010103@desquilbet.org> References: <48D0D7DC.3010103@desquilbet.org> Message-ID: On Wed, Sep 17, 2008 at 3:11 AM, J?r?me Desquilbet wrote: > I get the following error while building OTP R12B-4 on OpenBSD 4.3. > Any idea? It looks like get_extended_mem is calling get_extended_mem_bsd4 and checking the return value, but get_extended_mem_bsd4 returns void. I guess its function signature needs to change to return an int, and then the return statement needs to be changed to return 1? From joelr1@REDACTED Wed Sep 17 20:48:29 2008 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 17 Sep 2008 19:48:29 +0100 Subject: [erlang-questions] emacs indenting of when guards Message-ID: <24FC13D8-AFC5-44B0-B6F3-EBA853CF942C@gmail.com> I'm using the mode that came with R12B3. Can anyone indent B > C with A > B? I can't :-(. bar(A, B, C) when A > B; B > C -> ok. Is there a workaround for this? Thanks, Joel -- wagerlabs.com From andy@REDACTED Wed Sep 17 20:56:07 2008 From: andy@REDACTED (Andy Gross) Date: Wed, 17 Sep 2008 14:56:07 -0400 Subject: [erlang-questions] Compiling Erlang for the iPhone In-Reply-To: References: <5A017A52-FFE7-4DE7-A9AD-64183CF8DBDD@dauernheim.net> Message-ID: <41A4BCB4-B60E-4009-AFDB-1C06C5A6254A@andygross.org> Uwe, Unfortunately, the iPhone SDK Agreement forbids installation of non- Apple VMs or interpreters. :( Andy On Sep 14, 2008, at 12:49 PM, Uwe Dauernheim wrote: > Hej Chris, > > of course I'll do so, if I can deliver a benefit to the community. > > By the way: Anyone expierenced in the error message >>"lib/cpp" fails > sanity check< > Regards, > Uwe > > -- > > Am 14.09.2008 um 18:22 schrieb Chris Anderson: > >> On Sun, Sep 14, 2008 at 9:16 AM, Uwe Dauernheim >> wrote: >>> I'd like to compile Erlang for the iPhone. >> >> Uwe, >> >> I'm sorry I can't be helpful with an answer to your question, but I >> am >> very interested in your result. Please keep us posted on this list if >> you have success! >> >> Thanks, >> Chris >> >> -- >> Chris Anderson >> http://jchris.mfdz.com > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From webaccounts@REDACTED Wed Sep 17 20:57:47 2008 From: webaccounts@REDACTED (Dan Rubino) Date: Wed, 17 Sep 2008 19:57:47 +0100 Subject: [erlang-questions] Recommended standard Erlang project directory structure/layout... Message-ID: <1221677867.6051.6.camel@linux-box> Hi all, I am looking for documentation regarding a standard directory structure layout for Erlang projects. In Java we have the Maven standard layout which prescribes a layout for source/config/build etc. This of course works very well and keeps large projects well organised. As yet I have not found such a standard for Erlang. I was hoping the Joe Armstrong book would set this out but to my disappointment barely scratches the topic surface. So my question is - how are Erlang projects generally setup? What I am really after is a standard practice of sorts. Thanks, Dan From andy@REDACTED Wed Sep 17 21:10:01 2008 From: andy@REDACTED (Andy Gross) Date: Wed, 17 Sep 2008 15:10:01 -0400 Subject: [erlang-questions] Recommended standard Erlang project directory structure/layout... In-Reply-To: <1221677867.6051.6.camel@linux-box> References: <1221677867.6051.6.camel@linux-box> Message-ID: Dan, Check out the project skeleton for mochiweb: http://bob.pythonmac.org/archives/2007/12/17/using-the-mochiweb-project-skeleton/ Andy On Sep 17, 2008, at 2:57 PM, Dan Rubino wrote: > Hi all, > > I am looking for documentation regarding a standard directory > structure > layout for Erlang projects. In Java we have the Maven standard layout > which prescribes a layout for source/config/build etc. This of course > works very well and keeps large projects well organised. > > As yet I have not found such a standard for Erlang. I was hoping the > Joe > Armstrong book would set this out but to my disappointment barely > scratches the topic surface. > > So my question is - how are Erlang projects generally setup? What I am > really after is a standard practice of sorts. > > Thanks, > Dan > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From vances@REDACTED Wed Sep 17 21:14:56 2008 From: vances@REDACTED (Vance Shipley) Date: Wed, 17 Sep 2008 15:14:56 -0400 Subject: [erlang-questions] Recommended standard Erlang project directory structure/layout... In-Reply-To: <1221677867.6051.6.camel@linux-box> References: <1221677867.6051.6.camel@linux-box> Message-ID: <20080917191455.GB269@h216-235-12-173.host.egate.net> On Wed, Sep 17, 2008 at 07:57:47PM +0100, Dan Rubino wrote: } I am looking for documentation regarding a standard directory structure } layout for Erlang projects. http://www.erlang.org/doc/design_principles/applications.html#7.4 -Vance From gleber.p@REDACTED Wed Sep 17 21:16:58 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 17 Sep 2008 21:16:58 +0200 Subject: [erlang-questions] Recommended standard Erlang project directory structure/layout... In-Reply-To: References: <1221677867.6051.6.camel@linux-box> Message-ID: <14f0e3620809171216u2438d344sf5360d2fdf7eef6b@mail.gmail.com> I second that! I'm using it too On Wed, Sep 17, 2008 at 9:10 PM, Andy Gross wrote: > > Dan, > > Check out the project skeleton for mochiweb: http://bob.pythonmac.org/archives/2007/12/17/using-the-mochiweb-project-skeleton/ > > Andy > > > On Sep 17, 2008, at 2:57 PM, Dan Rubino wrote: > >> Hi all, >> >> I am looking for documentation regarding a standard directory >> structure >> layout for Erlang projects. In Java we have the Maven standard layout >> which prescribes a layout for source/config/build etc. This of course >> works very well and keeps large projects well organised. >> >> As yet I have not found such a standard for Erlang. I was hoping the >> Joe >> Armstrong book would set this out but to my disappointment barely >> scratches the topic surface. >> >> So my question is - how are Erlang projects generally setup? What I am >> really after is a standard practice of sorts. >> >> Thanks, >> Dan >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From joe@REDACTED Wed Sep 17 21:37:42 2008 From: joe@REDACTED (Joe Williams) Date: Wed, 17 Sep 2008 14:37:42 -0500 Subject: [erlang-questions] Recommended standard Erlang project directory structure/layout... In-Reply-To: <20080917191455.GB269@h216-235-12-173.host.egate.net> References: <1221677867.6051.6.camel@linux-box> <20080917191455.GB269@h216-235-12-173.host.egate.net> Message-ID: <48D15C86.206@joetify.com> Vance Shipley wrote: > On Wed, Sep 17, 2008 at 07:57:47PM +0100, Dan Rubino wrote: > } I am looking for documentation regarding a standard directory structure > } layout for Erlang projects. > > http://www.erlang.org/doc/design_principles/applications.html#7.4 > I have seen this layout use in a number of places and use it as well. -joe -- Name: Joseph A. Williams Email: joe@REDACTED From kenneth.lundin@REDACTED Wed Sep 17 21:38:40 2008 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 17 Sep 2008 21:38:40 +0200 Subject: [erlang-questions] Some facts about Erlang and SMP In-Reply-To: References: Message-ID: > ... > > Kenneth, > > Do you have any insight into why I might be seeing much higher CPU cost for > SMP on linux vs. Mac? Is there some difference in the lock implementations > that might be relevant? In general I don't think the measured CPU cost on different operating systems is a reliable way of measuring how well a program performs. I think is is more reliable to create measurements where the wall clock is used , e.g how long time does a certain operation take or how many calls per second can a system handle etc. Anyway the lock mechanisms used in the VM are: pthread mutex, for the run-queue pthread rwlock, for ets-tables inline spinlock and inline atomics these are part of the VM source code, for x86 32 and 64 bit, ppc 32 bit, sparc 32 and 64 bit. For other architectures the build will fall back to pthread spinlock and if that does not exist there is another fall back to pthread mutex. Linux and Mac OSx for x86 will use exactly the same spinlock and atomics but the pthread mutex and rwlock will be OS specific as well as the thread scheduling in general and this can of course give differences in performance even on the same HW. /Kenneth Erlang/OTP, Ericsson > > > -kevin > From vances@REDACTED Wed Sep 17 21:56:35 2008 From: vances@REDACTED (Vance Shipley) Date: Wed, 17 Sep 2008 15:56:35 -0400 Subject: [erlang-questions] Recommended standard Erlang project directory structure/layout... In-Reply-To: <48D15C86.206@joetify.com> References: <1221677867.6051.6.camel@linux-box> <20080917191455.GB269@h216-235-12-173.host.egate.net> <48D15C86.206@joetify.com> Message-ID: <20080917195634.GC269@h216-235-12-173.host.egate.net> On Wed, Sep 17, 2008 at 02:37:42PM -0500, Joe Williams wrote: > I have seen this layout use in a number of places and use it as well. This is how OTP is structured. Some other things which are standard practice aren't mentioned in the directory structure sections of OTP Design Principals: lib: OS driver libraries bin: OS executables c_src: C language source files (e.g. for drivers) java_src: Java language source files examples: Example code mibs: SNMP MIBs -Vance From stondage123@REDACTED Wed Sep 17 22:30:25 2008 From: stondage123@REDACTED (Andrew Stone) Date: Wed, 17 Sep 2008 13:30:25 -0700 (PDT) Subject: [erlang-questions] Compiling Erlang for the iPhone Message-ID: <830782.33866.qm@web35905.mail.mud.yahoo.com> Yep that sounds about right. Should've bought an OpenMoko. ----- Original Message ---- From: Andy Gross To: Uwe Dauernheim Cc: Erlang Questions Sent: Wednesday, September 17, 2008 2:56:07 PM Subject: Re: [erlang-questions] Compiling Erlang for the iPhone Uwe, Unfortunately, the iPhone SDK Agreement forbids installation of non- Apple VMs or interpreters. :( Andy On Sep 14, 2008, at 12:49 PM, Uwe Dauernheim wrote: > Hej Chris, > > of course I'll do so, if I can deliver a benefit to the community. > > By the way: Anyone expierenced in the error message >>"lib/cpp" fails > sanity check< > Regards, > Uwe > > -- > > Am 14.09.2008 um 18:22 schrieb Chris Anderson: > >> On Sun, Sep 14, 2008 at 9:16 AM, Uwe Dauernheim >> wrote: >>> I'd like to compile Erlang for the iPhone. >> >> Uwe, >> >> I'm sorry I can't be helpful with an answer to your question, but I >> am >> very interested in your result. Please keep us posted on this list if >> you have success! >> >> Thanks, >> Chris >> >> -- >> Chris Anderson >> http://jchris.mfdz.com > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From rvirding@REDACTED Wed Sep 17 23:47:51 2008 From: rvirding@REDACTED (Robert Virding) Date: Wed, 17 Sep 2008 23:47:51 +0200 Subject: [erlang-questions] Auto newline in emacs erlang mode Message-ID: <3dbc6d1c0809171447o3ef2426fu3570f06d02101925@mail.gmail.com> Is there a clean way to off the auto newline and indenting after a '->'? It's driving me nuts! It is easier to add it when you want it than remove it all the time you don't. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Wed Sep 17 23:59:24 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 18 Sep 2008 00:59:24 +0300 Subject: [erlang-questions] 12B4 dialyzer problem 5 In-Reply-To: <200809180229.56653.als@iinet.net.au> References: <200809180023.23196.als@iinet.net.au> <48D11AB6.6070802@cs.ntua.gr> <200809180229.56653.als@iinet.net.au> Message-ID: <48D17DBC.70305@cs.ntua.gr> Anthony Shipman wrote: > On Thu, 18 Sep 2008 12:56:54 am Kostis Sagonas wrote: >> >> To avoid typos like that, which sadly are very common, we _strongly_ >> recommend that you follow the convention of writing atoms quoted in spec >> declarations. I.e. that you write: >> >> -spec getHandlerModule(string()) -> >> {'ok', Module::atom(), StrmID::integer()} | 'error'. > > I think that that would only work well if dialyzer required it or warned when > it found an unquoted atom. You are right. This has been on our wish list (not for Dialyzer, but for the compiler), but it is very difficult to do since the quotes are removed as early as the tokenizer in Erlang. Seems very difficult to achieve. Kostis From ulf@REDACTED Thu Sep 18 00:27:46 2008 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 18 Sep 2008 00:27:46 +0200 Subject: [erlang-questions] Auto newline in emacs erlang mode In-Reply-To: <3dbc6d1c0809171447o3ef2426fu3570f06d02101925@mail.gmail.com> References: <3dbc6d1c0809171447o3ef2426fu3570f06d02101925@mail.gmail.com> Message-ID: <8209f740809171527nec89ef8u603e4f134c626c75@mail.gmail.com> I guess the easiest way would be to set erlang-electric-commands to nil. That would deactivate all electric commands. >From erlang.el: (defvar erlang-electric-commands '(erlang-electric-comma erlang-electric-semicolon erlang-electric-gt) "*List of activated electric commands. The list should contain the electric commands which should be active. Currently, the available electric commands are: `erlang-electric-comma' `erlang-electric-semicolon' `erlang-electric-gt' `erlang-electric-newline' Should the variable be bound to t, all electric commands are activated. To deactivate all electric commands, set this variable to nil.") Of course, you could also redefine it to include just the commands you want... BR, Ulf W 2008/9/17 Robert Virding : > Is there a clean way to off the auto newline and indenting after a '->'? > It's driving me nuts! It is easier to add it when you want it than remove it > all the time you don't. > > Robert > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From yoursurrogategod@REDACTED Thu Sep 18 00:49:12 2008 From: yoursurrogategod@REDACTED (YourSurrogateGod) Date: Wed, 17 Sep 2008 15:49:12 -0700 (PDT) Subject: [erlang-questions] A better shell. In-Reply-To: <4ac8254d0809170244s4ebd31b1y4d0b361cdf3cb76f@mail.gmail.com> References: <48CF2F1B.3070003@lionet.info> <2ae3549f-f1cb-4e3c-b7e3-d805c6de372a@m36g2000hse.googlegroups.com> <48CFF05B.90401@lionet.info> <15b6a55b-956f-45c8-b412-76751fe630ab@e53g2000hsa.googlegroups.com> <087d239c-07b5-47ef-9372-ae097ca12bcd@m45g2000hsb.googlegroups.com> <3dbc6d1c0809161457v2ed4f29bxe16bcc124dbf06f5@mail.gmail.com> <14f0e3620809161547x32377a37ke4c9abee0a8c41e1@mail.gmail.com> <3dbc6d1c0809161643t33fb3a80l7cb4b330333a1ef7@mail.gmail.com> <4ac8254d0809170244s4ebd31b1y4d0b361cdf3cb76f@mail.gmail.com> Message-ID: Speaking of GTK bindings. Are there any so that one could make Gnome applications (use all of the widgets and such) with Erlang? I haven't heard of any at the moment... If there are tutorials or examples, that would be great. On Sep 17, 5:44?am, "Tuncer Ayaz" wrote: > 2008/9/17 Robert Virding : > > > Thanks for the tip. Only problem is that Conkeror is now a separate browser. > > However, you did get me searching and I found an add-on to Firefox (which I > > use) called Firemacs which gives a some of the common key bindings inside > > Firefox. I will check it out and see what I think. > > If you're on a Mac you can set the Accel key to Meta in about:config: > ui.key.accelKey -> 224 > > If you're using Gtk+ you can switch Gtk+ to Emacs bindings in ~/.gtkrc-2.0: > gtk-key-theme-name = "Emacs" > > All Vi fans could consider using the Vimperator extension. > > > > > > > Robert > > > 2008/9/17 Gleb Peregud > > >> Check out Conkeror project (and old Conkeror extension for Firefox too). > > >> BR > > >> On 9/16/08, Robert Virding wrote: > >> > Well, I suppose one answer is to go in and hack edlin.erl which is in > >> > stdlib. Then you can change the commands to be whatever you like. As > >> > long as > >> > you only use the already defined operations it is not difficult. > > >> > Of course the alternative is to learn the emacs commands. :-) > > >> > Robert > > >> > P.S. Does anyone know how to make gmail/Firefox use emacs commands > >> > instead > >> > of the ones they do now? > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED > >http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From egil@REDACTED Thu Sep 18 01:34:35 2008 From: egil@REDACTED (=?ISO-8859-1?Q?Bj=F6rn-Egil_Dahlberg?=) Date: Thu, 18 Sep 2008 01:34:35 +0200 Subject: [erlang-questions] Problem building OTP on OpenBSD In-Reply-To: <48D0D7DC.3010103@desquilbet.org> References: <48D0D7DC.3010103@desquilbet.org> Message-ID: <48D1940B.9020807@erix.ericsson.se> Yes, it is an error. The following changes should resolve this issue: diff -Nau c_src/memsup.c@@/main/release/r12b_patch/OTP_R12B-4 c_src/memsup.c@@/main/release/r12b_patch/r12b_otp_7558/LATEST --- c_src/memsup.c@@/main/release/r12b_patch/OTP_R12B-4 2008-09-01 14:51:12.000000000 +0200 +++ c_src/memsup.c@@/main/release/r12b_patch/r12b_otp_7558/LATEST 2008-09-18 01:05:58.000000000 +0200 @@ -404,13 +404,13 @@ #endif #if defined(BSD4_4) -static void +static int get_extended_mem_bsd4(memory_ext *me) { struct vmtotal vt; long pgsz; - if (!get_vmtotal(&vt)) goto fail; - if ((pgsz = sysconf(_SC_PAGESIZE)) == -1) goto fail; + if (!get_vmtotal(&vt)) return 0; + if ((pgsz = sysconf(_SC_PAGESIZE)) == -1) return 0; me->total = (vt.t_free + vt.t_rm); me->free = vt.t_free; @@ -418,10 +418,7 @@ me->flag = F_MEM_TOTAL | F_MEM_FREE; - return; -fail: - print_error("%s", strerror(errno)); - exit(1); + return 1; } #endif The build has been tested on: FreeBSD 5.0-RELEASE #0: Thu Jan 16 22:16:53 GMT 2003 OpenBSD 4.0 GENERIC.RAID#2 sparc64 Regards, Bj?rn-Egil Erlang/OTP J?r?me Desquilbet wrote: > I get the following error while building OTP R12B-4 on OpenBSD 4.3. > Any idea? > Thanks a lot, > J?r?me. > > > === Entering application os_mon > gmake[3]: Entering directory > `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/src' > gmake[3]: Nothing to be done for `opt'. > gmake[3]: Leaving directory > `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/src' > gmake[3]: Entering directory > `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' > > gmake -f i386-unknown-openbsd4.3/Makefile TYPE=opt > gmake[4]: Entering directory > `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' > > gcc -c -o ../priv/obj/i386-unknown-openbsd4.3/memsup.o -g -O2 > -I/usr/tools/erlan > g/otp_src_R12B-4/erts/i386-unknown-openbsd4.3 -DHAVE_CONFIG_H memsup.c > memsup.c: In function `get_extended_mem': > memsup.c:456: error: void value not ignored as it ought to be > gmake[4]: *** [../priv/obj/i386-unknown-openbsd4.3/memsup.o] Error 1 > gmake[4]: Leaving directory > `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' > gmake[3]: *** [opt] Error 2 > gmake[3]: Leaving directory > `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' > gmake[2]: *** [opt] Error 2 > gmake[2]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon' > gmake[1]: *** [opt] Error 2 > gmake[1]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib' > gmake: *** [libs] Error 2 > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From bob@REDACTED Thu Sep 18 02:58:59 2008 From: bob@REDACTED (Bob Ippolito) Date: Wed, 17 Sep 2008 17:58:59 -0700 Subject: [erlang-questions] Compiling Erlang for the iPhone In-Reply-To: <41A4BCB4-B60E-4009-AFDB-1C06C5A6254A@andygross.org> References: <5A017A52-FFE7-4DE7-A9AD-64183CF8DBDD@dauernheim.net> <41A4BCB4-B60E-4009-AFDB-1C06C5A6254A@andygross.org> Message-ID: <6a36e7290809171758s2ea4ad25v7c98a1b8b377b6b@mail.gmail.com> I think it might actually say that you can't have a VM or interpreter that will run code over the network, I think you can use one as long as the code it's executing is static. (I haven't read the SDK agreement, but I did hear people talking at length about iPhone stuff at C4[2] recently) On Wed, Sep 17, 2008 at 11:56 AM, Andy Gross wrote: > > Uwe, > > Unfortunately, the iPhone SDK Agreement forbids installation of non- > Apple VMs or interpreters. :( > > Andy > > > On Sep 14, 2008, at 12:49 PM, Uwe Dauernheim wrote: > >> Hej Chris, >> >> of course I'll do so, if I can deliver a benefit to the community. >> >> By the way: Anyone expierenced in the error message >>"lib/cpp" fails >> sanity check<> >> Regards, >> Uwe >> >> -- >> >> Am 14.09.2008 um 18:22 schrieb Chris Anderson: >> >>> On Sun, Sep 14, 2008 at 9:16 AM, Uwe Dauernheim >>> wrote: >>>> I'd like to compile Erlang for the iPhone. >>> >>> Uwe, >>> >>> I'm sorry I can't be helpful with an answer to your question, but I >>> am >>> very interested in your result. Please keep us posted on this list if >>> you have success! >>> >>> Thanks, >>> Chris >>> >>> -- >>> Chris Anderson >>> http://jchris.mfdz.com >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ok@REDACTED Thu Sep 18 08:41:28 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 18 Sep 2008 18:41:28 +1200 Subject: [erlang-questions] lists:seq/[2,3] bug? Message-ID: <469D2176-D5D1-4C72-A849-E552184FCECE@cs.otago.ac.nz> On my Mac I have Erlang R12B-3. erl -version says Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 5.6.3 lists:seq(1, N) gives me the expected N-element list for integers N >= 1. I expect, indeed, I would require, that lists:seq(1, 0) should give me the empty list. Instead, 2> lists:seq(1, 0). ** exception error: no function clause matching lists:seq(1,0) 3> lists:seq(1, 0, 1). ** exception error: no function clause matching lists:seq(1,0,1) Here's a version of seq/2 that does what I expect. seq(Min, Max) when is_integer(Min), is_integer(Max), Min-1 =< Max -> seq_loop(Max-Min+1, Max, []). seq_loop(N, X, L) when N >= 4 -> seq_loop(N-4, X-4, [X-3,X-2,X-1,X|L]); seq_loop(N, X, L) when N >= 2 -> seq_loop(N-2, X-2, [X-1,X|L]); seq_loop(1, X, L) -> [X|L]; seq_loop(0, _, L) -> L. We expect length(lists:seq(L, U)) == U-L+1. It does make sense to report an error when U < L-1, because there is no way the result can have negative length. But the empty list is a perfectly good list. If people agree that this is a bug I'll provide a version of lists:seq/3 that behaves itself. We do expect that lists:seq(L, U) and lists:seq(L, U, 1) will give the same answer, after all. -- If stupidity were a crime, who'd 'scape hanging? From richardc@REDACTED Thu Sep 18 09:00:23 2008 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 18 Sep 2008 09:00:23 +0200 Subject: [erlang-questions] GTK bindings In-Reply-To: References: <48CF2F1B.3070003@lionet.info> <2ae3549f-f1cb-4e3c-b7e3-d805c6de372a@m36g2000hse.googlegroups.com> <48CFF05B.90401@lionet.info> <15b6a55b-956f-45c8-b412-76751fe630ab@e53g2000hsa.googlegroups.com> <087d239c-07b5-47ef-9372-ae097ca12bcd@m45g2000hsb.googlegroups.com> <3dbc6d1c0809161457v2ed4f29bxe16bcc124dbf06f5@mail.gmail.com> <14f0e3620809161547x32377a37ke4c9abee0a8c41e1@mail.gmail.com> <3dbc6d1c0809161643t33fb3a80l7cb4b330333a1ef7@mail.gmail.com> <4ac8254d0809170244s4ebd31b1y4d0b361cdf3cb76f@mail.gmail.com> Message-ID: <48D1FC87.8030601@it.uu.se> YourSurrogateGod wrote: > Speaking of GTK bindings. Are there any so that one could make Gnome > applications (use all of the widgets and such) with Erlang? I haven't > heard of any at the moment... The most mature (and portable) alternative is probably WxErlang: http://www.erlang.org/~dgud/wxerlang/ http://sourceforge.net/projects/wxerlang/ There are also a couple of attempts at direct GTK bindings, but don't know what their status is: http://code.google.com/p/gtknode/ http://erlgtk.sourceforge.net/ /Richard From nc@REDACTED Thu Sep 18 09:05:47 2008 From: nc@REDACTED (Nicolas Charpentier) Date: Thu, 18 Sep 2008 09:05:47 +0200 Subject: [erlang-questions] lists:seq/[2,3] bug? In-Reply-To: <469D2176-D5D1-4C72-A849-E552184FCECE@cs.otago.ac.nz> References: <469D2176-D5D1-4C72-A849-E552184FCECE@cs.otago.ac.nz> Message-ID: <48D1FDCB.1000100@charpi.net> Richard A. O'Keefe wrote: > On my Mac I have Erlang R12B-3. > erl -version says > Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 5.6.3 > > lists:seq(1, N) gives me the expected N-element list for > integers N >= 1. I expect, indeed, I would require, that > lists:seq(1, 0) should give me the empty list. Instead, > Hi, According to the documentation, the meaning of the first argument is the first value and the second one is the *final* value of the sequence not the length of the sequence. I think that your proposition will break a lot of code. Some example of lists:seq usage. Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.3 (abort with ^G) 1> lists:seq(2,3). [2,3] 2> lists:seq(2,0,-1). [2,1,0] 3> Regards, --- Nicolas Charpentie From ok@REDACTED Thu Sep 18 09:27:57 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 18 Sep 2008 19:27:57 +1200 Subject: [erlang-questions] lists:seq/[2,3] bug? In-Reply-To: <6339_1221721961_m8I7Cc6f016403_48D1FDCB.1000100@charpi.net> References: <469D2176-D5D1-4C72-A849-E552184FCECE@cs.otago.ac.nz> <6339_1221721961_m8I7Cc6f016403_48D1FDCB.1000100@charpi.net> Message-ID: On 18 Sep 2008, at 7:05 pm, Nicolas Charpentier wrote: > Richard A. O'Keefe wrote: > > On my Mac I have Erlang R12B-3. > > erl -version says > > Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 5.6.3 > > > > lists:seq(1, N) gives me the expected N-element list for > > integers N >= 1. I expect, indeed, I would require, that > > lists:seq(1, 0) should give me the empty list. Instead, > > > > Hi, > > According to the documentation, the meaning of the first argument is > the first value and the second one is the *final* value of the > sequence not the length of the sequence. Nobody, least of all me, ever said, thought, or for one instant imagined that the last argument was supposed to be the length of the sequence. Perhaps the fact of my example starting at 1 confused you. What I supposed about the length is no more than what is true: L = lists:seq(Min, Max) implies length(L) == Max - Min + 1. What I want is for this to hold in ALL cases where it COULD hold, including the empty list case length(L) == 0, when Max = Min - 1. Here's another example: lists:seq(5, 7) => [5,6,7] lists:seq(5, 6) => [5,6] lists:seq(5, 5) => [5] lists:seq(5, 4) *SHOULD* => [] but actually blows up. > > I think that your proposition will break a lot of code. Why do you think that? The correction I want ONLY affects cases where the current version blows up; whenever the current version returns any answer at all, mine returns the same one. > > Some example of lists:seq usage. > > Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads: > 0] [hipe] [kernel-poll:false] > > Eshell V5.6.3 (abort with ^G) > 1> lists:seq(2,3). > [2,3] Works with my code. > > 2> lists:seq(2,0,-1). > [2,1,0] I only provided model code for seq/2, but yes, with my code this also works identically. The only difference is that with my code seq(-1, 0, -1) => [] instead of wrongly blowing up. Here's the code with 'typer' specs. -spec(seq/2 :: (integer(),integer()) -> [integer()]). seq(Min, Max) when is_integer(Min), is_integer(Max), Min-1 =< Max -> seq_loop(Max-Min+1, Max, []). -spec(seq_loop/3 :: (non_neg_integer(),integer(),[integer()]) -> [integer()]). seq_loop(N, X, L) when N >= 4 -> seq_loop(N-4, X-4, [X-3,X-2,X-1,X|L]); seq_loop(N, X, L) when N >= 2 -> seq_loop(N-2, X-2, [X-1,X|L]); seq_loop(1, X, L) -> [X|L]; seq_loop(0, _, L) -> L. -spec(seq/3 :: (integer(),integer(),integer()) -> [integer()]). seq(Min, Max, Inc) when is_integer(Min), is_integer(Max), is_integer(Inc) -> if Inc > 0, Min - Inc =< Max -> N = (Max - Min + Inc) div Inc, seq_loop(N, Inc*(N-1)+Min, Inc, []) ; Inc < 0, Min - Inc >= Max -> N = (Min - Max - Inc) div (-Inc), seq_loop(N, Inc*(N-1)+Min, Inc, []) ; Inc == 0, Min == Max -> [Min] end. -spec(seq_loop/4 :: (non_neg_integer(),integer(),integer(),[integer()]) -> [integer()]). seq_loop(N, X, D, L) when N >= 4 -> Y = X-D, Z = Y-D, W = Z-D, seq_loop(N-4, W-D, D, [W,Z,Y,X|L]); seq_loop(N, X, D, L) when N >= 2 -> Y = X-D, seq_loop(N-2, Y-D, D, [Y,X|L]); seq_loop(1, X, _, L) -> [X|L]; seq_loop(0, _, _, L) -> L. From jeffm@REDACTED Mon Sep 15 05:01:14 2008 From: jeffm@REDACTED (jm) Date: Mon, 15 Sep 2008 13:01:14 +1000 Subject: [erlang-questions] Erlang in Australia? Message-ID: <48CDCFFA.3090907@ghostgun.com> Curious to know who's using Erang in Australia especially companies. Jeff. From tony@REDACTED Thu Sep 18 10:59:51 2008 From: tony@REDACTED (Tony Rogvall) Date: Thu, 18 Sep 2008 10:59:51 +0200 Subject: [erlang-questions] Compiling Erlang for the iPhone In-Reply-To: <6a36e7290809171758s2ea4ad25v7c98a1b8b377b6b@mail.gmail.com> References: <5A017A52-FFE7-4DE7-A9AD-64183CF8DBDD@dauernheim.net> <41A4BCB4-B60E-4009-AFDB-1C06C5A6254A@andygross.org> <6a36e7290809171758s2ea4ad25v7c98a1b8b377b6b@mail.gmail.com> Message-ID: There are alternatives. You do not have to go the apple way if you use Pawnage tool. Then you can build packages for the Cydia installer. The cross compiler can be found at Mac Ports. It require that you do have a copy of the root file system on the build machine. /Tony On 18 sep 2008, at 02.58, Bob Ippolito wrote: > I think it might actually say that you can't have a VM or interpreter > that will run code over the network, I think you can use one as long > as the code it's executing is static. > > (I haven't read the SDK agreement, but I did hear people talking at > length about iPhone stuff at C4[2] recently) > > On Wed, Sep 17, 2008 at 11:56 AM, Andy Gross > wrote: >> >> Uwe, >> >> Unfortunately, the iPhone SDK Agreement forbids installation of non- >> Apple VMs or interpreters. :( >> >> Andy >> >> >> On Sep 14, 2008, at 12:49 PM, Uwe Dauernheim wrote: >> >>> Hej Chris, >>> >>> of course I'll do so, if I can deliver a benefit to the community. >>> >>> By the way: Anyone expierenced in the error message >>"lib/cpp" >>> fails >>> sanity check<>> >>> Regards, >>> Uwe >>> >>> -- >>> >>> Am 14.09.2008 um 18:22 schrieb Chris Anderson: >>> >>>> On Sun, Sep 14, 2008 at 9:16 AM, Uwe Dauernheim >>>> >>>> wrote: >>>>> I'd like to compile Erlang for the iPhone. >>>> >>>> Uwe, >>>> >>>> I'm sorry I can't be helpful with an answer to your question, but I >>>> am >>>> very interested in your result. Please keep us posted on this >>>> list if >>>> you have success! >>>> >>>> Thanks, >>>> Chris >>>> >>>> -- >>>> Chris Anderson >>>> http://jchris.mfdz.com >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From adam@REDACTED Thu Sep 18 11:00:31 2008 From: adam@REDACTED (Adam Lindberg) Date: Thu, 18 Sep 2008 11:00:31 +0200 Subject: [erlang-questions] emacs indenting of when guards In-Reply-To: <24FC13D8-AFC5-44B0-B6F3-EBA853CF942C@gmail.com> References: <24FC13D8-AFC5-44B0-B6F3-EBA853CF942C@gmail.com> Message-ID: <6344005f0809180200u7c742317j2dff19900eaac8fc@mail.gmail.com> I'm not sure, but it's possible the erlware-mode might have solved this: http://code.google.com/p/erlware-mode/ Cheers! Adam On Wed, Sep 17, 2008 at 20:48, Joel Reymont wrote: > I'm using the mode that came with R12B3. > > Can anyone indent B > C with A > B? I can't :-(. > > bar(A, B, C) > when A > B; > B > C -> > ok. > > Is there a workaround for this? > > Thanks, Joel > > -- > wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From exta7@REDACTED Thu Sep 18 12:21:19 2008 From: exta7@REDACTED (Zvi) Date: Thu, 18 Sep 2008 03:21:19 -0700 (PDT) Subject: [erlang-questions] lists:seq/[2,3] bug? In-Reply-To: References: <469D2176-D5D1-4C72-A849-E552184FCECE@cs.otago.ac.nz> Message-ID: <19549838.post@talk.nabble.com> Richard, 1. if you already dealing with it, can you also extend it to floats too? I.e. if step is float, then the resulting list must be floats too. -spec(seq/1 :: (integer()) -> [integer()]). % is. lists:seq(Max) == lists:seq(1,Max) == lists:seq(1,Max,1) -spec(seq/2 :: (integer(),integer()) -> [integer()]). -spec(seq/2 :: (integer(), float()) -> [integer()]). -spec(seq/3 :: (integer(),integer(),integer()) -> [integer()]). -spec(seq/2 :: (float(),integer()) -> [float()]). number = float() | integer() -spec(seq/3 :: (number(),number(),float()) -> [float()]). 2. I'm all about common sence, and behaviour we expect must be consistent with similar constructs in other languages from Basic to Matlab. Python's "range([start,] stop [,step]) -> list of integers" construct is not a good example, b/c "stop" isn't included (which is counter-intuitive) and it's also defined only on integers. See example at the end of the message. 3. Step = 0 Also Erlang handles well case when Step=0, while both Matlab and Python not: Erlang: --------------------------- 1> lists:seq(1,1,0). [1] Matlab: ----------- >> 1:0:1 ans = Empty matrix: 1-by-0 Python: --------------------- >>> range(1,2,0) Traceback (most recent call last): File "", line 1, in range(1,2,0) ValueError: range() step argument must not be zero >>> VBScript: ----------- For i=1 To 1 Step 0: Print i: Next 1 1 1 1 ... endless loop 3. Syntax. Also will be good to have operator or parse-transform, which converting something like "[N..M]" to "lists:seq(N,M)" or "[N1,N2..M]" to "lists:seq(N1,M,N2-N1)" 4 Is this possible to have iterator or lazy evaluated sequence in Erlang? I.e. in code like this: Sum = lists:sum( [X*X || X<-lists:seq(1,1000000)] ). Do I really need to allocate list of 1000000 elements, just to be able to use List Comprehension construct? 5 Last thing, I think that function like this must be implemented in native code in the VM itself, like lists:reverse. Examples: Matlab: ------------------ >> 1:0 ans = Empty matrix: 1-by-0 Python: ----------------- >>> range(1,0) [] >>> range(1,1) [] VBScript: ---------- For i=1 To 0: Print i: Next Done! Erlang: -------------- 1> lists:seq(1,0). ** exception error: no function clause matching lists:seq(1,0) RESULT MUST BE: [] Erlang: ----------------------- 1> lists:seq(0,1,0.1). ** exception error: bad argument in an arithmetic expression in function lists:seq/3 RESULT MUST BE: [0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0] Matlab: ------------- >> 0:0.1:1 ans = 0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.9000 1.0000 VBScript: ---------- For i=0 To 1 Step 0.1: Print i: Next 0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1 Done! Best Regars, Zvi -- View this message in context: http://www.nabble.com/lists%3Aseq--2%2C3--bug--tp19547026p19549838.html Sent from the Erlang Questions mailing list archive at Nabble.com. From bbmaj7@REDACTED Thu Sep 18 14:31:12 2008 From: bbmaj7@REDACTED (Richard Andrews) Date: Thu, 18 Sep 2008 05:31:12 -0700 (PDT) Subject: [erlang-questions] Erlang in Australia? Message-ID: <656286.60368.qm@web65513.mail.ac4.yahoo.com> ----- Original Message ---- > From: jm > > Curious to know who's using Erang in Australia especially companies. Yes. I work for a small communications technology company in Melbourne using OTP as a core platform. -- Rich Make the switch to the world's best email. Get Yahoo!7 Mail! http://au.yahoo.com/y7mail From rklophaus@REDACTED Thu Sep 18 15:32:40 2008 From: rklophaus@REDACTED (RKlophaus) Date: Thu, 18 Sep 2008 06:32:40 -0700 (PDT) Subject: [erlang-questions] Erlang Users in Arlington, VA and Washington, DC Message-ID: <19551574.post@talk.nabble.com> Hello all, I am trying to pull together an Erlang Users Group in the Arlington, VA and Washington, DC area. If you are interested, please join the group on Meetup.com. (Just go to http://www.meetup.com and search for 'Erlang'). Thanks, Rusty -- View this message in context: http://www.nabble.com/Erlang-Users-in-Arlington%2C-VA-and-Washington%2C-DC-tp19551574p19551574.html Sent from the Erlang Questions mailing list archive at Nabble.com. From bob@REDACTED Thu Sep 18 16:44:18 2008 From: bob@REDACTED (Bob Ippolito) Date: Thu, 18 Sep 2008 07:44:18 -0700 Subject: [erlang-questions] lists:seq/[2,3] bug? In-Reply-To: <19549838.post@talk.nabble.com> References: <469D2176-D5D1-4C72-A849-E552184FCECE@cs.otago.ac.nz> <19549838.post@talk.nabble.com> Message-ID: <6a36e7290809180744y765838d9le8f233608d9d364f@mail.gmail.com> On Thu, Sep 18, 2008 at 3:21 AM, Zvi wrote: > > Richard, > > 1. if you already dealing with it, can you also extend it to floats too? > I.e. if step is float, then the resulting list must be floats too. > > -spec(seq/1 :: > (integer()) -> [integer()]). % is. lists:seq(Max) == > lists:seq(1,Max) == lists:seq(1,Max,1) > > -spec(seq/2 :: > (integer(),integer()) -> [integer()]). > -spec(seq/2 :: > (integer(), float()) -> [integer()]). > -spec(seq/3 :: > (integer(),integer(),integer()) -> [integer()]). > > -spec(seq/2 :: > (float(),integer()) -> [float()]). > > number = float() | integer() > > -spec(seq/3 :: > (number(),number(),float()) -> [float()]). > > > 2. I'm all about common sence, and behaviour we expect must be consistent > with similar constructs in other languages from Basic to Matlab. > Python's "range([start,] stop [,step]) -> list of integers" construct is > not a good example, b/c "stop" isn't included (which is counter-intuitive) > and it's also defined only on integers. See example at the end of the > message. The reason for this of course is that in almost all cases range is done with one argument, just the stop, and when you call range(10) you expect a list of length 10, not 11. The reason why it doesn't include the end point is because start=0 by default which makes sense because the index of the first element of a list is 0 in Python. -bob From btolputt@REDACTED Thu Sep 18 11:14:29 2008 From: btolputt@REDACTED (Benjamin Tolputt) Date: Thu, 18 Sep 2008 19:14:29 +1000 Subject: [erlang-questions] Erlang in Australia? In-Reply-To: <48CDCFFA.3090907@ghostgun.com> References: <48CDCFFA.3090907@ghostgun.com> Message-ID: <48D21BF5.70400@bigpond.net.au> Yeah, there are a few people/companies using it, but not many. I can't go into what I use it for in my day job (NDA reasons, sorry) - but in my "hobby-time" I use it to help develop scalable servers for environments for virtual agents (think "virtual world" without the over-hyped MMO gaming aspect). -- Regards, Benjamin Tolputt Analyst Programmer Mob: 0417 456 505 Email: btolputt@REDACTED This email and any files transmitted with it are confidential to the intended recipient and may be privileged. If you have received this email inadvertently or you are not the intended recipient, you may not disseminate, distribute, copy or in any way rely on it. Further, you should notify the sender immediately and delete the email from your computer. Whilst we have taken precautions to alert us to the presence of computer viruses, we cannot guarantee that this email and any files transmitted with it are free from such viruses. From dmercer@REDACTED Thu Sep 18 17:07:32 2008 From: dmercer@REDACTED (David Mercer) Date: Thu, 18 Sep 2008 10:07:32 -0500 Subject: [erlang-questions] lists:seq/[2,3] bug? In-Reply-To: <19549838.post@talk.nabble.com> References: <469D2176-D5D1-4C72-A849-E552184FCECE@cs.otago.ac.nz> <19549838.post@talk.nabble.com> Message-ID: <27B05485B97E4F78AED70A63A848994E@SSI.CORP> Zvi wrote: > 2. I'm all about common sence, and behaviour we expect must be consistent > with similar constructs in other languages from Basic to Matlab. > Python's "range([start,] stop [,step]) -> list of integers" construct > is > not a good example, b/c "stop" isn't included (which is counter-intuitive) > and it's also defined only on integers. See example at the end of the > message. I can't speak for Python, but I disagree that it is counterintuitive. I often expect ranges to include the lower bound but exclude the upper bound. Granted, these are typically continuous ranges, such as dates: e.g., if I want to query a database for all transaction for the week of September 1, I specify the range from September 1 to September 1+7. Since the range excludes the upper bound, September 8, I have a correct specification. If anything, I find including the upper bound counterintuitive. Take any arbitrary values of start, stop, and step: does the sequence include the stop or not? You can't know because it does when (stop - start) mod step == 0, but otherwise it does not. I'd say, to be consistent, we should exclude the stop, but that probably really would break some people's code... Cheers, David From puzza007@REDACTED Thu Sep 18 17:19:13 2008 From: puzza007@REDACTED (Paul Oliver) Date: Thu, 18 Sep 2008 16:19:13 +0100 Subject: [erlang-questions] Memory usage with gen_tcp Message-ID: Hi all, I have a simple echo server built on top of mochiweb_socket_server (http://mochiweb.googlecode.com/svn/trunk/src/mochiweb_socket_server.erl): -define(DEFAULTS, [{ip, "127.0.0.1"}, {loop, {?MODULE, loop}}, {name, ?MODULE}, {port, 8888}, {max, 100000}]). start() -> start(?DEFAULTS). start(Options) -> mochiweb_socket_server:start(Options). loop(Socket) -> case gen_tcp:recv(Socket, 0) of {ok, Data} -> gen_tcp:send(Socket, Data), loop(Socket); {error, closed} -> ok end. I'm load testing and have found that the memory used in the echo server per connected client is approximately 40K. I've tried setting sndbuf and recbuf to 1024 respectively (hardcoded in mochiweb_socket_server), but this doesn't seem to make a difference. Does anybody know where I should be looking to reduce this figure? Thanks, Paul. From erlang-questions_efine@REDACTED Thu Sep 18 18:01:28 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Thu, 18 Sep 2008 12:01:28 -0400 Subject: [erlang-questions] Memory usage with gen_tcp In-Reply-To: References: Message-ID: <6c2563b20809180901n435aa269k6ccaa1c5e5861d7a@mail.gmail.com> I don't know if this is a stupid idea, but if you are load testing is it possible that there is always around 40KB of data in flight per process? If you stop load testing and force a garbage collection in each process, does the figure reduce? Just a WAG. On Thu, Sep 18, 2008 at 11:19 AM, Paul Oliver wrote: > Hi all, > > I have a simple echo server built on top of mochiweb_socket_server > (http://mochiweb.googlecode.com/svn/trunk/src/mochiweb_socket_server.erl): > > -define(DEFAULTS, [{ip, "127.0.0.1"}, {loop, {?MODULE, loop}}, {name, > ?MODULE}, {port, 8888}, {max, 100000}]). > > start() -> > start(?DEFAULTS). > > start(Options) -> > mochiweb_socket_server:start(Options). > > loop(Socket) -> > case gen_tcp:recv(Socket, 0) of > {ok, Data} -> > gen_tcp:send(Socket, Data), > loop(Socket); > {error, closed} -> > ok > end. > > I'm load testing and have found that the memory used in the echo > server per connected client is approximately 40K. I've tried setting > sndbuf and recbuf to 1024 respectively (hardcoded in > mochiweb_socket_server), but this doesn't seem to make a difference. > Does anybody know where I should be looking to reduce this figure? > > Thanks, > Paul. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Thu Sep 18 18:38:19 2008 From: bob@REDACTED (Bob Ippolito) Date: Thu, 18 Sep 2008 09:38:19 -0700 Subject: [erlang-questions] Memory usage with gen_tcp In-Reply-To: References: Message-ID: <6a36e7290809180938o37456525g4c5029253431159@mail.gmail.com> You might want to try specifying the min_heap_size to some smaller number when spawning the processes, I don't recall the OTP machinations to do that off the top of my head though. Check spawn_opt for docs on how to tweak that in core erlang http://www.erlang.org/doc/man/erlang.html On Thu, Sep 18, 2008 at 8:19 AM, Paul Oliver wrote: > Hi all, > > I have a simple echo server built on top of mochiweb_socket_server > (http://mochiweb.googlecode.com/svn/trunk/src/mochiweb_socket_server.erl): > > -define(DEFAULTS, [{ip, "127.0.0.1"}, {loop, {?MODULE, loop}}, {name, > ?MODULE}, {port, 8888}, {max, 100000}]). > > start() -> > start(?DEFAULTS). > > start(Options) -> > mochiweb_socket_server:start(Options). > > loop(Socket) -> > case gen_tcp:recv(Socket, 0) of > {ok, Data} -> > gen_tcp:send(Socket, Data), > loop(Socket); > {error, closed} -> > ok > end. > > I'm load testing and have found that the memory used in the echo > server per connected client is approximately 40K. I've tried setting > sndbuf and recbuf to 1024 respectively (hardcoded in > mochiweb_socket_server), but this doesn't seem to make a difference. > Does anybody know where I should be looking to reduce this figure? > > Thanks, > Paul. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From kostis@REDACTED Thu Sep 18 19:20:53 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 18 Sep 2008 20:20:53 +0300 Subject: [erlang-questions] lists:seq/[2,3] bug? In-Reply-To: <469D2176-D5D1-4C72-A849-E552184FCECE@cs.otago.ac.nz> References: <469D2176-D5D1-4C72-A849-E552184FCECE@cs.otago.ac.nz> Message-ID: <48D28DF5.7070704@cs.ntua.gr> Richard A. O'Keefe wrote: > On my Mac I have Erlang R12B-3. > ..... > > lists:seq(1, N) gives me the expected N-element list for > integers N >= 1. I expect, indeed, I would require, that > lists:seq(1, 0) should give me the empty list. The word "expect" is pretty subjective. I think it's better to stick to the function's description in the manual before one characterizes something as a possible bug. I am not sure all library users have identical (or even similar) expectations, as these depend on their experiences, possibly from other languages they are familiar with. (Clearly, Richard is as experienced as one can be in this respect). The manual reads: "seq(From, To) -> Seq seq(From, To, Incr) -> Seq Returns a sequence of integers which starts with From and contains the successive results of adding Incr to the previous element, until To has been reached or passed (in the latter case, To is not an element of the sequence). Incr defaults to 1." Hmmm... Had I stopped reading the documentation here, *I* would actually expect that lists:seq(1, 0) returns [1] rather than []. (The phrasing "... to the previous element, until ..." suggests a repeat-based rather than while-based implementation.) However, the function's documentation continues: "Failure: If ToFrom and Incr is negative, or if Incr==0 and From/=To." Since it is stated that "Incr defaults to 1.", then clearly the "If To Instead, > > 2> lists:seq(1, 0). > ** exception error: no function clause matching lists:seq(1,0) > 3> lists:seq(1, 0, 1). > ** exception error: no function clause matching lists:seq(1,0,1) > > Here's a version of seq/2 that does what I expect. > > seq(Min, Max) when is_integer(Min), is_integer(Max), Min-1 =< Max -> > seq_loop(Max-Min+1, Max, []). > > seq_loop(N, X, L) when N >= 4 -> > seq_loop(N-4, X-4, [X-3,X-2,X-1,X|L]); > seq_loop(N, X, L) when N >= 2 -> > seq_loop(N-2, X-2, [X-1,X|L]); > seq_loop(1, X, L) -> > [X|L]; > seq_loop(0, _, L) -> > L. I agree that it probably does do what you expect it to do, since you are the one who wrote it :-) But then again, what about a call such as seq(10, 5) ? As far as I can see, it raises an exception in this case. > We expect length(lists:seq(L, U)) == U-L+1. > It does make sense to report an error when U < L-1, > because there is no way the result can have negative > length. But the empty list is a perfectly good list. > > If people agree that this is a bug I'll provide a version > of lists:seq/3 that behaves itself. We do expect that > lists:seq(L, U) and lists:seq(L, U, 1) will give the > same answer, after all. I agree with the last sentence. But in my opinion, they do have the same behaviour: 1> lists:seq(4, 2). ** exception error: no function clause matching lists:seq(4,2) 2> lists:seq(4, 2, 1). ** exception error: no function clause matching lists:seq(4,2,1) same same, no difference! Seriously now. In a statically typed language such as Haskell, I could see some good arguments why one would want the lists:seq/[2,3] functions to be total and return [] for L > U rather than throwing an exception. But in a language such as Erlang, I do not see any compelling reason to prefer returning []. Then again, perhaps I am not imaginative enough. I am sure that if there is such a reason, we'll probably soon find out about it ;-) Kostis From als@REDACTED Thu Sep 18 20:26:50 2008 From: als@REDACTED (Anthony Shipman) Date: Fri, 19 Sep 2008 04:26:50 +1000 Subject: [erlang-questions] custom supervisor Message-ID: <200809190426.50413.als@iinet.net.au> Is it possible to write a custom supervisor and include it an OTP environment? Looking at release_handler_1 in the sasl application is seems to assume that the implementation module for a supervisor is always stdlib:supervisor. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From nc@REDACTED Thu Sep 18 20:37:58 2008 From: nc@REDACTED (Nicolas Charpentier) Date: Thu, 18 Sep 2008 20:37:58 +0200 Subject: [erlang-questions] lists:seq/[2,3] bug? In-Reply-To: References: <469D2176-D5D1-4C72-A849-E552184FCECE@cs.otago.ac.nz> <6339_1221721961_m8I7Cc6f016403_48D1FDCB.1000100@charpi.net> Message-ID: <48D2A006.3080204@charpi.net> Richard A. O'Keefe wrote: >> I think that your proposition will break a lot of code. > > Why do you think that? The correction I want ONLY affects > cases where the current version blows up; whenever the > current version returns any answer at all, mine returns the > same one. Hi, With the current implementation, the process crashes if it calls lists:seq(N,M) with M Message-ID: <80330.1221764675@snookles.snookles.com> Hi, Vance, I don't know if you've discovered an answer to this question yet or not ... the last I used the SNMP manager + USM was well over 1.5 years ago, so my memory is quite fuzzy. IIRC, back then when using R11B-something (maybe -5?), I had problems with USM using one of the two crypto methods. I can't recall if it was MD5 or AES. (Have you tried using the AES flavor?) I can't recall if there was a fix, or a work-around, or something else. If it's still a problem, you can email me off-list, and I'll do more digging through my emailbox and my brain to try to remember what happened back then. -Scott From juanjo@REDACTED Thu Sep 18 21:18:04 2008 From: juanjo@REDACTED (Juan Jose Comellas) Date: Thu, 18 Sep 2008 16:18:04 -0300 Subject: [erlang-questions] Timezone calculations Message-ID: <1c3be50f0809181218p42667c42pb022583b9bb7ffb@mail.gmail.com> I need to perform time calculations based on arbitrary (user-supplied) timezones and I haven't found anything in Erlang/OTP that lets me determine the offset (in minutes or seconds) that a timezone has against UTC. The calendar module only supports converting times from UTC into the local timezone and the other way around, but what if what I want is to convert a time to another timezone that is not my local one? I'd prefer a portable solution, but even if there is an easy way to access the Olson/zoneinfo tz database on Linux that would be acceptable. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From taavi@REDACTED Thu Sep 18 22:03:22 2008 From: taavi@REDACTED (Taavi Talvik) Date: Thu, 18 Sep 2008 23:03:22 +0300 Subject: [erlang-questions] Timezone calculations In-Reply-To: <1c3be50f0809181218p42667c42pb022583b9bb7ffb@mail.gmail.com> References: <1c3be50f0809181218p42667c42pb022583b9bb7ffb@mail.gmail.com> Message-ID: <6DF82421-9627-41C2-AAAF-208932905780@uninet.ee> On Sep 18, 2008, at 10:18 PM, Juan Jose Comellas wrote: > I need to perform time calculations based on arbitrary (user- > supplied) timezones and I haven't found anything in Erlang/OTP that > lets me determine the offset (in minutes or seconds) that a timezone > has against UTC. The calendar module only supports converting times > from UTC into the local timezone and the other way around, but what > if what I want is to convert a time to another timezone that is not > my local one? > > I'd prefer a portable solution, but even if there is an easy way to > access the Olson/zoneinfo tz database on Linux that would be > acceptable. os:cmd("date args.."). It is reasonably easy to run existing external tools from erlang and capture results. Reimplementing everything probably does not make sense. best regards, taavi From fritchie@REDACTED Thu Sep 18 22:46:08 2008 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Thu, 18 Sep 2008 15:46:08 -0500 Subject: [erlang-questions] Etop issues: Erlang top got garbage In-Reply-To: Message of "Wed, 10 Sep 2008 16:28:02 PDT." <971980cc0809101628m1605418g4def91b9f9585061@mail.gmail.com> Message-ID: <98780.1221770768@snookles.snookles.com> Brian Troutwine wrote: bt> I'm attempting to use etop to debug a memory issue I am having, but bt> the output of etop is almost impossible to read. I get many, many bt> messages of this sort: bt> Erlang top got garbage {trace_ts,<4549.52.0>,out, bt> {gen_server,loop,6}, {1221,89025,387602}} Yes, I've noticed that too. The OTP folks almost certainly have more insight than I do about the cause. I redirect to a file and/or use "grep -v" when this happens. Easier to read that way. :-) I only see this when the system being examined is exceptionally busy. I've assumed it's because it's so busy that trace messages are being lost (or intentionally dropped) somewhere. But that's just a guess. Using "etop" on very busy servers is the norm, so it's more difficult to give my usual reply to the "Doctor, it hurts when..." problem. If push comes to shove, edit out the source code for the etop app and remove the message? -Scott From kevin@REDACTED Thu Sep 18 23:50:45 2008 From: kevin@REDACTED (Kevin A. Smith) Date: Thu, 18 Sep 2008 17:50:45 -0400 Subject: [erlang-questions] Escaping/Unescaping XML Message-ID: Hi all - I'm writing some code which needs to escape and un-escape XML. I've found xmerl_lib:export_text/1 which escapes things quite nicely but I can't find a function which does the opposite. Does such a function exist in the Erlang libraries? --Kevin From juanjo@REDACTED Fri Sep 19 00:36:44 2008 From: juanjo@REDACTED (Juan Jose Comellas) Date: Thu, 18 Sep 2008 19:36:44 -0300 Subject: [erlang-questions] Timezone calculations In-Reply-To: <6DF82421-9627-41C2-AAAF-208932905780@uninet.ee> References: <1c3be50f0809181218p42667c42pb022583b9bb7ffb@mail.gmail.com> <6DF82421-9627-41C2-AAAF-208932905780@uninet.ee> Message-ID: <1c3be50f0809181536i75a17466w6470a2f6d36a267f@mail.gmail.com> That may work but it's really not suitable for lots of calculations. It might be even better to use a hardcoded set of offsets or bite the bullet and parse the zoneinfo files myself. What is the best way to create bindings to the C functions that provide this functionality in libc? Is it worth it to create a linked in driver for this? What is the simplest way to create C bindings to lightweight functions that have a very low risk of crashing the Erlang VM? On Thu, Sep 18, 2008 at 5:03 PM, Taavi Talvik wrote: > > On Sep 18, 2008, at 10:18 PM, Juan Jose Comellas wrote: > > I need to perform time calculations based on arbitrary (user-supplied) >> timezones and I haven't found anything in Erlang/OTP that lets me determine >> the offset (in minutes or seconds) that a timezone has against UTC. The >> calendar module only supports converting times from UTC into the local >> timezone and the other way around, but what if what I want is to convert a >> time to another timezone that is not my local one? >> >> I'd prefer a portable solution, but even if there is an easy way to access >> the Olson/zoneinfo tz database on Linux that would be acceptable. >> > > os:cmd("date args.."). > > It is reasonably easy to run existing external tools from erlang and > capture results. > Reimplementing everything probably does not make sense. > > best regards, > taavi > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jerome@REDACTED Mon Sep 15 10:01:40 2008 From: jerome@REDACTED (=?ISO-8859-1?Q?J=E9r=F4me_Desquilbet?=) Date: Mon, 15 Sep 2008 10:01:40 +0200 Subject: [erlang-questions] Problem building OTP on OpenBSD Message-ID: <48CE1664.8060309@desquilbet.org> I get the following error while building OTP R12B-4 on OpenBSD 4.3. Any idea? Thanks a lot, J?r?me. === Entering application os_mon gmake[3]: Entering directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/src' gmake[3]: Nothing to be done for `opt'. gmake[3]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/src' gmake[3]: Entering directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gmake -f i386-unknown-openbsd4.3/Makefile TYPE=opt gmake[4]: Entering directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gcc -c -o ../priv/obj/i386-unknown-openbsd4.3/memsup.o -g -O2 -I/usr/tools/erlan g/otp_src_R12B-4/erts/i386-unknown-openbsd4.3 -DHAVE_CONFIG_H memsup.c memsup.c: In function `get_extended_mem': memsup.c:456: error: void value not ignored as it ought to be gmake[4]: *** [../priv/obj/i386-unknown-openbsd4.3/memsup.o] Error 1 gmake[4]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gmake[3]: *** [opt] Error 2 gmake[3]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gmake[2]: *** [opt] Error 2 gmake[2]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon' gmake[1]: *** [opt] Error 2 gmake[1]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib' gmake: *** [libs] Error 2 From jerome@REDACTED Sun Sep 14 22:35:53 2008 From: jerome@REDACTED (=?ISO-8859-1?Q?J=E9r=F4me_Desquilbet?=) Date: Sun, 14 Sep 2008 22:35:53 +0200 Subject: [erlang-questions] Problem building OTP on OpenBSD Message-ID: <48CD75A9.8020605@desquilbet.org> I get the following error while building OTP R12B-4 on OpenBSD 4.3. Any idea? Thanks a lot, J?r?me. === Entering application os_mon gmake[3]: Entering directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/src' gmake[3]: Nothing to be done for `opt'. gmake[3]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/src' gmake[3]: Entering directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gmake -f i386-unknown-openbsd4.3/Makefile TYPE=opt gmake[4]: Entering directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gcc -c -o ../priv/obj/i386-unknown-openbsd4.3/memsup.o -g -O2 -I/usr/tools/erlan g/otp_src_R12B-4/erts/i386-unknown-openbsd4.3 -DHAVE_CONFIG_H memsup.c memsup.c: In function `get_extended_mem': memsup.c:456: error: void value not ignored as it ought to be gmake[4]: *** [../priv/obj/i386-unknown-openbsd4.3/memsup.o] Error 1 gmake[4]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gmake[3]: *** [opt] Error 2 gmake[3]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gmake[2]: *** [opt] Error 2 gmake[2]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon' gmake[1]: *** [opt] Error 2 gmake[1]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib' gmake: *** [libs] Error 2 From jerome@REDACTED Tue Sep 16 11:25:46 2008 From: jerome@REDACTED (=?ISO-8859-1?Q?J=E9r=F4me_Desquilbet?=) Date: Tue, 16 Sep 2008 11:25:46 +0200 Subject: [erlang-questions] Problem building OTP on OpenBSD Message-ID: <48CF7B9A.20005@desquilbet.org> I get the following error while building OTP R12B-4 on OpenBSD 4.3. Any idea? Thanks a lot, J?r?me. === Entering application os_mon gmake[3]: Entering directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/src' gmake[3]: Nothing to be done for `opt'. gmake[3]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/src' gmake[3]: Entering directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gmake -f i386-unknown-openbsd4.3/Makefile TYPE=opt gmake[4]: Entering directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gcc -c -o ../priv/obj/i386-unknown-openbsd4.3/memsup.o -g -O2 -I/usr/tools/erlan g/otp_src_R12B-4/erts/i386-unknown-openbsd4.3 -DHAVE_CONFIG_H memsup.c memsup.c: In function `get_extended_mem': memsup.c:456: error: void value not ignored as it ought to be gmake[4]: *** [../priv/obj/i386-unknown-openbsd4.3/memsup.o] Error 1 gmake[4]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gmake[3]: *** [opt] Error 2 gmake[3]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gmake[2]: *** [opt] Error 2 gmake[2]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon' gmake[1]: *** [opt] Error 2 gmake[1]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib' gmake: *** [libs] Error 2 From jerome@REDACTED Mon Sep 15 19:36:09 2008 From: jerome@REDACTED (=?ISO-8859-1?Q?J=E9r=F4me_Desquilbet?=) Date: Mon, 15 Sep 2008 19:36:09 +0200 Subject: [erlang-questions] Problem building OTP on OpenBSD Message-ID: <48CE9D09.20303@desquilbet.org> I get the following error while building OTP R12B-4 on OpenBSD 4.3. Any idea? Thanks a lot, J?r?me. === Entering application os_mon gmake[3]: Entering directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/src' gmake[3]: Nothing to be done for `opt'. gmake[3]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/src' gmake[3]: Entering directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gmake -f i386-unknown-openbsd4.3/Makefile TYPE=opt gmake[4]: Entering directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gcc -c -o ../priv/obj/i386-unknown-openbsd4.3/memsup.o -g -O2 -I/usr/tools/erlan g/otp_src_R12B-4/erts/i386-unknown-openbsd4.3 -DHAVE_CONFIG_H memsup.c memsup.c: In function `get_extended_mem': memsup.c:456: error: void value not ignored as it ought to be gmake[4]: *** [../priv/obj/i386-unknown-openbsd4.3/memsup.o] Error 1 gmake[4]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gmake[3]: *** [opt] Error 2 gmake[3]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gmake[2]: *** [opt] Error 2 gmake[2]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon' gmake[1]: *** [opt] Error 2 gmake[1]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib' gmake: *** [libs] Error 2 From jerome@REDACTED Mon Sep 15 20:53:59 2008 From: jerome@REDACTED (=?ISO-8859-1?Q?J=E9r=F4me_Desquilbet?=) Date: Mon, 15 Sep 2008 20:53:59 +0200 Subject: [erlang-questions] Problem building OTP on OpenBSD Message-ID: <48CEAF47.9010309@desquilbet.org> I get the following error while building OTP R12B-4 on OpenBSD 4.3. Any idea? Thanks a lot, J?r?me. === Entering application os_mon gmake[3]: Entering directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/src' gmake[3]: Nothing to be done for `opt'. gmake[3]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/src' gmake[3]: Entering directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gmake -f i386-unknown-openbsd4.3/Makefile TYPE=opt gmake[4]: Entering directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gcc -c -o ../priv/obj/i386-unknown-openbsd4.3/memsup.o -g -O2 -I/usr/tools/erlan g/otp_src_R12B-4/erts/i386-unknown-openbsd4.3 -DHAVE_CONFIG_H memsup.c memsup.c: In function `get_extended_mem': memsup.c:456: error: void value not ignored as it ought to be gmake[4]: *** [../priv/obj/i386-unknown-openbsd4.3/memsup.o] Error 1 gmake[4]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gmake[3]: *** [opt] Error 2 gmake[3]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon/c_src' gmake[2]: *** [opt] Error 2 gmake[2]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib/os_mon' gmake[1]: *** [opt] Error 2 gmake[1]: Leaving directory `/usr/tools/erlang/otp_src_R12B-4/lib' gmake: *** [libs] Error 2 From goofyheadedpunk@REDACTED Fri Sep 19 02:53:43 2008 From: goofyheadedpunk@REDACTED (Brian Troutwine) Date: Thu, 18 Sep 2008 17:53:43 -0700 Subject: [erlang-questions] Death of Erlang VM Message-ID: <971980cc0809181753m5027e8f5i6580fbfa0dfc474a@mail.gmail.com> Hello all, I've encountered a problem, but I'm not really sure what is the matter. After running my erlang application for some time I was noticed that it had died, though not exited or become a zombie. I run it like so: $ erl +A 2 +K true -boot aule -config sys.config I run a Debian stable AMD64 machine. Here's some information on my environment: $ cat /proc/version Linux version 2.6.24-19-xen (buildd@REDACTED) (gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)) #1 SMP Wed Aug 20 21:08:51 UTC 2008 $ erl Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:4] [async-threads:0] [hipe] [kernel-poll:false] What appeared in my syslog follows. I am doing writes to disk with the delayed_write flag set. Is there more information that would be useful? Here's what appeared in my syslog: Sep 18 17:33:05 valinor kernel: [1134774.645406] Unable to handle kernel paging request at ffff88001a289008 RIP: Sep 18 17:33:05 valinor kernel: [1134774.645421] [] iov_iter_advance+0x66/0x80 Sep 18 17:33:05 valinor kernel: [1134774.645445] PGD 57f5067 PUD 57f6067 PMD 58c8067 PTE 0 Sep 18 17:33:05 valinor kernel: [1134774.645453] Oops: 0000 [1] SMP Sep 18 17:33:05 valinor kernel: [1134774.645458] CPU 3 Sep 18 17:33:05 valinor kernel: [1134774.645462] Modules linked in: ipv6 ext3 jbd mbcache evdev raid10 raid456 async_xor async_memcpy async_tx xor raid1 raid0 multipath linear md_mo d dm_mirror dm_snapshot dm_mod fuse loop 8250 serial_core Sep 18 17:33:05 valinor kernel: [1134774.645492] Pid: 2249, comm: beam.smp Not tainted 2.6.24-19-xen #1 Sep 18 17:33:05 valinor kernel: [1134774.645497] RIP: e030:[] [] iov_iter_advance+0x66/0x80 Sep 18 17:33:05 valinor kernel: [1134774.645504] RSP: e02b:ffff8800050c5b10 EFLAGS: 00010246 Sep 18 17:33:05 valinor kernel: [1134774.645508] RAX: 0000000000000000 RBX: 0000000000000b2a RCX: 0000000000000000 Sep 18 17:33:05 valinor kernel: [1134774.645513] RDX: 0000000000000000 RSI: 0000000000000b2a RDI: ffff8800050c5ba8 Sep 18 17:33:05 valinor kernel: [1134774.645518] RBP: 0000000000000b2a R08: 0000000000000000 R09: 0000000000000000 Sep 18 17:33:05 valinor kernel: [1134774.645523] R10: ffff88001a289000 R11: 0000000000000000 R12: 0000000000c09000 Sep 18 17:33:05 valinor kernel: [1134774.645527] R13: 0000000000001000 R14: ffff880018895220 R15: 0000000000000000 Sep 18 17:33:05 valinor kernel: [1134774.645534] FS: 00007f74138e0960(0000) GS:ffffffff805c6180(0000) knlGS:0000000000000000 Sep 18 17:33:05 valinor kernel: [1134774.645539] CS: e033 DS: 0000 ES: 0000 Sep 18 17:33:05 valinor kernel: [1134774.645542] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 Sep 18 17:33:05 valinor kernel: [1134774.645548] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000000 Sep 18 17:33:05 valinor kernel: [1134774.645553] Process beam.smp (pid: 2249, threadinfo ffff8800050c4000, task ffff88001ebfa800) Sep 18 17:33:05 valinor kernel: [1134774.645558] Stack: ffffffff80273f9e ffff88001ecfef00 ffff880012938080 0000000000000000 Sep 18 17:33:05 valinor kernel: [1134774.645567] ffff8800050c5db8 0000000000bfc427 ffff8800050c5d38 ffff88001ecfef00 Sep 18 17:33:05 valinor kernel: [1134774.645575] ffff880018895220 ffffffff880deac0 ffff880018895110 000000000000cbd9 Sep 18 17:33:05 valinor kernel: [1134774.645582] Call Trace: Sep 18 17:33:05 valinor kernel: [1134774.645588] [] generic_file_buffered_write+0x1de/0x6e0 Sep 18 17:33:05 valinor kernel: [1134774.645601] [] :jbd:journal_stop+0x13e/0x1d0 Sep 18 17:33:05 valinor kernel: [1134774.645608] [] __generic_file_aio_write_nolock+0x24f/0x400 Sep 18 17:33:05 valinor kernel: [1134774.645614] [] find_extend_vma+0x24/0x80 Sep 18 17:33:05 valinor kernel: [1134774.645622] [] unqueue_me+0x54/0xa0 Sep 18 17:33:05 valinor kernel: [1134774.645628] [] generic_file_aio_write+0x64/0xd0 Sep 18 17:33:05 valinor kernel: [1134774.645642] [] :ext3:ext3_file_write+0x23/0xc0 Sep 18 17:33:05 valinor kernel: [1134774.645650] [] :ext3:ext3_file_write+0x0/0xc0 Sep 18 17:33:05 valinor kernel: [1134774.645656] [] do_sync_readv_writev+0xcb/0x110 Sep 18 17:33:05 valinor kernel: [1134774.645663] [] futex_wake+0xcd/0xf0 Sep 18 17:33:05 valinor kernel: [1134774.645668] [] autoremove_wake_function+0x0/0x30 Sep 18 17:33:05 valinor kernel: [1134774.645675] [] do_futex+0x134/0xc30 Sep 18 17:33:05 valinor kernel: [1134774.645680] [] __kmalloc+0x13c/0x160 Sep 18 17:33:05 valinor kernel: [1134774.645686] [] do_readv_writev+0xfd/0x230 Sep 18 17:33:05 valinor kernel: [1134774.645693] [] error_exit+0x0/0x79 Sep 18 17:33:05 valinor kernel: [1134774.645700] [] sys_writev+0x53/0xc0 Sep 18 17:33:05 valinor kernel: [1134774.645706] [] system_call+0x68/0x6d Sep 18 17:33:05 valinor kernel: [1134774.645711] [] system_call+0x0/0x6d Sep 18 17:33:05 valinor kernel: [1134774.645716] Sep 18 17:33:05 valinor kernel: [1134774.645718] Sep 18 17:33:05 valinor kernel: [1134774.645718] Code: 49 8b 52 08 49 89 d3 eb c4 4c 89 17 4c 89 4f 10 eb 99 0f 1f Sep 18 17:33:05 valinor kernel: [1134774.645739] RIP [] iov_iter_advance+0x66/0x80 Sep 18 17:33:05 valinor kernel: [1134774.645745] RSP Sep 18 17:33:05 valinor kernel: [1134774.645749] CR2: ffff88001a289008 Sep 18 17:33:05 valinor kernel: [1134774.645762] ---[ end trace a91a752e8ec506f8 ]--- -- Brian From vlm@REDACTED Fri Sep 19 03:19:13 2008 From: vlm@REDACTED (Lev Walkin) Date: Thu, 18 Sep 2008 18:19:13 -0700 Subject: [erlang-questions] Death of Erlang VM In-Reply-To: <971980cc0809181753m5027e8f5i6580fbfa0dfc474a@mail.gmail.com> References: <971980cc0809181753m5027e8f5i6580fbfa0dfc474a@mail.gmail.com> Message-ID: <48D2FE11.6090307@lionet.info> R12B4 fixed at least one bug in Erlang VM which could potentially lead to VM crashes. I'd advise you to upgrade to R12B4 just in case. Brian Troutwine wrote: > Hello all, > > I've encountered a problem, but I'm not really sure what is the > matter. After running my erlang application for some time I was > noticed that it had died, though not exited or become a zombie. I run > it like so: > > $ erl +A 2 +K true -boot aule -config sys.config > > I run a Debian stable AMD64 machine. Here's some information on my environment: > > $ cat /proc/version > Linux version 2.6.24-19-xen (buildd@REDACTED) (gcc version 4.2.3 (Ubuntu > 4.2.3-2ubuntu7)) #1 SMP Wed Aug 20 21:08:51 UTC 2008 > $ erl > Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:4] > [async-threads:0] [hipe] [kernel-poll:false] > > What appeared in my syslog follows. I am doing writes to disk with the > delayed_write flag set. Is there more information that would be > useful? Here's what appeared in my syslog: > > Sep 18 17:33:05 valinor kernel: [1134774.645406] Unable to handle > kernel paging request at ffff88001a289008 RIP: > Sep 18 17:33:05 valinor kernel: [1134774.645421] [] > iov_iter_advance+0x66/0x80 > Sep 18 17:33:05 valinor kernel: [1134774.645445] PGD 57f5067 PUD > 57f6067 PMD 58c8067 PTE 0 > Sep 18 17:33:05 valinor kernel: [1134774.645453] Oops: 0000 [1] SMP > Sep 18 17:33:05 valinor kernel: [1134774.645458] CPU 3 > Sep 18 17:33:05 valinor kernel: [1134774.645462] Modules linked in: > ipv6 ext3 jbd mbcache evdev raid10 raid456 async_xor async_memcpy > async_tx xor raid1 raid0 multipath linear md_mo > d dm_mirror dm_snapshot dm_mod fuse loop 8250 serial_core > Sep 18 17:33:05 valinor kernel: [1134774.645492] Pid: 2249, comm: > beam.smp Not tainted 2.6.24-19-xen #1 > Sep 18 17:33:05 valinor kernel: [1134774.645497] RIP: > e030:[] [] > iov_iter_advance+0x66/0x80 > Sep 18 17:33:05 valinor kernel: [1134774.645504] RSP: > e02b:ffff8800050c5b10 EFLAGS: 00010246 > Sep 18 17:33:05 valinor kernel: [1134774.645508] RAX: 0000000000000000 > RBX: 0000000000000b2a RCX: 0000000000000000 > Sep 18 17:33:05 valinor kernel: [1134774.645513] RDX: 0000000000000000 > RSI: 0000000000000b2a RDI: ffff8800050c5ba8 > Sep 18 17:33:05 valinor kernel: [1134774.645518] RBP: 0000000000000b2a > R08: 0000000000000000 R09: 0000000000000000 > Sep 18 17:33:05 valinor kernel: [1134774.645523] R10: ffff88001a289000 > R11: 0000000000000000 R12: 0000000000c09000 > Sep 18 17:33:05 valinor kernel: [1134774.645527] R13: 0000000000001000 > R14: ffff880018895220 R15: 0000000000000000 > Sep 18 17:33:05 valinor kernel: [1134774.645534] FS: > 00007f74138e0960(0000) GS:ffffffff805c6180(0000) > knlGS:0000000000000000 > Sep 18 17:33:05 valinor kernel: [1134774.645539] CS: e033 DS: 0000 ES: 0000 > Sep 18 17:33:05 valinor kernel: [1134774.645542] DR0: 0000000000000000 > DR1: 0000000000000000 DR2: 0000000000000000 > Sep 18 17:33:05 valinor kernel: [1134774.645548] DR3: 0000000000000000 > DR6: 00000000ffff0ff0 DR7: 0000000000000000 > Sep 18 17:33:05 valinor kernel: [1134774.645553] Process beam.smp > (pid: 2249, threadinfo ffff8800050c4000, task ffff88001ebfa800) > Sep 18 17:33:05 valinor kernel: [1134774.645558] Stack: > ffffffff80273f9e ffff88001ecfef00 ffff880012938080 0000000000000000 > Sep 18 17:33:05 valinor kernel: [1134774.645567] ffff8800050c5db8 > 0000000000bfc427 ffff8800050c5d38 ffff88001ecfef00 > Sep 18 17:33:05 valinor kernel: [1134774.645575] ffff880018895220 > ffffffff880deac0 ffff880018895110 000000000000cbd9 > Sep 18 17:33:05 valinor kernel: [1134774.645582] Call Trace: > Sep 18 17:33:05 valinor kernel: [1134774.645588] [] > generic_file_buffered_write+0x1de/0x6e0 > Sep 18 17:33:05 valinor kernel: [1134774.645601] [] > :jbd:journal_stop+0x13e/0x1d0 > Sep 18 17:33:05 valinor kernel: [1134774.645608] [] > __generic_file_aio_write_nolock+0x24f/0x400 > Sep 18 17:33:05 valinor kernel: [1134774.645614] [] > find_extend_vma+0x24/0x80 > Sep 18 17:33:05 valinor kernel: [1134774.645622] [] > unqueue_me+0x54/0xa0 > Sep 18 17:33:05 valinor kernel: [1134774.645628] [] > generic_file_aio_write+0x64/0xd0 > Sep 18 17:33:05 valinor kernel: [1134774.645642] [] > :ext3:ext3_file_write+0x23/0xc0 > Sep 18 17:33:05 valinor kernel: [1134774.645650] [] > :ext3:ext3_file_write+0x0/0xc0 > Sep 18 17:33:05 valinor kernel: [1134774.645656] [] > do_sync_readv_writev+0xcb/0x110 > Sep 18 17:33:05 valinor kernel: [1134774.645663] [] > futex_wake+0xcd/0xf0 > Sep 18 17:33:05 valinor kernel: [1134774.645668] [] > autoremove_wake_function+0x0/0x30 > Sep 18 17:33:05 valinor kernel: [1134774.645675] [] > do_futex+0x134/0xc30 > Sep 18 17:33:05 valinor kernel: [1134774.645680] [] > __kmalloc+0x13c/0x160 > Sep 18 17:33:05 valinor kernel: [1134774.645686] [] > do_readv_writev+0xfd/0x230 > Sep 18 17:33:05 valinor kernel: [1134774.645693] [] > error_exit+0x0/0x79 > Sep 18 17:33:05 valinor kernel: [1134774.645700] [] > sys_writev+0x53/0xc0 > Sep 18 17:33:05 valinor kernel: [1134774.645706] [] > system_call+0x68/0x6d > Sep 18 17:33:05 valinor kernel: [1134774.645711] [] > system_call+0x0/0x6d > Sep 18 17:33:05 valinor kernel: [1134774.645716] > Sep 18 17:33:05 valinor kernel: [1134774.645718] > Sep 18 17:33:05 valinor kernel: [1134774.645718] Code: 49 8b 52 08 49 > 89 d3 eb c4 4c 89 17 4c 89 4f 10 eb 99 0f 1f > Sep 18 17:33:05 valinor kernel: [1134774.645739] RIP > [] iov_iter_advance+0x66/0x80 > Sep 18 17:33:05 valinor kernel: [1134774.645745] RSP > Sep 18 17:33:05 valinor kernel: [1134774.645749] CR2: ffff88001a289008 > Sep 18 17:33:05 valinor kernel: [1134774.645762] ---[ end trace > a91a752e8ec506f8 ]--- > From kenji.rikitake@REDACTED Fri Sep 19 03:20:59 2008 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Fri, 19 Sep 2008 10:20:59 +0900 Subject: [erlang-questions] Timezone calculations In-Reply-To: <1c3be50f0809181536i75a17466w6470a2f6d36a267f@mail.gmail.com> References: <1c3be50f0809181218p42667c42pb022583b9bb7ffb@mail.gmail.com> <6DF82421-9627-41C2-AAAF-208932905780@uninet.ee> <1c3be50f0809181536i75a17466w6470a2f6d36a267f@mail.gmail.com> Message-ID: <20080919012059.GA63964@k2r.org> Starting from an external program connected with Erlang by the port function looks much safer than making a linked driver. BTW Perl CPAN has DateTime library. It works for many different conversion requests, including the TAI issues I worked recently. http://search.cpan.org/dist/DateTime/ Regards, Kenji Rikitake In the message <1c3be50f0809181536i75a17466w6470a2f6d36a267f@REDACTED> dated Thu, Sep 18, 2008 at 07:36:21PM -0300, Juan Jose Comellas writes: > That may work but it's really not suitable for lots of calculations. It > might be even better to use a hardcoded set of offsets or bite the bullet > and parse the zoneinfo files myself. > > What is the best way to create bindings to the C functions that provide this > functionality in libc? Is it worth it to create a linked in driver for this? > What is the simplest way to create C bindings to lightweight functions that > have a very low risk of crashing the Erlang VM? From ok@REDACTED Fri Sep 19 04:30:33 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 19 Sep 2008 14:30:33 +1200 Subject: [erlang-questions] lists:seq/[2,3] bug? In-Reply-To: <18247_1221734151_m8IAZmd8003311_19549838.post@talk.nabble.com> References: <469D2176-D5D1-4C72-A849-E552184FCECE@cs.otago.ac.nz> <18247_1221734151_m8IAZmd8003311_19549838.post@talk.nabble.com> Message-ID: On 18 Sep 2008, at 10:21 pm, Zvi wrote: > 1. if you already dealing with it, can you also extend it to floats > too? > I.e. if step is float, then the resulting list must be floats too. Let me explain why this was an issue for me. I sometimes do things in Haskell and sometimes in Erlang. [3..2] is an empty list in Haskell. It makes life just that little bit harder if I can't do that in Erlang. Haskell does support [a..z] and [a,b..z] for floating point numbers. Since (a) floating-point loops are a little bit tricky (taking X[i+1] = X[i]+delta and taking X[i] = X[0]+i*delta give *different* answers, with the latter being slightly more accurate, and IEEE hasn't fixed all portability issues ) and (b) in current Erlang, lists:seq/2 and lists:seq/3 provide type information for the Dialyzer, which I for one would be very reluctant to break, I suggest that the way to handle floating point ranges would be to add two new functions: lists:float_seq(First, Last) lists:float_seq(First, Last, Inc) > 2. I'm all about common sense, and behaviour we expect must be > consistent > with similar constructs in other languages from Basic to Matlab. > Python's "range([start,] stop [,step]) -> list of integers" > construct is > not a good example, b/c "stop" isn't included (which is counter- > intuitive) > and it's also defined only on integers. See example at the end of the > message. To every example there is an equal and opposite example. In R, if x <= y, then x:y is x,x+1,...,y but if x < y, then x:y is y,y-1,...,x so that 1:3 is 1 2 3, 1:2 is 1 2, 1:1 is 1, but 1:0 is 1 0. (This may be the most hated thing about R, that 1:n does not work when n might be 0, so you have to say seq(from = 1, length = 0).) Haskell provided the motivation, but the reason I how to persuade Erlangers to make lists:seq(X, X-1) return [] is to make Erlang more consistent with ITSELF. > > 3. Step = 0 > Also Erlang handles well case when Step=0, while both Matlab and > Python not: Oddly enough, [1..1] => [1] in Haskell, but [1,1..1] => [1,1,1,1,1,1,1,1....... I see Step = 0 as very much a special case; it doesn't really fit well with the rest of the specification. However, I certainly don't want to break any code that might rely on it. > 3. Syntax. > Also will be good to have operator or parse-transform, which > converting > something like "[N..M]" to "lists:seq(N,M)" or "[N1,N2..M]" to > "lists:seq(N1,M,N2-N1)" It's pretty, certainly. I think we can do without it, though. > 4 Is this possible to have iterator or lazy evaluated sequence in > Erlang? > I.e. in code like this: > > Sum = lists:sum( [X*X || X<-lists:seq(1,1000000)] ). > > Do I really need to allocate list of 1000000 elements, just to be > able to > use List Comprehension construct? We don't need special purpose evaluation strategies for this, just for the compiler to recognise X <- lists:seq(A, Z[, D]) and do something special with it. In this case, you have *two* lists that you don't need, and sum(First, Last, F) -> sum_loop(First, Last, F, 0). sum_loop(First, Last, F, S) when First =< Last -> sum_loop(First+1, Last, F, S + F(First)); sum_loop(First, Last, _, S) when First > Last -> S. ... Sum = sum(1, 1000*1000, fun (X) -> X*X end) isn't _that_ hard to come up with. It would be nice to have an Erlang compiler that did cross-module inlining and deforestation. It's not going to happen soon. > 5 Last thing, I think that function like this must be implemented in > native > code in the VM itself, like lists:reverse. My concern here is whether the function(s) should have a value or not in certain cases. However, it's always a good idea to try things. Imagine my surprise, on a Mac (and therefore without HiPE), to find that reverse/1 coded in Erlang was only 3 times slower than the built-in one. On a SPARC, loaded with c(...,[native]), the result was 2 times slower than the built-in one, but I had to use ridiculously long lists to measure it. (And there's even one test result, with length 100*1000, where the Erlang code was faster...) List reversal turns up a lot more than sequence generation, so it makes sense to speed that up, even if it is just by a factor of 2. From Bruce@REDACTED Fri Sep 19 05:09:53 2008 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Fri, 19 Sep 2008 15:09:53 +1200 Subject: [erlang-questions] Timezone calculations In-Reply-To: <1c3be50f0809181218p42667c42pb022583b9bb7ffb@mail.gmail.com> References: <1c3be50f0809181218p42667c42pb022583b9bb7ffb@mail.gmail.com> Message-ID: <48D31801.2010102@Fitzsimons.org> Juan Jose Comellas wrote: > I need to perform time calculations based on arbitrary (user-supplied) > timezones and I haven't found anything in Erlang/OTP that lets me > determine the offset (in minutes or seconds) that a timezone has > against UTC. The calendar module only supports converting times from > UTC into the local timezone and the other way around, but what if what > I want is to convert a time to another timezone that is not my local one? > > I'd prefer a portable solution, but even if there is an easy way to > access the Olson/zoneinfo tz database on Linux that would be acceptable. Hi Juan, There is no easy answer, TZ's are annoying. The Olson files (or Olson-based OS files) are the best source reference but the POSIX OS routines for accessing them are horrible and not at all oriented to what you (and I, and others) want to use them for. They're old and clunky and don't quite behave the way it reads on the box. They're also subtly different between platforms, I suspect there are reasons harking back to the birth of Un*x. The way I have done it before is to, and bear with me here, is to swap the system (program instance) timezone for the destination timezone for the calculations that need performing. Basically you play with the TZ environment variable. Depending on your use case(s) it may also be necessary to change the date(!) so the offset changes e.g. DST are done correctly. The last time I did this it was in C/C++, the suggestions that you use a port program or linked-in driver would go well with this. TonyGJ's little driver that he used on the Erlang jukebox would be a fine model. I would fully support the effort to parse the Olson files for Erlang, although it may well drive you mad. Parsing is only the first step really, getting a decent data structure around them is not simple since they are quite rich and the supplied Olson C code is, let me be charitable here, cryptic. I've called it worse but I have a grudging respect for it since it does work. In these days of cheaper memory I would like to see a data structure that was more verbose, such as listing each time segment for every TZ for every year, which would make the calculations rather easier. You'd still need to parse the Olson files into this though since they are the primary (only?) single source that is comprehensive and kept current. I'd love to hear other thoughts :-) Cheers, Bruce From Bruce@REDACTED Fri Sep 19 05:11:20 2008 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Fri, 19 Sep 2008 15:11:20 +1200 Subject: [erlang-questions] Timezone calculations In-Reply-To: <1c3be50f0809181218p42667c42pb022583b9bb7ffb@mail.gmail.com> References: <1c3be50f0809181218p42667c42pb022583b9bb7ffb@mail.gmail.com> Message-ID: <48D31858.8060909@Fitzsimons.org> Juan Jose Comellas wrote: > I need to perform time calculations based on arbitrary (user-supplied) > timezones and I haven't found anything in Erlang/OTP that lets me > determine the offset (in minutes or seconds) that a timezone has > against UTC. The calendar module only supports converting times from > UTC into the local timezone and the other way around, but what if what > I want is to convert a time to another timezone that is not my local one? > > I'd prefer a portable solution, but even if there is an easy way to > access the Olson/zoneinfo tz database on Linux that would be acceptable. Hi Juan, There is no easy answer, TZ's are annoying. The Olson files (or Olson-based OS files) are the best source reference but the POSIX OS routines for accessing them are horrible and not at all oriented to what you (and I, and others) want to use them for. They're old and clunky and don't quite behave the way it reads on the box. They're also subtly different between platforms, I suspect there are reasons harking back to the birth of Un*x. The way I have done it before is to, and bear with me here, is to swap the system (program instance) timezone for the destination timezone for the calculations that need performing. Basically you play with the TZ environment variable. Depending on your use case(s) it may also be necessary to change the date(!) so the offset changes e.g. DST are done correctly. The last time I did this it was in C/C++, the suggestions that you use a port program or linked-in driver would go well with this. TonyGJ's little driver that he used on the Erlang jukebox would be a fine model. I would fully support the effort to parse the Olson files for Erlang, although it may well drive you mad. Parsing is only the first step really, getting a decent data structure around them is not simple since they are quite rich and the supplied Olson C code is, let me be charitable here, cryptic. I've called it worse but I have a grudging respect for it since it does work. In these days of cheaper memory I would like to see a data structure that was more verbose, such as listing each time segment for every TZ for every year, which would make the calculations rather easier. You'd still need to parse the Olson files into this though since they are the primary (only?) single source that is comprehensive and kept current. I'd love to hear other thoughts :-) Cheers, Bruce From Bruce@REDACTED Fri Sep 19 05:11:20 2008 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Fri, 19 Sep 2008 15:11:20 +1200 Subject: [erlang-questions] Timezone calculations In-Reply-To: <1c3be50f0809181218p42667c42pb022583b9bb7ffb@mail.gmail.com> References: <1c3be50f0809181218p42667c42pb022583b9bb7ffb@mail.gmail.com> Message-ID: <48D31858.8060909@Fitzsimons.org> Juan Jose Comellas wrote: > I need to perform time calculations based on arbitrary (user-supplied) > timezones and I haven't found anything in Erlang/OTP that lets me > determine the offset (in minutes or seconds) that a timezone has > against UTC. The calendar module only supports converting times from > UTC into the local timezone and the other way around, but what if what > I want is to convert a time to another timezone that is not my local one? > > I'd prefer a portable solution, but even if there is an easy way to > access the Olson/zoneinfo tz database on Linux that would be acceptable. Hi Juan, There is no easy answer, TZ's are annoying. The Olson files (or Olson-based OS files) are the best source reference but the POSIX OS routines for accessing them are horrible and not at all oriented to what you (and I, and others) want to use them for. They're old and clunky and don't quite behave the way it reads on the box. They're also subtly different between platforms, I suspect there are reasons harking back to the birth of Un*x. The way I have done it before is to, and bear with me here, is to swap the system (program instance) timezone for the destination timezone for the calculations that need performing. Basically you play with the TZ environment variable. Depending on your use case(s) it may also be necessary to change the date(!) so the offset changes e.g. DST are done correctly. The last time I did this it was in C/C++, the suggestions that you use a port program or linked-in driver would go well with this. TonyGJ's little driver that he used on the Erlang jukebox would be a fine model. I would fully support the effort to parse the Olson files for Erlang, although it may well drive you mad. Parsing is only the first step really, getting a decent data structure around them is not simple since they are quite rich and the supplied Olson C code is, let me be charitable here, cryptic. I've called it worse but I have a grudging respect for it since it does work. In these days of cheaper memory I would like to see a data structure that was more verbose, such as listing each time segment for every TZ for every year, which would make the calculations rather easier. You'd still need to parse the Olson files into this though since they are the primary (only?) single source that is comprehensive and kept current. I'd love to hear other thoughts :-) Cheers, Bruce From ok@REDACTED Fri Sep 19 05:19:10 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 19 Sep 2008 15:19:10 +1200 Subject: [erlang-questions] lists:seq/[2,3] bug? In-Reply-To: <8970_1221759228_m8IHXj4J003105_48D28DF5.7070704@cs.ntua.gr> References: <469D2176-D5D1-4C72-A849-E552184FCECE@cs.otago.ac.nz> <8970_1221759228_m8IHXj4J003105_48D28DF5.7070704@cs.ntua.gr> Message-ID: <222ECE37-CA2A-4D9E-A43E-F6D22FFCB169@cs.otago.ac.nz> On 19 Sep 2008, at 5:20 am, Kostis Sagonas wrote: > Richard A. O'Keefe wrote: >> On my Mac I have Erlang R12B-3. >> ..... >> >> lists:seq(1, N) gives me the expected N-element list for >> integers N >= 1. I expect, indeed, I would require, that >> lists:seq(1, 0) should give me the empty list. I was not referring to an IMPLEMENTATION bug, but to a DESIGN bug. As in, the function does what it is documented as doing, but that's not clearly the best thing to do. If lists:reverse/1 had been designed to crash on empty lists, or if lists:sublist(List, N) had been designed to crash if N was 0, EVEN IF the code did exactly what it was documented as doing, I think it would be reasonable to regard that as a design bug. >> So, I fail to see why, after having read the manual, one is >> surprised by > the results below: I am NOT surprised by the results. What I am is DISMAYED by them. It seems absurd to handle an increment of 0 (none of the languages I normally use bother with that) but to refuse to return a result with a length of 0, especially as the zero-length-result CAN be very naturally included in the scope of a SIMPLE explanation of what the result is, but the zero-step case CANNOT. What I am asking for is a DESIGN change, to get exactly the same result that we get now in every case where the current code gives any result at all, but to ALSO yield zero-length results when a simple specification (like "the length of the result is Max-Min+1") would lead you to expect them. I now have a slightly cleaner version of the code, which runs about twice as fast as the current library version. More speed AND more results. From ok@REDACTED Fri Sep 19 05:22:18 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 19 Sep 2008 15:22:18 +1200 Subject: [erlang-questions] lists:seq/[2,3] bug? In-Reply-To: <8246_1221763099_m8IIcGj2016231_48D2A006.3080204@charpi.net> References: <469D2176-D5D1-4C72-A849-E552184FCECE@cs.otago.ac.nz> <6339_1221721961_m8I7Cc6f016403_48D1FDCB.1000100@charpi.net> <8246_1221763099_m8IIcGj2016231_48D2A006.3080204@charpi.net> Message-ID: <7F770E1A-1529-49B2-B949-2226094AECBC@cs.otago.ac.nz> On 19 Sep 2008, at 6:37 am, Nicolas Charpentier wrote: > Richard A. O'Keefe wrote: >>> I think that your proposition will break a lot of code. >> Why do you think that? The correction I want ONLY affects >> cases where the current version blows up; whenever the >> current version returns any answer at all, mine returns the >> same one. > > Hi, > > With the current implementation, the process crashes if it calls > lists:seq(N,M) with M With your proposition, the same process will continue to do things > but using an empty sequence. ONLY in the case M = N - 1, and BECAUSE IT MAKES SENSE. > > For me, this is a big difference and all running applications must > be checked to ensure that they can handle empty sequence correctly. It is also the case right now that all existing code that uses seq should be checked to ensure that it DOESN'T expect empty results. I know what the manual says, but people find it easier to remember stuff that makes sense, and so it's entirely credible that other people than me would have test cases [F(I) || I <- lists:seq(1, N)] that fall down dead when N = 0 *but shouldn't*. From fritchie@REDACTED Fri Sep 19 06:34:35 2008 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Thu, 18 Sep 2008 23:34:35 -0500 Subject: [erlang-questions] Network partition scenario In-Reply-To: Message of "Thu, 11 Sep 2008 12:31:10 PDT." Message-ID: <21309.1221798875@snookles.snookles.com> JasonGanetsky wrote: jg> I will handle this, basically, by jg> shutting down the application on both nodes, clearing mnesia (which jg> is acceptable in this case), restarting mnesia, and then restarting jg> my application. Out of curiousity ... what does "clearing mnesia" mean? Starting from scratch, deleting all Mnesia data? Or something else? jg> I will not use mnesia:set_master_nodes(), as it jg> apparently causes the inconsistent_database message to be jg> suppressed. While the network partition was in effect, transactions on both sides may have done globally-inconsistent things ... but one won't know that until the partition is healed. jg> My question is: how do I get them to reconnect? Should I do this by jg> simpling calling net_adm:ping() on the other node regularly? Or is jg> there a better way? Also, am I correct in assuming that restarting jg> mnesia will cause them to re-sync? You'll need some excuse for one to communicate with the other. If you're using default value of "-kernel dist_auto_connect" (not "once" or "false", see net_kernel(3)), net_adm:ping() is good enough. Upon restarting, the local Mnesia instance will need to contact other transaction managers to calculate the fate of any unresolved transactions. That need will trigger re-connecting if dist_auto_connect is true. -Scott From fritchie@REDACTED Fri Sep 19 08:24:04 2008 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 19 Sep 2008 01:24:04 -0500 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: Message of "Sat, 13 Sep 2008 21:36:32 +0200." <97619b170809131236i5b313d1fu293f249bc6b71913@mail.gmail.com> Message-ID: <26699.1221805444@snookles.snookles.com> Rapsey wrote: r> How many mnesia transactions do you have left? From what I tested, r> transactions are slow as hell. I'm curious, what kind of transactions? In tests from over a year ago (using R11B-5, I think, it's the only hard data that I have within easy arm's reach), I had single table performance on 2-node cluster, Xeon 2.8GHz CPUs (maybe?), 'disc_copies' tables that were replicated on each node as well as fragmented, with single table read txns (context = sync_transaction) of up to 7K transactions/sec and single table (single key) update txns at 4.1K transactions/sec. Not stupendously great, but for a non-SMP VM plus Mnesia's distributed transaction managers involved in every transaction, it isn't too bad. If your tables were type 'disc_only_copies', then I'd have far fewer problems believing. -Scott From fritchie@REDACTED Fri Sep 19 08:28:32 2008 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 19 Sep 2008 01:28:32 -0500 Subject: [erlang-questions] My frustration with Erlang In-Reply-To: Message of "Sun, 14 Sep 2008 07:58:12 PDT." <217349.77552.qm@web38803.mail.mud.yahoo.com> Message-ID: <26889.1221805712@snookles.snookles.com> Thomas Lindgren wrote: tl> A further technical limitation of nodes, once pointed out to me by tl> Sean Hinde, is that sockets can't be sent between nodes today. If you can extract the file descriptor number, the "unixdom_drv" item in Jungerl should allow file descriptor passing on the same machine. Assuming support for your OS, no bit-rot in the repository ... YMMV? -Scott From fritchie@REDACTED Fri Sep 19 08:34:30 2008 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 19 Sep 2008 01:34:30 -0500 Subject: [erlang-questions] Plans for Erlounging in Victoria? Message-ID: <27180.1221806070@snookles.snookles.com> Hi, all. I haven't heard much about Erlounging, touring, etc. next week in Victoria, BC for the ICFP conference & workshops following. I'll be arriving Thursday afternoon, attending the CUFP and Erlang workshops on Friday & Saturday, then departing Sunday morning (alas!) to visit The Corporate Mothership down in the Bay Area for a while. Often, there's been a day (or afternoon) to see some of the sights. Having never visited Victoria before, I'm looking forward to some wandering around with a bunch of FP geeks. 'Twas a lot of fun in Pittsburgh, Salt Lake City, and Portland. -Scott From per@REDACTED Fri Sep 19 08:54:22 2008 From: per@REDACTED (Per Hedeland) Date: Fri, 19 Sep 2008 08:54:22 +0200 (CEST) Subject: [erlang-questions] Death of Erlang VM In-Reply-To: <971980cc0809181753m5027e8f5i6580fbfa0dfc474a@mail.gmail.com> Message-ID: <200809190654.m8J6sMB4083408@pluto.hedeland.org> "Brian Troutwine" wrote: > >I've encountered a problem, but I'm not really sure what is the >matter. After running my erlang application for some time I was >noticed that it had died, though not exited or become a zombie. [snip] >Sep 18 17:33:05 valinor kernel: [1134774.645453] Oops: 0000 [1] SMP The "cute" 'Oops' is telling you that the Linux kernel has discovered some badness in its internal data structures - this is almost always indicative of a kernel bug. It may or may not have anything to do with the fact that you were running Erlang, but one aspect of the Linux 'Oops' handling is that the currently running process is logged and killed, regardless. (Another is that the kernel keeps running, which might be considered an odd thing for the entity responsible for system integrity to do in that situation - a traditional Unix kernel forces a reboot, with a crash dump if enabled.) Anyway, even if 'beam' somehow triggered it (and a quick look at the stack trace indicates that this is likely), it's still a kernel problem - by definition, an unprivileged user process should never be able to mess up the kernel data (normally a privileged process shouldn't be able to either, but if it can and does scribble on kernel memory via /dev/mem or somesuch, it may be hard to argue the case). If not a kernel bug, it can of course be a HW issue - e.g. faulty memory or unreliable power supply can cause arbitrarily weird problems. Your best bet is probably to take the issue to some Linux support forum. --Per Hedeland From alexander.lamb@REDACTED Fri Sep 19 09:34:16 2008 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Fri, 19 Sep 2008 09:34:16 +0200 Subject: [erlang-questions] Connecting to MySQL: ODBC or Native driver? Message-ID: Hello, I need to connect to some existing MySQL databases. Version is 5.1. OTP version is R12B-2 Platform is MacOSX for development and Linux for deployment. From what I see, there are 3 solutions: 1) ODBC Pros: odbc module is supplied in the standard erlang distribution Cons: probably slower and certainly one layer too much, especially on MacOSX and Linux 2) Native driver from ProcessOne 3) "Enhanced" native driver from ProcessOne in ErlyWeb I tried (1) and (3) but didn't manage to connect. Before going further, I would like your opinion on which path to take. Thanks a lot, -- Alexander Lamb Founding Associate RODANOTECH S?rl 4 ch. de la Tour de Champel 1206 Geneva Switzerland Tel: 022 347 77 37 Fax: 022 347 77 38 http://www.rodanotech.ch From ulf.wiger@REDACTED Fri Sep 19 09:52:27 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 19 Sep 2008 09:52:27 +0200 Subject: [erlang-questions] Timezone calculations In-Reply-To: <1c3be50f0809181218p42667c42pb022583b9bb7ffb@mail.gmail.com> References: <1c3be50f0809181218p42667c42pb022583b9bb7ffb@mail.gmail.com> Message-ID: <48D35A3B.8020506@ericsson.com> Juan Jose Comellas skrev: > I need to perform time calculations based on arbitrary > (user-supplied) timezones and I haven't found anything in Erlang/OTP > that lets me determine the offset (in minutes or seconds) that a > timezone has against UTC. The calendar module only supports > converting times from UTC into the local timezone and the other way > around, but what if what I want is to convert a time to another > timezone that is not my local one? > > I'd prefer a portable solution, but even if there is an easy way to > access the Olson/zoneinfo tz database on Linux that would be > acceptable. Back in the good ol' days, when anybody who was anybody ran their mission-critical systems on Solaris*, and Solaris required an OS patch to deal with updated timezone rules (and DST is governed by political decisions in some countries!), we once decided to set the system clock of our embedded systems to UTC, and handled local time in Erlang by modifying the TZ environment variable - initially through a linked-in driver, but later with os:putenv/2. It's not a complete solution, nor in some respects an especially good one, but back then, we considered it the lesser of known evils. Of course, it wouldn't solve your particular problem, unless you'd be willing to consider starting a separate erlang node, setting its TZ to the zone you're interested in, and then calculate the diff between universal time and local time. (: The amount of coding required would be small, but might not be able to stand the side-effects and ugliness of it all... BR, Ulf W * I'm joking, of course, but at least we did it. From kenji.rikitake@REDACTED Fri Sep 19 10:17:10 2008 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Fri, 19 Sep 2008 17:17:10 +0900 Subject: [erlang-questions] Timezone calculations In-Reply-To: <48D35A3B.8020506@ericsson.com> References: <1c3be50f0809181218p42667c42pb022583b9bb7ffb@mail.gmail.com> <48D35A3B.8020506@ericsson.com> Message-ID: <20080919081710.GA70194@k2r.org> In the message <48D35A3B.8020506@REDACTED> dated Fri, Sep 19, 2008 at 09:52:04AM +0200, "Ulf Wiger (TN/EAB)" writes: > [...] we once > decided to set the system clock of our embedded systems to UTC, > and handled local time in Erlang by modifying the TZ environment > variable - initially through a linked-in driver, but later with > os:putenv/2. I like this idea very much, but executing os:putenv("TZ","GMT") is not enough to correct the erlang:now/1 issue for systems which the wall clocks are running in TAI, i.e. leap-second-aware timezone. See http://www.erlang.org/pipermail/erlang-patches/2008-September/000299.html for my patch to R12B4 to solve the leap-second issue. FYI. Kenji Rikitake (Should I write an EEP for this?) From mikpe@REDACTED Fri Sep 19 12:30:00 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Fri, 19 Sep 2008 12:30:00 +0200 Subject: [erlang-questions] Death of Erlang VM In-Reply-To: <971980cc0809181753m5027e8f5i6580fbfa0dfc474a@mail.gmail.com> References: <971980cc0809181753m5027e8f5i6580fbfa0dfc474a@mail.gmail.com> Message-ID: <18643.32552.215496.512841@harpo.it.uu.se> Brian Troutwine writes: > Hello all, > > I've encountered a problem, but I'm not really sure what is the > matter. After running my erlang application for some time I was > noticed that it had died, though not exited or become a zombie. I run > it like so: > > $ erl +A 2 +K true -boot aule -config sys.config > > I run a Debian stable AMD64 machine. Here's some information on my environment: > > $ cat /proc/version > Linux version 2.6.24-19-xen (buildd@REDACTED) (gcc version 4.2.3 (Ubuntu > 4.2.3-2ubuntu7)) #1 SMP Wed Aug 20 21:08:51 UTC 2008 > $ erl > Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:4] > [async-threads:0] [hipe] [kernel-poll:false] > > What appeared in my syslog follows. I am doing writes to disk with the > delayed_write flag set. Is there more information that would be > useful? Here's what appeared in my syslog: > > Sep 18 17:33:05 valinor kernel: [1134774.645406] Unable to handle > kernel paging request at ffff88001a289008 RIP: > Sep 18 17:33:05 valinor kernel: [1134774.645421] [] > iov_iter_advance+0x66/0x80 > Sep 18 17:33:05 valinor kernel: [1134774.645445] PGD 57f5067 PUD > 57f6067 PMD 58c8067 PTE 0 > Sep 18 17:33:05 valinor kernel: [1134774.645453] Oops: 0000 [1] SMP > Sep 18 17:33:05 valinor kernel: [1134774.645458] CPU 3 > Sep 18 17:33:05 valinor kernel: [1134774.645462] Modules linked in: > ipv6 ext3 jbd mbcache evdev raid10 raid456 async_xor async_memcpy > async_tx xor raid1 raid0 multipath linear md_mo > d dm_mirror dm_snapshot dm_mod fuse loop 8250 serial_core > Sep 18 17:33:05 valinor kernel: [1134774.645492] Pid: 2249, comm: > beam.smp Not tainted 2.6.24-19-xen #1 > Sep 18 17:33:05 valinor kernel: [1134774.645497] RIP: > e030:[] [] > iov_iter_advance+0x66/0x80 > Sep 18 17:33:05 valinor kernel: [1134774.645504] RSP: > e02b:ffff8800050c5b10 EFLAGS: 00010246 > Sep 18 17:33:05 valinor kernel: [1134774.645508] RAX: 0000000000000000 > RBX: 0000000000000b2a RCX: 0000000000000000 > Sep 18 17:33:05 valinor kernel: [1134774.645513] RDX: 0000000000000000 > RSI: 0000000000000b2a RDI: ffff8800050c5ba8 > Sep 18 17:33:05 valinor kernel: [1134774.645518] RBP: 0000000000000b2a > R08: 0000000000000000 R09: 0000000000000000 > Sep 18 17:33:05 valinor kernel: [1134774.645523] R10: ffff88001a289000 > R11: 0000000000000000 R12: 0000000000c09000 > Sep 18 17:33:05 valinor kernel: [1134774.645527] R13: 0000000000001000 > R14: ffff880018895220 R15: 0000000000000000 > Sep 18 17:33:05 valinor kernel: [1134774.645534] FS: > 00007f74138e0960(0000) GS:ffffffff805c6180(0000) > knlGS:0000000000000000 > Sep 18 17:33:05 valinor kernel: [1134774.645539] CS: e033 DS: 0000 ES: 0000 > Sep 18 17:33:05 valinor kernel: [1134774.645542] DR0: 0000000000000000 > DR1: 0000000000000000 DR2: 0000000000000000 > Sep 18 17:33:05 valinor kernel: [1134774.645548] DR3: 0000000000000000 > DR6: 00000000ffff0ff0 DR7: 0000000000000000 > Sep 18 17:33:05 valinor kernel: [1134774.645553] Process beam.smp > (pid: 2249, threadinfo ffff8800050c4000, task ffff88001ebfa800) > Sep 18 17:33:05 valinor kernel: [1134774.645558] Stack: > ffffffff80273f9e ffff88001ecfef00 ffff880012938080 0000000000000000 > Sep 18 17:33:05 valinor kernel: [1134774.645567] ffff8800050c5db8 > 0000000000bfc427 ffff8800050c5d38 ffff88001ecfef00 > Sep 18 17:33:05 valinor kernel: [1134774.645575] ffff880018895220 > ffffffff880deac0 ffff880018895110 000000000000cbd9 > Sep 18 17:33:05 valinor kernel: [1134774.645582] Call Trace: > Sep 18 17:33:05 valinor kernel: [1134774.645588] [] > generic_file_buffered_write+0x1de/0x6e0 > Sep 18 17:33:05 valinor kernel: [1134774.645601] [] > :jbd:journal_stop+0x13e/0x1d0 > Sep 18 17:33:05 valinor kernel: [1134774.645608] [] > __generic_file_aio_write_nolock+0x24f/0x400 > Sep 18 17:33:05 valinor kernel: [1134774.645614] [] > find_extend_vma+0x24/0x80 > Sep 18 17:33:05 valinor kernel: [1134774.645622] [] > unqueue_me+0x54/0xa0 > Sep 18 17:33:05 valinor kernel: [1134774.645628] [] > generic_file_aio_write+0x64/0xd0 > Sep 18 17:33:05 valinor kernel: [1134774.645642] [] > :ext3:ext3_file_write+0x23/0xc0 > Sep 18 17:33:05 valinor kernel: [1134774.645650] [] > :ext3:ext3_file_write+0x0/0xc0 > Sep 18 17:33:05 valinor kernel: [1134774.645656] [] > do_sync_readv_writev+0xcb/0x110 > Sep 18 17:33:05 valinor kernel: [1134774.645663] [] > futex_wake+0xcd/0xf0 > Sep 18 17:33:05 valinor kernel: [1134774.645668] [] > autoremove_wake_function+0x0/0x30 > Sep 18 17:33:05 valinor kernel: [1134774.645675] [] > do_futex+0x134/0xc30 > Sep 18 17:33:05 valinor kernel: [1134774.645680] [] > __kmalloc+0x13c/0x160 > Sep 18 17:33:05 valinor kernel: [1134774.645686] [] > do_readv_writev+0xfd/0x230 > Sep 18 17:33:05 valinor kernel: [1134774.645693] [] > error_exit+0x0/0x79 > Sep 18 17:33:05 valinor kernel: [1134774.645700] [] > sys_writev+0x53/0xc0 > Sep 18 17:33:05 valinor kernel: [1134774.645706] [] > system_call+0x68/0x6d > Sep 18 17:33:05 valinor kernel: [1134774.645711] [] > system_call+0x0/0x6d > Sep 18 17:33:05 valinor kernel: [1134774.645716] > Sep 18 17:33:05 valinor kernel: [1134774.645718] > Sep 18 17:33:05 valinor kernel: [1134774.645718] Code: 49 8b 52 08 49 > 89 d3 eb c4 4c 89 17 4c 89 4f 10 eb 99 0f 1f > Sep 18 17:33:05 valinor kernel: [1134774.645739] RIP > [] iov_iter_advance+0x66/0x80 > Sep 18 17:33:05 valinor kernel: [1134774.645745] RSP > Sep 18 17:33:05 valinor kernel: [1134774.645749] CR2: ffff88001a289008 > Sep 18 17:33:05 valinor kernel: [1134774.645762] ---[ end trace > a91a752e8ec506f8 ]--- As Per Hedeland wrote this is a kernel bug, or possibly bad HW. You should first check if this problem still appears with current kernels (2.6.26 or newer), and if it does, if it also appears on other machines (to rule out bad HW). If the problem persists, then it needs to be fixed. Without a test case it will be difficult to debug this, however. So, if you can, please try to distill your application down to something you can make public and which still triggers the problem. From exta7@REDACTED Fri Sep 19 16:06:39 2008 From: exta7@REDACTED (Zvi) Date: Fri, 19 Sep 2008 07:06:39 -0700 (PDT) Subject: [erlang-questions] value of spawned function Message-ID: <19573059.post@talk.nabble.com> Hi, I trying to implement some Fork-Join constructs in Erlang using links or monitors. I do not understand why when process finished executing function normally, it's (function's) return value isn't put into 'EXIT' or 'DOWN' messages? I.e. instead of atom 'normal' return {normal, ResultOfFun} or something similar. {'EXIT',Pid,normal} {'DOWN',Ref,process,Pid,normal} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -module(fj). -compile(export_all). -define(N, erlang:system_info(schedulers) ). test_monitor() -> % fork PidRefs = [spawn_monitor( fun() -> io:format("pid: ~w~n",[self()]) end) || _<-lists:seq(1,?N)], io:format("PidRefs: ~w~n", [PidRefs]), % join [receive {'DOWN',Ref,process,Pid,_}->ok end || {Pid,Ref}<-PidRefs ]. test_link() -> % fork process_flag(trap_exit, true), Pids = [spawn_link( fun() -> io:format("pid: ~w~n",[self()]) end) || _<-lists:seq(1,?N)], io:format("Pids: ~w~n", [Pids]), % join [receive {'EXIT',Pid,_}->ok end || Pid<-Pids ]. P.S. if there is some better ways to implement fork join please let me know. Zvi -- View this message in context: http://www.nabble.com/value-of-spawned-function-tp19573059p19573059.html Sent from the Erlang Questions mailing list archive at Nabble.com. From raimo+erlang-questions@REDACTED Fri Sep 19 16:51:45 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 19 Sep 2008 16:51:45 +0200 Subject: [erlang-questions] ned function In-Reply-To: <19573059.post@talk.nabble.com> References: <19573059.post@talk.nabble.com> Message-ID: <20080919145145.GB21328@erix.ericsson.se> On Fri, Sep 19, 2008 at 07:06:39AM -0700, Zvi wrote: > > Hi, > > I trying to implement some Fork-Join constructs in Erlang using links or > monitors. > I do not understand why when process finished executing function normally, > it's (function's) return value isn't put into 'EXIT' or 'DOWN' messages? > I.e. instead of atom 'normal' return {normal, ResultOfFun} or something > similar. > Nope. Functions return values, processes does not. One dirty way is to end with exit({done,Value}) and wait for {'DOWN',Ref,_,Pid,{done,Value}}. > {'EXIT',Pid,normal} > > {'DOWN',Ref,process,Pid,normal} > > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > -module(fj). > -compile(export_all). > > -define(N, erlang:system_info(schedulers) ). > > test_monitor() -> > % fork > PidRefs = [spawn_monitor( > fun() -> io:format("pid: ~w~n",[self()]) end) || > _<-lists:seq(1,?N)], > io:format("PidRefs: ~w~n", [PidRefs]), > % join > [receive {'DOWN',Ref,process,Pid,_}->ok end || {Pid,Ref}<-PidRefs ]. > > test_link() -> > % fork > process_flag(trap_exit, true), > Pids = [spawn_link( > fun() -> io:format("pid: ~w~n",[self()]) end) || > _<-lists:seq(1,?N)], > io:format("Pids: ~w~n", [Pids]), > % join > [receive {'EXIT',Pid,_}->ok end || Pid<-Pids ]. > > P.S. > if there is some better ways to implement fork join please let me know. > > Zvi > -- > View this message in context: http://www.nabble.com/value-of-spawned-function-tp19573059p19573059.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From kostis@REDACTED Fri Sep 19 17:30:46 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 19 Sep 2008 18:30:46 +0300 Subject: [erlang-questions] lists:seq/[2,3] bug? In-Reply-To: <7F770E1A-1529-49B2-B949-2226094AECBC@cs.otago.ac.nz> References: <469D2176-D5D1-4C72-A849-E552184FCECE@cs.otago.ac.nz> <6339_1221721961_m8I7Cc6f016403_48D1FDCB.1000100@charpi.net> <8246_1221763099_m8IIcGj2016231_48D2A006.3080204@charpi.net> <7F770E1A-1529-49B2-B949-2226094AECBC@cs.otago.ac.nz> Message-ID: <48D3C5A6.1040003@cs.ntua.gr> Richard A. O'Keefe wrote: > On 19 Sep 2008, at 6:37 am, Nicolas Charpentier wrote: > >> Richard A. O'Keefe wrote: >>>> I think that your proposition will break a lot of code. >>> Why do you think that? The correction I want ONLY affects >>> cases where the current version blows up; whenever the >>> current version returns any answer at all, mine returns the >>> same one. >> Hi, >> >> With the current implementation, the process crashes if it calls >> lists:seq(N,M) with M> With your proposition, the same process will continue to do things >> but using an empty sequence. > > ONLY in the case M = N - 1, and BECAUSE IT MAKES SENSE. Despite all the shouting, I've yet to read a coherent argument why the case M = N - 1 is more special than e.g. the case M = N - 42. [Please realize that similarly to "expect", the expression "makes sense" is also highly subjective. I do not see why throwing an exception for M> For me, this is a big difference and all running applications must >> be checked to ensure that they can handle empty sequence correctly. > > It is also the case right now that all existing code that uses seq > should be checked to ensure that it DOESN'T expect empty results. > I know what the manual says, but people find it easier to remember > stuff that makes sense, and so it's entirely credible that other > people than me would have test cases > [F(I) || I <- lists:seq(1, N)] > that fall down dead when N = 0 *but shouldn't*. I repeat: If we were to change the behaviour of lists:seq/2 -- and so far I've not yet read something that convinced me we should -- how is the above different than e.g. lists:seq(8, 5) ? Kostis From jason.ganetsky@REDACTED Fri Sep 19 17:33:26 2008 From: jason.ganetsky@REDACTED (Jason Ganetsky) Date: Fri, 19 Sep 2008 11:33:26 -0400 Subject: [erlang-questions] Network partition scenario In-Reply-To: <21309.1221798875@snookles.snookles.com> References: <21309.1221798875@snookles.snookles.com> Message-ID: On Fri, Sep 19, 2008 at 12:34 AM, Scott Lystig Fritchie < fritchie@REDACTED> wrote: > JasonGanetsky wrote: > > jg> I will handle this, basically, by > jg> shutting down the application on both nodes, clearing mnesia (which > jg> is acceptable in this case), restarting mnesia, and then restarting > jg> my application. > > Out of curiousity ... what does "clearing mnesia" mean? Starting from > scratch, deleting all Mnesia data? Or something else? Deleting all Mnesia data. They way I'm using Mnesia for my application, it works... (it's to be avoided, but it's acceptable in the infrequent case of partition). > > > jg> I will not use mnesia:set_master_nodes(), as it > jg> apparently causes the inconsistent_database message to be > jg> suppressed. > > While the network partition was in effect, transactions on both sides > may have done globally-inconsistent things ... but one won't know that > until the partition is healed. My question was not about the consequences of network partitions, but about how Mnesia detects and notifies. Mnesia listens to nodeup messages. Any time it receives one, it performs an "inconsistency" check, by querying the new node for whether it had itself marked the queryer as mnesia_down. If this is the case, a running_partitioned_network message is generated. Transactions do not factor in to the inconsistency check at all. Whenever a new node joins the ring, all nodes receive a nodeup message, so potentially, all nodes generate the running_partitioned_network message. Having a non-empty master_nodes list causes a node to always respond with "you are not mnesia_down", when queried. However, it still generates running_partitioned_network messages locally (as expected, since the other nodes may respond with "yes, you've been mnesia_down"). I discovered this by reading the Mnesia code, and by studying its behavior. I've decided to have empty master_nodes lists on all my nodes, because I want all nodes notified in the event of a network parition. > > > jg> My question is: how do I get them to reconnect? Should I do this by > jg> simpling calling net_adm:ping() on the other node regularly? Or is > jg> there a better way? Also, am I correct in assuming that restarting > jg> mnesia will cause them to re-sync? > > You'll need some excuse for one to communicate with the other. If > you're using default value of "-kernel dist_auto_connect" (not "once" or > "false", see net_kernel(3)), net_adm:ping() is good enough. > > Upon restarting, the local Mnesia instance will need to contact other > transaction managers to calculate the fate of any unresolved > transactions. That need will trigger re-connecting if dist_auto_connect > is true. > Does do anything with transactions? As far as I can tell, it simply dumps its replica and goes with whatever the other node has. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Fri Sep 19 17:43:12 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Fri, 19 Sep 2008 17:43:12 +0200 Subject: [erlang-questions] value of spawned function In-Reply-To: <19573059.post@talk.nabble.com> References: <19573059.post@talk.nabble.com> Message-ID: <14f0e3620809190843x108b91abteb567cb463e54f19@mail.gmail.com> You may try to use erlang:exit/1 to make 'EXIT'/'DOWN' message "return" something instead of 'normal'. Take a look at plists: http://code.google.com/p/plists/ - it implements quite a lot of parallel list operations, which may be what you are looking for :) On Fri, Sep 19, 2008 at 4:06 PM, Zvi wrote: > > Hi, > > I trying to implement some Fork-Join constructs in Erlang using links or > monitors. > I do not understand why when process finished executing function normally, > it's (function's) return value isn't put into 'EXIT' or 'DOWN' messages? > I.e. instead of atom 'normal' return {normal, ResultOfFun} or something > similar. > > {'EXIT',Pid,normal} > > {'DOWN',Ref,process,Pid,normal} > > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > -module(fj). > -compile(export_all). > > -define(N, erlang:system_info(schedulers) ). > > test_monitor() -> > % fork > PidRefs = [spawn_monitor( > fun() -> io:format("pid: ~w~n",[self()]) end) || > _<-lists:seq(1,?N)], > io:format("PidRefs: ~w~n", [PidRefs]), > % join > [receive {'DOWN',Ref,process,Pid,_}->ok end || {Pid,Ref}<-PidRefs ]. > > test_link() -> > % fork > process_flag(trap_exit, true), > Pids = [spawn_link( > fun() -> io:format("pid: ~w~n",[self()]) end) || > _<-lists:seq(1,?N)], > io:format("Pids: ~w~n", [Pids]), > % join > [receive {'EXIT',Pid,_}->ok end || Pid<-Pids ]. > > P.S. > if there is some better ways to implement fork join please let me know. > > Zvi > -- > View this message in context: http://www.nabble.com/value-of-spawned-function-tp19573059p19573059.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From jason.ganetsky@REDACTED Fri Sep 19 17:49:09 2008 From: jason.ganetsky@REDACTED (Jason Ganetsky) Date: Fri, 19 Sep 2008 11:49:09 -0400 Subject: [erlang-questions] value of spawned function In-Reply-To: <14f0e3620809190843x108b91abteb567cb463e54f19@mail.gmail.com> References: <19573059.post@talk.nabble.com> <14f0e3620809190843x108b91abteb567cb463e54f19@mail.gmail.com> Message-ID: Try something like this... -module(forkjoin). -compile(export_all). fork(FunList) when is_list(FunList) -> process_flag(trap_exit, true), ParentPid = self(), [begin WrappedFun = fun () -> ParentPid ! {'RESULT', self(), Fun()} end, spawn_link(WrappedFun) end || Fun <- FunList]. join(PidList) when is_list(PidList) -> [receive {'RESULT', Pid, Result} -> {ok, Result}; {'EXIT', Pid, Reason} -> {error, Reason} end || Pid <- PidList]. On Fri, Sep 19, 2008 at 11:43 AM, Gleb Peregud wrote: > You may try to use erlang:exit/1 to make 'EXIT'/'DOWN' message > "return" something instead of 'normal'. > > Take a look at plists: http://code.google.com/p/plists/ - it > implements quite a lot of parallel list operations, which may be what > you are looking for :) > > On Fri, Sep 19, 2008 at 4:06 PM, Zvi wrote: > > > > Hi, > > > > I trying to implement some Fork-Join constructs in Erlang using links or > > monitors. > > I do not understand why when process finished executing function > normally, > > it's (function's) return value isn't put into 'EXIT' or 'DOWN' messages? > > I.e. instead of atom 'normal' return {normal, ResultOfFun} or something > > similar. > > > > {'EXIT',Pid,normal} > > > > {'DOWN',Ref,process,Pid,normal} > > > > > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > -module(fj). > > -compile(export_all). > > > > -define(N, erlang:system_info(schedulers) ). > > > > test_monitor() -> > > % fork > > PidRefs = [spawn_monitor( > > fun() -> io:format("pid: ~w~n",[self()]) end) || > > _<-lists:seq(1,?N)], > > io:format("PidRefs: ~w~n", [PidRefs]), > > % join > > [receive {'DOWN',Ref,process,Pid,_}->ok end || {Pid,Ref}<-PidRefs > ]. > > > > test_link() -> > > % fork > > process_flag(trap_exit, true), > > Pids = [spawn_link( > > fun() -> io:format("pid: ~w~n",[self()]) end) || > > _<-lists:seq(1,?N)], > > io:format("Pids: ~w~n", [Pids]), > > % join > > [receive {'EXIT',Pid,_}->ok end || Pid<-Pids ]. > > > > P.S. > > if there is some better ways to implement fork join please let me know. > > > > Zvi > > -- > > View this message in context: > http://www.nabble.com/value-of-spawned-function-tp19573059p19573059.html > > Sent from the Erlang Questions mailing list archive at Nabble.com. > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > Gleb Peregud > http://gleber.pl/ > > Every minute is to be grasped. > Time waits for nobody. > -- Inscription on a Zen Gong > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Dana.RUBINO@REDACTED Fri Sep 19 17:46:51 2008 From: Dana.RUBINO@REDACTED (Dana.RUBINO@REDACTED) Date: Fri, 19 Sep 2008 16:46:51 +0100 Subject: [erlang-questions] Appmon problem In-Reply-To: References: Message-ID: Hi all, I am trying to look at an app via the appmon module - appmon:start() I can see my app in the main window but when I click on the button I cannot see any processes inside. Is there a configuration I am missing perhaps? I have a small app with a single supervisor with a few workers and packaged as a .app - started as application:load(appname) / start(appname). If I then switch to sup view it then consumes hundreds of MB mem! (and still doesn't show anything) Any thoughts on this? Thanks, Dan *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbs.com/gbm www.rbsgc.com *********************************************************************************** From thomasl_erlang@REDACTED Fri Sep 19 18:16:39 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 19 Sep 2008 09:16:39 -0700 (PDT) Subject: [erlang-questions] My frustration with Erlang In-Reply-To: <26889.1221805712@snookles.snookles.com> Message-ID: <408123.61339.qm@web38805.mail.mud.yahoo.com> --- On Fri, 9/19/08, Scott Lystig Fritchie wrote: > tl> A further technical limitation of nodes, once > pointed out to me by > tl> Sean Hinde, is that sockets can't be sent > between nodes today. > > If you can extract the file descriptor number, the > "unixdom_drv" item in > Jungerl should allow file descriptor passing on the same > machine. > Assuming support for your OS, no bit-rot in the repository > ... YMMV? By no means a fundamental limitation (on some Unices at least), but as you note, it may need some trailblazing. Best, Thomas From goofyheadedpunk@REDACTED Fri Sep 19 19:58:58 2008 From: goofyheadedpunk@REDACTED (Brian Troutwine) Date: Fri, 19 Sep 2008 10:58:58 -0700 Subject: [erlang-questions] Death of Erlang VM In-Reply-To: <18643.32552.215496.512841@harpo.it.uu.se> References: <971980cc0809181753m5027e8f5i6580fbfa0dfc474a@mail.gmail.com> <18643.32552.215496.512841@harpo.it.uu.se> Message-ID: <971980cc0809191058l60aafc1fn7ab9d5175623cbdb@mail.gmail.com> Thank you all for your input. > As Per Hedeland wrote this is a kernel bug, or possibly bad HW. It must be a kernel bug. I moved the setup to another system entirely. The trigger program, below, affects both systems similarly. For the time being I've simply removed delayed_write from my application, as it is rather difficult for me, at the moment, to upgrade my kernel version. I will upgrade my Erlang to R12B4 in the next few days, however. > Without a test case it will be difficult to debug this, however. > > So, if you can, please try to distill your application down to > something you can make public and which still triggers the problem. Certainly. It took some time to track down, but the delayed_write parameter to file:open/2 seems to be the culprit. The following code will cause the problem on my current system. -module(bang). -export([main/0]). main() -> {ok, Fd} = file:open("/tmp/blowup.data", [append, delayed_write]), loop(Fd, 0). loop(Fd, Accum) -> file:write(Fd, lists:flatten([integer_to_list(Accum) | "\n"])), loop(Fd, Accum+1). On Fri, Sep 19, 2008 at 3:30 AM, Mikael Pettersson wrote: > Brian Troutwine writes: > > Hello all, > > > > I've encountered a problem, but I'm not really sure what is the > > matter. After running my erlang application for some time I was > > noticed that it had died, though not exited or become a zombie. I run > > it like so: > > > > $ erl +A 2 +K true -boot aule -config sys.config > > > > I run a Debian stable AMD64 machine. Here's some information on my environment: > > > > $ cat /proc/version > > Linux version 2.6.24-19-xen (buildd@REDACTED) (gcc version 4.2.3 (Ubuntu > > 4.2.3-2ubuntu7)) #1 SMP Wed Aug 20 21:08:51 UTC 2008 > > $ erl > > Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:4] > > [async-threads:0] [hipe] [kernel-poll:false] > > > > What appeared in my syslog follows. I am doing writes to disk with the > > delayed_write flag set. Is there more information that would be > > useful? Here's what appeared in my syslog: > > > > Sep 18 17:33:05 valinor kernel: [1134774.645406] Unable to handle > > kernel paging request at ffff88001a289008 RIP: > > Sep 18 17:33:05 valinor kernel: [1134774.645421] [] > > iov_iter_advance+0x66/0x80 > > Sep 18 17:33:05 valinor kernel: [1134774.645445] PGD 57f5067 PUD > > 57f6067 PMD 58c8067 PTE 0 > > Sep 18 17:33:05 valinor kernel: [1134774.645453] Oops: 0000 [1] SMP > > Sep 18 17:33:05 valinor kernel: [1134774.645458] CPU 3 > > Sep 18 17:33:05 valinor kernel: [1134774.645462] Modules linked in: > > ipv6 ext3 jbd mbcache evdev raid10 raid456 async_xor async_memcpy > > async_tx xor raid1 raid0 multipath linear md_mo > > d dm_mirror dm_snapshot dm_mod fuse loop 8250 serial_core > > Sep 18 17:33:05 valinor kernel: [1134774.645492] Pid: 2249, comm: > > beam.smp Not tainted 2.6.24-19-xen #1 > > Sep 18 17:33:05 valinor kernel: [1134774.645497] RIP: > > e030:[] [] > > iov_iter_advance+0x66/0x80 > > Sep 18 17:33:05 valinor kernel: [1134774.645504] RSP: > > e02b:ffff8800050c5b10 EFLAGS: 00010246 > > Sep 18 17:33:05 valinor kernel: [1134774.645508] RAX: 0000000000000000 > > RBX: 0000000000000b2a RCX: 0000000000000000 > > Sep 18 17:33:05 valinor kernel: [1134774.645513] RDX: 0000000000000000 > > RSI: 0000000000000b2a RDI: ffff8800050c5ba8 > > Sep 18 17:33:05 valinor kernel: [1134774.645518] RBP: 0000000000000b2a > > R08: 0000000000000000 R09: 0000000000000000 > > Sep 18 17:33:05 valinor kernel: [1134774.645523] R10: ffff88001a289000 > > R11: 0000000000000000 R12: 0000000000c09000 > > Sep 18 17:33:05 valinor kernel: [1134774.645527] R13: 0000000000001000 > > R14: ffff880018895220 R15: 0000000000000000 > > Sep 18 17:33:05 valinor kernel: [1134774.645534] FS: > > 00007f74138e0960(0000) GS:ffffffff805c6180(0000) > > knlGS:0000000000000000 > > Sep 18 17:33:05 valinor kernel: [1134774.645539] CS: e033 DS: 0000 ES: 0000 > > Sep 18 17:33:05 valinor kernel: [1134774.645542] DR0: 0000000000000000 > > DR1: 0000000000000000 DR2: 0000000000000000 > > Sep 18 17:33:05 valinor kernel: [1134774.645548] DR3: 0000000000000000 > > DR6: 00000000ffff0ff0 DR7: 0000000000000000 > > Sep 18 17:33:05 valinor kernel: [1134774.645553] Process beam.smp > > (pid: 2249, threadinfo ffff8800050c4000, task ffff88001ebfa800) > > Sep 18 17:33:05 valinor kernel: [1134774.645558] Stack: > > ffffffff80273f9e ffff88001ecfef00 ffff880012938080 0000000000000000 > > Sep 18 17:33:05 valinor kernel: [1134774.645567] ffff8800050c5db8 > > 0000000000bfc427 ffff8800050c5d38 ffff88001ecfef00 > > Sep 18 17:33:05 valinor kernel: [1134774.645575] ffff880018895220 > > ffffffff880deac0 ffff880018895110 000000000000cbd9 > > Sep 18 17:33:05 valinor kernel: [1134774.645582] Call Trace: > > Sep 18 17:33:05 valinor kernel: [1134774.645588] [] > > generic_file_buffered_write+0x1de/0x6e0 > > Sep 18 17:33:05 valinor kernel: [1134774.645601] [] > > :jbd:journal_stop+0x13e/0x1d0 > > Sep 18 17:33:05 valinor kernel: [1134774.645608] [] > > __generic_file_aio_write_nolock+0x24f/0x400 > > Sep 18 17:33:05 valinor kernel: [1134774.645614] [] > > find_extend_vma+0x24/0x80 > > Sep 18 17:33:05 valinor kernel: [1134774.645622] [] > > unqueue_me+0x54/0xa0 > > Sep 18 17:33:05 valinor kernel: [1134774.645628] [] > > generic_file_aio_write+0x64/0xd0 > > Sep 18 17:33:05 valinor kernel: [1134774.645642] [] > > :ext3:ext3_file_write+0x23/0xc0 > > Sep 18 17:33:05 valinor kernel: [1134774.645650] [] > > :ext3:ext3_file_write+0x0/0xc0 > > Sep 18 17:33:05 valinor kernel: [1134774.645656] [] > > do_sync_readv_writev+0xcb/0x110 > > Sep 18 17:33:05 valinor kernel: [1134774.645663] [] > > futex_wake+0xcd/0xf0 > > Sep 18 17:33:05 valinor kernel: [1134774.645668] [] > > autoremove_wake_function+0x0/0x30 > > Sep 18 17:33:05 valinor kernel: [1134774.645675] [] > > do_futex+0x134/0xc30 > > Sep 18 17:33:05 valinor kernel: [1134774.645680] [] > > __kmalloc+0x13c/0x160 > > Sep 18 17:33:05 valinor kernel: [1134774.645686] [] > > do_readv_writev+0xfd/0x230 > > Sep 18 17:33:05 valinor kernel: [1134774.645693] [] > > error_exit+0x0/0x79 > > Sep 18 17:33:05 valinor kernel: [1134774.645700] [] > > sys_writev+0x53/0xc0 > > Sep 18 17:33:05 valinor kernel: [1134774.645706] [] > > system_call+0x68/0x6d > > Sep 18 17:33:05 valinor kernel: [1134774.645711] [] > > system_call+0x0/0x6d > > Sep 18 17:33:05 valinor kernel: [1134774.645716] > > Sep 18 17:33:05 valinor kernel: [1134774.645718] > > Sep 18 17:33:05 valinor kernel: [1134774.645718] Code: 49 8b 52 08 49 > > 89 d3 eb c4 4c 89 17 4c 89 4f 10 eb 99 0f 1f > > Sep 18 17:33:05 valinor kernel: [1134774.645739] RIP > > [] iov_iter_advance+0x66/0x80 > > Sep 18 17:33:05 valinor kernel: [1134774.645745] RSP > > Sep 18 17:33:05 valinor kernel: [1134774.645749] CR2: ffff88001a289008 > > Sep 18 17:33:05 valinor kernel: [1134774.645762] ---[ end trace > > a91a752e8ec506f8 ]--- > > As Per Hedeland wrote this is a kernel bug, or possibly bad HW. > > You should first check if this problem still appears with current > kernels (2.6.26 or newer), and if it does, if it also appears on > other machines (to rule out bad HW). If the problem persists, > then it needs to be fixed. > > Without a test case it will be difficult to debug this, however. > > So, if you can, please try to distill your application down to > something you can make public and which still triggers the problem. > -- Brian From james.hague@REDACTED Fri Sep 19 20:51:35 2008 From: james.hague@REDACTED (James Hague) Date: Fri, 19 Sep 2008 13:51:35 -0500 Subject: [erlang-questions] Monitoring changes in a directory tree Message-ID: Has anyone put together a module for monitoring changes in directory tree? If a file is changed, added, or deleted, I want to receive a message about it. The code for this is very different under OS X and Windows, so having a nice cross-platform module would be wonderful. Or is there a standalone utility I can spawn and get notifications from? From matthias@REDACTED Fri Sep 19 22:01:30 2008 From: matthias@REDACTED (Matthias Lang) Date: Fri, 19 Sep 2008 22:01:30 +0200 Subject: [erlang-questions] Death of Erlang VM In-Reply-To: <18643.32552.215496.512841@harpo.it.uu.se> References: <971980cc0809181753m5027e8f5i6580fbfa0dfc474a@mail.gmail.com> <18643.32552.215496.512841@harpo.it.uu.se> Message-ID: <20080919200130.GA3490@contorpis.lisalinda.com> I ran your 'bang' module on my machine, which is somewhat similar to yours (an AMD64, running as a 64-bit machine). I let it run for about a minute, no crash. I assume you would have said so if it required more patience than that. ~sandbox > cat /proc/version Linux version 2.6.24-1-amd64 (Debian 2.6.24-7) (dannf@REDACTED) (gcc version 4.1.3 20080114 (prerelease) (Debian 4.1.2-19)) #1 SMP Sat May 10 09:28:10 UTC 2008 ~sandbox >12erl +A 2 +K true Erlang (BEAM) emulator version 5.6.4 [source] [64-bit] [smp:2] [async-threads:2] [hipe] [kernel-poll:true] That's R12B-4. Matt From goofyheadedpunk@REDACTED Fri Sep 19 22:12:42 2008 From: goofyheadedpunk@REDACTED (Brian Troutwine) Date: Fri, 19 Sep 2008 13:12:42 -0700 Subject: [erlang-questions] Death of Erlang VM In-Reply-To: <20080919200130.GA3490@contorpis.lisalinda.com> References: <971980cc0809181753m5027e8f5i6580fbfa0dfc474a@mail.gmail.com> <18643.32552.215496.512841@harpo.it.uu.se> <20080919200130.GA3490@contorpis.lisalinda.com> Message-ID: <971980cc0809191312qdf8035fre80804faf6423a57@mail.gmail.com> > I assume you would have said so if it required more patience than that. I should have, but did not, I'm afraid. Thus far its taken anywhere from approximately five minutes to two hours for 'bang' to explode, as it were. However, after upgrading to R12B4 I've yet to see a crash of the sort I described previously, though the module has not yet been running for more than 1 hour and 15 minutes. On Fri, Sep 19, 2008 at 1:01 PM, Matthias Lang wrote: > I ran your 'bang' module on my machine, which is somewhat similar to > yours (an AMD64, running as a 64-bit machine). I let it run for about > a minute, no crash. I assume you would have said so if it required more > patience than that. > > ~sandbox > cat /proc/version > Linux version 2.6.24-1-amd64 (Debian 2.6.24-7) (dannf@REDACTED) (gcc version 4.1.3 20080114 (prerelease) (Debian 4.1.2-19)) #1 SMP Sat May 10 09:28:10 UTC 2008 > > ~sandbox >12erl +A 2 +K true > Erlang (BEAM) emulator version 5.6.4 [source] [64-bit] [smp:2] [async-threads:2] [hipe] [kernel-poll:true] > > That's R12B-4. > > Matt > -- Brian From jeffm@REDACTED Sat Sep 20 02:14:17 2008 From: jeffm@REDACTED (jm) Date: Sat, 20 Sep 2008 10:14:17 +1000 Subject: [erlang-questions] Monitoring changes in a directory tree In-Reply-To: References: Message-ID: <48D44059.2050305@ghostgun.com> If your on linux I have an inotify port I've been meaning to release. The only thing missing is the Makefile which should be straight forward except make and I don't seem to be getting along. If your interested I'll either email it or put in up somewhere for you to download and help you get it going. If someone doesn't mind supplying the Makefile, I'll release it for inclusion in any of the erlang package repositories. inotify works quite well. I had inotifywatch recursively watch the mail spool directory on a busy mail server with just over a 1M files on it consumming about 1% user CPU. Also, anyone know what the equivalent to inotify on solaris is? I don't have a running solaris system, but I'd like to expand this port/module to include support for solaris. Jeff. James Hague wrote: > Has anyone put together a module for monitoring changes in directory > tree? If a file is changed, added, or deleted, I want to receive a > message about it. The code for this is very different under OS X and > Windows, so having a nice cross-platform module would be wonderful. > > Or is there a standalone utility I can spawn and get notifications from? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From tobbe@REDACTED Sat Sep 20 08:27:54 2008 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Sat, 20 Sep 2008 08:27:54 +0200 Subject: [erlang-questions] Monitoring changes in a directory tree In-Reply-To: <48D44059.2050305@ghostgun.com> References: <48D44059.2050305@ghostgun.com> Message-ID: Suggestion: Upload the code to the trapexit.org User Contrib area. Cheers, Tobbe jm wrote: > If your on linux I have an inotify port I've been meaning to release. > The only thing missing is the Makefile which should be straight forward > except make and I don't seem to be getting along. If your interested > I'll either email it or put in up somewhere for you to download and help > you get it going. If someone doesn't mind supplying the Makefile, I'll > release it for inclusion in any of the erlang package repositories. > > inotify works quite well. I had inotifywatch recursively watch the mail > spool directory on a busy mail server with just over a 1M files on it > consumming about 1% user CPU. > > Also, anyone know what the equivalent to inotify on solaris is? I don't > have a running solaris system, but I'd like to expand this port/module > to include support for solaris. > > Jeff. > > James Hague wrote: >> Has anyone put together a module for monitoring changes in directory >> tree? If a file is changed, added, or deleted, I want to receive a >> message about it. The code for this is very different under OS X and >> Windows, so having a nice cross-platform module would be wonderful. >> >> Or is there a standalone utility I can spawn and get notifications from? >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> From als@REDACTED Sat Sep 20 15:56:42 2008 From: als@REDACTED (Anthony Shipman) Date: Sat, 20 Sep 2008 23:56:42 +1000 Subject: [erlang-questions] re.erl bug Message-ID: <200809202356.42590.als@iinet.net.au> I ran dialyzer to build a PLT table and it reported this re.erl:64: Call to missing or unexported function re:run/3 re.erl:401: Call to missing or unexported function re:run/3 -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From eliliang@REDACTED Sat Sep 20 16:32:52 2008 From: eliliang@REDACTED (Eli Liang) Date: Sat, 20 Sep 2008 07:32:52 -0700 (PDT) Subject: [erlang-questions] currying and lazy evaluation questions (just looking for some hacks for purposes of porting) Message-ID: <358930.34506.qm@web30406.mail.mud.yahoo.com> Two quick questions: ? I read a note on the Internet that said "You can do lazy evaluation in Erlang (observe Erlang QuickCheck), but you have to be explicit about it." ? Can some one explain to me how to "explicitly" use lazy evaluation in Erlang, in the general? ? I know that Erlang doesn't support implicit currying. If I wanted to "explicitly" curry, is there some way to do that? Or at least emulate currying? ? Since neither of these are naturally supported in the language, I suppose I'm just looking for some hacks which will let me port a few haskell programs to Erlang without massive rewrite. -------------- next part -------------- An HTML attachment was scrubbed... URL: From eliliang@REDACTED Sat Sep 20 20:44:25 2008 From: eliliang@REDACTED (Eli Liang) Date: Sat, 20 Sep 2008 11:44:25 -0700 (PDT) Subject: [erlang-questions] Erlang design patterns Message-ID: <362604.69913.qm@web30408.mail.mud.yahoo.com> Is there a library online of sample Erlang design patterns, especially any that are not already in OTP? -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony@REDACTED Sun Sep 21 06:09:13 2008 From: tony@REDACTED (Tony Arcieri) Date: Sat, 20 Sep 2008 22:09:13 -0600 Subject: [erlang-questions] EShell-like text input Message-ID: If I call io:get_line('> ') from EShell, then I'm able to use the left arrow key to go back and edit the text I've entered, and the up and down arrows provide a history of what's been entered. However, if I try to do this using erl -eval or an escript, bypassing the shell, then I do not get these extra features. None of the arrow keys work and just input their respective character sequences. Is there any way to enable the arrow keys / history when not using EShell? -- Tony Arcieri medioh.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From exta7@REDACTED Sun Sep 21 13:00:48 2008 From: exta7@REDACTED (Zvi) Date: Sun, 21 Sep 2008 04:00:48 -0700 (PDT) Subject: [erlang-questions] value of spawned function In-Reply-To: References: <19573059.post@talk.nabble.com> <14f0e3620809190843x108b91abteb567cb463e54f19@mail.gmail.com> Message-ID: <19593397.post@talk.nabble.com> Jason, thanks. Your example is something I had in mind. But my rant was about impurity/assymetry of Erlang API, i.e.: 1. erlang:spawn, without erlang:join 2. Erlang is multiparadigm language, so Actors implemented using functions, so even if functions return values, actors/processes does not. So to return value we need a wrapper fun and a sending a message. For me Actors/message passing is a assembler of concurrent programming. There is a need for standard framework for higher level models: * Task-level parallel: Fork-Join, Manager-Workers (aka Master-Slave - pool and slave modules?) * Data-parallel: parallel list comprehensions, plists module, Map/Reduce But your solution still have some problems, like quickly reaching process limit for real life tasks and crushing BEAM. So instead of spawning Erlang process for each subtask, I need to implement scheduler processes per core. I trying to implement general Fork-Join framework, like this one: Result solve(Problem problem) { if (problem is small) directly solve problem else { split problem into independent parts fork new subtasks to solve each part join all subtasks compose result from subresults } } (see http://www.infoq.com/news/2007/07/concurrency-java-se-7) See my implemenation of parallel quicksort and mergesort using your forkjoin code. Zvi -module(forkjoin). -compile(export_all). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% forkjoin(FunList) when is_list(FunList) -> process_flag(trap_exit, true), ParentPid = self(), % fork PidList = [spawn_link( fun () -> ParentPid ! {'RESULT', self(), Fun()} end) || Fun <- FunList], % join [receive {'RESULT', Pid, Result} -> {ok, Result}; {'EXIT', Pid, Reason} -> {error, Reason} end || Pid <- PidList]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% pqsort([]) -> []; pqsort([X]) -> [X]; %not necessary - optimization pqsort([X,Y]) when X [X,Y]; %not necessary - optimization pqsort([X,Y]) -> [Y,X]; %not necessary - optimization pqsort([H|T]) -> [{ok,L1},{ok,L2}] = forkjoin([fun() -> pqsort([X || X<-T, X pqsort([X || X<-T, X>=H]) end]), L1++[H | L2]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% pmergesort([]) -> []; pmergesort([X]) -> [X]; %not necessary - optimization pmergesort([X,Y]) when X [X,Y]; %not necessary - optimization pmergesort([X,Y]) -> [Y,X]; %not necessary - optimization pmergesort(L) when is_list(L) -> {L1,L2} = lists:split(length(L) div 2,L), [{ok,SL1},{ok,SL2}] = forkjoin([fun() -> pmergesort(L1) end, fun() -> pmergesort(L2) end]), merge(SL1,SL2). % merge two sorted lists merge(L1,[]) -> L1; merge([],L2) -> L2; merge([H1|T1],[H2|T2]) when H1

[H1|merge(T1,[H2|T2])]; merge([H1|T1],[H2|T2]) -> [H2|merge([H1|T1],T2)]. -- View this message in context: http://www.nabble.com/value-of-spawned-function-tp19573059p19593397.html Sent from the Erlang Questions mailing list archive at Nabble.com. From weaveinator@REDACTED Sun Sep 21 16:37:16 2008 From: weaveinator@REDACTED (Steve Weaver) Date: Sun, 21 Sep 2008 07:37:16 -0700 Subject: [erlang-questions] Installation problem with java and jinterface Message-ID: Hi - When I try to install R12B-4 I get the following 2 errors: 1. ERROR in OtpAuthException.java (at line 27) public class OtpAuthException extends OtpException { ^^^^^^^^^^^^ OtpException cannot be resolved to a type ---------- 2. ERROR in OtpAuthException.java (at line 32) super(s); I'm running Suse 10.3, Java version 1.6 - I seem to have everything pathed correctly and using default settings for the make. I have tried this install with root privledges as well but get the same error. I just doesn't seem to be aware of the java lib. Any help is greatly appreciated! Thanks Estaban -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Sun Sep 21 16:37:17 2008 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 21 Sep 2008 16:37:17 +0200 Subject: [erlang-questions] value of spawned function In-Reply-To: <19593397.post@talk.nabble.com> References: <19573059.post@talk.nabble.com> <14f0e3620809190843x108b91abteb567cb463e54f19@mail.gmail.com> <19593397.post@talk.nabble.com> Message-ID: <8209f740809210737w4dbdba8dqfd9ae030187fbf60@mail.gmail.com> 2008/9/21 Zvi : > > But my rant was about impurity/assymetry of Erlang API, i.e.: > 1. erlang:spawn, without erlang:join > 2. Erlang is multiparadigm language, so Actors implemented using functions, > so even if functions return values, actors/processes does not. So to return > value we need a wrapper fun and a sending a message. What you're seeing is the consequence of the view that processes are spawned by a supervisor, which normally doesn't care about the result of the child's computation - only if it completes as planned or if it may need to be restarted. Either way you look at it, you will have some inconvenient case if a process terminates by simply not recursing any more. If it happens to end on an expression that returns a huge term, the EXIT message will be huge as well. If the spawning process only cared about whether it died normally, this will have amounted to an expensive and unnecessary copy, and the recommendation would have to be to always exit explicitly with a small return value, unless the spawner really needs to know the result. In most applications written in Erlang so far, I believe this to be the most common pattern, and the implicit exit(normal) is logical and convenient. > For me Actors/message passing is a assembler of concurrent programming. > There is a need for standard framework for higher level models: > * Task-level parallel: Fork-Join, Manager-Workers (aka Master-Slave - pool > and slave modules?) > * Data-parallel: parallel list comprehensions, plists module, Map/Reduce That discussion has indeed started now, and SMP Erlang is the enabler. As long as Erlang always used only one scheduler, there wasn't much point in having such a framework. > But your solution still have some problems, like quickly reaching process > limit for real life tasks and crushing BEAM. So instead of spawning Erlang > process for each subtask, I need to implement scheduler processes per core. > I trying to implement general Fork-Join framework, like this one: > > Result solve(Problem problem) { > if (problem is small) > directly solve problem > else { > split problem into independent parts > fork new subtasks to solve each part > join all subtasks > compose result from subresults > } > } ...and of course, determining the 'problem is small' condition is very difficult in general. Most languages that specialize in parallel computation will have finer-grained processes than Erlang, making this particular test unnecessary. BR, Ulf W From als@REDACTED Sun Sep 21 18:43:13 2008 From: als@REDACTED (Anthony Shipman) Date: Mon, 22 Sep 2008 02:43:13 +1000 Subject: [erlang-questions] 12B4 dialyzer problem 6 - strings Message-ID: <200809220243.13666.als@iinet.net.au> I've got some code that accesses a driver and it looks like this: 119: -spec parseDate(string()) -> integer() | badarg. parseDate(Date) when is_list(Date) -> Port = open(), N = parseDate(Port, Date), ok = close(Port), N. -spec parseDate(port(), string()) -> integer() | badarg. parseDate(Port, Date) when is_port(Port), is_list(Date) -> Bin = port_control(Port, ?CMD_PDATE, Date), binary_to_term(Bin). Dialyzer says, with -Wunderspecs, dwcAuxDrv.erl:119: Type specification dwcAuxDrv:parseDate/1 :: (string()) -> integer() | 'badarg' is a supertype of the success typing: ([byte()]) -> 'badarg' | integer() I thought that string() and [byte()] would be the same. But delving into the source code I find that a string() is a [char()] and a char() is an integer in the range 0..16#10ffff (from hipe erl_types.erl). So there's a contradiction in there. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From dawsdesign@REDACTED Sun Sep 21 22:39:45 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Sun, 21 Sep 2008 16:39:45 -0400 Subject: [erlang-questions] How to dynamically add one node to erlang's distrubted application? In-Reply-To: References: <48C75879.6010904@charpi.net> <6c2563b20809100222m7704ef93i48dacd62e1593eca@mail.gmail.com> Message-ID: Simple. global/whereis_name/1 2008/9/11 devdoer bird > Thanks. It works for me. but I have some more questions. > > If we have a center server, how can we let other client know where it is? > > We can pass the center server information to each node at each node's > startup,but if we want to change the center server Eg. for its poor > performance,how can we let other nodes know "the center server is changed" > ,suppose we don't know how many client nodes are alive either? > The solution I found d is we can save the client nodes informaton into a > persistent storage. > Does someone have a better way to solve these problems? > Any suggestion is helpful,Thanks. > 2008/9/10 Edwin Fine > > I do have a suggestion. Write a program that takes the configurations for >> all 100 (1000, 10000) machines from a file or database, generates the >> configuration files, and then distributes them to the nodes using an agent >> or something similar. The config files are kept under configuration >> management centrally and pushed out to nodes when changes are made. >> >> 2008/9/10 devdoer bird >> >>> Thanks. If I have 100 machines ,I have to edt the config files on all 100 >>> machines, that's unacceptable. Are there any solutions? >>> >>> >>> 2008/9/10 Nicolas Charpentier >>> >>>> devdoer bird wrote: >>>> >>>>> ... >>>>> Now I want to add one more node to the system .How can I do this >>>>> using erlang's distributed applicaiton mechanism? Do I have to edit the >>>>> config file on all 3 nodes to add the 4th node and restart all of them? >>>>> >>>>> >>>> >>>> >>>> Hi, >>>> >>>> if you can't stop your nodes because others mandatory applications are >>>> running you can try to use application:load/2 on all your nodes. The second >>>> param is the distribution parameter which overload kernel value. >>>> To be able to load an application, it have to be stopped. >>>> Don't forget to update the config file for the next node restart. >>>> >>>> I never tried to do that but the documentation seems to say that it's >>>> possible >>>> >>>> >>>> Regards, >>>> >>>> ---- >>>> Nicolas >>>> http://charpi.net >>>> >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Sun Sep 21 22:52:46 2008 From: richardc@REDACTED (Richard Carlsson) Date: Sun, 21 Sep 2008 22:52:46 +0200 Subject: [erlang-questions] Monitoring changes in a directory tree In-Reply-To: References: Message-ID: <48D6B41E.6060403@it.uu.se> James Hague wrote: > Has anyone put together a module for monitoring changes in directory > tree? If a file is changed, added, or deleted, I want to receive a > message about it. The code for this is very different under OS X and > Windows, so having a nice cross-platform module would be wonderful. > > Or is there a standalone utility I can spawn and get notifications from? There is a module file_monitor.erl that currently lives in the EUnit repository (I've been meaning to put it somewhere more suitable and make it more official, but that hasn't happened yet). It currently only does polling - so it's portable at least - and it has no builtin function for monitoring a whole tree, so you have to do the traversal yourself to monitor subdirectories. http://svn.process-one.net/contribs/trunk/eunit/src/file_monitor.erl /Richard From dbyrne@REDACTED Mon Sep 22 00:31:54 2008 From: dbyrne@REDACTED (Dennis Byrne) Date: Sun, 21 Sep 2008 17:31:54 -0500 Subject: [erlang-questions] Installation problem with java and jinterface In-Reply-To: Message-ID: Can you post the contents of OtpAuthException.java ? I'm curious as to why it wouldn't compile. ____________________________________________ Dennis Byrne ThoughtWorks - Chicago http://notdennisbyrne.blogspot.com/ 312-505-7965 erlang-questions-bounces@REDACTED wrote on 09/21/2008 09:37:16 AM: > Hi - > When I try to install R12B-4 I get the following 2 errors: > > 1. ERROR in OtpAuthException.java (at line 27) > public class OtpAuthException extends OtpException { > ^^^^^^^^^^^^ > OtpException cannot be resolved to a type > ---------- > 2. ERROR in OtpAuthException.java (at line 32) > super(s); > > I'm running Suse 10.3, Java version 1.6 - I seem to have everything > pathed correctly and using default settings for the make. I have > tried this install with root privledges as well but get the same > error. I just doesn't seem to be aware of the java lib. > > Any help is greatly appreciated! > Thanks > Estaban_______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Mon Sep 22 02:36:51 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 22 Sep 2008 12:36:51 +1200 Subject: [erlang-questions] lists:seq/[2,3] bug? In-Reply-To: <11368_1221838939_m8JFgGF3021068_48D3C5A6.1040003@cs.ntua.gr> References: <469D2176-D5D1-4C72-A849-E552184FCECE@cs.otago.ac.nz> <6339_1221721961_m8I7Cc6f016403_48D1FDCB.1000100@charpi.net> <8246_1221763099_m8IIcGj2016231_48D2A006.3080204@charpi.net> <7F770E1A-1529-49B2-B949-2226094AECBC@cs.otago.ac.nz> <11368_1221838939_m8JFgGF3021068_48D3C5A6.1040003@cs.ntua.gr> Message-ID: <474966F4-4936-496C-A875-655566732E20@cs.otago.ac.nz> On 20 Sep 2008, at 3:30 am, Kostis Sagonas wrote: > Despite all the shouting, I've yet to read a coherent argument why the > case M = N - 1 is more special than e.g. the case M = N - 42. That's not what I say; what I say is that it is *less* special. The reason that M = N - 1 is less special is ever so simple: you can have a list with length 0, but you can't have a list with length -41. Surely this is obvious? > [Please realize that similarly to "expect", the expression "makes > sense" > is also highly subjective. I do not see why throwing an exception for > M > Haskell, where exceptions are problematic, at least is consistent in > its > behaviour. Haskell has exceptions and uses them extensively. For example, take n xs returns at most the first n elements of the list xs; when n < 0 you get an exception. > In Haskell the equivalent of lists:seq/2 defines a *total* > function over the integers, not a function that returns [] in some > special cases only. Disregarding for a moment that throwing exceptions > in Erlang is OK, why would Erlang have a different behaviour ? I want to remember length(lists:seq(A,Z)) = Z-A+1. Nice, simple, exceptionless. (As in, anything that would be an exception really is an 'exception'.) I suspect that the Haskell designers didn't give a Contintental [%] about exceptions. They were after a simple specification too, and theirs may have been something like [a..z] is the set of all values x such that a <= x <= z, listed in ascending order. When z < a, there are no such values, so from that specification you can deduce that the answer is []. For some types, Haskell defines [a..z] to be (roughly) takeWhile (<= z) [a..] It would have been perfectly simple for the Haskell designers to put enumFromTo a z | a <= z = takeWhile (<= z) enumFrom a enumFromTo a z = error "Prelude.enumFromTo: empty range" in the standard prelude, had they wished to. After all, they did exactly that kind of thing for `take`. I would actually be happy with something that matches Haskell exactly here. The important thing is to have a specification that is simple, memorable, and precise. Queer corner cases (like arbitrarily excluding []) make a specification more complex, harder to remember, and harder to use correctly. > > I repeat: If we were to change the behaviour of lists:seq/2 -- and so > far I've not yet read something that convinced me we should -- how is > the above different than e.g. lists:seq(8, 5) ? I repeat, because 5-8+1 is -2, and you can't have a list of length -2. But you *can* have a list of length 0. In the course of writing this message, I've asked in Haskell-caf? why fromEnumTo is defined the way it is. When I get an answer, I'll pass it on. [%] This is an Americanism, but my father used it, so it must be OK. It refers to the "Continental currency" of the American Confederacy, which became worthless when they lost the Civil War. From ok@REDACTED Mon Sep 22 06:32:14 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 22 Sep 2008 16:32:14 +1200 Subject: [erlang-questions] currying and lazy evaluation questions (just looking for some hacks for purposes of porting) In-Reply-To: <17734_1221935442_m8KIUdqs027611_358930.34506.qm@web30406.mail.mud.yahoo.com> References: <17734_1221935442_m8KIUdqs027611_358930.34506.qm@web30406.mail.mud.yahoo.com> Message-ID: <7BD9312C-00A4-4BC5-87A9-C282F71A8F96@cs.otago.ac.nz> On 21 Sep 2008, at 2:32 am, Eli Liang wrote: > I read a note on the Internet that said "You can do lazy evaluation > in Erlang (observe Erlang QuickCheck), but you have to be explicit > about it." > > Can some one explain to me how to "explicitly" use lazy evaluation > in Erlang, in the general? Use closures. "Structure and Interpretation of Computer Programs" (which is available on the web these days) explains the idea. Basically, instead of some value, you return a function to compute it. E.g. lazy_append(L1, L2) -> case L1() of [] -> L2 ; [H|T] -> fun () -> [H | lazy_append(T, L2)] end end. This is the "don't evaluate YET" part of lazy evaluation. Lazy evaluate also adds "don't evaluate AGAIN", which is fairly straightforward to do in Scheme and SML (thanks to mutable boxes), but sufficiently tricky in Erlang that I've never bothered. > > I know that Erlang doesn't support implicit currying. If I wanted to > "explicitly" curry, is there some way to do that? Or at least > emulate currying? curry(F) when is_function(F, 2) -> fun (X) -> fun (Y) -> F(X, Y) end end. > Since neither of these are naturally supported in the language, I > suppose I'm just looking for some hacks which will let me port a few > haskell programs to Erlang without massive rewrite. As a regular Haskeller, I'd say they'd have to be fairly trivial Haskell. From Dana.RUBINO@REDACTED Mon Sep 22 12:38:45 2008 From: Dana.RUBINO@REDACTED (Dana.RUBINO@REDACTED) Date: Mon, 22 Sep 2008 11:38:45 +0100 Subject: [erlang-questions] Gen supervisor query... Message-ID: Hi all, I have a simple supervisor setup which is watching two worker processes. Now I have created the init method as such: init(Args) -> [{port,Port},{maxconns, MaxConnections},{sockethandlermod, SocketHandlerMod}] = Args, Registered = registered(), case lists:any(fun(X) -> X =:= ?CONNCOUNTER end, Registered) of true -> error_logger:info_msg("TCP connection monitor (~p) already registered...SKIPPING~n",[?CONNCOUNTER]); false -> register(?CONNCOUNTER, spawn(fun() -> counter(0, MaxConnections) end)), error_logger:info_msg("TCP server <~p> started TCP connection monitor.~n", [self()]) end, GenTcpServer1 = {'GenTcpServer1',{generic_tcp_server,start_link,[Port,SocketHandlerMod]},permanent,2000,worker,[generic_tcp_server]}, GenTcpServer2 = {'GenTcpServer2',{generic_tcp_server,start_link,[Port,SocketHandlerMod]},permanent,2000,worker,[generic_tcp_server]}, {ok,{{one_for_one,0,1}, [GenTcpServer1, GenTcpServer2]}}. Nothing fancy going on there - I would expect this supervisor to start both GenTcpServer1 AND GenTcpServer2 given two speca have been returned? For some reason it is only starting one when I look in appmon etc. Any thoughts? Many Thanks, Dan *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbs.com/gbm www.rbsgc.com *********************************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Mon Sep 22 13:26:37 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Mon, 22 Sep 2008 07:26:37 -0400 Subject: [erlang-questions] Gen supervisor query... In-Reply-To: References: Message-ID: <6c2563b20809220426g1d1d8b1ewad8cbf4d6ee4aef5@mail.gmail.com> Hi Dan The first thing that comes to mind is, does the generic_tcp_server register itself? If so, the second one will fail to start. Do you see any error messages? I find if you start SASL before you run your program, you may get better error information (application:start(sasl), or -boot sasl on the command line). Anotyher possibility is, could one of them have died before you looked in appmon? What does your output/error log look like? The other thing is, instead of explicitly looking in registered() for your connection monitor, you coud just use whereis(): case whereis(?CONNCOUNTER) of undefined -> % Not registered register(?CONNCOUNTER, spawn(fun() -> counter(0, MaxConnections) end)), error_logger:info_msg("TCP server <~p> started TCP connection monitor.~n", [self()]); Pid -> error_logger:info_msg( "TCP connection monitor (~p) already registered as ~p ...SKIPPING~n", [?CONNCOUNTER, Pid] ) end Hope this helps. 2008/9/22 > Hi all, > > I have a simple supervisor setup which is watching two worker processes. > > Now I have created the init method as such: > > > init(Args) -> > > [{port,Port},{maxconns, MaxConnections},{sockethandlermod, > SocketHandlerMod}] = Args, > > Registered = registered(), > > case lists:any(fun(X) -> X =:= ?CONNCOUNTER end, Registered) of > > true -> > > error_logger:info_msg("TCP connection monitor (~p) already > registered...SKIPPING~n",[?CONNCOUNTER]); > > false -> > > register(?CONNCOUNTER, spawn(fun() -> counter(0, > MaxConnections) end)), > > error_logger:info_msg("TCP server <~p> started TCP connection > monitor.~n", [self()]) > > end, > > > > GenTcpServer1 = > {'GenTcpServer1',{generic_tcp_server,start_link,[Port,SocketHandlerMod]}, > permanent,2000,worker,[generic_tcp_server]}, > > GenTcpServer2 = > {'GenTcpServer2',{generic_tcp_server,start_link,[Port,SocketHandlerMod]}, > permanent,2000,worker,[generic_tcp_server]}, > > {ok,{{one_for_one,0,1}, [GenTcpServer1, GenTcpServer2]}}. > > N > othing fancy going on there - I would expect this supervisor to start both GenTcpServer1 AND GenTcpServer2 given two speca have been returned? > > For some reason it is only starting one when I look in appmon etc. > > Any thoughts? > > Many Thanks, > Dan > > > > *********************************************************************************** > The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority > > This e-mail message is confidential and for use by the > addressee only. If the message is received by anyone other > than the addressee, please return the message to the sender > by replying to it and then delete the message from your > computer. Internet e-mails are not necessarily secure. The > Royal Bank of Scotland plc does not accept responsibility for > changes made to this message after it was sent. > > Whilst all reasonable care has been taken to avoid the > transmission of viruses, it is the responsibility of the recipient to > ensure that the onward transmission, opening or use of this > message and any attachments will not adversely affect its > systems or data. No responsibility is accepted by The > Royal Bank of Scotland plc in this regard and the recipient should carry > out such virus and other checks as it considers appropriate. > Visit our websites at: www.rbs.comwww.rbs.com/gbmwww.rbsgc.com > *********************************************************************************** > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tobias.lindahl@REDACTED Mon Sep 22 14:04:11 2008 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Mon, 22 Sep 2008 14:04:11 +0200 Subject: [erlang-questions] 12B4 dialyzer problem 6 - strings In-Reply-To: <200809220243.13666.als@iinet.net.au> References: <200809220243.13666.als@iinet.net.au> Message-ID: <48D789BB.40903@kreditor.se> Anthony Shipman wrote: > I've got some code that accesses a driver and it looks like this: > > 119: -spec parseDate(string()) -> integer() | badarg. > > parseDate(Date) when is_list(Date) -> > Port = open(), > N = parseDate(Port, Date), > ok = close(Port), > N. > > -spec parseDate(port(), string()) -> integer() | badarg. > > parseDate(Port, Date) when is_port(Port), is_list(Date) -> > Bin = port_control(Port, ?CMD_PDATE, Date), > binary_to_term(Bin). > > Dialyzer says, with -Wunderspecs, > > dwcAuxDrv.erl:119: Type specification dwcAuxDrv:parseDate/1 :: (string()) > -> integer() | 'badarg' is a supertype of the success typing: ([byte()]) > -> 'badarg' | integer() > > I thought that string() and [byte()] would be the same. But delving into the > source code I find that a string() is a [char()] and a char() is an integer > in the range 0..16#10ffff (from hipe erl_types.erl). So there's a > contradiction in there. I'm not sure that it is contradicting, but yes it might be a bit surprising. Richard Carlsson set this limit when he implemented the original type domain, and I have just left it as is. Basically it is a trade-off to allow people to call their lists of integers strings even if they do not follow the [byte()] limit. In general, the warnings that you get when using -Wunderspecs (and friends) is something you might want to look at, but not necessarily fix. Tobias From Dana.RUBINO@REDACTED Mon Sep 22 14:10:03 2008 From: Dana.RUBINO@REDACTED (Dana.RUBINO@REDACTED) Date: Mon, 22 Sep 2008 13:10:03 +0100 Subject: [erlang-questions] Gen supervisor query... In-Reply-To: <6c2563b20809220426g1d1d8b1ewad8cbf4d6ee4aef5@mail.gmail.com> References: <6c2563b20809220426g1d1d8b1ewad8cbf4d6ee4aef5@mail.gmail.com> Message-ID: Hi Edwin, Thanks for the advice! I think you may be correct in that it appears the second process is dying shortly after being started - the log is indicating it is being started! (they don't register themselves) Slightly off-topic, any ideas why the appmon uses such a large amount of memory when switching to sup view from proc? Many thanks, Dan ________________________________ From: emofine@REDACTED [mailto:emofine@REDACTED] On Behalf Of Edwin Fine Sent: 22 September 2008 12:27 To: RUBINO, Dana, GBM Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Gen supervisor query... Hi Dan The first thing that comes to mind is, does the generic_tcp_server register itself? If so, the second one will fail to start. Do you see any error messages? I find if you start SASL before you run your program, you may get better error information (application:start(sasl), or -boot sasl on the command line). Anotyher possibility is, could one of them have died before you looked in appmon? What does your output/error log look like? The other thing is, instead of explicitly looking in registered() for your connection monitor, you coud just use whereis(): case whereis(?CONNCOUNTER) of undefined -> % Not registered register(?CONNCOUNTER, spawn(fun() -> counter(0, MaxConnections) end)), error_logger:info_msg("TCP server <~p> started TCP connection monitor.~n", [self()]); Pid -> error_logger:info_msg( "TCP connection monitor (~p) already registered as ~p ...SKIPPING~n", [?CONNCOUNTER, Pid] ) end Hope this helps. 2008/9/22 > Hi all, I have a simple supervisor setup which is watching two worker processes. Now I have created the init method as such: init(Args) -> [{port,Port},{maxconns, MaxConnections},{sockethandlermod, SocketHandlerMod}] = Args, Registered = registered(), case lists:any(fun(X) -> X =:= ?CONNCOUNTER end, Registered) of true -> error_logger:info_msg("TCP connection monitor (~p) already registered...SKIPPING~n",[?CONNCOUNTER]); false -> register(?CONNCOUNTER, spawn(fun() -> counter(0, MaxConnections) end)), error_logger:info_msg("TCP server <~p> started TCP connection monitor.~n", [self()]) end, GenTcpServer1 = {'GenTcpServer1',{generic_tcp_server,start_link,[Port,SocketHandlerMod]},permanent,2000,worker,[generic_tcp_server]}, GenTcpServer2 = {'GenTcpServer2',{generic_tcp_server,start_link,[Port,SocketHandlerMod]},permanent,2000,worker,[generic_tcp_server]}, {ok,{{one_for_one,0,1}, [GenTcpServer1, GenTcpServer2]}}. Nothing fancy going on there - I would expect this supervisor to start both GenTcpServer1 AND GenTcpServer2 given two speca have been returned? For some reason it is only starting one when I look in appmon etc. Any thoughts? Many Thanks, Dan *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbs.com/gbm www.rbsgc.com *********************************************************************************** _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreasmk2@REDACTED Mon Sep 22 14:09:50 2008 From: andreasmk2@REDACTED (Andreas Bakurov) Date: Mon, 22 Sep 2008 15:09:50 +0300 Subject: [erlang-questions] Erlang design patterns In-Reply-To: <362604.69913.qm@web30408.mail.mud.yahoo.com> References: <362604.69913.qm@web30408.mail.mud.yahoo.com> Message-ID: <48D78B0E.5030801@gmail.com> > > s there a library online of sample Erlang design patterns, especially > any that are not already in OTP? > OTP is a good implementation of Erlang design patterns. Another source of specialized patterns is: Design Patterns for Simulations in Erlang/OTP paper http://osmirrors.cerias.purdue.edu/pub/FreeBSD/ports/local-distfiles/olgeni/master_thesis_patterns.pdf From erlang-questions_efine@REDACTED Mon Sep 22 14:26:24 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Mon, 22 Sep 2008 08:26:24 -0400 Subject: [erlang-questions] Gen supervisor query... In-Reply-To: References: <6c2563b20809220426g1d1d8b1ewad8cbf4d6ee4aef5@mail.gmail.com> Message-ID: <6c2563b20809220526x633c4cabx5bbdf701264a8be6@mail.gmail.com> On Mon, Sep 22, 2008 at 8:10 AM, wrote: > Hi Edwin, > > Thanks for the advice! > You're welcome. > > I think you may be correct in that it appears the second process is dying > shortly after being started - the log is indicating it is being started! > (they don't register themselves) > > Well, is it possible that they are both contending for the same resource (a socket?) and the first process to get it wins? Did you try starting SASL? > Slightly off-topic, any ideas why the appmon uses such a large amount of > memory when switching to sup view from proc? > Sorry, no idea. > > Many thanks, > Dan > > ------------------------------ > *From:* emofine@REDACTED [mailto:emofine@REDACTED] *On Behalf Of *Edwin > Fine > *Sent:* 22 September 2008 12:27 > *To:* RUBINO, Dana, GBM > *Cc:* erlang-questions@REDACTED > *Subject:* Re: [erlang-questions] Gen supervisor query... > > Hi Dan > > The first thing that comes to mind is, does the generic_tcp_server register > itself? If so, the second one will fail to start. Do you see any error > messages? I find if you start SASL before you run your program, you may get > better error information (application:start(sasl), or -boot sasl on the > command line). Anotyher possibility is, could one of them have died before > you looked in appmon? What does your output/error log look like? > > The other thing is, instead of explicitly looking in registered() for your > connection monitor, you coud just use whereis(): > > case whereis(?CONNCOUNTER) of > undefined -> % Not registered > register(?CONNCOUNTER, spawn(fun() -> counter(0, MaxConnections) > end)), > error_logger:info_msg("TCP server <~p> started TCP connection > monitor.~n", [self()]); > Pid -> > error_logger:info_msg( > "TCP connection monitor (~p) already registered as ~p > ...SKIPPING~n", > [?CONNCOUNTER, Pid] > ) > end > > Hope this helps. > > 2008/9/22 > >> Hi all, >> >> I have a simple supervisor setup which is watching two worker processes. >> >> Now I have created the init method as such: >> >> >> init(Args) -> >> >> [{port,Port},{maxconns, MaxConnections},{sockethandlermod, >> SocketHandlerMod}] = Args, >> >> Registered = registered(), >> >> case lists:any(fun(X) -> X =:= ?CONNCOUNTER end, Registered) of >> >> true -> >> >> error_logger:info_msg("TCP connection monitor (~p) already >> registered...SKIPPING~n",[?CONNCOUNTER]); >> >> false -> >> >> register(?CONNCOUNTER, spawn(fun() -> counter(0, >> MaxConnections) end)), >> >> error_logger:info_msg("TCP server <~p> started TCP connection >> monitor.~n", [self()]) >> >> end, >> >> >> >> GenTcpServer1 = >> {'GenTcpServer1',{generic_tcp_server,start_link,[Port,SocketHandlerMod]}, >> permanent,2000,worker,[generic_tcp_server]}, >> >> GenTcpServer2 = >> {'GenTcpServer2',{generic_tcp_server,start_link,[Port,SocketHandlerMod]}, >> permanent,2000,worker,[generic_tcp_server]}, >> >> {ok,{{one_for_one,0,1}, [GenTcpServer1, GenTcpServer2]}}. >> >> N >> othing fancy going on there - I would expect this supervisor to start both GenTcpServer1 AND GenTcpServer2 given two speca have been returned? >> >> For some reason it is only starting one when I look in appmon etc. >> >> Any thoughts? >> >> Many Thanks, >> Dan >> >> >> >> *********************************************************************************** >> The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. >> Authorised and regulated by the Financial Services Authority >> >> This e-mail message is confidential and for use by the >> addressee only. If the message is received by anyone other >> than the addressee, please return the message to the sender >> by replying to it and then delete the message from your >> computer. Internet e-mails are not necessarily secure. The >> Royal Bank of Scotland plc does not accept responsibility for >> changes made to this message after it was sent. >> >> Whilst all reasonable care has been taken to avoid the >> transmission of viruses, it is the responsibility of the recipient to >> ensure that the onward transmission, opening or use of this >> message and any attachments will not adversely affect its >> systems or data. No responsibility is accepted by The >> Royal Bank of Scotland plc in this regard and the recipient should carry >> out such virus and other checks as it considers appropriate. >> Visit our websites at: www.rbs.comwww.rbs.com/gbmwww.rbsgc.com >> *********************************************************************************** >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From roberto@REDACTED Mon Sep 22 14:58:42 2008 From: roberto@REDACTED (Roberto Aloi) Date: Mon, 22 Sep 2008 14:58:42 +0200 Subject: [erlang-questions] Yaws + Json Message-ID: Hello everyone, I'm pretty new to this mailing list. I'm trying to make the "Ajax through json rpc" example from yaws (http://yaws.hyber.org/json_intro.yaws ) working, but when I run it locally I get the following javascript error when invoking the method: "TypeError: Undefined Value". Any hint? Rob From litaocheng@REDACTED Mon Sep 22 15:49:43 2008 From: litaocheng@REDACTED (litao cheng) Date: Mon, 22 Sep 2008 21:49:43 +0800 Subject: [erlang-questions] puzzle about gen_server:call/2 Message-ID: Greetings ! I read the codes of gen_server.erl and gen.erl in stdlib, the gen_server:call/3 invoke process is illustrated as follows: gen_server:call/3 -> gen:call/3 -> gen:call/4 -> gen:do_call/4 in the gen:do_call/4, first check if the target Process is exist by invoke erlang:monitor/2, if the process is alive then send the message, after the messge is sended, invoke the wait_resp_mon/3 to wait the response, if the Mod:handle_call return {reply, Reply, State}, then in wait_resp_mon/3, we can receive the message and return the Reply to the gen_server:call/2 caller. My Question is: If the Mod:handle_call return {noreply, State}, then I see the gen_server continue the loop, not send any message to caller, in that case I think the wait_resp_mon/3 will be blocked, Factually I know the caller not block! Anyone can give me a explain? thanks! Best Regards! -------------- next part -------------- An HTML attachment was scrubbed... URL: From joe@REDACTED Mon Sep 22 15:54:45 2008 From: joe@REDACTED (Joe Williams) Date: Mon, 22 Sep 2008 08:54:45 -0500 Subject: [erlang-questions] xmerl with multiple items Message-ID: <48D7A3A5.8080304@joetify.com> I am working on one of the xmerl examples found at http://blog.tornkvist.org/blog.yaws?id=1193209275268448 specifically, ########## -module(xp). -export([go/1]). -include_lib("xmerl/include/xmerl.hrl"). -define(Val(X), (fun() -> [#xmlElement{name = N, content = [#xmlText{value = V}|_]}] = X, {N,V} end)()). go(File) -> {Xml, _} = xmerl_scan:file(File), [?Val(xmerl_xpath:string("//SKU", Xml)), ?Val(xmerl_xpath:string("//ItemName", Xml)), ?Val(xmerl_xpath:string("//CollectionNo", Xml)), ?Val(xmerl_xpath:string("//Pages", Xml))]. ########## The issue that I am having is if I add to the example XML file that the site provides. I am changing the following, ########## | 403276 Trivet 0 0 |########## to ########## 403276 Trivet 0 0 123412 Book 1 2 ########## When I run it against the XML it complains of, ########## 3> xp:go("xp.xml"). ** exception error: no match of right hand side value [{xmlElement,'SKU','SKU',[], ########## What is the best way to fix this issue so I can have the code work for one to many items? Thanks. -joe -- Name: Joseph A. Williams Email: joe@REDACTED From puzza007@REDACTED Mon Sep 22 16:08:53 2008 From: puzza007@REDACTED (Paul Oliver) Date: Mon, 22 Sep 2008 15:08:53 +0100 Subject: [erlang-questions] Memory leak question Message-ID: Hi all, I've written a test client that starts a number of sockets and repeatedly sends and receives a static sting from an echo server. I've noticed some strange behavior with an if statement and was wondering if someone can tell me why? The following code seems to leak memory and processes until my box is hosed: loop(Sock, Log) -> Before = if Log -> now(); true -> 0 end, ok = gen_tcp:send(Sock, <<"01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789">>), receive {tcp, Sock, _Data} -> if Log -> [{total, Total}, {processes, Processes} , _, _, _, _, {binary, Binary}, _, _] = erlang:memory(), error_logger:info_msg("tot_mem: ~p, binary: ~p, procs: ~p, time: ~p", [Total, Binary, Processes, timer:now_diff(now(),Before)/1000]); true -> true end; Error -> % Anything other than a data message, print error error_logger:error_msg(Error) end, receive after ?MESSAGE_INTERVAL -> true end, loop(Sock, Log). Example logs: =INFO REPORT==== 22-Sep-2008::14:53:31 === tot_mem: 587049608, binary: 334781944, procs: 171962344, time: 9.685 [snip - box now running out of swap] =INFO REPORT==== 22-Sep-2008::15:00:23 === tot_mem: 1261717856, binary: 874756136, procs: 307929080, time: 23137.121 However, changing the receive/if to: receive {tcp, Sock, _Data} -> [{total, Total}, {processes, Processes} , _, _, _, _, {binary, Binary}, _, _] = erlang:memory(), if Log -> error_logger:info_msg("tot_mem: ~p, binary: ~p, procs: ~p, time: ~p", [Total, Binary, Processes, timer:now_diff(now(),Before)/1000]); true -> true end; allows the program to run without leaking anything. Any help greatly appreciated. Cheers, Paul. From vinoski@REDACTED Mon Sep 22 16:24:34 2008 From: vinoski@REDACTED (Steve Vinoski) Date: Mon, 22 Sep 2008 10:24:34 -0400 Subject: [erlang-questions] xmerl with multiple items In-Reply-To: <48D7A3A5.8080304@joetify.com> References: <48D7A3A5.8080304@joetify.com> Message-ID: <65b2728e0809220724q13f6f878j912135dab0793c92@mail.gmail.com> On 9/22/08, Joe Williams wrote: > > I am working on one of the xmerl examples found at > http://blog.tornkvist.org/blog.yaws?id=1193209275268448 specifically, > What is the best way to fix this issue so I can have the code work for > one to many items? Change the Val macro to: -define(Val(X), (fun() -> [{N,V} || #xmlElement{name = N, content = [#xmlText{value = V}|_]} <- X] end)()). When xpath matches multiple items, this allows all matches to appear in the result, and it still works for one match as well. --steve From joe@REDACTED Mon Sep 22 16:34:48 2008 From: joe@REDACTED (Joe Williams) Date: Mon, 22 Sep 2008 09:34:48 -0500 Subject: [erlang-questions] xmerl with multiple items In-Reply-To: <65b2728e0809220724q13f6f878j912135dab0793c92@mail.gmail.com> References: <48D7A3A5.8080304@joetify.com> <65b2728e0809220724q13f6f878j912135dab0793c92@mail.gmail.com> Message-ID: <48D7AD08.8050609@joetify.com> Works great, thanks for the help. -joe Steve Vinoski wrote: > On 9/22/08, Joe Williams wrote: > >> I am working on one of the xmerl examples found at >> http://blog.tornkvist.org/blog.yaws?id=1193209275268448 specifically, >> > > > > >> What is the best way to fix this issue so I can have the code work for >> one to many items? >> > > Change the Val macro to: > > -define(Val(X), > (fun() -> > [{N,V} || #xmlElement{name = N, content = [#xmlText{value > = V}|_]} <- X] > end)()). > > When xpath matches multiple items, this allows all matches to appear > in the result, and it still works for one match as well. > > --steve > -- Name: Joseph A. Williams Email: joe@REDACTED From erlang-questions_efine@REDACTED Mon Sep 22 16:39:53 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Mon, 22 Sep 2008 10:39:53 -0400 Subject: [erlang-questions] Memory leak question In-Reply-To: References: Message-ID: <6c2563b20809220739j51d94d1fva0c78690c490792a@mail.gmail.com> I'm confused; how exactly is the receive/if changed? Looks the same to me. Am i missing something? On Mon, Sep 22, 2008 at 10:08 AM, Paul Oliver wrote: > Hi all, > > I've written a test client that starts a number of sockets and > repeatedly sends and receives a static sting from an echo server. > I've noticed some strange behavior with an if statement and was > wondering if someone can tell me why? The following code seems to > leak memory and processes until my box is hosed: > > loop(Sock, Log) -> > Before = if Log -> now(); > true -> 0 > end, > ok = gen_tcp:send(Sock, > > <<"01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789">>), > receive > {tcp, Sock, _Data} -> > if Log -> > [{total, Total}, {processes, > Processes} , _, _, _, _, {binary, > Binary}, _, _] = erlang:memory(), > error_logger:info_msg("tot_mem: ~p, > binary: ~p, procs: ~p, time: ~p", > > [Total, Binary, Processes, timer:now_diff(now(),Before)/1000]); > true -> true > end; > Error -> > % Anything other than a data message, print error > error_logger:error_msg(Error) > end, > receive > after ?MESSAGE_INTERVAL -> > true > end, > loop(Sock, Log). > > Example logs: > > =INFO REPORT==== 22-Sep-2008::14:53:31 === > tot_mem: 587049608, binary: 334781944, procs: 171962344, time: 9.685 > > [snip - box now running out of swap] > > =INFO REPORT==== 22-Sep-2008::15:00:23 === > tot_mem: 1261717856, binary: 874756136, procs: 307929080, time: 23137.121 > > > However, changing the receive/if to: > > receive > {tcp, Sock, _Data} -> > [{total, Total}, {processes, Processes} , _, _, _, > _, {binary, > Binary}, _, _] = erlang:memory(), > if Log -> > error_logger:info_msg("tot_mem: ~p, > binary: ~p, procs: ~p, time: ~p", > > [Total, Binary, Processes, timer:now_diff(now(),Before)/1000]); > true -> true > end; > > allows the program to run without leaking anything. > > Any help greatly appreciated. > > Cheers, > Paul. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Mon Sep 22 16:43:49 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Mon, 22 Sep 2008 10:43:49 -0400 Subject: [erlang-questions] Yaws + Json In-Reply-To: References: Message-ID: <6c2563b20809220743t1023b2fchc373c2b20175b92b@mail.gmail.com> Just fyi, there is an erlyaws-list, too, in case you get no joy here. On Mon, Sep 22, 2008 at 8:58 AM, Roberto Aloi wrote: > Hello everyone, I'm pretty new to this mailing list. > I'm trying to make the "Ajax through json rpc" example from yaws ( > http://yaws.hyber.org/json_intro.yaws > ) working, but when I run it locally I get the following javascript > error when invoking the method: > "TypeError: Undefined Value". > Any hint? > > Rob > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Mon Sep 22 16:44:01 2008 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 22 Sep 2008 16:44:01 +0200 Subject: [erlang-questions] puzzle about gen_server:call/2 In-Reply-To: References: Message-ID: <8209f740809220744x6f24a668m66d1dc0b89e4ef54@mail.gmail.com> It is possible to return {noreply, NewState} in cases when e.g. the request triggers a background job. The server can then reply later with gen_server:reply(From, Reply), and be free to handle other requests in the meantime. BR, Ulf W 2008/9/22 litao cheng : > Greetings ! > I read the codes of gen_server.erl and gen.erl in stdlib, the > gen_server:call/3 invoke process is illustrated as follows: > > gen_server:call/3 -> > gen:call/3 -> > gen:call/4 -> > gen:do_call/4 > > in the gen:do_call/4, first check if the target Process is exist by invoke > erlang:monitor/2, if the process is alive then send the message, > after the messge is sended, invoke the wait_resp_mon/3 to wait the > response, if the Mod:handle_call return {reply, Reply, State}, then in > wait_resp_mon/3, we can receive the message and return the Reply to the > gen_server:call/2 caller. My Question is: If the Mod:handle_call return > {noreply, State}, then I see the gen_server continue the loop, not send any > message to caller, in that case I think the wait_resp_mon/3 will be blocked, > Factually I know the caller not block! Anyone can give me a explain? > > thanks! > Best Regards! > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From puzza007@REDACTED Mon Sep 22 16:58:33 2008 From: puzza007@REDACTED (Paul Oliver) Date: Mon, 22 Sep 2008 15:58:33 +0100 Subject: [erlang-questions] Memory leak question In-Reply-To: <6c2563b20809220739j51d94d1fva0c78690c490792a@mail.gmail.com> References: <6c2563b20809220739j51d94d1fva0c78690c490792a@mail.gmail.com> Message-ID: Hi Edwin, Sorry, the line ending erlang:memory() is moved outside the if expression in the non-leaking code. Cheers, Paul. On Mon, Sep 22, 2008 at 3:39 PM, Edwin Fine wrote: > I'm confused; how exactly is the receive/if changed? Looks the same to me. > Am i missing something? > > On Mon, Sep 22, 2008 at 10:08 AM, Paul Oliver wrote: >> >> Hi all, >> >> I've written a test client that starts a number of sockets and >> repeatedly sends and receives a static sting from an echo server. >> I've noticed some strange behavior with an if statement and was >> wondering if someone can tell me why? The following code seems to >> leak memory and processes until my box is hosed: >> >> loop(Sock, Log) -> >> Before = if Log -> now(); >> true -> 0 >> end, >> ok = gen_tcp:send(Sock, >> >> <<"01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789">>), >> receive >> {tcp, Sock, _Data} -> >> if Log -> >> [{total, Total}, {processes, >> Processes} , _, _, _, _, {binary, >> Binary}, _, _] = erlang:memory(), >> error_logger:info_msg("tot_mem: ~p, >> binary: ~p, procs: ~p, time: ~p", >> >> [Total, Binary, Processes, timer:now_diff(now(),Before)/1000]); >> true -> true >> end; >> Error -> >> % Anything other than a data message, print error >> error_logger:error_msg(Error) >> end, >> receive >> after ?MESSAGE_INTERVAL -> >> true >> end, >> loop(Sock, Log). >> >> Example logs: >> >> =INFO REPORT==== 22-Sep-2008::14:53:31 === >> tot_mem: 587049608, binary: 334781944, procs: 171962344, time: 9.685 >> >> [snip - box now running out of swap] >> >> =INFO REPORT==== 22-Sep-2008::15:00:23 === >> tot_mem: 1261717856, binary: 874756136, procs: 307929080, time: 23137.121 >> >> >> However, changing the receive/if to: >> >> receive >> {tcp, Sock, _Data} -> >> [{total, Total}, {processes, Processes} , _, _, _, >> _, {binary, >> Binary}, _, _] = erlang:memory(), >> if Log -> >> error_logger:info_msg("tot_mem: ~p, >> binary: ~p, procs: ~p, time: ~p", >> >> [Total, Binary, Processes, timer:now_diff(now(),Before)/1000]); >> true -> true >> end; >> >> allows the program to run without leaking anything. >> >> Any help greatly appreciated. >> >> Cheers, >> Paul. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > From sverker@REDACTED Mon Sep 22 17:01:47 2008 From: sverker@REDACTED (Sverker Eriksson) Date: Mon, 22 Sep 2008 17:01:47 +0200 Subject: [erlang-questions] Memory leak question In-Reply-To: References: Message-ID: <48D7B35B.7060300@erix.ericsson.se> Do you use any packet-option on the socket. Otherwise you don't have any guarantee that you will receive all the echoed data in one message. That is, you will send more data than you receive as you have a 1-to-1 relation between send and receive in your loop. /Sverker, Erlang/OTP Ericsson From puzza007@REDACTED Mon Sep 22 17:06:25 2008 From: puzza007@REDACTED (Paul Oliver) Date: Mon, 22 Sep 2008 16:06:25 +0100 Subject: [erlang-questions] Memory leak question In-Reply-To: <48D7B35B.7060300@erix.ericsson.se> References: <48D7B35B.7060300@erix.ericsson.se> Message-ID: On Mon, Sep 22, 2008 at 4:01 PM, Sverker Eriksson wrote: > Do you use any packet-option on the socket. Otherwise you don't have any > guarantee that you will receive all the echoed data in one message. That is, > you will send more data than you receive as you have a 1-to-1 relation > between send and receive in your loop. > > /Sverker, Erlang/OTP Ericsson > > > > Hi Sverker, I've used {packet, 0}. Please find the full source below. Cheers, Paul. -module(load_test). -export([start/1, init/1]). -define(RETRY_WAIT, 1000). -define(MESSAGE_INTERVAL, 1000). -define(CLIENT_START_WAIT, 2). -define(SOCK_OPTS, [binary, {packet, 0}, {recbuf, 1000}, {sndbuf, 1000}]). start(1) -> spawn(?MODULE, init, [true]), ok; start(Clients) -> spawn(?MODULE, init, [false]), receive after ?CLIENT_START_WAIT -> true end, start(Clients - 1). init(Log) -> case gen_tcp:connect('127.0.0.1', 8888, ?SOCK_OPTS, 30000) of {ok, Sock} -> loop(Sock, Log); {error, X} -> % If we get a connect error, wait and reconnect error_logger:info_msg(X), receive after ?RETRY_WAIT -> true end, init(Log) end. loop(Sock, Log) -> Before = if Log -> now(); true -> 0 end, ok = gen_tcp:send(Sock, <<"01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789">>), receive {tcp, Sock, _Data} -> case Log of true -> [{total, Total}, {processes, Processes} , _, _, _, _, {binary, Binary}, _, _] = erlang:memory(), error_logger:info_msg("tot_mem: ~p, binary: ~p, procs: ~p, time: ~p", [Total, Binary, Processes, timer:now_diff(now(),Before)/1000]); _ -> true end; Error -> % Anything other than a data message, print error error_logger:error_msg(Error) end, receive after ?MESSAGE_INTERVAL -> true end, loop(Sock, Log). From sverker@REDACTED Mon Sep 22 17:30:20 2008 From: sverker@REDACTED (Sverker Eriksson) Date: Mon, 22 Sep 2008 17:30:20 +0200 Subject: [erlang-questions] Memory leak question In-Reply-To: References: <48D7B35B.7060300@erix.ericsson.se> Message-ID: <48D7BA0C.9030803@erix.ericsson.se> Paul Oliver wrote: > receive > {tcp, Sock, _Data} -> Print size(_Data) as well. To see how much data you are receiving compared to how much you are sending each time. /Sverker, Erlang/OTP Ericsson From puzza007@REDACTED Mon Sep 22 17:56:04 2008 From: puzza007@REDACTED (Paul Oliver) Date: Mon, 22 Sep 2008 16:56:04 +0100 Subject: [erlang-questions] Memory leak question In-Reply-To: <48D7BA0C.9030803@erix.ericsson.se> References: <48D7B35B.7060300@erix.ericsson.se> <48D7BA0C.9030803@erix.ericsson.se> Message-ID: On Mon, Sep 22, 2008 at 4:30 PM, Sverker Eriksson wrote: > Paul Oliver wrote: >> receive >> {tcp, Sock, _Data} -> > > > Print size(_Data) as well. To see how much data you are receiving > compared to how much you are sending each time. > > > /Sverker, Erlang/OTP Ericsson > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > Hi Sverker, Sent and recd seem to correspond. =INFO REPORT==== 22-Sep-2008::16:47:14 === sent: 500, Rec: 500, tot_mem: 629591144, binary: 400980312, procs: 148333264, time: 43.069 =INFO REPORT==== 22-Sep-2008::16:47:16 === sent: 500, Rec: 500, tot_mem: 631668704, binary: 403595160, procs: 148333160, time: 784.132 I also enabled logging for all clients where sent =/= recv and didn't get any matches... Cheers, Paul. From dawsdesign@REDACTED Mon Sep 22 18:14:04 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Mon, 22 Sep 2008 12:14:04 -0400 Subject: [erlang-questions] Yaws + Json In-Reply-To: <6c2563b20809220743t1023b2fchc373c2b20175b92b@mail.gmail.com> References: <6c2563b20809220743t1023b2fchc373c2b20175b92b@mail.gmail.com> Message-ID: You might want to try using the superb firefox addon, firebug to see what the server is sending to your browser. You can find it at http://getfirebug.com/releases/ 2008/9/22 Edwin Fine > Just fyi, there is an erlyaws-list, too, in case you get no joy here. > > > On Mon, Sep 22, 2008 at 8:58 AM, Roberto Aloi < > roberto@REDACTED> wrote: > >> Hello everyone, I'm pretty new to this mailing list. >> I'm trying to make the "Ajax through json rpc" example from yaws ( >> http://yaws.hyber.org/json_intro.yaws >> ) working, but when I run it locally I get the following javascript >> error when invoking the method: >> "TypeError: Undefined Value". >> Any hint? >> >> Rob >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Mon Sep 22 18:53:40 2008 From: rvirding@REDACTED (Robert Virding) Date: Mon, 22 Sep 2008 18:53:40 +0200 Subject: [erlang-questions] Edoc question Message-ID: <3dbc6d1c0809220953l47f6125aj164733f7796ee3bf@mail.gmail.com> I have a small question about using edoc. The "standard" way for an application seems to be to have an overview file and then generate files for every module taking the documentation from the source files. Also the formatting available in the overview is quite primitive, at least compared to that available for the source files. Have I understood the basics correctly here? The problem is that I don't want to work that way. What I need/would like is: - For my applications I would like to write an extended description of the system in the overview and need the full formatting in the overview. Edoc itself does this by having a user's guide, this would be acceptable, while yecc puts everything into description of the yecc module, which I think is the wrong place for it. - I do not like to put user documentation in source files, it clutters them up unnecessarily. In my view source files should only contain documentation which is relevant for understanding the code, having user documentation in the same file I think clutters it up unnecessarily, and hides what is essential for the code. Now the answer to these questions may very well be RTFM then please just tell me where in the FM to R. While I am at it: can you get something which suitable for paper and not just HTML? Printing out from the browser is not good enough. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin@REDACTED Mon Sep 22 20:22:05 2008 From: kevin@REDACTED (Kevin A. Smith) Date: Mon, 22 Sep 2008 14:22:05 -0400 Subject: [erlang-questions] Yaws + Json In-Reply-To: References: <6c2563b20809220743t1023b2fchc373c2b20175b92b@mail.gmail.com> Message-ID: <689E1CCE-F15C-467A-B1B7-6B8AC01F3874@hypotheticalabs.com> If you just want to snoop at headers and such, the LiveHTTPHeaders plugin is also quite nice. --Kevin On Sep 22, 2008, at 12:14 PM, Matt Williamson wrote: > You might want to try using the superb firefox addon, firebug to see > what the server is sending to your browser. You can find it at http://getfirebug.com/releases/ > > 2008/9/22 Edwin Fine > Just fyi, there is an erlyaws-list, too, in case you get no joy here. > > > On Mon, Sep 22, 2008 at 8:58 AM, Roberto Aloi > wrote: > Hello everyone, I'm pretty new to this mailing list. > I'm trying to make the "Ajax through json rpc" example from yaws (http://yaws.hyber.org/json_intro.yaws > ) working, but when I run it locally I get the following javascript > error when invoking the method: > "TypeError: Undefined Value". > Any hint? > > Rob > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From richardc@REDACTED Mon Sep 22 20:44:18 2008 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 22 Sep 2008 20:44:18 +0200 Subject: [erlang-questions] Edoc question In-Reply-To: <3dbc6d1c0809220953l47f6125aj164733f7796ee3bf@mail.gmail.com> References: <3dbc6d1c0809220953l47f6125aj164733f7796ee3bf@mail.gmail.com> Message-ID: <48D7E782.1070700@it.uu.se> Robert Virding wrote: > - For my applications I would like to write an extended description of > the system in the overview and need the full formatting in the overview. > Edoc itself does this by having a user's guide, this would be > acceptable, while yecc puts everything into description of the yecc > module, which I think is the wrong place for it. I also think that the high-level description should go in the overview, and that is how I write my docs. I just wonder what you mean by "the full formatting"? The contents of the overview file are parsed just like a source code comment (without the leading % characters), and there is not much difference between what you can do in a module @doc and an overview @doc. You have the same wiki expansion, macros, and of course full xhtml for anything else you might need, such as tables. The overview.edoc file for edoc itself should be a decent reference. > While I am at it: can you get something which suitable for paper and not > just HTML? Printing out from the browser is not good enough. Sorry. You can write a layout plugin (I kind of expected that someone else would do that for me, but no luck) to generate different html or any other kind of xml-based output. Also, the standard layout could be improved to make the output more easily "skinnable" through CSS. /Richard From litaocheng@REDACTED Tue Sep 23 03:39:37 2008 From: litaocheng@REDACTED (litao cheng) Date: Tue, 23 Sep 2008 09:39:37 +0800 Subject: [erlang-questions] puzzle about gen_server:call/2 In-Reply-To: <8209f740809220744x6f24a668m66d1dc0b89e4ef54@mail.gmail.com> References: <8209f740809220744x6f24a668m66d1dc0b89e4ef54@mail.gmail.com> Message-ID: thank you! Ulf W. 2008/9/22 Ulf Wiger > It is possible to return {noreply, NewState} in cases when > e.g. the request triggers a background job. The server can > then reply later with gen_server:reply(From, Reply), and > be free to handle other requests in the meantime. > > BR, > Ulf W > > 2008/9/22 litao cheng : > > Greetings ! > > I read the codes of gen_server.erl and gen.erl in stdlib, the > > gen_server:call/3 invoke process is illustrated as follows: > > > > gen_server:call/3 -> > > gen:call/3 -> > > gen:call/4 -> > > gen:do_call/4 > > > > in the gen:do_call/4, first check if the target Process is exist by > invoke > > erlang:monitor/2, if the process is alive then send the message, > > after the messge is sended, invoke the wait_resp_mon/3 to wait the > > response, if the Mod:handle_call return {reply, Reply, State}, then in > > wait_resp_mon/3, we can receive the message and return the Reply to the > > gen_server:call/2 caller. My Question is: If the Mod:handle_call return > > {noreply, State}, then I see the gen_server continue the loop, not send > any > > message to caller, in that case I think the wait_resp_mon/3 will be > blocked, > > Factually I know the caller not block! Anyone can give me a explain? > > > > thanks! > > Best Regards! > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From saleyn@REDACTED Tue Sep 23 04:25:26 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Mon, 22 Sep 2008 22:25:26 -0400 Subject: [erlang-questions] Erlang shell patch for special keys Message-ID: <48D85396.4060907@gmail.com> Attached patch fixes handling of special keys in the Erlang shell. I tested this on Linux and Windows, though my primary concern was to get it working on Linux. Del - Delete char at current position ^-> - Move right one word ^<- - Move left one word ^W - kill a word ^U - kill a line Serge P.S. ^U is a merge of someone else's contrib - I saw this on the mailing list a couple of years ago, but don't recall who the author was... -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: erlin.erl.patch URL: From john.hughes@REDACTED Tue Sep 23 07:14:14 2008 From: john.hughes@REDACTED (John Hughes) Date: Tue, 23 Sep 2008 07:14:14 +0200 Subject: [erlang-questions] currying and lazy evaluation questions References: Message-ID: <96D3B50792094B55A9AE7D2F65123797@JTablet2007> > I read a note on the Internet that said "You can do lazy evaluation in > Erlang (observe Erlang QuickCheck), but you have to be explicit about it." > ? > Can some one explain to me how to "explicitly" use lazy evaluation in > Erlang, in the general? > ? I use macros -define(DELAY(E),fun()->E end). -define(FORCE(F),F()). to save a little typing, and more importantly mark the places where I'm thinking in terms of laziness. In my experience this is pretty tedious (lots of syntactic noise) and error-prone (easy to forget to FORCE or DELAY somewhere)--and as Richard pointed out, inefficient if you FORCE the same value more than once, so you basically can only use the idea where lazy data-structures are going to be consumed once only. I certainly wouldn't recommend transliterating Haskell code and inserting DELAY and FORCE everywhere to get the same semantics--that would be very heavyweight, and often unnecessary. But in those cases where you really need lazy evaluation, it's a useful technique. John From martin.logan@REDACTED Tue Sep 23 07:05:31 2008 From: martin.logan@REDACTED (Martin Logan) Date: Tue, 23 Sep 2008 00:05:31 -0500 Subject: [erlang-questions] Recommended standard Erlang project directory structure/layout... In-Reply-To: <1221677867.6051.6.camel@linux-box> Message-ID: I recommend that you check out Erlware. Www.erlware.org. We have embodied a standard layout in our build tools. On 9/17/08 1:57 PM, "Dan Rubino" wrote: > Hi all, > > I am looking for documentation regarding a standard directory structure > layout for Erlang projects. In Java we have the Maven standard layout > which prescribes a layout for source/config/build etc. This of course > works very well and keeps large projects well organised. > > As yet I have not found such a standard for Erlang. I was hoping the Joe > Armstrong book would set this out but to my disappointment barely > scratches the topic surface. > > So my question is - how are Erlang projects generally setup? What I am > really after is a standard practice of sorts. > > Thanks, > Dan > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From devdoer2@REDACTED Tue Sep 23 10:14:41 2008 From: devdoer2@REDACTED (devdoer bird) Date: Tue, 23 Sep 2008 16:14:41 +0800 Subject: [erlang-questions] Which file contains the code related to the erlang shell 's string espace ? Message-ID: HI: I want to modify the erlang shell to let it output non-ascii word as a string without escape? which source file shall I work on? I've posted a mail about this problem before. So I paste the mail below to help explain my problem. How to show non-ascii charaters correctly in erlang shell? The link is : http://groups.google.com/group/erlangquestions/browse_thread/thread/907993531a2c0752 Thanks . -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Tue Sep 23 10:46:29 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Tue, 23 Sep 2008 04:46:29 -0400 Subject: [erlang-questions] Which file contains the code related to the erlang shell 's string espace ? In-Reply-To: <6c2563b20809230145m721d04a2g94bf7ccd1324ee00@mail.gmail.com> References: <6c2563b20809230145m721d04a2g94bf7ccd1324ee00@mail.gmail.com> Message-ID: <6c2563b20809230146x424fb99fj9b7fadd2f45c1188@mail.gmail.com> 1. Go to the Erlang FAQ web site: http://www.erlang.org/faq.html 2. Select the erlang-bugs list radio button. 3. Enter "mog" into the search box. 4. Press "Google Search". 5. It's the second post ( http://www.erlang.org/pipermail/erlang-bugs/2008-June/000850.html). The ^L patch is attached as a URL. 6. Learn how to search the archives - they are full of years and years worth of information. You just have to use the right search terms, which is the tricky part sometimes. 2008/9/23 devdoer bird > HI: > I want to modify the erlang shell to let it output non-ascii word as a > string without escape? which source file shall I work on? > > I've posted a mail about this problem before. So I paste the mail below > to help explain my problem. > > How to show non-ascii charaters correctly in erlang shell? > > The link is : > > http://groups.google.com/group/erlangquestions/browse_thread/thread/907993531a2c0752 > Thanks . > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From roberto@REDACTED Tue Sep 23 11:03:59 2008 From: roberto@REDACTED (Roberto Aloi) Date: Tue, 23 Sep 2008 11:03:59 +0200 Subject: [erlang-questions] Yaws + Json In-Reply-To: References: <6c2563b20809220743t1023b2fchc373c2b20175b92b@mail.gmail.com> Message-ID: <68D796DB-F202-4FD7-AF8B-4EB5C1B99023@erlang-consulting.com> > You might want to try using the superb firefox addon, firebug to see > what the server is sending to your browser. You can find it at http://getfirebug.com/releases/ Thanks so much. I fixed the issue. Great plugin btw. Rob -------------- next part -------------- An HTML attachment was scrubbed... URL: From hb@REDACTED Tue Sep 23 12:10:29 2008 From: hb@REDACTED (Haldun Bayhantopcu) Date: Tue, 23 Sep 2008 12:10:29 +0200 Subject: [erlang-questions] Mnesia table replication/sharing question Message-ID: <76C357B7-34C4-446F-8988-3D3655053368@cs.bilgi.edu.tr> Hi all, Assume that we have N erlang nodes, running same application. I want to share an mnesia table T1 with all N nodes, which I see no problem. However, I want to share another mnesia table T2 with pairs of nodes. I mean the contents of T2 will be identical and replicated to/with only sharing pair. In another words, I want N/2 different contents for T2 table. Is this possible with mnesia, not with renaming T2 for each distinct pair of nodes? Thanks in advance, Haldun. From ulf.wiger@REDACTED Tue Sep 23 12:47:52 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 23 Sep 2008 12:47:52 +0200 Subject: [erlang-questions] Mnesia table replication/sharing question In-Reply-To: <76C357B7-34C4-446F-8988-3D3655053368@cs.bilgi.edu.tr> References: <76C357B7-34C4-446F-8988-3D3655053368@cs.bilgi.edu.tr> Message-ID: <48D8C958.9090507@ericsson.com> If you want mnesia to treat these tables as different, you have to name them differently, or configure the table as a fragmented table (see man page for mnesia_frag), in which you control the fragment allocation and key distribution (see man page for mnesia_frag_hash). It may be easier to use explicit naming, though. (: BR, Ulf W Haldun Bayhantopcu skrev: > Hi all, > > Assume that we have N erlang nodes, running same application. I want > to share an mnesia table T1 with all N nodes, which I see no problem. > However, I want to share another mnesia table T2 with pairs of nodes. > I mean the contents of T2 will be identical and replicated to/with > only sharing pair. In another words, I want N/2 different contents for > T2 table. Is this possible with mnesia, not with renaming T2 for each > distinct pair of nodes? > > Thanks in advance, > Haldun. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From saleyn@REDACTED Tue Sep 23 13:18:50 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Tue, 23 Sep 2008 07:18:50 -0400 Subject: [erlang-questions] Which file contains the code related to the erlang shell 's string espace ? In-Reply-To: References: Message-ID: <48D8D09A.3050603@gmail.com> I suggest you would look at the io_lib:write/1 function to accomplish this. Serge devdoer bird wrote: > HI: > I want to modify the erlang shell to let it output non-ascii word as a > string without escape? which source file shall I work on? > > I've posted a mail about this problem before. So I paste the mail below to > help explain my problem. > > How to show non-ascii charaters correctly in erlang > shell? > > The link is : > http://groups.google.com/group/erlangquestions/browse_thread/thread/907993531a2c0752 > Thanks . > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From rvirding@REDACTED Tue Sep 23 13:52:35 2008 From: rvirding@REDACTED (Robert Virding) Date: Tue, 23 Sep 2008 13:52:35 +0200 Subject: [erlang-questions] [erlang-patches] Erlang shell patch for special keys In-Reply-To: <48D85396.4060907@gmail.com> References: <48D85396.4060907@gmail.com> Message-ID: <3dbc6d1c0809230452k417243e0j3af38271e6617ee6@mail.gmail.com> The ^U collides with the normal emacs use of ^U which I personally think is more useful. A philosophical point is whether to mix the emacs based commands we have today with more Windows inspired commands like ^<- and ^->? Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From erik.reitsma@REDACTED Tue Sep 23 15:02:28 2008 From: erik.reitsma@REDACTED (Erik Reitsma) Date: Tue, 23 Sep 2008 15:02:28 +0200 Subject: [erlang-questions] JInterface empty string issue Message-ID: <110BA8ACEE682C479D0B008B6BE4AEB10712CEE5@esealmw107.eemea.ericsson.se> Hi all, We are sending strings (in tuples and otherwise) from Erlang to Java (receiving them with JInterface). If the string is non-empty, we receive an OtpErlangString in Java. But if the string is empty, the empty list (nil) is sent, which becomes an OtpErlangList. This means that we cannot "blindly" cast the incoming message (or tuple element) to an OtpErlangString, but we must always check if it is the empty list. I believe this issue could be solved by making OtpErlangString extend OtpErlangList and implementing the OtpErlangList methods in OtpErlangString. Regards, *Erik. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bardb@REDACTED Tue Sep 23 15:22:12 2008 From: bardb@REDACTED (Bard Bloom) Date: Tue, 23 Sep 2008 09:22:12 -0400 Subject: [erlang-questions] Millions of processes? In-Reply-To: References: Message-ID: I've seen in Erlang promotional materials some rather impressive claims about how cheap Erlang processes are, and how many of them one can spawn. Which is pretty cool. But, what Erlang programs take advantage of that kind of power? Are there any examples of programs which use huge numbers of processes in interesting ways? (I am the local Erlang fancier. I got challenged on that point, and didn't have a very good answer.) Thanks very much, Bard Bloom -------------- next part -------------- An HTML attachment was scrubbed... URL: From tomas.abrahamsson@REDACTED Tue Sep 23 15:24:45 2008 From: tomas.abrahamsson@REDACTED (Tomas Abrahamsson) Date: Tue, 23 Sep 2008 15:24:45 +0200 Subject: [erlang-questions] Memory leak question In-Reply-To: References: Message-ID: On Mon, Sep 22, 2008 at 16:08, Paul Oliver wrote: > Hi all, > > I've written a test client that starts a number of sockets and > repeatedly sends and receives a static sting from an echo server. > I've noticed some strange behavior with an if statement and was > wondering if someone can tell me why? I tried 100 clients sending one message every 0.1 seconds, over the night (13 hours), but couldn't repeat your results. I did not run out of memory. I tried both your code fragments. The beam process used up between 11 and 15 MB of RAM (as reported by top). It oscillated (well, slowly) between 11 and 15 MB of RAM usage. CPU usage was low. Virtually no swapping/paging took place. I don't know what version of Erlang you used, how long you had to run, etc, but anyway, this is what I used: R12B-4 (32-bit) on one dual-core opteron machine with 4 GB RAM, running SuSE linux enterprise desktop 10.1, erl was started like this: "erl -s xload start_clients", thus just default for everything: smp, memory allocators and such. (I had to write a tcp/ip echo server to be able to run your code, perhaps some delicate working of the echo server or some other part of the environment could have an effect on the results?) BRs Tomas From ulf@REDACTED Tue Sep 23 16:41:25 2008 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 23 Sep 2008 16:41:25 +0200 Subject: [erlang-questions] Millions of processes? In-Reply-To: References: Message-ID: <8209f740809230741j4e7f3ab4j38ca8b5f97e8f7c6@mail.gmail.com> In the products we build, we tend to hit memory and bandwidth limits long before we reach millions (even hundreds of thousand) processes. This is partly because many of the processes do network IO, and because our products are physically constrained by fairly tight space, cost and power budgets. Physical constraints are subject to change, of course... The way we chose to program nowadays is, however, inspired by the knowledge that we don't have to worry about the number of processes per se, even if we'd end up with several hundred thousand of them. BR, Ulf W 2008/9/23 Bard Bloom : > I've seen in Erlang promotional materials some rather impressive claims > about how cheap Erlang processes are, and how many of them one can spawn. > Which is pretty cool. But, what Erlang programs take advantage of that kind > of power? Are there any examples of programs which use huge numbers of > processes in interesting ways? (I am the local Erlang fancier. I got > challenged on that point, and didn't have a very good answer.) > > Thanks very much, > Bard Bloom > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From nicolas@REDACTED Tue Sep 23 17:08:58 2008 From: nicolas@REDACTED (Nicolas Niclausse) Date: Tue, 23 Sep 2008 17:08:58 +0200 Subject: [erlang-questions] Millions of processes? In-Reply-To: References: Message-ID: <48D9068A.7050200@niclux.org> Bard Bloom ecrivait le 23.09.2008 15:22: > I've seen in Erlang promotional materials some rather impressive claims > about how cheap Erlang processes are, and how many of them one can > spawn. Which is pretty cool. But, what Erlang programs take advantage of > that kind of power? Are there any examples of programs which use huge > numbers of processes in interesting ways? (I am the local Erlang > fancier. I got challenged on that point, and didn't have a very good > answer.) You can use tsung to simulate millions of users to do load/stress testing. It uses an erlang process for each simulated user. I tried to simulate ~1.3 million users, distributed on ~30 nodes, with one smp beam per node, to see if it works. it does :) -- Nicolas From ulf.wiger@REDACTED Tue Sep 23 17:14:37 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 23 Sep 2008 17:14:37 +0200 Subject: [erlang-questions] Millions of processes? In-Reply-To: <48D9068A.7050200@niclux.org> References: <48D9068A.7050200@niclux.org> Message-ID: <48D907DD.1030909@ericsson.com> Nicolas Niclausse skrev: > Bard Bloom ecrivait le 23.09.2008 15:22: >> I've seen in Erlang promotional materials some rather impressive claims >> about how cheap Erlang processes are, and how many of them one can >> spawn. Which is pretty cool. But, what Erlang programs take advantage of >> that kind of power? Are there any examples of programs which use huge >> numbers of processes in interesting ways? (I am the local Erlang >> fancier. I got challenged on that point, and didn't have a very good >> answer.) > > You can use tsung to simulate millions of users to do load/stress testing. > It uses an erlang process for each simulated user. > > I tried to simulate ~1.3 million users, distributed on ~30 nodes, with one > smp beam per node, to see if it works. it does :) > Yeah, but that's just some 43k processes per node then. (: Don't you also run into the problem that practically every process in tsung does network IO? BR, Ulf W From bob@REDACTED Tue Sep 23 17:31:52 2008 From: bob@REDACTED (Bob Ippolito) Date: Tue, 23 Sep 2008 08:31:52 -0700 Subject: [erlang-questions] Millions of processes? In-Reply-To: References: Message-ID: <6a36e7290809230831i738b27c6n5de4b16e9e8867c1@mail.gmail.com> We've got a couple applications that use thousands of processes per node. If those were pthreads, we'd be out of RAM before actually doing anything. 2008/9/23 Bard Bloom : > I've seen in Erlang promotional materials some rather impressive claims > about how cheap Erlang processes are, and how many of them one can spawn. > Which is pretty cool. But, what Erlang programs take advantage of that kind > of power? Are there any examples of programs which use huge numbers of > processes in interesting ways? (I am the local Erlang fancier. I got > challenged on that point, and didn't have a very good answer.) > > Thanks very much, > Bard Bloom > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From nicolas@REDACTED Tue Sep 23 17:34:33 2008 From: nicolas@REDACTED (Nicolas Niclausse) Date: Tue, 23 Sep 2008 17:34:33 +0200 Subject: [erlang-questions] Millions of processes? In-Reply-To: <48D907DD.1030909@ericsson.com> References: <48D9068A.7050200@niclux.org> <48D907DD.1030909@ericsson.com> Message-ID: <48D90C89.1080009@niclux.org> Ulf Wiger (TN/EAB) ecrivait le 23.09.2008 17:14: > Nicolas Niclausse skrev: >> Bard Bloom ecrivait le 23.09.2008 15:22: >>> I've seen in Erlang promotional materials some rather impressive claims >>> about how cheap Erlang processes are, and how many of them one can >>> spawn. Which is pretty cool. But, what Erlang programs take advantage of >>> that kind of power? Are there any examples of programs which use huge >>> numbers of processes in interesting ways? (I am the local Erlang >>> fancier. I got challenged on that point, and didn't have a very good >>> answer.) >> >> You can use tsung to simulate millions of users to do load/stress >> testing. >> It uses an erlang process for each simulated user. >> >> I tried to simulate ~1.3 million users, distributed on ~30 nodes, with >> one >> smp beam per node, to see if it works. it does :) >> > > Yeah, but that's just some 43k processes per node then. (: Yes, i didn't have enough memory on nodes so i had to use many of them :) (4GB per node with a 64 bit erlang VM) > Don't you also run into the problem that practically every > process in tsung does network IO? No. But each node had a gigabit ethernet link, and not all users (processes) were doing network IO simultaneously in the test (because of "thinktimes" in the scenario ), it was something like 10% of them. The cumulative bandwitdh was "only" 1Gbit/s -- Nicolas From exta7@REDACTED Tue Sep 23 18:22:07 2008 From: exta7@REDACTED (Zvi) Date: Tue, 23 Sep 2008 09:22:07 -0700 (PDT) Subject: [erlang-questions] Millions of processes? In-Reply-To: <6a36e7290809230831i738b27c6n5de4b16e9e8867c1@mail.gmail.com> References: <6a36e7290809230831i738b27c6n5de4b16e9e8867c1@mail.gmail.com> Message-ID: <19631434.post@talk.nabble.com> I'm no Linux expert, but http://en.wikipedia.org/wiki/Native_POSIX_Thread_Library "The Native POSIX Thread Library (NPTL) is a software feature that enables the Linux kernel to run programs written to use POSIX Threads fairly efficiently. In tests, NPTL succeeded in starting 100,000 threads on a IA-32 in two seconds. In comparison, this test under a kernel without NPTL would have taken around 15 minutes." I guess future Erlang VM will offer some more generic MxN threading model, i.e. M Erlang user-level processes implemented on N "schedulers" - native threads. Today in SMP Erlang is only limited support (i.e. command line options) to specify number o scheduler and no programmatic support for affinity of schedulers per core and Erlang processes per schedulers. Zvi Bob Ippolito wrote: > > We've got a couple applications that use thousands of processes per > node. If those were pthreads, we'd be out of RAM before actually doing > anything. > > 2008/9/23 Bard Bloom : >> I've seen in Erlang promotional materials some rather impressive claims >> about how cheap Erlang processes are, and how many of them one can spawn. >> Which is pretty cool. But, what Erlang programs take advantage of that >> kind >> of power? Are there any examples of programs which use huge numbers of >> processes in interesting ways? (I am the local Erlang fancier. I got >> challenged on that point, and didn't have a very good answer.) >> >> Thanks very much, >> Bard Bloom >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/Millions-of-processes--tp19627769p19631434.html Sent from the Erlang Questions mailing list archive at Nabble.com. From ulf.wiger@REDACTED Tue Sep 23 19:09:30 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 23 Sep 2008 19:09:30 +0200 Subject: [erlang-questions] Millions of processes? In-Reply-To: <19631434.post@talk.nabble.com> References: <6a36e7290809230831i738b27c6n5de4b16e9e8867c1@mail.gmail.com> <19631434.post@talk.nabble.com> Message-ID: <48D922CA.8030309@ericsson.com> NPTL is fast, but AFAIK uses a minimum stack size of 8KB per thread (the minimum heap size for erlang processes seems to be 932 bytes on a 32-bit system). There also seem to be other limits, making it very difficult in practice to reach anywhere near 100,000 threads, and it's not encouraged either. http://nptl.bullopensource.org/Tests/NPTL-limits.html In the Linux kernel FAQ, the philosophy on threads is explained thus: "Avoid the temptation to create large numbers of threads in your application. Threads should only be used to take advantage of multiple processors or for specialised applications (i.e. low-latency real-time), not as a way of avoiding programmer effort (writing a state machine or an event callback system is quite easy). A good rule of thumb is to have up to 1.5 threads per processor and/or one thread per RT input stream. On a single processor system, a normal application would have at most two threads, over 10 threads is seriously flawed and hundreds or thousands of threads is progressively more insane. A common request is to modify the Linux scheduler to better handle large numbers of running processes/threads. This is always rejected by the kernel developer community because it is, frankly, stupid to have large numbers of threads. Many noted and respected people will extol the virtues of large numbers of threads. They are wrong. Some languages and toolkits create a thread for each object, because it fits into a particular ideology. A thread per object may be appealing in the abstract, but is in fact inefficient in the real world. Linux is not a good computer science project. It is, however, good engineering. Understand the distinction, and you will understand why many widely acclaimed ideas in computer science are held with contempt in the Linux kernel developer community. " http://www.kernel.org/pub/linux/docs/lkml/#s7-21 BR, Ulf W Zvi skrev: > I'm no Linux expert, but > > http://en.wikipedia.org/wiki/Native_POSIX_Thread_Library > > "The Native POSIX Thread Library (NPTL) is a software feature that > enables the Linux kernel to run programs written to use POSIX Threads > fairly efficiently. In tests, NPTL succeeded in starting 100,000 > threads on a IA-32 in two seconds. In comparison, this test under a > kernel without NPTL would have taken around 15 minutes." > > I guess future Erlang VM will offer some more generic MxN threading > model, i.e. M Erlang user-level processes implemented on N > "schedulers" - native threads. Today in SMP Erlang is only limited > support (i.e. command line options) to specify number o scheduler and > no programmatic support for affinity of schedulers per core and > Erlang processes per schedulers. > > Zvi > > > Bob Ippolito wrote: >> We've got a couple applications that use thousands of processes per >> node. If those were pthreads, we'd be out of RAM before actually >> doing anything. >> >> 2008/9/23 Bard Bloom : >>> I've seen in Erlang promotional materials some rather impressive >>> claims about how cheap Erlang processes are, and how many of them >>> one can spawn. Which is pretty cool. But, what Erlang programs >>> take advantage of that kind of power? Are there any examples of >>> programs which use huge numbers of processes in interesting ways? >>> (I am the local Erlang fancier. I got challenged on that point, >>> and didn't have a very good answer.) >>> >>> Thanks very much, Bard Bloom >>> >>> _______________________________________________ erlang-questions >>> mailing list erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >> _______________________________________________ erlang-questions >> mailing list erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > From vinoski@REDACTED Tue Sep 23 19:12:36 2008 From: vinoski@REDACTED (Steve Vinoski) Date: Tue, 23 Sep 2008 13:12:36 -0400 Subject: [erlang-questions] Millions of processes? In-Reply-To: <19631434.post@talk.nabble.com> References: <6a36e7290809230831i738b27c6n5de4b16e9e8867c1@mail.gmail.com> <19631434.post@talk.nabble.com> Message-ID: <65b2728e0809231012u7d90704cv1d3bcf1d6d948933@mail.gmail.com> On 9/23/08, Zvi wrote: > > I'm no Linux expert, but > > http://en.wikipedia.org/wiki/Native_POSIX_Thread_Library > > "The Native POSIX Thread Library (NPTL) is a software feature that enables > the Linux kernel to run programs written to use POSIX Threads fairly > efficiently. > In tests, NPTL succeeded in starting 100,000 threads on a IA-32 in two > seconds. In comparison, this test under a kernel without NPTL would have > taken around 15 minutes." This test was done 6-7 years ago. As a result of this work, have you seen any Linux apps that make use of huge numbers of pthreads, thereby noticeably advancing the state of the art for whatever application domain they address? I haven't. Also, I wonder what the default thread stack size was set to for this test? I'm guessing it was set to be artificially small -- too small to do any real work, in fact -- just to get to the 100000 mark. I have to side with Bob's comment on this one. --steve > Bob Ippolito wrote: > > > > We've got a couple applications that use thousands of processes per > > node. If those were pthreads, we'd be out of RAM before actually doing > > anything. > > > > 2008/9/23 Bard Bloom : > >> I've seen in Erlang promotional materials some rather impressive claims > >> about how cheap Erlang processes are, and how many of them one can spawn. > >> Which is pretty cool. But, what Erlang programs take advantage of that > >> kind > >> of power? Are there any examples of programs which use huge numbers of > >> processes in interesting ways? (I am the local Erlang fancier. I got > >> challenged on that point, and didn't have a very good answer.) > >> > >> Thanks very much, > >> Bard Bloom > >> > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > -- > View this message in context: http://www.nabble.com/Millions-of-processes--tp19627769p19631434.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From raould@REDACTED Tue Sep 23 19:17:18 2008 From: raould@REDACTED (Raoul Duke) Date: Tue, 23 Sep 2008 10:17:18 -0700 Subject: [erlang-questions] Millions of processes? In-Reply-To: <48D922CA.8030309@ericsson.com> References: <6a36e7290809230831i738b27c6n5de4b16e9e8867c1@mail.gmail.com> <19631434.post@talk.nabble.com> <48D922CA.8030309@ericsson.com> Message-ID: <91a2ba3e0809231017l973a355yed188a4043071187@mail.gmail.com> also, aren't Erlang processes safer than Linux threads (not processes)? From exta7@REDACTED Tue Sep 23 19:55:07 2008 From: exta7@REDACTED (Zvi) Date: Tue, 23 Sep 2008 10:55:07 -0700 (PDT) Subject: [erlang-questions] Millions of processes? In-Reply-To: <48D922CA.8030309@ericsson.com> References: <6a36e7290809230831i738b27c6n5de4b16e9e8867c1@mail.gmail.com> <19631434.post@talk.nabble.com> <48D922CA.8030309@ericsson.com> Message-ID: <19633362.post@talk.nabble.com> Ulf Wiger (TN/EAB) wrote: > > "Avoid the temptation to create large numbers of threads in your > application. ..." > lol, this reminds me, that in one of the first PL/1 texbooks, was written: "please avoid using subroutines, since they are very slow" (not exact citation, but something like this). I guess, then subroutine was State-of-the-Art Computer Science concept and spaggethi-code was called a "good engineering" :-) I thought Linux is a server-side OS, so simple "thread-per-connection" model is bad for Linux. Now I understand why Apache fork itself. Zvi -- View this message in context: http://www.nabble.com/Millions-of-processes--tp19627769p19633362.html Sent from the Erlang Questions mailing list archive at Nabble.com. From erlang-questions_efine@REDACTED Tue Sep 23 20:29:49 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Tue, 23 Sep 2008 14:29:49 -0400 Subject: [erlang-questions] [erlang-patches] Erlang shell patch for special keys In-Reply-To: <3dbc6d1c0809230452k417243e0j3af38271e6617ee6@mail.gmail.com> References: <48D85396.4060907@gmail.com> <3dbc6d1c0809230452k417243e0j3af38271e6617ee6@mail.gmail.com> Message-ID: <6c2563b20809231129x6f71ca5ap4bb6951fdc86a95d@mail.gmail.com> Well, how about being able to select which emulation you want to use, like one can via "set -o emacs" or set -o vi"? It could be an Erlang environment variable, e.g. -env ERL_SHELL_EDITOR_STYLE emacs. 2008/9/23 Robert Virding > The ^U collides with the normal emacs use of ^U which I personally think is > more useful. A philosophical point is whether to mix the emacs based > commands we have today with more Windows inspired commands like ^<- and ^->? > > Robert > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From raould@REDACTED Tue Sep 23 21:15:48 2008 From: raould@REDACTED (Raoul Duke) Date: Tue, 23 Sep 2008 12:15:48 -0700 Subject: [erlang-questions] Millions of processes? In-Reply-To: <19633362.post@talk.nabble.com> References: <6a36e7290809230831i738b27c6n5de4b16e9e8867c1@mail.gmail.com> <19631434.post@talk.nabble.com> <48D922CA.8030309@ericsson.com> <19633362.post@talk.nabble.com> Message-ID: <91a2ba3e0809231215g25c4f200xab57cc1ec180e163@mail.gmail.com> > I guess, then subroutine was State-of-the-Art Computer Science concept and > spaggethi-code was called a "good engineering" :-) i see premature or sometimes sadly required optimization every working day. pretty depressing. From Bill.McKeeman@REDACTED Tue Sep 23 21:37:06 2008 From: Bill.McKeeman@REDACTED (Bill McKeeman) Date: Tue, 23 Sep 2008 15:37:06 -0400 Subject: [erlang-questions] Millions of processes? In-Reply-To: <91a2ba3e0809231215g25c4f200xab57cc1ec180e163@mail.gmail.com> References: <6a36e7290809230831i738b27c6n5de4b16e9e8867c1@mail.gmail.com> <19631434.post@talk.nabble.com> <48D922CA.8030309@ericsson.com> <19633362.post@talk.nabble.com> <91a2ba3e0809231215g25c4f200xab57cc1ec180e163@mail.gmail.com> Message-ID: Raoul, I would not be depressed, there has always been a tradeoff between elegance and performance at the bleeding edge. On my first computer we taped bits of 5-hole paper tape into our programs because the plug-panel sine and cosine were too slow. Nothing has changed... /s/ Bill -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Raoul Duke Sent: Tuesday, September 23, 2008 3:16 PM To: erlang-questions@REDACTED Subject: Re: [erlang-questions] Millions of processes? > I guess, then subroutine was State-of-the-Art Computer Science concept and > spaggethi-code was called a "good engineering" :-) i see premature or sometimes sadly required optimization every working day. pretty depressing. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From rvirding@REDACTED Tue Sep 23 22:35:10 2008 From: rvirding@REDACTED (Robert Virding) Date: Tue, 23 Sep 2008 22:35:10 +0200 Subject: [erlang-questions] Leex, Erlog and LFE now on gitub Message-ID: <3dbc6d1c0809231335l61218dafp83d885f5fc5f7f5@mail.gmail.com> I have now put leex, erlog and LFE on github for those who prefer to load their code that way. For thos who don't git it (sorry, couldn't help myself) I will still be puting complete releases on trapext.org. The relevant links are: http://github.com/rvirding/leex/tree http://github.com/rvirding/erlog/tree http://github.com/rvirding/lfe/tree I will be updating these as I work on them. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Wed Sep 24 00:23:26 2008 From: vances@REDACTED (Vance Shipley) Date: Tue, 23 Sep 2008 18:23:26 -0400 Subject: [erlang-questions] Millions of processes? In-Reply-To: <48D922CA.8030309@ericsson.com> References: <6a36e7290809230831i738b27c6n5de4b16e9e8867c1@mail.gmail.com> <19631434.post@talk.nabble.com> <48D922CA.8030309@ericsson.com> Message-ID: <20080923222326.GT269@h216-235-12-173.host.egate.net> On Tue, Sep 23, 2008 at 07:09:30PM +0200, Ulf Wiger (TN/EAB) wrote: } In the Linux kernel FAQ, the philosophy on threads is } explained thus: } } "Avoid the temptation to create large numbers of threads in your } application. Threads should only be used to take advantage of multiple } processors or for specialised applications (i.e. low-latency real-time), } not as a way of avoiding programmer effort (writing a state machine or } an event callback system is quite easy). Contrast that to the Erlang Programming Rules and Conventions: 5.4 Assign exactly one parallel process to each true concurrent activity in the system -Vance From vances@REDACTED Wed Sep 24 00:24:13 2008 From: vances@REDACTED (Vance Shipley) Date: Tue, 23 Sep 2008 18:24:13 -0400 Subject: [erlang-questions] [erlang-patches] Erlang shell patch for special keys In-Reply-To: <6c2563b20809231129x6f71ca5ap4bb6951fdc86a95d@mail.gmail.com> References: <48D85396.4060907@gmail.com> <3dbc6d1c0809230452k417243e0j3af38271e6617ee6@mail.gmail.com> <6c2563b20809231129x6f71ca5ap4bb6951fdc86a95d@mail.gmail.com> Message-ID: <20080923222412.GU269@h216-235-12-173.host.egate.net> You beat me to it. +1 On Tue, Sep 23, 2008 at 02:29:49PM -0400, Edwin Fine wrote: } Well, how about being able to select which emulation you want to use, like } one can via "set -o emacs" or set -o vi"? It could be an Erlang environment } variable, e.g. -env ERL_SHELL_EDITOR_STYLE emacs. -Vance From matthew@REDACTED Sat Sep 20 20:08:00 2008 From: matthew@REDACTED (Matthew Sackman) Date: Sat, 20 Sep 2008 19:08:00 +0100 Subject: [erlang-questions] Some facts about Erlang and SMP In-Reply-To: References: Message-ID: <20080920180800.GB3504@wellquite.org> On Tue, Sep 16, 2008 at 11:34:03AM +0200, Kenneth Lundin wrote: > - The SMP VM with only one scheduler is slightly slower than the non > SMP VM. The SMP VM need to to use all the locks inside but as long as > there are no lock-conflicts the overhead caused by locking is not > significant (it is the lock conflicts that takes time). This explains > why it in some cases can be more efficient to run several SMP VM's > with one scheduler each > instead on one SMP VM with several schedulers. Of course the running > of several VM's require that the application can run > in many parallel tasks which has no or very little communication with > each other. I'm having some difficulties with the "it's only when locks conflict that locking time is significant" idea. My understanding with the pthreads locks is that you start with a CAS, and if that fails then you spin for a while (with CAS), and if you spin for too long then you go a kernel lock. If that's wrong then I'm sorry, as most of the following will also be wrong! Now assuming the above is correct (or at least close enough for jazz), in the conflict case, sure, you're going to block, which is the point, and then some time in the future either the kernel will wake you up (pretty slow), or the spinning finally succeeds in which case the wakeup should be really fast. If there's not a conflict then the first CAS will succeed. But a CAS is many hundreds of cycles as you've got to do cache-coherency and then really go all the way out to RAM and load the values in fresh, especially in a multisocket box. So hundreds of cycles does not seem like "not significant", at least to me. Or have I missed something obvious here? I rather expect that you'll end up with lock-free per-cpu task-queues with workstealing algorithms which as a colleague has just pointed out, has been used for these purposes for some time (at least 10 years); though I do appreciate the "get it out working and then tune it" approach. Matthew From ok@REDACTED Wed Sep 24 03:52:24 2008 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 24 Sep 2008 13:52:24 +1200 Subject: [erlang-questions] Edoc question In-Reply-To: <8695_1222111608_m8MJQkYf029903_48D7E782.1070700@it.uu.se> References: <3dbc6d1c0809220953l47f6125aj164733f7796ee3bf@mail.gmail.com> <8695_1222111608_m8MJQkYf029903_48D7E782.1070700@it.uu.se> Message-ID: <9E7D9640-3930-4ABD-BA5E-A0EE70594579@cs.otago.ac.nz> > Robert Virding wrote: >> While I am at it: can you get something which suitable for paper >> and not >> just HTML? Printing out from the browser is not good enough. I wonder if we have an opportunity to use 'pandoc' here? http://johnmacfarlane.net/pandoc/try If the issue is printing automatically, without having to script some browser, I've been a moderately happy user of 'html2ps' for a while. (Or a Perl script by that name, anyway.) From saleyn@REDACTED Wed Sep 24 03:57:20 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Tue, 23 Sep 2008 21:57:20 -0400 Subject: [erlang-questions] [erlang-patches] Erlang shell patch for special keys In-Reply-To: <20080923222412.GU269@h216-235-12-173.host.egate.net> References: <48D85396.4060907@gmail.com> <3dbc6d1c0809230452k417243e0j3af38271e6617ee6@mail.gmail.com> <6c2563b20809231129x6f71ca5ap4bb6951fdc86a95d@mail.gmail.com> <20080923222412.GU269@h216-235-12-173.host.egate.net> Message-ID: <48D99E80.3080903@gmail.com> Agree with you all, as changing handling of key codes may be a sensitive subject. Though I admit it is quite annoying that the shell special key handling behaves differently when switching between Unix and Windows. Vance Shipley wrote: > You beat me to it. +1 > > On Tue, Sep 23, 2008 at 02:29:49PM -0400, Edwin Fine wrote: > } Well, how about being able to select which emulation you want to use, like > } one can via "set -o emacs" or set -o vi"? It could be an Erlang environment > } variable, e.g. -env ERL_SHELL_EDITOR_STYLE emacs. > > -Vance > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From jim@REDACTED Wed Sep 24 04:18:38 2008 From: jim@REDACTED (Jim Larson) Date: Tue, 23 Sep 2008 19:18:38 -0700 Subject: [erlang-questions] currying and lazy evaluation questions In-Reply-To: Your message of "Tue, 23 Sep 2008 07:14:14 +0200." <96D3B50792094B55A9AE7D2F65123797@JTablet2007> Message-ID: <200809240218.m8O2IcTF021636@krumkake.jetcafe.org> In message <96D3B50792094B55A9AE7D2F65123797@REDACTED> you write: John Hughes writes: >> I read a note on the Internet that said "You can do lazy evaluation in >> Erlang (observe Erlang QuickCheck), but you have to be explicit about it." >> ? >> Can some one explain to me how to "explicitly" use lazy evaluation in >> Erlang, in the general? >> ? > >I use macros > >-define(DELAY(E),fun()->E end). >-define(FORCE(F),F()). One aspect of many lazy functional implementations is that delayed computations are memoized when forced - the evaluated result is stored, so that in Promise = ?DELAY(expensive_computation(X, Y, Z)), Value1 = ?FORCE(Promise), Value2 = ?FORCE(Promise) the expensive computation is only evaluated once. This can have a dramatic effect on the efficiency of lazy functional data structures, as shown in Okasaki. Sadly, there's no trick for getting this behavior in purely functional code, since it involves a side effect. However, one can throw processes at the problem: delay(Thunk) -> spawn_link(fun() -> lazy_wait(Thunk) end). force(Lazy) -> Lazy ! {self(), force}, receive {Lazy, Result} -> Result end. lazy_wait(Thunk) -> receive {Proc, force} -> Result = Thunk(), Proc ! {self(), Result}, memo_loop(Result) end. memo_loop(Result) -> receive {Proc, force} -> Proc ! {self(), Result}, memo_loop(Result) end. I don't think that processes get garbage collected, so there's a nontrivial problem of reclaiming resources. This trick still might be useful in some limitied settings, through. Jim From john.hughes@REDACTED Wed Sep 24 07:05:09 2008 From: john.hughes@REDACTED (John Hughes) Date: Wed, 24 Sep 2008 07:05:09 +0200 Subject: [erlang-questions] currying and lazy evaluation questions References: <200809240218.m8O2IcTF021636@krumkake.jetcafe.org> Message-ID: <71A5086A466244DCAA1BED849FB51388@JTablet2007> There's another problem with this approach: it involves copying a function between processes (in the spawn_link in delay below). As has been pointed out several times recently, this copying losing all sharing in the representation. Function closures can contain a LOT of sharing in their representations, and this can really blow up memory use--you can send a function from a process with a heap of a few kilobytes, and find you're failing to allocate half a gigabyte or so in the receiver. If one tried to model lazy evaluation this way, and made much use of it, then I would expect this to happen quickly. (It certainly happened quickly to me!) John > > One aspect of many lazy functional implementations is that delayed > computations are memoized when forced - the evaluated result is stored, > so that in > > Promise = ?DELAY(expensive_computation(X, Y, Z)), > Value1 = ?FORCE(Promise), > Value2 = ?FORCE(Promise) > > the expensive computation is only evaluated once. This can have a > dramatic effect on the efficiency of lazy functional data structures, > as shown in Okasaki. > > Sadly, there's no trick for getting this behavior in purely functional > code, since it involves a side effect. However, one can throw processes > at the problem: > > delay(Thunk) -> > spawn_link(fun() -> lazy_wait(Thunk) end). > > force(Lazy) -> > Lazy ! {self(), force}, > receive > {Lazy, Result} -> Result > end. > > lazy_wait(Thunk) -> > receive > {Proc, force} -> > Result = Thunk(), > Proc ! {self(), Result}, > memo_loop(Result) > end. > > memo_loop(Result) -> > receive > {Proc, force} -> > Proc ! {self(), Result}, > memo_loop(Result) > end. > > I don't think that processes get garbage collected, so there's a > nontrivial problem of reclaiming resources. This trick still might > be useful in some limitied settings, through. > > Jim > > From attila.rajmund.nohl@REDACTED Wed Sep 24 09:36:07 2008 From: attila.rajmund.nohl@REDACTED (attila.rajmund.nohl@REDACTED) Date: Wed, 24 Sep 2008 09:36:07 +0200 (CEST) Subject: [erlang-questions] Millions of processes? In-Reply-To: <20080923222326.GT269@h216-235-12-173.host.egate.net> References: <6a36e7290809230831i738b27c6n5de4b16e9e8867c1@mail.gmail.com> <19631434.post@talk.nabble.com> <48D922CA.8030309@ericsson.com> <20080923222326.GT269@h216-235-12-173.host.egate.net> Message-ID: On Tue, 23 Sep 2008, Vance Shipley wrote: > On Tue, Sep 23, 2008 at 07:09:30PM +0200, Ulf Wiger (TN/EAB) wrote: > } In the Linux kernel FAQ, the philosophy on threads is > } explained thus: > } > } "Avoid the temptation to create large numbers of threads in your > } application. Threads should only be used to take advantage of multiple > } processors or for specialised applications (i.e. low-latency real-time), > } not as a way of avoiding programmer effort (writing a state machine or > } an event callback system is quite easy). > > Contrast that to the Erlang Programming Rules and Conventions: > > 5.4 Assign exactly one parallel process to each true concurrent > activity in the system Don't forget that in erlang's case the above mentioned "programmer effort" was already done by the developers of the erlang VM... Bye,NAR -- "Beware of bugs in the above code; I have only proved it correct, not tried it." From bgustavsson@REDACTED Wed Sep 24 10:07:10 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Wed, 24 Sep 2008 10:07:10 +0200 Subject: [erlang-questions] Some facts about Erlang and SMP In-Reply-To: <20080920180800.GB3504@wellquite.org> References: <20080920180800.GB3504@wellquite.org> Message-ID: <6672d0160809240107h60151c4t595ca2bba3b98a1@mail.gmail.com> On Sat, Sep 20, 2008 at 8:08 PM, Matthew Sackman wrote: > I'm having some difficulties with the "it's only when locks conflict > that locking time is significant" idea. My understanding with the > pthreads locks is that you start with a CAS, and if that fails then you > spin for a while (with CAS), and if you spin for too long then you go a > kernel lock. If that's wrong then I'm sorry, as most of the following > will also be wrong! > > Now assuming the above is correct (or at least close enough for jazz), > in the conflict case, sure, you're going to block, which is the point, > and then some time in the future either the kernel will wake you up > (pretty slow), or the spinning finally succeeds in which case the > wakeup should be really fast. > > If there's not a conflict then the first CAS will succeed. But a CAS is > many hundreds of cycles as you've got to do cache-coherency and then > really go all the way out to RAM and load the values in fresh, > especially in a multisocket box. So hundreds of cycles does not seem > like "not significant", at least to me. Or have I missed something > obvious here? > > It depends on the context. Compared to not having any locks at all (as in the non-SMP emulator), the cost for taking a lock without any conflict is significant. (That's why the non-SMP emulator is faster than SMP emulator running with only one scheduler.) Compared to a lock conflict when multiple scheduler threads cannot do any useful work while waiting for a lock, the cost for taking a lock directly without any conflict is not significant. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex.arnon@REDACTED Wed Sep 24 11:25:51 2008 From: alex.arnon@REDACTED (Alex Arnon) Date: Wed, 24 Sep 2008 12:25:51 +0300 Subject: [erlang-questions] Millions of processes? In-Reply-To: References: <6a36e7290809230831i738b27c6n5de4b16e9e8867c1@mail.gmail.com> <19631434.post@talk.nabble.com> <48D922CA.8030309@ericsson.com> <20080923222326.GT269@h216-235-12-173.host.egate.net> Message-ID: <944da41d0809240225g5b4d672cr73cf5637c7d1f832@mail.gmail.com> On Wed, Sep 24, 2008 at 10:36 AM, wrote: > On Tue, 23 Sep 2008, Vance Shipley wrote: > > > On Tue, Sep 23, 2008 at 07:09:30PM +0200, Ulf Wiger (TN/EAB) wrote: > > } In the Linux kernel FAQ, the philosophy on threads is > > } explained thus: > > } > > } "Avoid the temptation to create large numbers of threads in your > > } application. Threads should only be used to take advantage of multiple > > } processors or for specialised applications (i.e. low-latency > real-time), > > } not as a way of avoiding programmer effort (writing a state machine or > > } an event callback system is quite easy). > > > > Contrast that to the Erlang Programming Rules and Conventions: > > > > 5.4 Assign exactly one parallel process to each true concurrent > > activity in the system > > Don't forget that in erlang's case the above mentioned "programmer effort" > was already done by the developers of the erlang VM... > > Bye,NAR > -- > "Beware of bugs in the above code; I have only proved it correct, not > tried it." > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > Also: "... because it is, frankly, stupid to have large numbers of threads. " Dear oh dear. -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Wed Sep 24 11:33:09 2008 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 24 Sep 2008 11:33:09 +0200 Subject: [erlang-questions] [erlang-bugs] Very minor documentation bug in proplists module In-Reply-To: <1222246644.7604.48.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> References: <1222235518.7604.36.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> <48D9FEFD.8070207@it.uu.se> <1222246644.7604.48.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Message-ID: <48DA0955.6090307@it.uu.se> Bengt Kleberg wrote: > The proplists module is (IMHO) somewhat byzantine and I did not > understand that lookup/2 is the main primitive. Oh, it's not all that bad (now that I look at it again), but it could do with a lot more examples. In particular, it's not obvious what all the expansion/substitution stuff is good for. But it is; here is some example code from the hipe module (simplified a bit): ---- expand_options(Opts) -> proplists:normalize(Opts, [{negations, opt_negations()}, {aliases, opt_aliases()}, {expand, opt_basic_expansions()}, {expand, opt_expansions()}]). opt_negations() -> [{no_binary_opt, binary_opt}, {no_bitlevel_binaries, bitlevel_binaries}, {no_debug, debug}, ... {no_use_indexing, use_indexing}]. opt_aliases() -> [{'O0', o0}, {'O1', o1}, {'O2', o2}, {'O3', o3}]. opt_basic_expansions() -> [{pp_all, [pp_beam, pp_icode, pp_rtl, pp_native]}]. opt_expansions() -> [{o1, o1_opts()}, {o2, o2_opts()}, {o3, o3_opts()}, {x87, [x87, inline_fp]}]. ---- /Richard From ulf.wiger@REDACTED Wed Sep 24 11:38:36 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 24 Sep 2008 11:38:36 +0200 Subject: [erlang-questions] Millions of processes? In-Reply-To: <944da41d0809240225g5b4d672cr73cf5637c7d1f832@mail.gmail.com> References: <6a36e7290809230831i738b27c6n5de4b16e9e8867c1@mail.gmail.com> <19631434.post@talk.nabble.com> <48D922CA.8030309@ericsson.com> <20080923222326.GT269@h216-235-12-173.host.egate.net> <944da41d0809240225g5b4d672cr73cf5637c7d1f832@mail.gmail.com> Message-ID: <48DA0A9C.10707@ericsson.com> Alex Arnon skrev: > > Also: > > "... because it is, frankly, stupid to have large numbers of threads. " > > Dear oh dear. ...but let's all remember that there's a big difference between erlang processes and POSIX threads. Threads share memory, so there's no isolation at all. I'd hate to debug a misbehaving application where hundreds of thousand threads all have unconstrained access to all data. BR, Ulf W From bengt.kleberg@REDACTED Wed Sep 24 12:23:55 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 24 Sep 2008 12:23:55 +0200 Subject: [erlang-questions] Millions of processes? In-Reply-To: <48D922CA.8030309@ericsson.com> References: <6a36e7290809230831i738b27c6n5de4b16e9e8867c1@mail.gmail.com> <19631434.post@talk.nabble.com> <48D922CA.8030309@ericsson.com> Message-ID: <1222251835.7604.58.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Greetings, It is not only _ideas_ in computer science that are held in contempt (as quoted below). Ages ago (before 2000) I read an article about Linux in embedded environments. The article quoted Linus Torvalds on why not to use micro kernels. The reasons where that they are: 1 Experimental 2 Complex 3 Slow After looking around for a while I found plenty of articles about commercial micro kernels, and benchmarks showing micro kernels running workloads faster than monolithic kernels. So 1 and 3 seemed to be incorrect. I submitted these findings to the magazine, which prompted an answer from Mr Torvalds. He assert that all three where true, but did not discuss what I had found. So (IMHO) it is also facts that are not held in very high regard. bengt On Tue, 2008-09-23 at 19:09 +0200, Ulf Wiger (TN/EAB) wrote: > NPTL is fast, but AFAIK uses a minimum stack size of 8KB > per thread (the minimum heap size for erlang processes > seems to be 932 bytes on a 32-bit system). There also seem > to be other limits, making it very difficult in practice > to reach anywhere near 100,000 threads, and it's not > encouraged either. > > http://nptl.bullopensource.org/Tests/NPTL-limits.html > > In the Linux kernel FAQ, the philosophy on threads is > explained thus: > > "Avoid the temptation to create large numbers of threads in your > application. Threads should only be used to take advantage of multiple > processors or for specialised applications (i.e. low-latency real-time), > not as a way of avoiding programmer effort (writing a state machine or > an event callback system is quite easy). A good rule of thumb is to have > up to 1.5 threads per processor and/or one thread per RT input stream. > On a single processor system, a normal application would have at most > two threads, over 10 threads is seriously flawed and hundreds or > thousands of threads is progressively more insane. > A common request is to modify the Linux scheduler to better handle large > numbers of running processes/threads. This is always rejected by the > kernel developer community because it is, frankly, stupid to have large > numbers of threads. Many noted and respected people will extol the > virtues of large numbers of threads. They are wrong. Some languages and > toolkits create a thread for each object, because it fits into a > particular ideology. A thread per object may be appealing in the > abstract, but is in fact inefficient in the real world. Linux is not a > good computer science project. It is, however, good engineering. > Understand the distinction, and you will understand why many widely > acclaimed ideas in computer science are held with contempt in the Linux > kernel developer community. " > > http://www.kernel.org/pub/linux/docs/lkml/#s7-21 > > BR, > Ulf W > > > Zvi skrev: > > I'm no Linux expert, but > > > > http://en.wikipedia.org/wiki/Native_POSIX_Thread_Library > > > > "The Native POSIX Thread Library (NPTL) is a software feature that > > enables the Linux kernel to run programs written to use POSIX Threads > > fairly efficiently. In tests, NPTL succeeded in starting 100,000 > > threads on a IA-32 in two seconds. In comparison, this test under a > > kernel without NPTL would have taken around 15 minutes." > > > > I guess future Erlang VM will offer some more generic MxN threading > > model, i.e. M Erlang user-level processes implemented on N > > "schedulers" - native threads. Today in SMP Erlang is only limited > > support (i.e. command line options) to specify number o scheduler and > > no programmatic support for affinity of schedulers per core and > > Erlang processes per schedulers. > > > > Zvi > > > > > > Bob Ippolito wrote: > >> We've got a couple applications that use thousands of processes per > >> node. If those were pthreads, we'd be out of RAM before actually > >> doing anything. > >> > >> 2008/9/23 Bard Bloom : > >>> I've seen in Erlang promotional materials some rather impressive > >>> claims about how cheap Erlang processes are, and how many of them > >>> one can spawn. Which is pretty cool. But, what Erlang programs > >>> take advantage of that kind of power? Are there any examples of > >>> programs which use huge numbers of processes in interesting ways? > >>> (I am the local Erlang fancier. I got challenged on that point, > >>> and didn't have a very good answer.) > >>> > >>> Thanks very much, Bard Bloom > >>> > >>> _______________________________________________ erlang-questions > >>> mailing list erlang-questions@REDACTED > >>> http://www.erlang.org/mailman/listinfo/erlang-questions > >>> > >> _______________________________________________ erlang-questions > >> mailing list erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From thompsonsimonuk@REDACTED Wed Sep 24 12:36:19 2008 From: thompsonsimonuk@REDACTED (Simon Thompson) Date: Wed, 24 Sep 2008 11:36:19 +0100 Subject: [erlang-questions] New release of Wrangler, the Erlang refactorer Message-ID: We are pleased to let you know that we have just announced a new release of Wrangler (the Erlang refactorer). The current snapshot supports a number of basic structural refactorings, data-related refactorings, process-related refactorings, as well as duplicated code detection. You can get Wrangler 0.5 (bundled with Distel) via http://www.cs.kent.ac.uk/projects/forse/ The current snapshot is embedded in Emacs, but we are now in the process of integrating Wrangler with Erlide, the Erlang IDE powered by Eclipse. You are very welcome to try it out, and send us your comments, suggestions, or refactoring ideas. Our project email address is: erlang-refactor@REDACTED Best Regards, Simon Thompson and Huiqing Li -------------- next part -------------- An HTML attachment was scrubbed... URL: From Dana.RUBINO@REDACTED Wed Sep 24 11:48:41 2008 From: Dana.RUBINO@REDACTED (Dana.RUBINO@REDACTED) Date: Wed, 24 Sep 2008 10:48:41 +0100 Subject: [erlang-questions] Mnesia best practices Message-ID: Hi all, Anyone know the prescribed way for ensuring an Mnesia DB is up and running (if not then start it) when starting up an erlang application? I would ideally like a process which is in charge of starting Mnesia and monitoring it to ensure it has not gone down? Should I just use a supervisor for this? Thanks, Dan *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbs.com/gbm www.rbsgc.com *********************************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From vinoski@REDACTED Wed Sep 24 13:57:11 2008 From: vinoski@REDACTED (Steve Vinoski) Date: Wed, 24 Sep 2008 07:57:11 -0400 Subject: [erlang-questions] Erlang mimeparse Message-ID: <65b2728e0809240457j69c26f8cw935780c0eeb5c020@mail.gmail.com> Hi, if your code has to deal with HTTP Accept and Content-type headers and the MIME types and media ranges they specify, you might find the mimeparse module helpful: It's a port to Erlang of Joe Gregorio's original mimeparse.py Python module, described here: Also available in Ruby and PHP, and all available from the first link above. --steve From zerthurd@REDACTED Wed Sep 24 15:14:01 2008 From: zerthurd@REDACTED (Maxim Treskin) Date: Wed, 24 Sep 2008 20:14:01 +0700 Subject: [erlang-questions] Stringification in erlang macros Message-ID: Hello Is it possible to stringify macros argument in erlang? In cpp we have #EXPR which replaces with string value of EXPR. I wrote something like this using parse_transform, but it is ugly, requires too much workarounds for works in every place in code and almost not works :) For example I want: -define(ASSERT(Cond), if '$@'(Cond) -> ok; true -> io:format("[~w:~b]: Assertion: ~p~n", [?MODULE, ?LINE, '$#'(Cond)]) end). and code like: ?ASSERT(asd =:= 123) will prints: [mod:432]: Assertion: "asd =:= 123" Also, is there any right method to put asserts or my idea is wrong in base? Thank you. -- Maxim Treskin From v@REDACTED Wed Sep 24 15:32:31 2008 From: v@REDACTED (Valentin Micic) Date: Wed, 24 Sep 2008 15:32:31 +0200 Subject: [erlang-questions] Millions of processes? In-Reply-To: <48DA0A9C.10707@ericsson.com> Message-ID: <200809241331.m8ODVeKn001780@mail.pharos-avantgard.com> I do not understand *why* do we even compare ERLANG processes with POSIX threads? What is the connection?? V. -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Ulf Wiger (TN/EAB) Sent: 24 September 2008 11:39 AM To: Alex Arnon Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Millions of processes? Alex Arnon skrev: > > Also: > > "... because it is, frankly, stupid to have large numbers of threads. " > > Dear oh dear. ...but let's all remember that there's a big difference between erlang processes and POSIX threads. Threads share memory, so there's no isolation at all. I'd hate to debug a misbehaving application where hundreds of thousand threads all have unconstrained access to all data. BR, Ulf W _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From bgustavsson@REDACTED Wed Sep 24 15:33:09 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Wed, 24 Sep 2008 15:33:09 +0200 Subject: [erlang-questions] Stringification in erlang macros In-Reply-To: References: Message-ID: <6672d0160809240633s505ae68fn708a84b573224bb0@mail.gmail.com> On Wed, Sep 24, 2008 at 3:14 PM, Maxim Treskin wrote: > Hello > > Is it possible to stringify macros argument in erlang? In cpp we have > #EXPR which replaces with string value of EXPR. I wrote something like > this using parse_transform, but it is ugly, requires too much > workarounds for works in every place in code and almost not works :) > Yes, see: http://www.erlang.org/doc/reference_manual/macros.html#7.5 /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Wed Sep 24 15:39:08 2008 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 24 Sep 2008 15:39:08 +0200 Subject: [erlang-questions] Stringification in erlang macros In-Reply-To: References: Message-ID: <48DA42FC.2080601@it.uu.se> Maxim Treskin wrote: > Is it possible to stringify macros argument in erlang? ??Foo stringifies the macro argument Foo. See the eunit.hrl file for examples of writing assertion macros: http://svn.process-one.net/contribs/trunk/eunit/include/eunit.hrl (or simply use eunit, even if it is just for the macros). /Richard From erlang-questions_efine@REDACTED Wed Sep 24 16:03:03 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Wed, 24 Sep 2008 10:03:03 -0400 Subject: [erlang-questions] edoc hack to cross-reference standard Erlang OTP docs In-Reply-To: <48821440.6040506@it.uu.se> References: <6c2563b20807182210s560b1f84qe3170de51fdc42f8@mail.gmail.com> <48821440.6040506@it.uu.se> Message-ID: <6c2563b20809240703g11edff7ata9547dfba7317603@mail.gmail.com> Hi Richard, Did you ever find the time to look at my hacks? Edwin On Sat, Jul 19, 2008 at 12:20 PM, Richard Carlsson wrote: > Edwin Fine wrote: > >> I have hacked together a modification to edoc_lib.erl that takes the list >> of directories returned by code:get_path() and adds the corresponding HTML >> directories to the list of apps that edoc will create cross-reference links >> for. This seems to work well for my needs, which are explained in the >> earlier posts I made. I don't claim that my hack is production ready or >> works in all situations, but it could be a basis to modify edoc if someone, >> who may or may not be named Richard, likes the approach. I've attached the >> edoc_lib.erl source code, which is from R12B-3, in case anyone who builds >> Erlang from source wants to try it out. >> > > Hi! Just wanted to let you know that I've seen your mails and will take > a look at it when I can find the time. I know that the inter-application > linkage stuff is a bit unfinished, and I wasn't even aware about the .js > hack used in the OTP documentation. Thanks, > > /Richard > > -- > "Having users is like optimization: the wise course is to delay it." > -- Paul Graham > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsu79@REDACTED Wed Sep 24 16:28:48 2008 From: chsu79@REDACTED (Christian) Date: Wed, 24 Sep 2008 16:28:48 +0200 Subject: [erlang-questions] Millions of processes? In-Reply-To: <200809241331.m8ODVeKn001780@mail.pharos-avantgard.com> References: <48DA0A9C.10707@ericsson.com> <200809241331.m8ODVeKn001780@mail.pharos-avantgard.com> Message-ID: On Wed, Sep 24, 2008 at 3:32 PM, Valentin Micic wrote: > I do not understand *why* do we even compare ERLANG processes with POSIX > threads? What is the connection?? It's valuable to spread Erlang mindshare. What leaks out about Erlang to the outsiders is how Erlang is good for making use of multi-core computers and distributing computations. And while Erlang has some great examples of applications that scale very well with the numbers of cores available, its not really a representative picture that you go to Erlang to write your ray-tracer if you want it to run 16 times faster on a 16-core machine than a 1-core machine. The advice represented in the Linux FAQ mentioned above probably comes from people that are worried about using the optimal number of threads for their computations on a specific hardware platform to get the most out of it. I'd like to call the distinction: using threads for "modeling" reasons, and using it for "technical" reasons. In Erlang we use Erlang processes for modeling reasons, it is simpler to program if you map each concurrent activity in a system to a process, so code for each process only have a single sequential job to focus on (and to get right). Technical reasons to use threads or processes are those that are unrelated to making the modeling simpler, often they make the model more complex. Performing kernel convolutions on large images are typical of something that is very simple to express as a single sequential job, its basically four nested loops, for each pixel in the image, you sum the products of the kernel coefficients with a pixels in a region around the current pixel. This means each pixel in the result image only depends on the kernel and a NxN region around that pixel in the input image. There is potential for huge gains in speed in having 8 cores performing the convolution concurrently for 1/8th of pixels in the image each. But you need to do it right, you must make sure each core make the most of the data it gets into its cache-lines, otherwise you risk having your data bus being the bottleneck and you wont get a 8 time speedup. A lot of people coming to Erlang wonder where the libraries are for splitting up a job into parts executed in multiple processes so they can make this "technical" use of having multi-core computers. However, most use of Erlang is in domains where you have embarasingly simple parallelism. A web application can easily have 100 concurrent requests to process, and when modelled as an isolated process each, you can already potentially make use of a 96 core machine, which most of us can only wish for in a year or two right now. From mazen@REDACTED Wed Sep 24 16:29:53 2008 From: mazen@REDACTED (Mazen Harake) Date: Wed, 24 Sep 2008 16:29:53 +0200 Subject: [erlang-questions] Mnesia best practices In-Reply-To: References: Message-ID: <48DA4EE1.6030400@erlang-consulting.com> Use targets systems that conform to OTP release handling and and this sort of things come to you for free... you don't need to start Mnesia from your application. /Mazen Dana.RUBINO@REDACTED wrote: > Hi all, > > Anyone know the prescribed way for ensuring an Mnesia DB is up and > running (if not then start it) when starting up an erlang application? > > I would ideally like a process which is in charge of starting Mnesia > and monitoring it to ensure it has not gone down? > > Should I just use a supervisor for this? > > Thanks, > Dan > > *********************************************************************************** > The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority > > This e-mail message is confidential and for use by the > addressee only. If the message is received by anyone other > than the addressee, please return the message to the sender > by replying to it and then delete the message from your > computer. Internet e-mails are not necessarily secure. The > Royal Bank of Scotland plc does not accept responsibility for > changes made to this message after it was sent. > > Whilst all reasonable care has been taken to avoid the > transmission of viruses, it is the responsibility of the recipient to > ensure that the onward transmission, opening or use of this > message and any attachments will not adversely affect its > systems or data. No responsibility is accepted by The > Royal Bank of Scotland plc in this regard and the recipient should carry > out such virus and other checks as it considers appropriate. > Visit our websites at: > www.rbs.com > www.rbs.com/gbm > www.rbsgc.com > *********************************************************************************** > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From rvirding@REDACTED Wed Sep 24 16:43:42 2008 From: rvirding@REDACTED (Robert Virding) Date: Wed, 24 Sep 2008 16:43:42 +0200 Subject: [erlang-questions] Stringification in erlang macros In-Reply-To: References: Message-ID: <3dbc6d1c0809240743u5ead6333h58fb4ce1bc9613de@mail.gmail.com> 2008/9/24 Maxim Treskin > Hello > > Is it possible to stringify macros argument in erlang? Sorry, I can't help myself here. :-) In LFE this is no problem, quite trivial in fact, as you have the full power of lisp in your macros. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From Dana.RUBINO@REDACTED Wed Sep 24 16:56:03 2008 From: Dana.RUBINO@REDACTED (Dana.RUBINO@REDACTED) Date: Wed, 24 Sep 2008 15:56:03 +0100 Subject: [erlang-questions] Mnesia best practices In-Reply-To: <48DA4EE1.6030400@erlang-consulting.com> References: <48DA4EE1.6030400@erlang-consulting.com> Message-ID: Hi Mazen, Can you be more specific please? I have had a look at the OTP Design principles i.e. release handling as suggested. Although it mentions target systems and building a release (.rel which looks good) it doesn't specify how I might specify the working Mnesia instance which I also want starting? Any ideas? Thanks, Dan -----Original Message----- From: Mazen Harake [mailto:mazen@REDACTED] Sent: 24 September 2008 15:30 To: RUBINO, Dana, GBM Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Mnesia best practices Use targets systems that conform to OTP release handling and and this sort of things come to you for free... you don't need to start Mnesia from your application. /Mazen Dana.RUBINO@REDACTED wrote: > Hi all, > > Anyone know the prescribed way for ensuring an Mnesia DB is up and > running (if not then start it) when starting up an erlang application? > > I would ideally like a process which is in charge of starting Mnesia > and monitoring it to ensure it has not gone down? > > Should I just use a supervisor for this? > > Thanks, > Dan > > ********************************************************************** > ************* The Royal Bank of Scotland plc. Registered in Scotland > No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority > > This e-mail message is confidential and for use by the addressee only. > If the message is received by anyone other than the addressee, please > return the message to the sender by replying to it and then delete the > message from your computer. Internet e-mails are not necessarily > secure. The Royal Bank of Scotland plc does not accept responsibility > for changes made to this message after it was sent. > > Whilst all reasonable care has been taken to avoid the transmission of > viruses, it is the responsibility of the recipient to ensure that the > onward transmission, opening or use of this message and any > attachments will not adversely affect its systems or data. No > responsibility is accepted by The Royal Bank of Scotland plc in this > regard and the recipient should carry out such virus and other checks > as it considers appropriate. > Visit our websites at: > www.rbs.com > www.rbs.com/gbm > www.rbsgc.com > ********************************************************************** > ************* > > ---------------------------------------------------------------------- > -- > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From gam3-erlang@REDACTED Wed Sep 24 15:39:26 2008 From: gam3-erlang@REDACTED (G. Allen Morris III) Date: Wed, 24 Sep 2008 09:39:26 -0400 Subject: [erlang-questions] Bug in amd64 escript Message-ID: <20080924133926.GA30556@gam3.net> I was writing a simple little script in erlang that outputs lots of text to standard out. The problem is that the output is cut off. If I pipe the output through 'more' then all the output is seen. I get simular output if I run the program with erl -noshell -pa `pwd` \ -s bobeer bobeer -s erlang halt If I use erl -noshell -pa `pwd` \ -s bobeer bobeer -s init stop then it works. Having init:stop() at the end of the script does not help. This is on debian with this version Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:3] [async-threads:0] [kernel-poll:false] This problem does not seem to be on my 32 bit computer Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads:0] [kernel-poll:false] -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 242 bytes Desc: Digital signature URL: From bgustavsson@REDACTED Wed Sep 24 17:09:47 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Wed, 24 Sep 2008 17:09:47 +0200 Subject: [erlang-questions] SSL_CTX_set_info_callback In-Reply-To: References: Message-ID: <6672d0160809240809i6e39155bi7b95ab4a495ccd84@mail.gmail.com> On Mon, Sep 15, 2008 at 9:22 PM, Tony Rogvall wrote: > Hi! > > I have a slight build problem with R12B-4 on Mac OS X (10.5.4) > > For some reason it fails to link esock_ssl with the reason: > > Undefined symbols: > "_SSL_CTX_set_info_callback", referenced from: > _set_ssl_parameters in esock_openssl.o > ld: symbol(s) not found > > > If I comment away that call (it's just debugging anyway) everything > works fine. > I have checked what ever can be checked (include paths etc) everything > looks fine. > > Any one else seen this? > We have not seen this problem in our daily builds, but we have only run our test on Mac OS 10.5.3 and 10.5.5, never on 10.5.4. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From raould@REDACTED Wed Sep 24 18:21:08 2008 From: raould@REDACTED (Raoul Duke) Date: Wed, 24 Sep 2008 09:21:08 -0700 Subject: [erlang-questions] Millions of processes? In-Reply-To: References: <48DA0A9C.10707@ericsson.com> <200809241331.m8ODVeKn001780@mail.pharos-avantgard.com> Message-ID: <91a2ba3e0809240921y190a314fyc87c3348c9647224@mail.gmail.com> > I'd like to call the distinction: using threads for "modeling" > reasons, and using it for "technical" reasons. great point! because all too often i see code with lots of "stuff" going on that is in my mind absolutely *not* essential complexity. and it makes me mad/sad. sincerely. From erlang-questions_efine@REDACTED Wed Sep 24 19:13:40 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Wed, 24 Sep 2008 13:13:40 -0400 Subject: [erlang-questions] Mnesia best practices In-Reply-To: References: <48DA4EE1.6030400@erlang-consulting.com> Message-ID: <6c2563b20809241013v4c2a5a88l757b9c45948760c5@mail.gmail.com> Dan, I shamelessly use techniques that I learn from reading the code for ejabberd. Even if to some learned Erlangistas it may not be the *ne plus ultra* of Erlang code, to me it's got a lot of things in it to which I say, "I didn't know you could do *that*!". Sometimes I struggle to figure out how to do something, being fairly new to Erlang/OTP myself, and I ask, WWJD (What Would Jabber Do?) and more often than not, there is an answer. You could do a lot worse than taking a look at its organization and techniques. It helps that it's a stable, real-world application that's in widespread production. http://www.ejabberd.im/ Of course, ejabberd is not the only interesting Erlang application out there from which to cherry-pick idioms and techniques, it's just the first one I really looked into deeply. There are many others that are well done or cleverly done (and sometimes both), like RabbitMQ. Hope this helps. Regards, Edwin Fine On Wed, Sep 24, 2008 at 10:56 AM, wrote: > Hi Mazen, > > Can you be more specific please? I have had a look at the OTP Design > principles i.e. release handling as suggested. > > Although it mentions target systems and building a release (.rel which > looks good) it doesn't specify how I might specify the working Mnesia > instance which I also want starting? > > Any ideas? > > Thanks, > Dan > > -----Original Message----- > From: Mazen Harake [mailto:mazen@REDACTED] > Sent: 24 September 2008 15:30 > To: RUBINO, Dana, GBM > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Mnesia best practices > > Use targets systems that conform to OTP release handling and and this sort > of things come to you for free... you don't need to start Mnesia from your > application. > > /Mazen > > Dana.RUBINO@REDACTED wrote: > > Hi all, > > > > Anyone know the prescribed way for ensuring an Mnesia DB is up and > > running (if not then start it) when starting up an erlang application? > > > > I would ideally like a process which is in charge of starting Mnesia > > and monitoring it to ensure it has not gone down? > > > > Should I just use a supervisor for this? > > > > Thanks, > > Dan > > > > ********************************************************************** > > ************* The Royal Bank of Scotland plc. Registered in Scotland > > No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. > > Authorised and regulated by the Financial Services Authority > > > > This e-mail message is confidential and for use by the addressee only. > > If the message is received by anyone other than the addressee, please > > return the message to the sender by replying to it and then delete the > > message from your computer. Internet e-mails are not necessarily > > secure. The Royal Bank of Scotland plc does not accept responsibility > > for changes made to this message after it was sent. > > > > Whilst all reasonable care has been taken to avoid the transmission of > > viruses, it is the responsibility of the recipient to ensure that the > > onward transmission, opening or use of this message and any > > attachments will not adversely affect its systems or data. No > > responsibility is accepted by The Royal Bank of Scotland plc in this > > regard and the recipient should carry out such virus and other checks > > as it considers appropriate. > > Visit our websites at: > > www.rbs.com > > www.rbs.com/gbm > > www.rbsgc.com > > ********************************************************************** > > ************* > > > > ---------------------------------------------------------------------- > > -- > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Wed Sep 24 19:42:03 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Wed, 24 Sep 2008 13:42:03 -0400 Subject: [erlang-questions] Bug in amd64 escript In-Reply-To: <20080924133926.GA30556@gam3.net> References: <20080924133926.GA30556@gam3.net> Message-ID: <6c2563b20809241042k7dc1af96je72737c561121606@mail.gmail.com> My guess is that the Erlang VM is exiting before the text you have written to standard output has been flushed to the operating system, which will cause the unflushed text to disappear. What you have to do is ensure that the 'bobeer' process completes its output operations before Erlang exits. If you look in the documentation about the -s flag to erl (in the init module of the kernel application), you will see that it says that each process called via -s completes before the next one is started: The functions are executed sequentially in an initialization process, which > then terminates normally and passes control to the user. This means that a > -s call which does not return will block further processing; to avoid > this, use some variant of spawn in such cases. > It also says that init:stop() smoothly takes down the processes, which possibly includes flushing any unwritten buffers to the O/S (not sure of this). erlang:halt() I think is much more brutal, but I stand to be corrected. This is probably why calling -s init stop after -s bobeer bobeer has the effect it has. 2008/9/24 G. Allen Morris III > I was writing a simple little script in erlang that outputs lots of > text to standard out. The problem is that the output is cut off. > > If I pipe the output through 'more' then all the output is seen. > > I get simular output if I run the program with > > erl -noshell -pa `pwd` \ > -s bobeer bobeer -s erlang halt > > If I use > > erl -noshell -pa `pwd` \ > -s bobeer bobeer -s init stop > > then it works. > > Having init:stop() at the end of the script does not help. > > This is on debian with this version > > Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:3] > [async-threads:0] [kernel-poll:false] > > This problem does not seem to be on my 32 bit computer > > Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads:0] > [kernel-poll:false] > > > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > > iGcEARECACcFAkjaQw4gGmh0dHA6Ly93d3cuZ2FtMy5uZXQvcG9saWN5Lmh0bWwA > CgkQVVDRYykdW3ziZACePxtJ4odALLQhe9cnf56Jdga6AGIAn3TLJhxBcZhPAsQi > TOrHX1gUOlOY > =vfB+ > -----END PGP SIGNATURE----- > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Wed Sep 24 21:22:40 2008 From: vances@REDACTED (Vance Shipley) Date: Wed, 24 Sep 2008 15:22:40 -0400 Subject: [erlang-questions] Mnesia best practices In-Reply-To: References: <48DA4EE1.6030400@erlang-consulting.com> Message-ID: <20080924192239.GA269@h216-235-12-173.host.egate.net> Dana, The release resource file (.rel) defines the what applications are included in a release package (.tar.gz). When a release package is created a .boot file is generated. When the run time system is started with 'erl -boot foo.boot' all the applications required by the foo release will be started. This is best handled by following the Embedded Systems User's Guide(*) so that your application(s) can be run out of the operating system's initializatiuon at boot time, or with start(+). You write an application resource file (.app)(~) to specify the resources needed by your application. This includes the applications which must be started ({applications, Apps}) or loaded ({included_applications}) beforehand. You also specify how your application will be started ({mod, Start}). You may define application environment variables here as well. For example you may define the default locations of some resources here with {env, Env}. For example: {env, [{foo_data, "data/foo"}]}. In your application you access the environment variable using application:get_env(foo_data). When the run time system is started with `erl -config sys` it will read a configuration file named sys.config(^) (this is done as part of starting an embedded system). In your configuration file you may overide, or just create, environment variables for any of the applications. The sys.config file is where you want to do local configuration. You would overide your default foo_file value with the locally defined location of that resource. Now here's the answer to your question; you overide mnesia's application environment variables in your configuration file. The mnesia environment variables, or configuration parameters, are documented at the bottom of the mnesia page: http://erlang.org/doc/apps/mnesia/index.html. An example sys.config file: [{mnesia, [{dir, "db"}]}, {foo, [{foo_file, "/tmp/foo"}]}]. -Vance (*) http://erlang.org/doc/embedded/part_frame.html (+) http://erlang.org/doc/apps/erts/index.html (~) http://erlang.org/doc/apps/kernel/index.html (^) http://erlang.org/doc/apps/kernel/index.html On Wed, Sep 24, 2008 at 03:56:03PM +0100, Dana.RUBINO@REDACTED wrote: } Can you be more specific please? I have had a look at the OTP Design } principles i.e. release handling as suggested. } } Although it mentions target systems and building a release (.rel which } looks good) it doesn't specify how I might specify the working Mnesia } instance which I also want starting? From vmitsner@REDACTED Thu Sep 25 01:02:15 2008 From: vmitsner@REDACTED (Vladimir Mitsner) Date: Wed, 24 Sep 2008 18:02:15 -0500 Subject: [erlang-questions] backup applications Message-ID: <32e4cadb0809241602y6771e28apc811abc55c72aec6@mail.gmail.com> I heard that there is a way to set up an erlang application such that it runs in parallel with a backup "shadow" application which can take over if the primary crashes. Is that the case? And where would I find documentation about setting up applications to run with such backups? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Thu Sep 25 02:24:52 2008 From: rvirding@REDACTED (Robert Virding) Date: Thu, 25 Sep 2008 02:24:52 +0200 Subject: [erlang-questions] Edoc question In-Reply-To: <48D7E782.1070700@it.uu.se> References: <3dbc6d1c0809220953l47f6125aj164733f7796ee3bf@mail.gmail.com> <48D7E782.1070700@it.uu.se> Message-ID: <3dbc6d1c0809241724t5f5acba9p1ff5fbde22784d20@mail.gmail.com> 2008/9/22 Richard Carlsson > Robert Virding wrote: > > - For my applications I would like to write an extended description of > > the system in the overview and need the full formatting in the overview. > > Edoc itself does this by having a user's guide, this would be > > acceptable, while yecc puts everything into description of the yecc > > module, which I think is the wrong place for it. > > I also think that the high-level description should go in the overview, > and that is how I write my docs. I just wonder what you mean by "the > full formatting"? The contents of the overview file are parsed just like > a source code comment (without the leading % characters), and there is > not much difference between what you can do in a module @doc and an > overview @doc. You have the same wiki expansion, macros, and of course > full xhtml for anything else you might need, such as tables. The > overview.edoc file for edoc itself should be a decent reference. I will try it some more and see if I can get it to work. There is no overview.edoc file for edoc in the distribution, from where can I get it? How do I setup edoc so it will not look in my src directory but use the .edoc files in my doc directory instead? Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Thu Sep 25 03:32:58 2008 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 25 Sep 2008 13:32:58 +1200 Subject: [erlang-questions] Stringification in erlang macros In-Reply-To: <1619_1222262575_m8ODMq9o006317_be8f531d0809240614mbfac039m18d0dc81ebb45406@mail.gmail.com> References: <1619_1222262575_m8ODMq9o006317_be8f531d0809240614mbfac039m18d0dc81ebb45406@mail.gmail.com> Message-ID: <7B3D620A-229C-4C88-9053-EDCE8DBDCCD6@cs.otago.ac.nz> You could define assert using a parse transform and get a parse tree, which you could then treat in various ways. Stringising is so limiting because you do not get to see what you most need to see, which is the values of the variables. Given the file and line number, you could discover the string, but not the variables. With a parse transform, you could turn assert Guard end into if Guard -> ok ; true -> ... file:line: V1=, ..., Vn= ... end From saleyn@REDACTED Thu Sep 25 04:10:40 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Wed, 24 Sep 2008 22:10:40 -0400 Subject: [erlang-questions] Edoc question In-Reply-To: <3dbc6d1c0809241724t5f5acba9p1ff5fbde22784d20@mail.gmail.com> References: <3dbc6d1c0809220953l47f6125aj164733f7796ee3bf@mail.gmail.com> <48D7E782.1070700@it.uu.se> <3dbc6d1c0809241724t5f5acba9p1ff5fbde22784d20@mail.gmail.com> Message-ID: <48DAF320.10603@gmail.com> Robert, Attached is a sample overview from the jungerl/LAMA project, and here's how you can customize location of the overview file (see the 'overview' option): $ cd your_app/src $ erl -pa ../bin -run edoc_run files '["your_file1.erl", "your_file2.erl"]' '[{overview,"../doc/overview.edoc"}, {dev,{vsn,"$VSN"}}, {dir, "../doc"}, {application, "your_app_name"}]' Serge Robert Virding wrote: > 2008/9/22 Richard Carlsson > >> Robert Virding wrote: >>> - For my applications I would like to write an extended description of >>> the system in the overview and need the full formatting in the overview. >>> Edoc itself does this by having a user's guide, this would be >>> acceptable, while yecc puts everything into description of the yecc >>> module, which I think is the wrong place for it. >> I also think that the high-level description should go in the overview, >> and that is how I write my docs. I just wonder what you mean by "the >> full formatting"? The contents of the overview file are parsed just like >> a source code comment (without the leading % characters), and there is >> not much difference between what you can do in a module @doc and an >> overview @doc. You have the same wiki expansion, macros, and of course >> full xhtml for anything else you might need, such as tables. The >> overview.edoc file for edoc itself should be a decent reference. > > > I will try it some more and see if I can get it to work. There is no > overview.edoc file for edoc in the distribution, from where can I get it? > > How do I setup edoc so it will not look in my src directory but use the > .edoc files in my doc directory instead? > > Robert > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: overview.edoc URL: From rklophaus@REDACTED Thu Sep 25 05:06:39 2008 From: rklophaus@REDACTED (Rusty Klophaus) Date: Wed, 24 Sep 2008 23:06:39 -0400 Subject: [erlang-questions] Erlang Users of Arlington, VA and Washington, DC In-Reply-To: <2d435ba4-dad0-42e1-8029-985ac29c1c51@p25g2000hsf.googlegroups.com> References: <2d435ba4-dad0-42e1-8029-985ac29c1c51@p25g2000hsf.googlegroups.com> Message-ID: Hello all, I am trying to pull together an Erlang Users Group in the Arlington, VA and Washington, DC area. We're already off to a great start with 5 people registered. The first meeting is Wednesday, Oct 1, 2008 - 6pm at Greenberry's Coffee in Arlington. (One week from today.) If you are interested, please join the group on Meetup.com. (Just go to http://www.meetup.com and search for 'Erlang'). Thanks, Rusty p.s. - Apologies to those who have already seen this message twice before. Just trying to get the word out. From cappy2112@REDACTED Thu Sep 25 06:34:45 2008 From: cappy2112@REDACTED (Tony Cappellini) Date: Wed, 24 Sep 2008 21:34:45 -0700 Subject: [erlang-questions] First Erlang experiences- not so good Message-ID: <8249c4ac0809242134g54f14753u9c8e1b4cdc2abfa6@mail.gmail.com> I've been going through this intro to Erlang http://www.onlamp.com/pub/a/onlamp/2007/09/13/introduction-to-erlang.html?page=last#thread using the Windows version of the Erlang (BEAM) emulator version 5.6.4 [smp:2] [async-threads:0] shell. For some reason, the example.erl file on the above site, will not compile. I've contacted the autor and he verified the sources that can be downloaded from the site still compile on his system, which is Linux. I've even tried typing the few lines in example.erl into a new file and compiling it, but still have the same problem- below Eshell V5.6.4 (abort with ^G) 1> c(example). ./example.erl:1: syntax error before: '-' ./example.erl:2: syntax error before: p ./example.erl:4: syntax error before: a ./example.erl:7: syntax error before: a ./example.erl:9: syntax error before: a ./example.erl:10: no module definition error 2> Would someone shed some light on what a newbie is doing wrong? Attached is the example.erl file I tried compiling. Below are the lines from example.erl as well. -module(example). -export([fact/1, fact/2, call_with_five/1]). fact(0) -> 1; fact(N) -> N * fact(N-1). fact(A,B) -> io:format("Chuck Norris kicks ~p people in ~p places ~n", [A,B]). call_with_five(Func) -> Func(5). Thanks -------------- next part -------------- A non-text attachment was scrubbed... Name: example.erl Type: application/octet-stream Size: 456 bytes Desc: not available URL: From zerthurd@REDACTED Thu Sep 25 06:43:56 2008 From: zerthurd@REDACTED (Maxim Treskin) Date: Thu, 25 Sep 2008 11:43:56 +0700 Subject: [erlang-questions] Stringification in erlang macros In-Reply-To: <48DA42FC.2080601@it.uu.se> References: <48DA42FC.2080601@it.uu.se> Message-ID: > ??Foo stringifies the macro argument Foo. See the eunit.hrl > file for examples of writing assertion macros: I have some strange behaviour with this. When I wrote macros like: -define(A(Cond), io:format("[~w:~b]: " ++ ??Cond ++ "~n", [?MODULE, ?LINE])). it writes me line with number 1, not with current line number, i.e.: [t:1]: V1 =/= V2 If I remove ??Cond and macros will be: -define(A(Cond), io:format("[~w:~b]: " ++ "~n", [?MODULE, ?LINE])). it shows current line number, i.e.: [t:26]: It seems some bug here... -- Maxim Treskin From rklophaus@REDACTED Thu Sep 25 06:47:46 2008 From: rklophaus@REDACTED (Rusty Klophaus) Date: Thu, 25 Sep 2008 00:47:46 -0400 Subject: [erlang-questions] Suggestions for Erlang BarCamp Presentation? In-Reply-To: References: <2d435ba4-dad0-42e1-8029-985ac29c1c51@p25g2000hsf.googlegroups.com> Message-ID: Hello all, I will be attending BarCamp in Washington, DC on October 18th, and I'd like to use it as an opportunity to spread the word about Erlang. BarCamp, from what I understand, is a grassroots tech-focused conference that's held in a number of different cities. There are slots during the day where attendees can sign up to give a 30 minute presentation on interesting technology. (http://barcampdc.org) So my questions are: 1. Have you given or attended a good Erlang presentation at BarCamp or elsewhere, and what was the focus? 2. If you were going to give a talk to get people excited about Erlang, what would you say? 3. I've never been to BarCamp before. Any overall suggestions on how to make the most of it? Any help is greatly appreciated. Thanks, Rusty Klophaus From zerthurd@REDACTED Thu Sep 25 07:08:15 2008 From: zerthurd@REDACTED (Maxim Treskin) Date: Thu, 25 Sep 2008 12:08:15 +0700 Subject: [erlang-questions] Stringification in erlang macros In-Reply-To: References: <48DA42FC.2080601@it.uu.se> Message-ID: Patch which fix this problem attached On 25/09/2008, Maxim Treskin wrote: >> ??Foo stringifies the macro argument Foo. See the eunit.hrl >> file for examples of writing assertion macros: > > I have some strange behaviour with this. When I wrote macros like: > -define(A(Cond), io:format("[~w:~b]: " ++ ??Cond ++ "~n", [?MODULE, > ?LINE])). > > it writes me line with number 1, not with current line number, i.e.: > [t:1]: V1 =/= V2 > > If I remove ??Cond and macros will be: > -define(A(Cond), io:format("[~w:~b]: " ++ "~n", [?MODULE, ?LINE])). > > it shows current line number, i.e.: > [t:26]: > > It seems some bug here... > > -- > Maxim Treskin > -- Maxim Treskin -------------- next part -------------- A non-text attachment was scrubbed... Name: epp_stringify_line.patch Type: text/x-diff Size: 783 bytes Desc: not available URL: From jeffm@REDACTED Thu Sep 25 07:20:12 2008 From: jeffm@REDACTED (jm) Date: Thu, 25 Sep 2008 15:20:12 +1000 Subject: [erlang-questions] Millions of processes? In-Reply-To: <1222251835.7604.58.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> References: <6a36e7290809230831i738b27c6n5de4b16e9e8867c1@mail.gmail.com> <19631434.post@talk.nabble.com> <48D922CA.8030309@ericsson.com> <1222251835.7604.58.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Message-ID: <48DB1F8C.2050206@ghostgun.com> This was generally true only of the early micro kernels. Apparently, the Mach kernel is slow when compared to the newer L4 kernel. see http://en.wikipedia.org/wiki/L4_microkernel_family#History Jeff. Bengt Kleberg wrote: > Greetings, > > It is not only _ideas_ in computer science that are held in contempt (as > quoted below). Ages ago (before 2000) I read an article about Linux in > embedded environments. The article quoted Linus Torvalds on why not to > use micro kernels. The reasons where that they are: > 1 Experimental > 2 Complex > 3 Slow > > After looking around for a while I found plenty of articles about > commercial micro kernels, and benchmarks showing micro kernels running > workloads faster than monolithic kernels. So 1 and 3 seemed to be > incorrect. > I submitted these findings to the magazine, which prompted an answer > from Mr Torvalds. He assert that all three where true, but did not > discuss what I had found. So (IMHO) it is also facts that are not held > in very high regard. > > From toby@REDACTED Thu Sep 25 07:26:25 2008 From: toby@REDACTED (Toby Thain) Date: Thu, 25 Sep 2008 01:26:25 -0400 Subject: [erlang-questions] First Erlang experiences- not so good In-Reply-To: <8249c4ac0809242134g54f14753u9c8e1b4cdc2abfa6@mail.gmail.com> References: <8249c4ac0809242134g54f14753u9c8e1b4cdc2abfa6@mail.gmail.com> Message-ID: <7161F4C0-2277-479C-B38C-C9DADEFA76C2@telegraphics.com.au> On 25-Sep-08, at 12:34 AM, Tony Cappellini wrote: > I've been going through this intro to Erlang > > http://www.onlamp.com/pub/a/onlamp/2007/09/13/introduction-to- > erlang.html?page=last#thread > > using the Windows version of the > Erlang (BEAM) emulator version 5.6.4 [smp:2] [async-threads:0] > shell. > > For some reason, the example.erl file on the above site, will not > compile. It does. The file you attached, however, seems to be in UTF-16? $ hexdump example.erl 0000000 fffe 2d00 6d00 6f00 6400 7500 6c00 6500 Some Windows tool is letting you down. Copy and paste from the site into a simple ASCII text file and this will all work fine. --Toby From johnston@REDACTED Thu Sep 25 07:35:41 2008 From: johnston@REDACTED (Benjamin Johnston) Date: Thu, 25 Sep 2008 15:35:41 +1000 Subject: [erlang-questions] First Erlang experiences- not so good In-Reply-To: <8249c4ac0809242134g54f14753u9c8e1b4cdc2abfa6@mail.gmail.com> References: <8249c4ac0809242134g54f14753u9c8e1b4cdc2abfa6@mail.gmail.com> Message-ID: <48DB232D.5040107@it.uts.edu.au> >I've been going through this intro to Erlang > >http://www.onlamp.com/pub/a/onlamp/2007/09/13/introduction-to-erlang.html?page=last#thread > >For some reason, the example.erl file on the above site, will not compile. > > Hi Tony, Even though they look identical, the example.erl file on the above site, and the file that you have attached are different. Try opening them up in a hex editor/viewer and you will see the difference. Your attachment is encoded in Unicode: the first two bytes of your file are 0xFF, 0xFE, and every second byte of the file is a 0x00. The example.erl on the above site is not in Unicode. The compiler apparently does not like Unicode, so you'll need to configure your editor to save in some other format. You can get example.erl to compile by opening it up in notepad, and then click "Save As". In the "Save As" dialog box, there is an option to choose your encoding. If you select ANSI, the file will compile correctly. I hope that helps, -Ben From bengt.kleberg@REDACTED Thu Sep 25 08:39:01 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 25 Sep 2008 08:39:01 +0200 Subject: [erlang-questions] Millions of processes? In-Reply-To: <48DB1F8C.2050206@ghostgun.com> References: <6a36e7290809230831i738b27c6n5de4b16e9e8867c1@mail.gmail.com> <19631434.post@talk.nabble.com> <48D922CA.8030309@ericsson.com> <1222251835.7604.58.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> <48DB1F8C.2050206@ghostgun.com> Message-ID: <1222324741.21786.6.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> There where other micro kernels around at the time. At least 2 had benchmarks showing them to be faster than ''macro kernels''. bengt On Thu, 2008-09-25 at 15:20 +1000, jm wrote: > This was generally true only of the early micro kernels. Apparently, the > Mach kernel is slow when compared to the newer L4 kernel. see > http://en.wikipedia.org/wiki/L4_microkernel_family#History > > Jeff. > > Bengt Kleberg wrote: > > Greetings, > > > > It is not only _ideas_ in computer science that are held in contempt (as > > quoted below). Ages ago (before 2000) I read an article about Linux in > > embedded environments. The article quoted Linus Torvalds on why not to > > use micro kernels. The reasons where that they are: > > 1 Experimental > > 2 Complex > > 3 Slow > > > > After looking around for a while I found plenty of articles about > > commercial micro kernels, and benchmarks showing micro kernels running > > workloads faster than monolithic kernels. So 1 and 3 seemed to be > > incorrect. > > I submitted these findings to the magazine, which prompted an answer > > from Mr Torvalds. He assert that all three where true, but did not > > discuss what I had found. So (IMHO) it is also facts that are not held > > in very high regard. > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From richardc@REDACTED Thu Sep 25 08:55:18 2008 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 25 Sep 2008 08:55:18 +0200 Subject: [erlang-questions] Edoc question In-Reply-To: <3dbc6d1c0809241724t5f5acba9p1ff5fbde22784d20@mail.gmail.com> References: <3dbc6d1c0809220953l47f6125aj164733f7796ee3bf@mail.gmail.com> <48D7E782.1070700@it.uu.se> <3dbc6d1c0809241724t5f5acba9p1ff5fbde22784d20@mail.gmail.com> Message-ID: <48DB35D6.4010705@it.uu.se> Robert Virding wrote: > I will try it some more and see if I can get it to work. There is no > overview.edoc file for edoc in the distribution, from where can I get it? It is included in the source distribution, under lib/edoc/doc. > How do I setup edoc so it will not look in my src directory but use the > .edoc files in my doc directory instead? The default location for the overview file _is_ in the application doc directory. Actually, if you read section 1.4 "The overview page" in the edoc user guide, I think it answers all your questions so far: http://www.erlang.org/doc/apps/edoc/chapter.html#1.4 (And if you follow the link to the edoc_doclet module, you'll see the {overview,Filename} option described.) /Richard From richardc@REDACTED Thu Sep 25 09:47:27 2008 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 25 Sep 2008 09:47:27 +0200 Subject: [erlang-questions] Stringification in erlang macros In-Reply-To: References: <48DA42FC.2080601@it.uu.se> Message-ID: <48DB420F.30303@it.uu.se> Actually, it looks like this is a symptom of a deeper problem, where the line number of an expanded macro argument gets propagated to the tokens to the right of it in the macro body (in epp:expand_macro/4). Your patch fixes only this particular symptom, but thanks a lot for discovering this. /Richard Maxim Treskin wrote: > Patch which fix this problem attached > > > On 25/09/2008, Maxim Treskin wrote: >>> ??Foo stringifies the macro argument Foo. See the eunit.hrl >>> file for examples of writing assertion macros: >> I have some strange behaviour with this. When I wrote macros like: >> -define(A(Cond), io:format("[~w:~b]: " ++ ??Cond ++ "~n", [?MODULE, >> ?LINE])). >> >> it writes me line with number 1, not with current line number, i.e.: >> [t:1]: V1 =/= V2 >> >> If I remove ??Cond and macros will be: >> -define(A(Cond), io:format("[~w:~b]: " ++ "~n", [?MODULE, ?LINE])). >> >> it shows current line number, i.e.: >> [t:26]: >> >> It seems some bug here... >> >> -- >> Maxim Treskin >> > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From gleber.p@REDACTED Thu Sep 25 10:22:26 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Thu, 25 Sep 2008 10:22:26 +0200 Subject: [erlang-questions] backup applications In-Reply-To: <32e4cadb0809241602y6771e28apc811abc55c72aec6@mail.gmail.com> References: <32e4cadb0809241602y6771e28apc811abc55c72aec6@mail.gmail.com> Message-ID: <14f0e3620809250122h5455216egd68fea2245f9257f@mail.gmail.com> 2008/9/25 Vladimir Mitsner : > I heard that there is a way to set up an erlang application such that it > runs in parallel with a backup "shadow" application which can take over if > the primary crashes. Is that the case? And where would I find > documentation about setting up applications to run with such backups? > Thank you. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > Hi, Take a look: http://www.erlang.org/doc/design_principles/distributed_applications.html#9 BR -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From Dana.RUBINO@REDACTED Thu Sep 25 11:46:51 2008 From: Dana.RUBINO@REDACTED (Dana.RUBINO@REDACTED) Date: Thu, 25 Sep 2008 10:46:51 +0100 Subject: [erlang-questions] Mnesia best practices In-Reply-To: <6c2563b20809241013v4c2a5a88l757b9c45948760c5@mail.gmail.com> References: <48DA4EE1.6030400@erlang-consulting.com> <6c2563b20809241013v4c2a5a88l757b9c45948760c5@mail.gmail.com> Message-ID: Thanks a lot guys - this has been a great help. I will certainly be looking into Jabber! Thanks, Dan ________________________________ From: emofine@REDACTED [mailto:emofine@REDACTED] On Behalf Of Edwin Fine Sent: 24 September 2008 18:14 To: RUBINO, Dana, GBM Cc: mazen@REDACTED; erlang-questions@REDACTED Subject: Re: [erlang-questions] Mnesia best practices Dan, I shamelessly use techniques that I learn from reading the code for ejabberd. Even if to some learned Erlangistas it may not be the ne plus ultra of Erlang code, to me it's got a lot of things in it to which I say, "I didn't know you could do that!". Sometimes I struggle to figure out how to do something, being fairly new to Erlang/OTP myself, and I ask, WWJD (What Would Jabber Do?) and more often than not, there is an answer. You could do a lot worse than taking a look at its organization and techniques. It helps that it's a stable, real-world application that's in widespread production. http://www.ejabberd.im/ Of course, ejabberd is not the only interesting Erlang application out there from which to cherry-pick idioms and techniques, it's just the first one I really looked into deeply. There are many others that are well done or cleverly done (and sometimes both), like RabbitMQ. Hope this helps. Regards, Edwin Fine On Wed, Sep 24, 2008 at 10:56 AM, > wrote: Hi Mazen, Can you be more specific please? I have had a look at the OTP Design principles i.e. release handling as suggested. Although it mentions target systems and building a release (.rel which looks good) it doesn't specify how I might specify the working Mnesia instance which I also want starting? Any ideas? Thanks, Dan -----Original Message----- From: Mazen Harake [mailto:mazen@REDACTED] Sent: 24 September 2008 15:30 To: RUBINO, Dana, GBM Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Mnesia best practices Use targets systems that conform to OTP release handling and and this sort of things come to you for free... you don't need to start Mnesia from your application. /Mazen Dana.RUBINO@REDACTED wrote: > Hi all, > > Anyone know the prescribed way for ensuring an Mnesia DB is up and > running (if not then start it) when starting up an erlang application? > > I would ideally like a process which is in charge of starting Mnesia > and monitoring it to ensure it has not gone down? > > Should I just use a supervisor for this? > > Thanks, > Dan > > ********************************************************************** > ************* The Royal Bank of Scotland plc. Registered in Scotland > No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority > > This e-mail message is confidential and for use by the addressee only. > If the message is received by anyone other than the addressee, please > return the message to the sender by replying to it and then delete the > message from your computer. Internet e-mails are not necessarily > secure. The Royal Bank of Scotland plc does not accept responsibility > for changes made to this message after it was sent. > > Whilst all reasonable care has been taken to avoid the transmission of > viruses, it is the responsibility of the recipient to ensure that the > onward transmission, opening or use of this message and any > attachments will not adversely affect its systems or data. No > responsibility is accepted by The Royal Bank of Scotland plc in this > regard and the recipient should carry out such virus and other checks > as it considers appropriate. > Visit our websites at: > www.rbs.com > www.rbs.com/gbm > www.rbsgc.com > ********************************************************************** > ************* > > ---------------------------------------------------------------------- > -- > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From rklophaus@REDACTED Thu Sep 25 14:26:39 2008 From: rklophaus@REDACTED (Rusty Klophaus) Date: Thu, 25 Sep 2008 08:26:39 -0400 Subject: [erlang-questions] Suggestions for Erlang BarCamp Presentation? Message-ID: <03C63891-6DF6-4B2E-A317-054F7A7ED8B6@gmail.com> Hello all, I will be attending BarCamp in Washington, DC on October 18th, and I'd like to use it as an opportunity to spread the word about Erlang. BarCamp, from what I understand, is a grassroots tech-focused conference that's held in a number of different cities. There are slots during the day where attendees can sign up to give a 30 minute presentation on interesting technology. (http://barcampdc.org) So my questions are: 1. Have you given or attended a good Erlang presentation at BarCamp or elsewhere, and what was the focus? 2. If you were going to give a talk to get people excited about Erlang, what would you say? 3. I've never been to BarCamp before. Any overall suggestions on how to make the most of it? Any help is greatly appreciated. Thanks, Rusty Klophaus From russell.brown@REDACTED Thu Sep 25 11:26:53 2008 From: russell.brown@REDACTED (Russell Brown) Date: Thu, 25 Sep 2008 10:26:53 +0100 Subject: [erlang-questions] Newbie question. Joe Armstrong book. Ring benchmark. Message-ID: <499F3640-F8EA-4797-AF02-65ACC198F1D3@mac.com> ?Hi, I've just done the "ring benchmark" from the end of Chapter 8 in the Joe Armstrong book (Programming Erlang: Software for a Concurrent World). I think I have a module that does what is asked in the problem "(Write a ring benchmark. Create N processes in a ring. Send a message round the ring M times so that a total of N * M messages get sent. Time how long this takes for different values of N and M.)" I am certain it is nowhere near the best or most elegant way to do it as I am not very accomplished (but I do like to have a go anyway). What I am wondering is why, when I run the "benchmark" only one of the cores on my laptop's dual core seems to get used. Have I written it wrong (so that there is no concurrency) or is a ring by its nature a sequential thing? I have attached the code in case it helps answer the above question. As I say I am a total newb. My reason for posting is just to verify that the implementation works and to find out why it only uses one core. Also, is there a canonical implementation that beginners like me can have a look at? Many thanks in advance Russell -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ring.erl Type: application/octet-stream Size: 1700 bytes Desc: not available URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: From dizzyd@REDACTED Thu Sep 25 14:47:40 2008 From: dizzyd@REDACTED (Dave Smith) Date: Thu, 25 Sep 2008 06:47:40 -0600 Subject: [erlang-questions] custom supervisor In-Reply-To: <200809190426.50413.als@iinet.net.au> References: <200809190426.50413.als@iinet.net.au> Message-ID: On Thu, Sep 18, 2008 at 12:26 PM, Anthony Shipman wrote: > Is it possible to write a custom supervisor and include it an OTP environment? > Looking at release_handler_1 in the sasl application is seems to assume that > the implementation module for a supervisor is always stdlib:supervisor. This is a question I'd love to see answered by the OTP team. There have been several situations where I wanted to create a custom supervisor, but in the end just went with a normal sup w/ another process working as an interface (of sorts) to the supervisor to accomplish my goals. My understanding (perhaps flawed) is that you rarely want to introduce new code into the supervisory tree since if you screw it up, it will dramatically affect the overall stability of your application. But the desire to customize the supervisor behaviour a bit more does pop up often enough that I wonder if there is a better way to attack this need for extensibility. D. From toby@REDACTED Thu Sep 25 16:30:01 2008 From: toby@REDACTED (Toby Thain) Date: Thu, 25 Sep 2008 10:30:01 -0400 Subject: [erlang-questions] Millions of processes? In-Reply-To: <1222324741.21786.6.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> References: <6a36e7290809230831i738b27c6n5de4b16e9e8867c1@mail.gmail.com> <19631434.post@talk.nabble.com> <48D922CA.8030309@ericsson.com> <1222251835.7604.58.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> <48DB1F8C.2050206@ghostgun.com> <1222324741.21786.6.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Message-ID: On 25-Sep-08, at 2:39 AM, Bengt Kleberg wrote: > There where other micro kernels around at the time. At least 2 had > benchmarks showing them to be faster than ''macro kernels''. Does a generic 'faster' metric/scale really exist when comparing operating systems? What I tend to see in benchmarks of complex systems like filesystems, databases, operating systems is that it's multivariate, workload dependent, and simply leads to differing sweet spots. And frequently, there are important attributes unconnected with performance... --Toby > > > bengt > > On Thu, 2008-09-25 at 15:20 +1000, jm wrote: >> This was generally true only of the early micro kernels. >> Apparently, the >> Mach kernel is slow when compared to the newer L4 kernel. see >> http://en.wikipedia.org/wiki/L4_microkernel_family#History >> >> Jeff. >> >> Bengt Kleberg wrote: >>> Greetings, >>> >>> It is not only _ideas_ in computer science that are held in >>> contempt (as >>> quoted below). Ages ago (before 2000) I read an article about >>> Linux in >>> embedded environments. The article quoted Linus Torvalds on why >>> not to >>> use micro kernels. The reasons where that they are: >>> 1 Experimental >>> 2 Complex >>> 3 Slow >>> >>> After looking around for a while I found plenty of articles about >>> commercial micro kernels, and benchmarks showing micro kernels >>> running >>> workloads faster than monolithic kernels. So 1 and 3 seemed to be >>> incorrect. >>> I submitted these findings to the magazine, which prompted an answer >>> from Mr Torvalds. He assert that all three where true, but did not >>> discuss what I had found. So (IMHO) it is also facts that are not >>> held >>> in very high regard. >>> >>> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From erlang-questions_efine@REDACTED Thu Sep 25 17:06:19 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Thu, 25 Sep 2008 11:06:19 -0400 Subject: [erlang-questions] Newbie question. Joe Armstrong book. Ring benchmark. In-Reply-To: <499F3640-F8EA-4797-AF02-65ACC198F1D3@mac.com> References: <499F3640-F8EA-4797-AF02-65ACC198F1D3@mac.com> Message-ID: <6c2563b20809250806o3b613335o1f5967a8a2aa66ba@mail.gmail.com> Hi Russell, In general, it's worth searching the erlang archives, which often have the answers to many questions. The searchable archive is at http://www.erlang.org/faq.html. This post discusses your question. There are quite a few posts in the archives about the ring benchmark. http://www.erlang.org/pipermail/erlang-questions/2006-March/019503.html 2008/9/25 Russell Brown > > Hi,I've just done the "ring benchmark" from the end of Chapter 8 in the > Joe Armstrong book (Programming Erlang: Software for a Concurrent World). > > I think I have a module that does what is asked in the problem "(Write a > ring benchmark. Create N processes in a ring. Send a message round the > ring M times so that a total of N * M messages get sent. Time how long > this takes for different values of N and M.)" > > I am certain it is nowhere near the best or most elegant way to do it as I > am not very accomplished (but I do like to have a go anyway). What I am > wondering is why, when I run the "benchmark" only one of the cores on my > laptop's dual core seems to get used. Have I written it wrong (so that there > is no concurrency) or is a ring by its nature a sequential thing? > > I have attached the code in case it helps answer the above question. As I > say I am a total newb. My reason for posting is just to verify that the > implementation works and to find out why it only uses one core. > > Also, is there a canonical implementation that beginners like me can have a > look at? > > Many thanks in advance > > Russell > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cappy2112@REDACTED Thu Sep 25 17:22:47 2008 From: cappy2112@REDACTED (Tony Cappellini) Date: Thu, 25 Sep 2008 08:22:47 -0700 Subject: [erlang-questions] First Erlang experiences- not so good In-Reply-To: <48DB232D.5040107@it.uts.edu.au> References: <8249c4ac0809242134g54f14753u9c8e1b4cdc2abfa6@mail.gmail.com> <48DB232D.5040107@it.uts.edu.au> Message-ID: <8249c4ac0809250822y4dcf5aebr19717219d800665f@mail.gmail.com> > Hi Tony, > > Even though they look identical, the example.erl file on the above site, and > the file that you have attached are different. Try opening them up in a hex > editor/viewer and you will see the difference. > > Your attachment is encoded in Unicode: the first two bytes of your file are > 0xFF, 0xFE, and every second byte of the file is a 0x00. The example.erl on > the above site is not in Unicode. The compiler apparently does not like > Unicode, so you'll need to configure your editor to save in some other > format. > > You can get example.erl to compile by opening it up in notepad, and then > click "Save As". In the "Save As" dialog box, there is an option to choose > your encoding. If you select ANSI, the file will compile correctly. > I will try this shortly. Thanks for all the replies. From saleyn@REDACTED Thu Sep 25 16:04:24 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Thu, 25 Sep 2008 10:04:24 -0400 Subject: [erlang-questions] custom supervisor In-Reply-To: References: <200809190426.50413.als@iinet.net.au> Message-ID: <48DB9A68.7040004@gmail.com> I've also always been using this "middle-man" approach, where the parent supervisor has a restart strategy with {MaxRestarts, MaxTime} = {0, 1}, and the childspec spawns a linked process that actually acts as a "supervisor" for its linked child(ren). This is very similar to what supervisor_bridge behavior is. You can see an example of such a supervisor that allows scheduled execution of tasks here: http://forum.trapexit.org/viewtopic.php?p=44147#44147 Serge Dave Smith wrote: > On Thu, Sep 18, 2008 at 12:26 PM, Anthony Shipman wrote: >> Is it possible to write a custom supervisor and include it an OTP environment? >> Looking at release_handler_1 in the sasl application is seems to assume that >> the implementation module for a supervisor is always stdlib:supervisor. > > This is a question I'd love to see answered by the OTP team. There > have been several situations where I wanted to create a custom > supervisor, but in the end just went with a normal sup w/ another > process working as an interface (of sorts) to the supervisor to > accomplish my goals. > > My understanding (perhaps flawed) is that you rarely want to introduce > new code into the supervisory tree since if you screw it up, it will > dramatically affect the overall stability of your application. But the > desire to customize the supervisor behaviour a bit more does pop up > often enough that I wonder if there is a better way to attack this > need for extensibility. > > D. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From cappy2112@REDACTED Thu Sep 25 17:03:55 2008 From: cappy2112@REDACTED (Tony Cappellini) Date: Thu, 25 Sep 2008 08:03:55 -0700 Subject: [erlang-questions] First Erlang experiences- not so good In-Reply-To: <7161F4C0-2277-479C-B38C-C9DADEFA76C2@telegraphics.com.au> References: <8249c4ac0809242134g54f14753u9c8e1b4cdc2abfa6@mail.gmail.com> <7161F4C0-2277-479C-B38C-C9DADEFA76C2@telegraphics.com.au> Message-ID: <8249c4ac0809250803l18a19704yf34a6ed5c3f1facf@mail.gmail.com> > > It does. > > The file you attached, however, seems to be in UTF-16? That may have been do to Firefox, when the file was emailed. That file was downloaded from the site, and emailed, unedited. > Copy and paste from the site into a simple ASCII text file and this will all > work fine. I had started by doing it exactly that way, before downloading the sources. From rpettit@REDACTED Thu Sep 25 19:09:58 2008 From: rpettit@REDACTED (Rick Pettit) Date: Thu, 25 Sep 2008 12:09:58 -0500 (CDT) Subject: [erlang-questions] First Erlang experiences- not so good In-Reply-To: <8249c4ac0809250803l18a19704yf34a6ed5c3f1facf@mail.gmail.com> References: <8249c4ac0809242134g54f14753u9c8e1b4cdc2abfa6@mail.gmail.com> <7161F4C0-2277-479C-B38C-C9DADEFA76C2@telegraphics.com.au> <8249c4ac0809250803l18a19704yf34a6ed5c3f1facf@mail.gmail.com> Message-ID: <52060.192.168.34.10.1222362598.squirrel@squirrelmail.vail> On Thu, September 25, 2008 10:03 am, Tony Cappellini wrote: >> >> It does. >> >> The file you attached, however, seems to be in UTF-16? > That may have been do to Firefox, when the file was emailed. > That file was downloaded from the site, and emailed, unedited. > >> Copy and paste from the site into a simple ASCII text file and this will >> all >> work fine. > I had started by doing it exactly that way, before downloading the > sources. It could be time to change the subject to "bad download experiences" since this seems less and less to have anything to do with erlang. -Rick From babo.online@REDACTED Thu Sep 25 19:16:24 2008 From: babo.online@REDACTED (Attila Babo) Date: Thu, 25 Sep 2008 19:16:24 +0200 Subject: [erlang-questions] Fixed SMTP client using gen_fsm behaviour Message-ID: <597c69660809251016w58511287ha2894262f152b42c@mail.gmail.com> I've just posted on trapexit my changes for the simple SMTP client: http://www.trapexit.org/forum/viewtopic.php?p=44154 That's based on Michael Bradford code from the user contribution area of erlang.org, contains all the changes of Dmitriy plus fixes to gen_fsm state handling to shut off error reporting at normal stop state. Example at the comment section also corrected as well as the unused variables. Download the original code and replace smtp_fsm.erl or just use it as is, this single file contains all you need to have a simple SMTP client. Enjoy! From cappy2112@REDACTED Thu Sep 25 19:50:01 2008 From: cappy2112@REDACTED (Tony Cappellini) Date: Thu, 25 Sep 2008 10:50:01 -0700 Subject: [erlang-questions] First Erlang experiences- not so good In-Reply-To: <52060.192.168.34.10.1222362598.squirrel@squirrelmail.vail> References: <8249c4ac0809242134g54f14753u9c8e1b4cdc2abfa6@mail.gmail.com> <7161F4C0-2277-479C-B38C-C9DADEFA76C2@telegraphics.com.au> <8249c4ac0809250803l18a19704yf34a6ed5c3f1facf@mail.gmail.com> <52060.192.168.34.10.1222362598.squirrel@squirrelmail.vail> Message-ID: <8249c4ac0809251050s2541e30aj179eb063cc1fc0f1@mail.gmail.com> I get the same compile errors when I typed in the code and saved it. The author of that article downloaded the sources, compiled and ran them on his linux system, so it is not a download issue. If the Windows version of the Erlang shell is sensitive to encodings, it is a language related issue, not a download issue. > It could be time to change the subject to "bad download experiences" since > this seems less and less to have anything to do with erlang. > > -Rick > > From dave.smith.to@REDACTED Thu Sep 25 20:57:08 2008 From: dave.smith.to@REDACTED (Dave Smith) Date: Thu, 25 Sep 2008 14:57:08 -0400 Subject: [erlang-questions] First Erlang experiences- not so good In-Reply-To: <8249c4ac0809251050s2541e30aj179eb063cc1fc0f1@mail.gmail.com> References: <8249c4ac0809242134g54f14753u9c8e1b4cdc2abfa6@mail.gmail.com> <7161F4C0-2277-479C-B38C-C9DADEFA76C2@telegraphics.com.au> <8249c4ac0809250803l18a19704yf34a6ed5c3f1facf@mail.gmail.com> <52060.192.168.34.10.1222362598.squirrel@squirrelmail.vail> <8249c4ac0809251050s2541e30aj179eb063cc1fc0f1@mail.gmail.com> Message-ID: <5ea453f90809251157u28cbae7ds341d40caceafa5fb@mail.gmail.com> The Erlang source code files are assumed to be Latin-1 (ISO-8859-1). This is well documented. The problem, as explained by Toby, is that the *editor*you are using is writing the file in UTF-16(probably) . So you either need to use another editor or configure the one you have to write Latin-1. This is also *not* a problem with the Windows version of Erlang; you would get the same result if you compiled your UTF-16 source on linux, etc. It is very unusual to store source code for any programming language in UTF-16. What editor are you using? -DS 2008/9/25 Tony Cappellini > I get the same compile errors when I typed in the code and saved it. > The author of that article downloaded the sources, compiled and ran > them on his linux system, so it is not a download issue. > If the Windows version of the Erlang shell is sensitive to encodings, > it is a language related issue, not a download issue. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From russell.brown@REDACTED Thu Sep 25 18:05:02 2008 From: russell.brown@REDACTED (Russell Brown) Date: Thu, 25 Sep 2008 17:05:02 +0100 Subject: [erlang-questions] Newbie question. Joe Armstrong book. Ring benchmark. In-Reply-To: <6c2563b20809250806o3b613335o1f5967a8a2aa66ba@mail.gmail.com> References: <499F3640-F8EA-4797-AF02-65ACC198F1D3@mac.com> <6c2563b20809250806o3b613335o1f5967a8a2aa66ba@mail.gmail.com> Message-ID: <8550ED8E-3FBF-4EAC-84CE-2BFD634036AC@mac.com> On 25 Sep 2008, at 16:06, Edwin Fine wrote: > Hi Russell, > > In general, it's worth searching the erlang archives, which often > have the answers to many questions. The searchable archive is at > http://www.erlang.org/faq.html. > > This post discusses your question. There are quite a few posts in > the archives about the ring benchmark. > > http://www.erlang.org/pipermail/erlang-questions/2006-March/ > 019503.html Thanks for that. Good resource, should have checked it before, In future I will be sure too. Seems my version is like a few others out there and the answer is: yeah, ring benchmark is not so concurrent. Thanks again. Enjoying this. Russell > > > 2008/9/25 Russell Brown > > Hi, > I've just done the "ring benchmark" from the end of Chapter 8 in > the Joe Armstrong book (Programming Erlang: Software for a > Concurrent World). > > I think I have a module that does what is asked in the problem > "(Write a ring benchmark. Create N processes in a ring. Send a > message round the ring M times so that a total of N * M messages > get sent. Time how long this takes for different values of N and M.)" > > I am certain it is nowhere near the best or most elegant way to do > it as I am not very accomplished (but I do like to have a go > anyway). What I am wondering is why, when I run the "benchmark" > only one of the cores on my laptop's dual core seems to get used. > Have I written it wrong (so that there is no concurrency) or is a > ring by its nature a sequential thing? > > I have attached the code in case it helps answer the above > question. As I say I am a total newb. My reason for posting is > just to verify that the implementation works and to find out why it > only uses one core. > > Also, is there a canonical implementation that beginners like me > can have a look at? > > Many thanks in advance > > Russell > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From saleyn@REDACTED Thu Sep 25 21:48:38 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Thu, 25 Sep 2008 15:48:38 -0400 Subject: [erlang-questions] Redirect -remsh output Message-ID: <48DBEB16.9050903@gmail.com> When using -remsh option to start a shell on a remote node, is there a way to have tab expansion in the shell work by printing the expansion hints in the remote shell? Serge From rec@REDACTED Thu Sep 25 22:04:49 2008 From: rec@REDACTED (Roger Critchlow) Date: Thu, 25 Sep 2008 14:04:49 -0600 Subject: [erlang-questions] First Erlang experiences- not so good In-Reply-To: <8249c4ac0809251050s2541e30aj179eb063cc1fc0f1@mail.gmail.com> References: <8249c4ac0809242134g54f14753u9c8e1b4cdc2abfa6@mail.gmail.com> <7161F4C0-2277-479C-B38C-C9DADEFA76C2@telegraphics.com.au> <8249c4ac0809250803l18a19704yf34a6ed5c3f1facf@mail.gmail.com> <52060.192.168.34.10.1222362598.squirrel@squirrelmail.vail> <8249c4ac0809251050s2541e30aj179eb063cc1fc0f1@mail.gmail.com> Message-ID: <66d1c98f0809251304t43d1f85etb8a47d04fe0eb45c@mail.gmail.com> When I compile your example.erl on Linux, I get: rec@REDACTED:~/erlang$ erlc ~/Desktop/example.erl /home/rec-ubuntu/Desktop/example.erl:1: syntax error before: '-' /home/rec-ubuntu/Desktop/example.erl:2: syntax error before: p /home/rec-ubuntu/Desktop/example.erl:4: syntax error before: a /home/rec-ubuntu/Desktop/example.erl:7: syntax error before: a /home/rec-ubuntu/Desktop/example.erl:9: syntax error before: a /home/rec-ubuntu/Desktop/example.erl:10: no module definition which are exactly the same errors that you get when you compiled it on Windows. So the Linux version of Erlang has the same sensitivity to encodings as the Windows version. -- rec -- On Thu, Sep 25, 2008 at 11:50 AM, Tony Cappellini wrote: > I get the same compile errors when I typed in the code and saved it. > The author of that article downloaded the sources, compiled and ran > them on his linux system, so it is not a download issue. > If the Windows version of the Erlang shell is sensitive to encodings, > it is a language related issue, not a download issue. > > > > It could be time to change the subject to "bad download experiences" > since > > this seems less and less to have anything to do with erlang. > > > > -Rick > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cappy2112@REDACTED Thu Sep 25 22:15:25 2008 From: cappy2112@REDACTED (Tony Cappellini) Date: Thu, 25 Sep 2008 13:15:25 -0700 Subject: [erlang-questions] First Erlang experiences- not so good In-Reply-To: <5ea453f90809251157u28cbae7ds341d40caceafa5fb@mail.gmail.com> References: <8249c4ac0809242134g54f14753u9c8e1b4cdc2abfa6@mail.gmail.com> <7161F4C0-2277-479C-B38C-C9DADEFA76C2@telegraphics.com.au> <8249c4ac0809250803l18a19704yf34a6ed5c3f1facf@mail.gmail.com> <52060.192.168.34.10.1222362598.squirrel@squirrelmail.vail> <8249c4ac0809251050s2541e30aj179eb063cc1fc0f1@mail.gmail.com> <5ea453f90809251157u28cbae7ds341d40caceafa5fb@mail.gmail.com> Message-ID: <8249c4ac0809251315s57ffc766ye9bb1c76481d3974@mail.gmail.com> > is well documented. The problem, as explained by Toby, is that the editor > you are using is writing the file in UTF-16(probably) . I did see his reply. I also had tried compiling the file I downloaded without editing it, and had the same problem- or so I thought so. It appears as though I did not overwrite the file i had edited by hand, with the one I downloaded. I've deleted thed edited file, and unzipped it from the downloaded zip file. It now compiles. > It is very unusual to store source code for any programming language in > UTF-16. What editor are you using? I think when I typed in the example, I used Scintilla Text Editor, which is just a very lightweight editor, that I use for quick edits. For regular development I'll use Slick Edit, Wing IDE, or Codewrite I use Scintilla Text Editor daily for python, Windows batch files, C/C++ and have no problems. This is the first language I've worked with that is sensitive to the encodings used. I'll see if i can make it defualt to whatever Erlang requires. Thanks From toby@REDACTED Thu Sep 25 22:55:12 2008 From: toby@REDACTED (Toby Thain) Date: Thu, 25 Sep 2008 16:55:12 -0400 Subject: [erlang-questions] First Erlang experiences- not so good In-Reply-To: <8249c4ac0809251050s2541e30aj179eb063cc1fc0f1@mail.gmail.com> References: <8249c4ac0809242134g54f14753u9c8e1b4cdc2abfa6@mail.gmail.com> <7161F4C0-2277-479C-B38C-C9DADEFA76C2@telegraphics.com.au> <8249c4ac0809250803l18a19704yf34a6ed5c3f1facf@mail.gmail.com> <52060.192.168.34.10.1222362598.squirrel@squirrelmail.vail> <8249c4ac0809251050s2541e30aj179eb063cc1fc0f1@mail.gmail.com> Message-ID: On 25-Sep-08, at 1:50 PM, Tony Cappellini wrote: > I get the same compile errors when I typed in the code and saved it. > The author of that article downloaded the sources, compiled and ran > them on his linux system, so it is not a download issue. > If the Windows version of the Erlang shell is sensitive to encodings, > it is a language related issue, not a download issue. That file did not compile on OS X either - it wasn't ASCII text. The program itself is correct. You can copy and paste into an ASCII text editor and it will compile and run without problems. --Toby > > >> It could be time to change the subject to "bad download >> experiences" since >> this seems less and less to have anything to do with erlang. >> >> -Rick >> >> From toby@REDACTED Thu Sep 25 22:56:15 2008 From: toby@REDACTED (Toby Thain) Date: Thu, 25 Sep 2008 16:56:15 -0400 Subject: [erlang-questions] First Erlang experiences- not so good In-Reply-To: <8249c4ac0809251315s57ffc766ye9bb1c76481d3974@mail.gmail.com> References: <8249c4ac0809242134g54f14753u9c8e1b4cdc2abfa6@mail.gmail.com> <7161F4C0-2277-479C-B38C-C9DADEFA76C2@telegraphics.com.au> <8249c4ac0809250803l18a19704yf34a6ed5c3f1facf@mail.gmail.com> <52060.192.168.34.10.1222362598.squirrel@squirrelmail.vail> <8249c4ac0809251050s2541e30aj179eb063cc1fc0f1@mail.gmail.com> <5ea453f90809251157u28cbae7ds341d40caceafa5fb@mail.gmail.com> <8249c4ac0809251315s57ffc766ye9bb1c76481d3974@mail.gmail.com> Message-ID: <298D9526-480B-47C5-BA2B-D8AF04793942@telegraphics.com.au> On 25-Sep-08, at 4:15 PM, Tony Cappellini wrote: >> is well documented. The problem, as explained by Toby, is that the >> editor >> you are using is writing the file in UTF-16(probably) . > I did see his reply. I also had tried compiling the file I downloaded > without editing it, and had the same problem- or so I thought so. > It appears as though I did not overwrite the file i had edited by > hand, with the one I downloaded. > > I've deleted thed edited file, and unzipped it from the downloaded > zip file. > > It now compiles. > >> It is very unusual to store source code for any programming >> language in >> UTF-16. What editor are you using? > I think when I typed in the example, I used Scintilla Text Editor, > which is just a very lightweight editor, that I use for quick edits. > For regular development I'll use Slick Edit, Wing IDE, or Codewrite Eclipse is also great. There is an Erlang environment. http://erlide.sourceforge.net/ --Toby > > I use Scintilla Text Editor daily for python, Windows batch files, > C/C++ and have no problems. > This is the first language I've worked with that is sensitive to the > encodings used. > > > I'll see if i can make it defualt to whatever Erlang requires. > > Thanks > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From daveb@REDACTED Thu Sep 25 23:33:06 2008 From: daveb@REDACTED (Dave Bryson) Date: Thu, 25 Sep 2008 16:33:06 -0500 Subject: [erlang-questions] SASL logger Message-ID: I'm having a problem getting the logger to work the way I'd like. Basically I want to log any error messages to a single file. I'm seeing the Progress reports in the log file but not the error message. I'm starting a shell like this: > erl -pa $PWD/ebin $PWD/deps/*/ebin -boot start_sasl -config log1 log1.config looks like this: [{sasl,[ {sasl_error_logger,{file,"log.txt"}} ]}]. Then from the shell I'm calling > error_logger:error_msg("test). It output to the shell but not the log file. What am I missing? Thanks, Dave From dave.smith.to@REDACTED Fri Sep 26 00:58:16 2008 From: dave.smith.to@REDACTED (Dave Smith) Date: Thu, 25 Sep 2008 18:58:16 -0400 Subject: [erlang-questions] First Erlang experiences- not so good In-Reply-To: <8249c4ac0809251315s57ffc766ye9bb1c76481d3974@mail.gmail.com> References: <8249c4ac0809242134g54f14753u9c8e1b4cdc2abfa6@mail.gmail.com> <7161F4C0-2277-479C-B38C-C9DADEFA76C2@telegraphics.com.au> <8249c4ac0809250803l18a19704yf34a6ed5c3f1facf@mail.gmail.com> <52060.192.168.34.10.1222362598.squirrel@squirrelmail.vail> <8249c4ac0809251050s2541e30aj179eb063cc1fc0f1@mail.gmail.com> <5ea453f90809251157u28cbae7ds341d40caceafa5fb@mail.gmail.com> <8249c4ac0809251315s57ffc766ye9bb1c76481d3974@mail.gmail.com> Message-ID: <5ea453f90809251558r3782e5f1qc35e7a048345f997@mail.gmail.com> 2008/9/25 Tony Cappellini > > I use Scintilla Text Editor daily for python, Windows batch files, > C/C++ and have no problems. > This is the first language I've worked with that is sensitive to the > encodings used. > > Yes, some languages support multiple character encodings. Some will check the first two bytes of the file and assume an encoding based on a byte-order-mark(BOM). Some also support directives that will allow the programmer to specify an encoding (possibly in a comment) Recent python interpreters do: http://www.python.org/dev/peps/pep-0263/ The XML standard does as well http://www.w3.org/TR/xml11/#sec-guessing-no-ext-info In any case, I avoid UCS-2 or or any UTF-16 variant to store source code. These would effectively double the byte size of my code (I know hard-drives are cheep, but waste-not want-not). If you do use a lot of non-ascii characters in your python code UTF-8 is the way to go. You do have me thinking about what it would take to write an alternate Erlang pre-compiler that will do this type of decoding. Hmmm. A weekend research project for me. :) -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Fri Sep 26 01:03:12 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Thu, 25 Sep 2008 19:03:12 -0400 Subject: [erlang-questions] First Erlang experiences- not so good In-Reply-To: <298D9526-480B-47C5-BA2B-D8AF04793942@telegraphics.com.au> References: <8249c4ac0809242134g54f14753u9c8e1b4cdc2abfa6@mail.gmail.com> <7161F4C0-2277-479C-B38C-C9DADEFA76C2@telegraphics.com.au> <8249c4ac0809250803l18a19704yf34a6ed5c3f1facf@mail.gmail.com> <52060.192.168.34.10.1222362598.squirrel@squirrelmail.vail> <8249c4ac0809251050s2541e30aj179eb063cc1fc0f1@mail.gmail.com> <5ea453f90809251157u28cbae7ds341d40caceafa5fb@mail.gmail.com> <8249c4ac0809251315s57ffc766ye9bb1c76481d3974@mail.gmail.com> <298D9526-480B-47C5-BA2B-D8AF04793942@telegraphics.com.au> Message-ID: <6c2563b20809251603m5f44d47bw352d5c968b4a82c1@mail.gmail.com> Toby, ErlIDE was a bit crashy the last time I tried it (probably 6 months ago, can't recall). Are you using a recent version? How long have you used ErlIDE for? Do you find it stable? Regards, Edwin On Thu, Sep 25, 2008 at 4:56 PM, Toby Thain wrote: > > On 25-Sep-08, at 4:15 PM, Tony Cappellini wrote: > > >> is well documented. The problem, as explained by Toby, is that the > >> editor > >> you are using is writing the file in UTF-16(probably) . > > I did see his reply. I also had tried compiling the file I downloaded > > without editing it, and had the same problem- or so I thought so. > > It appears as though I did not overwrite the file i had edited by > > hand, with the one I downloaded. > > > > I've deleted thed edited file, and unzipped it from the downloaded > > zip file. > > > > It now compiles. > > > >> It is very unusual to store source code for any programming > >> language in > >> UTF-16. What editor are you using? > > I think when I typed in the example, I used Scintilla Text Editor, > > which is just a very lightweight editor, that I use for quick edits. > > For regular development I'll use Slick Edit, Wing IDE, or Codewrite > > > Eclipse is also great. There is an Erlang environment. > http://erlide.sourceforge.net/ > > --Toby > > > > > > I use Scintilla Text Editor daily for python, Windows batch files, > > C/C++ and have no problems. > > This is the first language I've worked with that is sensitive to the > > encodings used. > > > > > > I'll see if i can make it defualt to whatever Erlang requires. > > > > Thanks > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Fri Sep 26 01:04:48 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Thu, 25 Sep 2008 19:04:48 -0400 Subject: [erlang-questions] Redirect -remsh output In-Reply-To: <48DBEB16.9050903@gmail.com> References: <48DBEB16.9050903@gmail.com> Message-ID: <6c2563b20809251604v506fc646g1c31ec1b156b8686@mail.gmail.com> +1 The lack of tab keyword expansion on remsh annoys the heck out of me. I am glad you brought it up. On Thu, Sep 25, 2008 at 3:48 PM, Serge Aleynikov wrote: > When using -remsh option to start a shell on a remote node, is there a > way to have tab expansion in the shell work by printing the expansion > hints in the remote shell? > > Serge > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Fri Sep 26 02:13:39 2008 From: rvirding@REDACTED (Robert Virding) Date: Fri, 26 Sep 2008 02:13:39 +0200 Subject: [erlang-questions] First Erlang experiences- not so good In-Reply-To: <5ea453f90809251558r3782e5f1qc35e7a048345f997@mail.gmail.com> References: <8249c4ac0809242134g54f14753u9c8e1b4cdc2abfa6@mail.gmail.com> <7161F4C0-2277-479C-B38C-C9DADEFA76C2@telegraphics.com.au> <8249c4ac0809250803l18a19704yf34a6ed5c3f1facf@mail.gmail.com> <52060.192.168.34.10.1222362598.squirrel@squirrelmail.vail> <8249c4ac0809251050s2541e30aj179eb063cc1fc0f1@mail.gmail.com> <5ea453f90809251157u28cbae7ds341d40caceafa5fb@mail.gmail.com> <8249c4ac0809251315s57ffc766ye9bb1c76481d3974@mail.gmail.com> <5ea453f90809251558r3782e5f1qc35e7a048345f997@mail.gmail.com> Message-ID: <3dbc6d1c0809251713r94f8101t6bf4dd3a2e0b5a2c@mail.gmail.com> 2008/9/26 Dave Smith > > > You do have me thinking about what it would take to write an alternate > Erlang pre-compiler that will do this type of decoding. Hmmm. A weekend > research project for me. :) > If you were to make these modifications in file_server/file_io_server then you wouldn't have to make any modifications io_lib, erl_scan, ... These would still work out of the bag. The only problem is detecting you are using UTF-8, UTF-16... when you open the file. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From nem@REDACTED Fri Sep 26 02:27:10 2008 From: nem@REDACTED (Geoff Cant) Date: Fri, 26 Sep 2008 02:27:10 +0200 Subject: [erlang-questions] Redirect -remsh output In-Reply-To: <6c2563b20809251604v506fc646g1c31ec1b156b8686@mail.gmail.com> (Edwin Fine's message of "Thu, 25 Sep 2008 19:04:48 -0400") References: <48DBEB16.9050903@gmail.com> <6c2563b20809251604v506fc646g1c31ec1b156b8686@mail.gmail.com> Message-ID: It's not that there's a lack of tab expansion, it's just that the expansions are being calculated on the wrong node. As far as I can tell, they're getting calculated on the group_leader? (local) node and not the evaluator node (remote). http://github.com/mfoemmel/erlang-otp/tree/master/lib/stdlib/src/edlin_expand.erl at line 45 and 51 probably just needs to ensure Mod:module_info() and code:loaded() get evaluated on the right node. I'm not completely sure of my terminology here (evaluator node vs. group_leader/IO node), but I think that's the problem. Cheers, --Geoff "Edwin Fine" writes: > +1 > > The lack of tab keyword expansion on remsh annoys the heck out of me. I am > glad you brought it up. > > On Thu, Sep 25, 2008 at 3:48 PM, Serge Aleynikov wrote: > >> When using -remsh option to start a shell on a remote node, is there a >> way to have tab expansion in the shell work by printing the expansion >> hints in the remote shell? >> >> Serge From kevin@REDACTED Fri Sep 26 04:02:59 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Thu, 25 Sep 2008 19:02:59 -0700 Subject: [erlang-questions] First Erlang experiences- not so good In-Reply-To: <3dbc6d1c0809251713r94f8101t6bf4dd3a2e0b5a2c@mail.gmail.com> References: <8249c4ac0809242134g54f14753u9c8e1b4cdc2abfa6@mail.gmail.com> <7161F4C0-2277-479C-B38C-C9DADEFA76C2@telegraphics.com.au> <8249c4ac0809250803l18a19704yf34a6ed5c3f1facf@mail.gmail.com> <52060.192.168.34.10.1222362598.squirrel@squirrelmail.vail> <8249c4ac0809251050s2541e30aj179eb063cc1fc0f1@mail.gmail.com> <5ea453f90809251157u28cbae7ds341d40caceafa5fb@mail.gmail.com> <8249c4ac0809251315s57ffc766ye9bb1c76481d3974@mail.gmail.com> <5ea453f90809251558r3782e5f1qc35e7a048345f997@mail.gmail.com> <3dbc6d1c0809251713r94f8101t6bf4dd3a2e0b5a2c@mail.gmail.com> Message-ID: On Sep 25, 2008, at 5:13 PM, Robert Virding wrote: > 2008/9/26 Dave Smith > > > You do have me thinking about what it would take to write an > alternate Erlang pre-compiler that will do this type of decoding. > Hmmm. A weekend research project for me. :) > > If you were to make these modifications in file_server/ > file_io_server then you wouldn't have to make any modifications > io_lib, erl_scan, ... These would still work out of the bag. The > only problem is detecting you are using UTF-8, UTF-16... when you > open the file. The usual approach seems to be to examine the first couple bytes to look for a BOM, and otherwise assume ASCII. (Python also allows a special comment in the first two lines, and Perl has a lexically scoped 'use utf8' pragma.) -kevin -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony@REDACTED Fri Sep 26 06:01:51 2008 From: tony@REDACTED (Tony Arcieri) Date: Thu, 25 Sep 2008 22:01:51 -0600 Subject: [erlang-questions] Writing my own REPL Message-ID: I'd like to write a REPL for my own language which is based on Erlang. More to the point, I'd like my REPL to be able to use edlin.erl, which seems pretty tricky. As I understand it, I need to disable input support (i.e. erl -noinput), start user_drv myself, and create my own group leader with the group module. Is this correct? I tried to put together a simple Read-Print-Loop, but had problems with that as well: -module(myshell). -export([init/0, start/0, loop/0]). init() -> Result = group:start(user_drv:start(), {myshell, start, []}), io:format("group:start result: ~p~n", [Result]). start() -> io:format("starting shell~n"), spawn(fun loop/0). loop() -> Result = io:get_line('> '), io:format("get_line result: ~p~n", [Result]), loop(). After compiling this, I started it with: erl -noinput -s myshell init -s init stop This gave me: Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads:0] [kernel-poll:false] group:start result: <0.29.0> Eshell V5.6.3 (abort with ^G) 1> (I get the same thing starting it with -noshell) What am I doing wrong? -- Tony Arcieri medioh.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From saleyn@REDACTED Fri Sep 26 06:25:58 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Fri, 26 Sep 2008 00:25:58 -0400 Subject: [erlang-questions] Redirect -remsh output In-Reply-To: References: <48DBEB16.9050903@gmail.com> <6c2563b20809251604v506fc646g1c31ec1b156b8686@mail.gmail.com> Message-ID: <48DC6456.1090402@gmail.com> I believe you are right, as tab-expansion works only on some standard modules (e.g. stdlib, kernel, etc) that are in the path on both nodes. So, adding the appropriate rpc:call/4 in both places should fix the issue. Serge Geoff Cant wrote: > It's not that there's a lack of tab expansion, it's just that the > expansions are being calculated on the wrong node. As far as I can tell, > they're getting calculated on the group_leader? (local) node and not the > evaluator node (remote). > > http://github.com/mfoemmel/erlang-otp/tree/master/lib/stdlib/src/edlin_expand.erl > at line 45 and 51 probably just needs to ensure Mod:module_info() and > code:loaded() get evaluated on the right node. > > I'm not completely sure of my terminology here (evaluator node > vs. group_leader/IO node), but I think that's the problem. > > Cheers, > --Geoff > > "Edwin Fine" writes: > >> +1 >> >> The lack of tab keyword expansion on remsh annoys the heck out of me. I am >> glad you brought it up. >> >> On Thu, Sep 25, 2008 at 3:48 PM, Serge Aleynikov wrote: >> >>> When using -remsh option to start a shell on a remote node, is there a >>> way to have tab expansion in the shell work by printing the expansion >>> hints in the remote shell? >>> >>> Serge > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bengt.kleberg@REDACTED Fri Sep 26 07:36:25 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 26 Sep 2008 07:36:25 +0200 Subject: [erlang-questions] Millions of processes? In-Reply-To: References: <6a36e7290809230831i738b27c6n5de4b16e9e8867c1@mail.gmail.com> <19631434.post@talk.nabble.com> <48D922CA.8030309@ericsson.com> <1222251835.7604.58.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> <48DB1F8C.2050206@ghostgun.com> <1222324741.21786.6.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Message-ID: <1222407385.12748.40.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Greetings, I had not at the time heard of a generic benchmark for this kind of comparison. There was no benchmark of anything mentioned in the article. The benchmarks I found, with micro kernels being faster than macro kernels, involved running a web server, copying file trees, etc. I do agree that some things are more important than performance (slow and correct is generally better than fast and wrong), but this is (as usual) not a black and white question. What if we get an almost correct answer in time, compared to an accurate answer too late? bengt On Thu, 2008-09-25 at 10:30 -0400, Toby Thain wrote: > On 25-Sep-08, at 2:39 AM, Bengt Kleberg wrote: > > > There where other micro kernels around at the time. At least 2 had > > benchmarks showing them to be faster than ''macro kernels''. > > Does a generic 'faster' metric/scale really exist when comparing > operating systems? > > What I tend to see in benchmarks of complex systems like filesystems, > databases, operating systems is that it's multivariate, workload > dependent, and simply leads to differing sweet spots. And frequently, > there are important attributes unconnected with performance... > > --Toby > > > > > > > bengt > > > > On Thu, 2008-09-25 at 15:20 +1000, jm wrote: > >> This was generally true only of the early micro kernels. > >> Apparently, the > >> Mach kernel is slow when compared to the newer L4 kernel. see > >> http://en.wikipedia.org/wiki/L4_microkernel_family#History > >> > >> Jeff. > >> > >> Bengt Kleberg wrote: > >>> Greetings, > >>> > >>> It is not only _ideas_ in computer science that are held in > >>> contempt (as > >>> quoted below). Ages ago (before 2000) I read an article about > >>> Linux in > >>> embedded environments. The article quoted Linus Torvalds on why > >>> not to > >>> use micro kernels. The reasons where that they are: > >>> 1 Experimental > >>> 2 Complex > >>> 3 Slow > >>> > >>> After looking around for a while I found plenty of articles about > >>> commercial micro kernels, and benchmarks showing micro kernels > >>> running > >>> workloads faster than monolithic kernels. So 1 and 3 seemed to be > >>> incorrect. > >>> I submitted these findings to the magazine, which prompted an answer > >>> from Mr Torvalds. He assert that all three where true, but did not > >>> discuss what I had found. So (IMHO) it is also facts that are not > >>> held > >>> in very high regard. > >>> > >>> > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > From mats.cronqvist@REDACTED Fri Sep 26 11:55:25 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Fri, 26 Sep 2008 11:55:25 +0200 Subject: [erlang-questions] Redirect -remsh output In-Reply-To: <48DC6456.1090402@gmail.com> References: <48DBEB16.9050903@gmail.com> <6c2563b20809251604v506fc646g1c31ec1b156b8686@mail.gmail.com> <48DC6456.1090402@gmail.com> Message-ID: <48DCB18D.7040709@gmail.com> Serge Aleynikov wrote: > I believe you are right, as tab-expansion works only on some standard > modules (e.g. stdlib, kernel, etc) that are in the path on both nodes. > > So, adding the appropriate rpc:call/4 in both places should fix the issue. > from the shell; io:setopts([{expand_fun,fun(B)->rpc:call(RemoteNode,edlin_expand,expand,[B]) end}]). patch; --- /home/masse/wrk/user_drv.erl 2008-09-26 11:54:04.000000000 +0200 +++ /usr/lib/erlang/lib/kernel-2.12.3/src/user_drv.erl 2008-07-20 07:14:47.000000000 +0200 @@ -113,11 +113,7 @@ case init:get_argument(remsh) of {ok,[[Node]]} -> RShell = {list_to_atom(Node),shell,start,[]}, - RGr = - group:start(self(), RShell, - [{expand_fun, - fun(B)->rpc:call(Node,edlin_expand,expand,[B] - end)}]), + RGr = group:start(self(), RShell), {RGr,RShell}; E when E =:= error ; E =:= {ok,[[]]} -> {group:start(self(), Shell),Shell} From csanto@REDACTED Fri Sep 26 13:14:53 2008 From: csanto@REDACTED (Corrado Santoro) Date: Fri, 26 Sep 2008 13:14:53 +0200 Subject: [erlang-questions] Problems cross-compiling OTP on ARM Message-ID: <48DCC42D.70302@diit.unict.it> Hello, I'm trying to cross-compile OTP on a ARM9 architecture and I'm compiling R11B-5. The build stops generating the following linker error: obj/arm-unknown-linux-gnu/opt/hybrid/erl_bif_table.o:(.data+0x2c80): undefined reference to `hipe_bifs_write_u8_2' obj/arm-unknown-linux-gnu/opt/hybrid/erl_bif_table.o:(.data+0x2c94): undefined reference to `hipe_bifs_write_u32_2' obj/arm-unknown-linux-gnu/opt/hybrid/erl_bif_table.o:(.data+0x2ca8): undefined reference to `hipe_bifs_bytearray_2' obj/arm-unknown-linux-gnu/opt/hybrid/erl_bif_table.o:(.data+0x2cbc): undefined reference to `hipe_bifs_bytearray_sub_2' obj/arm-unknown-linux-gnu/opt/hybrid/erl_bif_table.o:(.data+0x2cd0): undefined reference to `hipe_bifs_bytearray_update_3' ... The strange thing is that I've disabled hipe (./configure --disable_hipe), but it seems that hipe is still considered? The "configure" line I'm using is: ./configure --target=arm-linux --host=arm-linux --disable-hipe --without-jinterface Any hint? Thanks, --Corrado -- ================================================================== Eng. Corrado Santoro, Ph.D. University of Catania - ITALY Dept. of Mathematics and Informatics VoIP: sip:7035@REDACTED ================================================================== From saleyn@REDACTED Fri Sep 26 13:59:16 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Fri, 26 Sep 2008 07:59:16 -0400 Subject: [erlang-questions] Redirect -remsh output In-Reply-To: <48DCB18D.7040709@gmail.com> References: <48DBEB16.9050903@gmail.com> <6c2563b20809251604v506fc646g1c31ec1b156b8686@mail.gmail.com> <48DC6456.1090402@gmail.com> <48DCB18D.7040709@gmail.com> Message-ID: <48DCCE94.4050603@gmail.com> Mats, Thanks for nailing this down! One little correction for those who will use the patch is that this needs to be applied as a reverse patch. Serge Mats Cronqvist wrote: > Serge Aleynikov wrote: >> I believe you are right, as tab-expansion works only on some standard >> modules (e.g. stdlib, kernel, etc) that are in the path on both nodes. >> >> So, adding the appropriate rpc:call/4 in both places should fix the >> issue. >> > from the shell; > io:setopts([{expand_fun,fun(B)->rpc:call(RemoteNode,edlin_expand,expand,[B]) > end}]). > > patch; > --- /home/masse/wrk/user_drv.erl 2008-09-26 11:54:04.000000000 +0200 > +++ /usr/lib/erlang/lib/kernel-2.12.3/src/user_drv.erl 2008-07-20 > 07:14:47.000000000 +0200 > @@ -113,11 +113,7 @@ > case init:get_argument(remsh) of > {ok,[[Node]]} -> > RShell = {list_to_atom(Node),shell,start,[]}, > - RGr = > - group:start(self(), RShell, > - [{expand_fun, > - > fun(B)->rpc:call(Node,edlin_expand,expand,[B] > - end)}]), > + RGr = group:start(self(), RShell), > {RGr,RShell}; > E when E =:= error ; E =:= {ok,[[]]} -> > {group:start(self(), Shell),Shell} > > From saleyn@REDACTED Fri Sep 26 14:29:57 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Fri, 26 Sep 2008 08:29:57 -0400 Subject: [erlang-questions] Redirect -remsh output In-Reply-To: <48DCB18D.7040709@gmail.com> References: <48DBEB16.9050903@gmail.com> <6c2563b20809251604v506fc646g1c31ec1b156b8686@mail.gmail.com> <48DC6456.1090402@gmail.com> <48DCB18D.7040709@gmail.com> Message-ID: <48DCD5C5.8040804@gmail.com> Actually there is a little bug in the patch which is fixed in the attachment. I would definitely vote for including this in the OTP distribution! Serge Mats Cronqvist wrote: > Serge Aleynikov wrote: >> I believe you are right, as tab-expansion works only on some standard >> modules (e.g. stdlib, kernel, etc) that are in the path on both nodes. >> >> So, adding the appropriate rpc:call/4 in both places should fix the >> issue. >> > from the shell; > io:setopts([{expand_fun,fun(B)->rpc:call(RemoteNode,edlin_expand,expand,[B]) > end}]). > > patch; > --- /home/masse/wrk/user_drv.erl 2008-09-26 11:54:04.000000000 +0200 > +++ /usr/lib/erlang/lib/kernel-2.12.3/src/user_drv.erl 2008-07-20 > 07:14:47.000000000 +0200 > @@ -113,11 +113,7 @@ > case init:get_argument(remsh) of > {ok,[[Node]]} -> > RShell = {list_to_atom(Node),shell,start,[]}, > - RGr = > - group:start(self(), RShell, > - [{expand_fun, > - > fun(B)->rpc:call(Node,edlin_expand,expand,[B] > - end)}]), > + RGr = group:start(self(), RShell), > {RGr,RShell}; > E when E =:= error ; E =:= {ok,[[]]} -> > {group:start(self(), Shell),Shell} > > -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: user_drv.erl.patch URL: From mats.cronqvist@REDACTED Fri Sep 26 14:47:59 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Fri, 26 Sep 2008 14:47:59 +0200 Subject: [erlang-questions] Redirect -remsh output In-Reply-To: <48DCCE94.4050603@gmail.com> References: <48DBEB16.9050903@gmail.com> <6c2563b20809251604v506fc646g1c31ec1b156b8686@mail.gmail.com> <48DC6456.1090402@gmail.com> <48DCB18D.7040709@gmail.com> <48DCCE94.4050603@gmail.com> Message-ID: <48DCD9FF.4000908@gmail.com> Serge Aleynikov wrote: > Mats, > > Thanks for nailing this down! One little correction for those who > will use the patch is that this needs to be applied as a reverse patch. so i take it the patch was mostly OK. good to hear, 'cause i was too hasty with it. i haven't actually tested it. bad practice, but i wanted to get something out before lunch... From matthias@REDACTED Fri Sep 26 14:48:50 2008 From: matthias@REDACTED (Matthias Lang) Date: Fri, 26 Sep 2008 14:48:50 +0200 Subject: [erlang-questions] Problems cross-compiling OTP on ARM In-Reply-To: <48DCC42D.70302@diit.unict.it> References: <48DCC42D.70302@diit.unict.it> Message-ID: <20080926124850.GA28625@contorpis.lisalinda.com> On Friday, September 26, Corrado Santoro wrote: > The strange thing is that I've disabled hipe (./configure > --disable_hipe), but it seems that hipe is still considered? You've pretty much figured it out: --disable_hipe would more accurately be --disable_some_parts_of_hipe_but_not_others_which_is_fine_unless_you're_cross_compiling_in_which_case_its_a_bit_of_a_pain So, it's a question which comes up on the list every so often in connection with cross compiling. There's an article on the trapexit wiki showing how I cross-compile R10B. Others have successfully followed those instructions for a variety of CPUs. For R11B, I use slightly different patches. I've attached them. Matthias -------------- next part -------------- A non-text attachment was scrubbed... Name: r11b2_cross_compile_patches.zip Type: application/zip Size: 2172 bytes Desc: not available URL: From mats.cronqvist@REDACTED Fri Sep 26 14:53:32 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Fri, 26 Sep 2008 14:53:32 +0200 Subject: [erlang-questions] Redirect -remsh output In-Reply-To: <48DCD5C5.8040804@gmail.com> References: <48DBEB16.9050903@gmail.com> <6c2563b20809251604v506fc646g1c31ec1b156b8686@mail.gmail.com> <48DC6456.1090402@gmail.com> <48DCB18D.7040709@gmail.com> <48DCD5C5.8040804@gmail.com> Message-ID: <48DCDB4C.80209@gmail.com> Serge Aleynikov wrote: > Actually there is a little bug in the patch which is fixed in the > attachment. i use the Erlang Way for my patches; "send and pray." > I would definitely vote for including this in the OTP distribution! yes, it's hard to see why you would want to do the tab expansion on the local machine. mats From mikpe@REDACTED Fri Sep 26 19:15:53 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Fri, 26 Sep 2008 19:15:53 +0200 Subject: [erlang-questions] Problems cross-compiling OTP on ARM In-Reply-To: <20080926124850.GA28625@contorpis.lisalinda.com> References: <48DCC42D.70302@diit.unict.it> <20080926124850.GA28625@contorpis.lisalinda.com> Message-ID: <18653.6345.495590.200475@harpo.it.uu.se> Matthias Lang writes: > On Friday, September 26, Corrado Santoro wrote: > > > The strange thing is that I've disabled hipe (./configure > > --disable_hipe), but it seems that hipe is still considered? > > You've pretty much figured it out: --disable_hipe would more accurately > be --disable_some_parts_of_hipe_but_not_others_which_is_fine_unless_you're_cross_compiling_in_which_case_its_a_bit_of_a_pain The reason for that is that dialyzer for reasons I don't know/remember uses parts of HiPE, and it was decided (jointly by the dialyzer group and OTP) to keep parts of HiPE even if --disable-hipe is in effect so that dialyzer can work. I don't think the cross-compilation scenario was ever mentioned in those discussions. /Mikael From klacke@REDACTED Fri Sep 26 22:29:49 2008 From: klacke@REDACTED (Claes Wikstrom) Date: Fri, 26 Sep 2008 22:29:49 +0200 Subject: [erlang-questions] Problems cross-compiling OTP on ARM In-Reply-To: <18653.6345.495590.200475@harpo.it.uu.se> References: <48DCC42D.70302@diit.unict.it> <20080926124850.GA28625@contorpis.lisalinda.com> <18653.6345.495590.200475@harpo.it.uu.se> Message-ID: <48DD463D.60902@hyber.org> Mikael Pettersson wrote: > I don't think the cross-compilation scenario was ever mentioned in > those discussions. > Cross compilation support in the OTP make structure is severely missing. I believe this is a truly important part that should be addressed in a more formal way that Matt Langs patch set. Quite a bit of work to get cross compile support all the way into OTP make - and support it. Nevertheless, truly important issue for device developers. This should be done. At Tail-f we have one customer running on xscale and we're crosscompiling for that cpu - pain. /klacke From rvirding@REDACTED Fri Sep 26 23:41:58 2008 From: rvirding@REDACTED (Robert Virding) Date: Fri, 26 Sep 2008 23:41:58 +0200 Subject: [erlang-questions] Running another shell at startup Message-ID: <3dbc6d1c0809261441p62881387ma043b3c9b001e135@mail.gmail.com> I would like to run another shell other than the Erlang shell at startup, but still have user_drv with all its goodies running. How do I do it? I know that you can pass an intial shell argument into user_drv but I can't see how to get it there. N.B. What I would like is the normal startup just with another shell instead. I really want to know, Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From babo.online@REDACTED Fri Sep 26 23:55:16 2008 From: babo.online@REDACTED (Attila Babo) Date: Fri, 26 Sep 2008 23:55:16 +0200 Subject: [erlang-questions] Writing my own REPL In-Reply-To: References: Message-ID: <597c69660809261455v69c947a4h904c5f1ab0bbbfbf@mail.gmail.com> Your init function returns immediately then you asked for init:stop() so Erlang quits as you ordered. What's wrong with a simple REPL cycle using your code like this: erl -noshell -s myshell loop -s init stop Take a look at LFE (git://github.com/rvirding/lfe.git), it works as expected: erl -noshell -s lfe_shell server -s init stop -pa ebin From rvirding@REDACTED Sat Sep 27 00:01:36 2008 From: rvirding@REDACTED (Robert Virding) Date: Sat, 27 Sep 2008 00:01:36 +0200 Subject: [erlang-questions] Writing my own REPL In-Reply-To: <597c69660809261455v69c947a4h904c5f1ab0bbbfbf@mail.gmail.com> References: <597c69660809261455v69c947a4h904c5f1ab0bbbfbf@mail.gmail.com> Message-ID: <3dbc6d1c0809261501k1d93fc0bja61705b73e034b2c@mail.gmail.com> Does it? I didn't know that. :-) However if I do -noshell do I still user_drv running with its ability to do ^G? Which I want (see another question). Robert 2008/9/26 Attila Babo > Your init function returns immediately then you asked for init:stop() > so Erlang quits as you ordered. What's wrong with a simple REPL cycle > using your code like this: > erl -noshell -s myshell loop -s init stop > > Take a look at LFE (git://github.com/rvirding/lfe.git), it works as > expected: > erl -noshell -s lfe_shell server -s init stop -pa ebin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From babo.online@REDACTED Sat Sep 27 00:06:15 2008 From: babo.online@REDACTED (Attila Babo) Date: Sat, 27 Sep 2008 00:06:15 +0200 Subject: [erlang-questions] Writing my own REPL In-Reply-To: <3dbc6d1c0809261501k1d93fc0bja61705b73e034b2c@mail.gmail.com> References: <597c69660809261455v69c947a4h904c5f1ab0bbbfbf@mail.gmail.com> <3dbc6d1c0809261501k1d93fc0bja61705b73e034b2c@mail.gmail.com> Message-ID: <597c69660809261506n6df10543k26aecfb2c5443901@mail.gmail.com> % erl -noshell -s lfe_shell server -s init stop -pa ebin LFE Shell V5.6.4 (abort with ^G) >(: c i) There is no shell or user_drv loaded, so ^G is not available. From matthias@REDACTED Fri Sep 26 23:21:31 2008 From: matthias@REDACTED (Matthias Lang) Date: Fri, 26 Sep 2008 23:21:31 +0200 Subject: [erlang-questions] Problems cross-compiling OTP on ARM In-Reply-To: <48DD463D.60902@hyber.org> References: <48DCC42D.70302@diit.unict.it> <20080926124850.GA28625@contorpis.lisalinda.com> <18653.6345.495590.200475@harpo.it.uu.se> <48DD463D.60902@hyber.org> Message-ID: <20080926212131.GA567@contorpis.lisalinda.com> On Friday, September 26, Claes Wikstrom wrote: > Cross compilation support in the OTP make structure is severely > missing. I believe this is a truly important part that should be > addressed in a more formal way that Matt Langs patch set. Yes, I agree, my patches are quick and dirty. I was far too much of a coward to even think about a complete fix. Though some of the things in the patches, especially Brian Zhou's, should be completely non-controversial, e.g. -DED_LD=ld +if test "x$LD" = x; then + DED_LD=ld +else + DED_LD=$LD +fi but still they get ignored. I'm guessing there aren't any paying customers that need cross compilation. > Quite a bit of work to get cross compile support all the way > into OTP make - and support it. Yes, exactly. And it's going to be unpleasant, unglamorous and thankless work. I bet it's at the top of someone's list ;-) Matt From tony@REDACTED Sat Sep 27 00:25:29 2008 From: tony@REDACTED (Tony Arcieri) Date: Fri, 26 Sep 2008 16:25:29 -0600 Subject: [erlang-questions] Writing my own REPL In-Reply-To: <597c69660809261506n6df10543k26aecfb2c5443901@mail.gmail.com> References: <597c69660809261455v69c947a4h904c5f1ab0bbbfbf@mail.gmail.com> <3dbc6d1c0809261501k1d93fc0bja61705b73e034b2c@mail.gmail.com> <597c69660809261506n6df10543k26aecfb2c5443901@mail.gmail.com> Message-ID: On Fri, Sep 26, 2008 at 4:06 PM, Attila Babo wrote: > There is no shell or user_drv loaded, so ^G is not available. > Well, hence the problem. How do I start user_drv for a custom shell and start the whole thing from the command line? I've tried user_drv:start('tty_sl -c -e', {myshell, start, []}) and that also never executes my shell. Should I write a custom user_sup to start from the command line? -- Tony Arcieri medioh.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From S.J.Thompson@REDACTED Tue Sep 23 21:48:59 2008 From: S.J.Thompson@REDACTED (S.J.Thompson) Date: Tue, 23 Sep 2008 20:48:59 +0100 (BST) Subject: [erlang-questions] New release of Wrangler, the Erlang refactorer Message-ID: We are pleased to let you know that we have just announced a new release of Wrangler (the Erlang refactorer). The current snapshot supports a number of basic structural refactorings, data-related refactorings, process-related refactorings, as well as duplicated code detection. You can get Wrangler 0.5 (bundled with Distel) via http://www.cs.kent.ac.uk/projects/forse/ The current snapshot is embedded in Emacs, but we are now in the process of integrating Wrangler with Erlide, the Erlang IDE powered by Eclipse. You are very welcome to try it out, and send us your comments, suggestions, or refactoring ideas. Our project email address is: erlang-refactor@REDACTED Best Regards, Simon Thompson and Huiqing Li From H.Li@REDACTED Tue Sep 23 12:16:44 2008 From: H.Li@REDACTED (H.Li@REDACTED) Date: Tue, 23 Sep 2008 11:16:44 +0100 (BST) Subject: [erlang-questions] [ANN] Erlang refactorer -- Wrangler 0.5 Message-ID: <60942.86.154.149.168.1222165004.squirrel@webmail.cs.kent.ac.uk> Dear Erlang users, We are pleased to announce the availability of Wrangler 0.5, a snapshot of our Erlang Refactorer prototype. The current snapshot supports a number of basic structural refactorings, data-related refactorings, process-related refactorings, as well as duplicated code detection. You can get Wrangler 0.5 (bundled with Distel) via http://www.cs.kent.ac.uk/projects/forse/ Please see the README and Documentation for build/use instructions, and let us know about any problems, bugs, suggestions. Our project Email address is: erlang-refactor@REDACTED The current snapshot is still embedded in Emacs, but we are now in the process of integrating Wrangler with Erlide, the Erlang IDE powered by Eclipse. Happy Refactoring! Simon Thompson, Huiqing Li From saleyn@REDACTED Sat Sep 27 01:33:58 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Fri, 26 Sep 2008 19:33:58 -0400 Subject: [erlang-questions] Redirect -remsh output In-Reply-To: <48DCDB4C.80209@gmail.com> References: <48DBEB16.9050903@gmail.com> <6c2563b20809251604v506fc646g1c31ec1b156b8686@mail.gmail.com> <48DC6456.1090402@gmail.com> <48DCB18D.7040709@gmail.com> <48DCD5C5.8040804@gmail.com> <48DCDB4C.80209@gmail.com> Message-ID: <48DD7166.4060809@gmail.com> Mats Cronqvist wrote: > Serge Aleynikov wrote: >> Actually there is a little bug in the patch which is fixed in the >> attachment. > i use the Erlang Way for my patches; "send and pray." At least your "send and play" cured my "tab and cry". ;-) From bgustavsson@REDACTED Sat Sep 27 08:15:49 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Sat, 27 Sep 2008 08:15:49 +0200 Subject: [erlang-questions] Problems cross-compiling OTP on ARM In-Reply-To: <18653.6345.495590.200475@harpo.it.uu.se> References: <48DCC42D.70302@diit.unict.it> <20080926124850.GA28625@contorpis.lisalinda.com> <18653.6345.495590.200475@harpo.it.uu.se> Message-ID: <6672d0160809262315n72c52832l94b8ea3aa112b752@mail.gmail.com> On Fri, Sep 26, 2008 at 7:15 PM, Mikael Pettersson wrote: > Matthias Lang writes: > > On Friday, September 26, Corrado Santoro wrote: > > > > > The strange thing is that I've disabled hipe (./configure > > > --disable_hipe), but it seems that hipe is still considered? > > > > You've pretty much figured it out: --disable_hipe would more accurately > > be > --disable_some_parts_of_hipe_but_not_others_which_is_fine_unless_you're_cross_compiling_in_which_case_its_a_bit_of_a_pain > > The reason for that is that dialyzer for reasons I don't know/remember > uses parts of HiPE, and it was decided (jointly by the dialyzer group > and OTP) to keep parts of HiPE even if --disable-hipe is in effect so > that dialyzer can work. > Yes, that is correct. Actually, I think that the current version of Dialyzer does not use HiPE as much as it used to. It used to run the first pass of HiPE compiler and do its analysis on the icode format, but as far as I know, Dialyzer now does the entire analysis using Core Erlang and only uses a few modules in hipe/cerl (which are pure Erlang, and not dependent on any HiPE support in the run-time system). Tobias or Kostis could confirm those details, but I think that it would be enough to include only the hipe/cerl sub-directory to support Dialyzer. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From csanto@REDACTED Sat Sep 27 10:17:25 2008 From: csanto@REDACTED (Corrado Santoro) Date: Sat, 27 Sep 2008 10:17:25 +0200 Subject: [erlang-questions] Cross-compiling on ARM: PAIN! Message-ID: <48DDEC15.1090004@diit.unict.it> Hello again, I've applied the Matthias' patch and the compilation goes on, but it still stops when compiling beam_emu.c; this is the error: beam/beam_emu.c: In function 'process_main': beam/beam_emu.c:1323: error: label 'lb_hipe_trap_throw' used but not defined beam/beam_emu.c:1323: error: label 'lb_hipe_trap_return' used but not defined beam/beam_emu.c:1323: error: label 'lb_hipe_trap_resume' used but not defined beam/beam_emu.c:1323: error: label 'lb_hipe_trap_reschedule' used but not defined beam/beam_emu.c:1323: error: label 'lb_hipe_trap_call_closure' used but not defined beam/beam_emu.c:1323: error: label 'lb_hipe_trap_call' used but not defined beam/beam_emu.c:1323: error: label 'lb_hipe_call_count' used but not defined It seems that those labels, which are defined in the code parts enabled by #define HIPE, are in any case referenced in other sources (maybe beam_opcodes.h) without protecting them by #ifdef HIPE/#endif. So... before starting to make myself lost in the million lines of C source which will drive me mad :-) ... plaase, has someone some suggestions? :-) I'm using R11B-5 without HIPE. Thanks again, --Corrado -- ================================================================== Eng. Corrado Santoro, Ph.D. University of Catania - ITALY Dept. of Mathematics and Informatics VoIP: sip:7035@REDACTED ================================================================== From webaccounts@REDACTED Sat Sep 27 12:49:02 2008 From: webaccounts@REDACTED (Dan Rubino) Date: Sat, 27 Sep 2008 11:49:02 +0100 Subject: [erlang-questions] Release building path question Message-ID: <1222512542.5895.9.camel@linux-box> Hi all, I am trying to build a release and would like to include multiple applications I have built. I am able to build a release which includes any number of the apps which come with the erlang distribution i.e. in the erlang/lib directory. Now it seems somehow that lib directory is on a path somewhere. If I want to add several of my own apps which are in other locations how would I go about ensuring they are picked up when I build the release? Is there some way of setting a path i.e. each apps ebin directory so that the release builder can pick them up? Thanks, Dan From webaccounts@REDACTED Sat Sep 27 12:18:45 2008 From: webaccounts@REDACTED (Dan Rubino) Date: Sat, 27 Sep 2008 11:18:45 +0100 Subject: [erlang-questions] Appmon not starting under ubuntu linux Message-ID: <1222510725.5895.4.camel@linux-box> Hi all, I normally develop my Erlang apps under windows but this weekend am having a go under Linux. My apps compile and start fine however when I try and run appmon i.e. appmon:start(). The console just hangs and doesnt open the appmon interface. I am running 5.5.5 - anyone come across this before? Thanks, Dan From mikpe@REDACTED Sat Sep 27 13:51:06 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Sat, 27 Sep 2008 13:51:06 +0200 Subject: [erlang-questions] Cross-compiling on ARM: PAIN! In-Reply-To: <48DDEC15.1090004@diit.unict.it> References: <48DDEC15.1090004@diit.unict.it> Message-ID: <18654.7722.169470.289819@harpo.it.uu.se> Corrado Santoro writes: > Hello again, > > I've applied the Matthias' patch and the compilation goes on, but it > still stops when compiling beam_emu.c; this is the error: > > beam/beam_emu.c: In function 'process_main': > beam/beam_emu.c:1323: error: label 'lb_hipe_trap_throw' used but not defined > beam/beam_emu.c:1323: error: label 'lb_hipe_trap_return' used but not > defined > beam/beam_emu.c:1323: error: label 'lb_hipe_trap_resume' used but not > defined > beam/beam_emu.c:1323: error: label 'lb_hipe_trap_reschedule' used but > not defined > beam/beam_emu.c:1323: error: label 'lb_hipe_trap_call_closure' used but > not defined > beam/beam_emu.c:1323: error: label 'lb_hipe_trap_call' used but not defined > beam/beam_emu.c:1323: error: label 'lb_hipe_call_count' used but not defined > > > It seems that those labels, which are defined in the code parts enabled > by #define HIPE, are in any case referenced in other sources (maybe > beam_opcodes.h) without protecting them by #ifdef HIPE/#endif. > > So... before starting to make myself lost in the million lines of C > source which will drive me mad :-) ... plaase, has someone some > suggestions? :-) > > I'm using R11B-5 without HIPE. Looks like you have leftovers from a previous HiPE-enabled build in the same OTP source tree. Either don't do that (always build in a clean tree), or enable HiPE. From n39052@REDACTED Sat Sep 27 16:36:49 2008 From: n39052@REDACTED (Sergey A.) Date: Sat, 27 Sep 2008 07:36:49 -0700 Subject: [erlang-questions] Erlang - Postgresql Driver Message-ID: <3bff71aa0809270736x2bf4f965p60e8697587b98643@mail.gmail.com> Hello. > I used postgreSql database with Erlang by using erlang - postgresql driver got from "erlang-consulting.com". > I need a higher rate of insertation with other basic operations. > Is this driver support for this capacity? If any other alternatives? As mentioned above, there is a fork of jungerl pgsql driver maintained by ejabberd developers. A svn-branch called gen_fsm_rewrite representing a new version of pgsql - pgsql2 - is >2x faster than original pgsql and have function for batch inserts/updates (I'm about fun pgsql2:execute_many/3). The driver also support transactions, and is active developed. You can get the source by the following command: svn checkout https://svn.process-one.net/ejabberd-modules/pgsql/branches/gen_fsm_rewrite/ pgsql2 Documentation is included. To take a look at svn commits, see the following: https://forge.process-one.net/browse/ejabberd-modules/pgsql/branches/gen_fsm_rewrite I beleive that pgsql2 is currently the best solution to communicate with PostgreSQL from Erlang. -- Sergey. From saleyn@REDACTED Sat Sep 27 17:10:43 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Sat, 27 Sep 2008 11:10:43 -0400 Subject: [erlang-questions] Erlang & .NET Message-ID: <48DE4CF3.6090407@gmail.com> In a recent need to have a rich UI client for some of my UNIX processes, this week I was playing with the otp.net contribution (from jungerl) that implements an Erlang node in .NET. Given limited experience with .NET I was quite impressed with how easy it was to get a node running in .NET that exchanges terms with the Erlang VM. After making some improvements to otp.net I ran into a need to be able to have a shell in the UI to execute ad-hoc commands on a distributed node running elsewhere. I understand that this can be accomplished by passing a string to be evaluated to the Erlang node that would do the parsing and execution, but I'd rather have the parser on the C# side. This brings the question of whether anyone has an open-source implementation of the Erlang term parser in .NET. Serge From vances@REDACTED Sat Sep 27 18:39:16 2008 From: vances@REDACTED (Vance Shipley) Date: Sat, 27 Sep 2008 12:39:16 -0400 Subject: [erlang-questions] Release building path question In-Reply-To: <1222512542.5895.9.camel@linux-box> References: <1222512542.5895.9.camel@linux-box> Message-ID: <20080927163916.GE48159@h216-235-12-173.host.egate.net> Dan, Use the {path,[Dir]} option to systools:make_tar/2: systools:make_tar(foo, [{path, "../*/ebin"}]) There is some magic which picks up files based on where it expects them to be. Be sure to structure the directories properly; foo/ebin, foo/src, foo/priv, bar/ebin, bar/src, bar/priv. Add the option {dirs, [IncDir]} to include any extra directories: systools:make_tar(foo, [{path, "../*/ebin"},{dirs, [src,priv]}]) That should do it. -Vance On Sat, Sep 27, 2008 at 11:49:02AM +0100, Dan Rubino wrote: } Is there some way of setting a path i.e. each apps ebin directory so } that the release builder can pick them up? From rvirding@REDACTED Sat Sep 27 20:45:57 2008 From: rvirding@REDACTED (Robert Virding) Date: Sat, 27 Sep 2008 20:45:57 +0200 Subject: [erlang-questions] Loading code generated on the fly Message-ID: <3dbc6d1c0809271145v3f461df2h80ab6c431e66d438@mail.gmail.com> I am generating compiled erlang code on the fly without saving using files (using LFE) and need to load the compiled binary into the system. Now, I know how to do myself "by hand" but I would prefer to go through the normal code loader to keep it all clean. There is a call code:load_binary(Module, FileName, Binary) which seems to do what I want, BUT there is this argument FileName. Now I don't intend to save the module in a file unless I really have to as it seems like a bit of unnecessary work to save it in a file just so I can load it. What is the significance of the FileName argument and does it matter what I set it to? Can I just call Module.beam and be done with? Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Sat Sep 27 21:00:40 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sat, 27 Sep 2008 21:00:40 +0200 Subject: [erlang-questions] Loading code generated on the fly In-Reply-To: <3dbc6d1c0809271145v3f461df2h80ab6c431e66d438@mail.gmail.com> References: <3dbc6d1c0809271145v3f461df2h80ab6c431e66d438@mail.gmail.com> Message-ID: <95be1d3b0809271200q3327c334gb24356451fbe8461@mail.gmail.com> Hi! 2008/9/27 Robert Virding : > There is a call code:load_binary(Module, FileName, Binary) which seems to do > what I want, BUT there is this argument FileName. Now I don't intend to save > the module in a file unless I really have to as it seems like a bit of > unnecessary work to save it in a file just so I can load it. What is the > significance of the FileName argument and does it matter what I set it to? > Can I just call Module.beam and be done with? I think so, we do it like this for ErlIDE and didn't had any problems related to that. Yet. ;-) best regards, Vlad From erlang-questions_efine@REDACTED Sat Sep 27 21:06:12 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 27 Sep 2008 15:06:12 -0400 Subject: [erlang-questions] Loading code generated on the fly In-Reply-To: <3dbc6d1c0809271145v3f461df2h80ab6c431e66d438@mail.gmail.com> References: <3dbc6d1c0809271145v3f461df2h80ab6c431e66d438@mail.gmail.com> Message-ID: <6c2563b20809271206t63e99a03sc66f519fc9dee1b4@mail.gmail.com> This is what I have been using successfully for a short while now. Hope this helps. %% %% Compile from string hack by Mats Cronqvist (Thank You!!) %% NOTE: Does not work if there are macros in Text! %% compile_and_load(Text) -> try Forms = ?MODULE:scan_and_parse(Text, 1, []), {ok, Mod, Bin} = compile:forms(Forms), {module, _M} = code:load_binary(Mod, "generated", Bin), io:format( "~p:compile_and_load replaced module ~p with [~s]~n", [?MODULE, Mod, Text] ), code:purge(Mod), ok catch Err:Reason -> io:format( "compile_and_load failed, err:reason {~p:~p}~n~p~n", [Err, Reason, Text] ), {Err, Reason} end. scan_and_parse([], _Line, Forms) -> lists:reverse(Forms); scan_and_parse(Text, Line, Forms) -> {done, {ok, Toks, NLine}, Cont} = erl_scan:tokens([], Text, Line), {ok, Form} = erl_parse:parse_form(Toks), ?MODULE:scan_and_parse(Cont, NLine, [Form|Forms]). 2008/9/27 Robert Virding > I am generating compiled erlang code on the fly without saving using files > (using LFE) and need to load the compiled binary into the system. Now, I > know how to do myself "by hand" but I would prefer to go through the normal > code loader to keep it all clean. > > There is a call code:load_binary(Module, FileName, Binary) which seems to > do what I want, BUT there is this argument FileName. Now I don't intend to > save the module in a file unless I really have to as it seems like a bit of > unnecessary work to save it in a file just so I can load it. What is the > significance of the FileName argument and does it matter what I set it to? > Can I just call Module.beam and be done with? > > Robert > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From klacke@REDACTED Sat Sep 27 21:08:59 2008 From: klacke@REDACTED (Claes Wikstrom) Date: Sat, 27 Sep 2008 21:08:59 +0200 Subject: [erlang-questions] Problems cross-compiling OTP on ARM In-Reply-To: <20080926212131.GA567@contorpis.lisalinda.com> References: <48DCC42D.70302@diit.unict.it> <20080926124850.GA28625@contorpis.lisalinda.com> <18653.6345.495590.200475@harpo.it.uu.se> <48DD463D.60902@hyber.org> <20080926212131.GA567@contorpis.lisalinda.com> Message-ID: <48DE84CB.7040608@hyber.org> Matthias Lang wrote: > Yes, exactly. And it's going to be unpleasant, unglamorous and thankless > work. I bet it's at the top of someone's list ;-) > Yeah, like mine. And as for "paying customers", I don't think it has been possible to become one in several years. The xcompile pain is ... well big. We now xcompile to one additional cpu, I shudder to 1. Port that stuff into latest greatest OTP 2. Have one additional xcompile cpu to support. Also, not just unglamorous and thankless, difficult too. /klacke From klacke@REDACTED Sat Sep 27 21:16:37 2008 From: klacke@REDACTED (Claes Wikstrom) Date: Sat, 27 Sep 2008 21:16:37 +0200 Subject: [erlang-questions] Loading code generated on the fly In-Reply-To: <3dbc6d1c0809271145v3f461df2h80ab6c431e66d438@mail.gmail.com> References: <3dbc6d1c0809271145v3f461df2h80ab6c431e66d438@mail.gmail.com> Message-ID: <48DE8695.8010402@hyber.org> Robert Virding wrote: > I am generating compiled erlang code on the fly without saving using > files (using LFE) and need to load the compiled binary into the system. > Now, I know how to do myself "by hand" but I would prefer to go through > the normal code loader to keep it all clean. I have a similar situation in yaws, however I chose to actually write the .erl file. In retrospect this has been very good for debugging over the years. /klacke From erlang-questions_efine@REDACTED Sat Sep 27 21:19:55 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 27 Sep 2008 15:19:55 -0400 Subject: [erlang-questions] Appmon not starting under ubuntu linux In-Reply-To: <1222510725.5895.4.camel@linux-box> References: <1222510725.5895.4.camel@linux-box> Message-ID: <6c2563b20809271219u10855d72o26fa3415293c3fbe@mail.gmail.com> Dan, appmon uses graphics, which need X. In Windows, graphics are built in so you need nothing special. I assume you are not logged in as superuser. Try the following: $ xterm If you see an xterm, your appmon should have worked. If you get an error message, there are two things I can think of off the top of my head that might not be set up correctly. Is your DISPLAY variable set correctly? I am assuming that this is a local Linux box and that you are not using ssh or telnet to a remote box. If you are, that's another story. Try setting DISPLAY as follows: $ export DISPLAY=:0.0 Then try the xterm again. If it STILL doesn't work, there may be X authority problems. Try this: $ xhost + Warning: this is a security risk, allowing any X system access to your box. But we'll only be doing this for a moment and I assume you are behind a firewall. Now try xterm again. If it works, appmon should work too. To make this work without having to open up using xhost +, Google xauth and Xauthority and ensure you have a ~/.Xauthority file set up correctly. Hope this helps. If you are still stuck, please post what happened above with xterm when you try it. On Sat, Sep 27, 2008 at 6:18 AM, Dan Rubino wrote: > Hi all, > > I normally develop my Erlang apps under windows but this weekend am > having a go under Linux. > > My apps compile and start fine however when I try and run appmon i.e. > appmon:start(). > > The console just hangs and doesnt open the appmon interface. > > I am running 5.5.5 - anyone come across this before? > > Thanks, > Dan > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Sat Sep 27 22:06:54 2008 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 27 Sep 2008 22:06:54 +0200 Subject: [erlang-questions] Erlang & .NET In-Reply-To: <48DE4CF3.6090407@gmail.com> References: <48DE4CF3.6090407@gmail.com> Message-ID: <8209f740809271306v2c557cfaraf3d178fcff4de71@mail.gmail.com> You could stay within the FP fold and port the OCaml Erlang term-to-caml type implementation in ErlOcaml to F#. (: http://code.google.com/p/erlocaml/source/browse/trunk/lib/ocamerl/ocamerl/eterm.ml I have no intuition for whether or not this is a good idea... BR, Ulf W 2008/9/27 Serge Aleynikov : > In a recent need to have a rich UI client for some of my UNIX processes, > this week I was playing with the otp.net contribution (from jungerl) > that implements an Erlang node in .NET. Given limited experience with > .NET I was quite impressed with how easy it was to get a node running in > .NET that exchanges terms with the Erlang VM. After making some > improvements to otp.net I ran into a need to be able to have a shell in > the UI to execute ad-hoc commands on a distributed node running > elsewhere. I understand that this can be accomplished by passing a > string to be evaluated to the Erlang node that would do the parsing and > execution, but I'd rather have the parser on the C# side. > > This brings the question of whether anyone has an open-source > implementation of the Erlang term parser in .NET. > > Serge > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From kenneth.lundin@REDACTED Sat Sep 27 22:21:54 2008 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Sat, 27 Sep 2008 22:21:54 +0200 Subject: [erlang-questions] Appmon not starting under ubuntu linux In-Reply-To: <6c2563b20809271219u10855d72o26fa3415293c3fbe@mail.gmail.com> References: <1222510725.5895.4.camel@linux-box> <6c2563b20809271219u10855d72o26fa3415293c3fbe@mail.gmail.com> Message-ID: Appmon is written using the Gs application which is an interface towards TCL/TK. You need TCL/TK in order to get Gs working. I suspect that this is the missing thing. Either you don't have TCL/TK, it is of wrong version or GS can't find it in the path. try doing gs:start() in the shell. I suppose this will fail if there is something missing for Gs (like TCL/TK). /Kenneth Erlang/OTP Ericsson 2008/9/27 Edwin Fine : > Dan, > > appmon uses graphics, which need X. In Windows, graphics are built in so you > need nothing special. I assume you are not logged in as superuser. > > Try the following: > > $ xterm > > If you see an xterm, your appmon should have worked. If you get an error > message, there are two things I can think of off the top of my head that > might not be set up correctly. > > Is your DISPLAY variable set correctly? I am assuming that this is a local > Linux box and that you are not using ssh or telnet to a remote box. If you > are, that's another story. > > Try setting DISPLAY as follows: > > $ export DISPLAY=:0.0 > > Then try the xterm again. If it STILL doesn't work, there may be X authority > problems. Try this: > > $ xhost + > > Warning: this is a security risk, allowing any X system access to your box. > But we'll only be doing this for a moment and I assume you are behind a > firewall. > > Now try xterm again. If it works, appmon should work too. > > To make this work without having to open up using xhost +, Google xauth and > Xauthority and ensure you have a ~/.Xauthority file set up correctly. > > Hope this helps. If you are still stuck, please post what happened above > with xterm when you try it. > > On Sat, Sep 27, 2008 at 6:18 AM, Dan Rubino > wrote: >> >> Hi all, >> >> I normally develop my Erlang apps under windows but this weekend am >> having a go under Linux. >> >> My apps compile and start fine however when I try and run appmon i.e. >> appmon:start(). >> >> The console just hangs and doesnt open the appmon interface. >> >> I am running 5.5.5 - anyone come across this before? >> >> Thanks, >> Dan >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From lemenkov@REDACTED Sat Sep 27 22:23:24 2008 From: lemenkov@REDACTED (Peter Lemenkov) Date: Sun, 28 Sep 2008 00:23:24 +0400 Subject: [erlang-questions] Fwd: Build Error (Job 324): erlang-R12B-3_3_el4 on fedora-4-epel In-Reply-To: <20080927201659.16DE81880F4@buildsys.fedoraproject.org> References: <20080927201659.16DE81880F4@buildsys.fedoraproject.org> Message-ID: Hello All! I encountered strange build error while trying to rebuild erlang on Red Hat Enterprise Linux 4.x for PowerPC arch: ========================================== ---------- Forwarded message ---------- From: buildsys@REDACTED Date: 28.09.2008 0:16 Subject: Build Error (Job 324): erlang-R12B-3_3_el4 on fedora-4-epel To: lemenkov@REDACTED Job failed on arch ppc Build logs may be found at http://buildsys.fedoraproject.org/logs/fedora-4-epel/324-erlang-R12B-3.3.el4/ ------------------------------------------------- Makefile:35: warning: overriding commands for target `docs' /builddir/build/BUILD/otp_src_R12B-3/make/otp_subdir.mk:28: warning: ignoring old commands for target `docs' === Entering application hipe make[3]: Entering directory `/builddir/build/BUILD/otp_src_R12B-3/lib/hipe/rtl' /builddir/build/BUILD/otp_src_R12B-3/bin/powerpc-unknown-linux-gnu/hipe_mkliterals -e > hipe_literals.hrl erlc -W +debug_info +warn_obsolete_guard +inline -o../ebin hipe_rtl_arch.erl Failed to create thread: make[3]: Leaving directory `/builddir/build/BUILD/otp_src_R12B-3/lib/hipe/rtl' make[2]: Leaving directory `/builddir/build/BUILD/otp_src_R12B-3/lib/hipe' make[1]: Leaving directory `/builddir/build/BUILD/otp_src_R12B-3/lib' RPM build errors: Invalid argument (22) make[3]: *** [../ebin/hipe_rtl_arch.beam] Aborted make[2]: *** [opt] Error 2 make[1]: *** [opt] Error 2 make: *** [secondary_bootstrap_build] Error 2 error: Bad exit status from /var/tmp/rpm-tmp.1781 (%build) Bad exit status from /var/tmp/rpm-tmp.1781 (%build) Child returncode was: 1 EXCEPTION: Command failed. See logs for output. # ['bash', '--login', '-c', 'rpmbuild -bb --target ppc --nodeps builddir/build/SPECS/erlang.spec'] Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/mock/trace_decorator.py", line 70, in trace result = func(*args, **kw) File "/usr/lib/python2.4/site-packages/mock/util.py", line 316, in do raise mock.exception.Error, ("Command failed. See logs for output.\n # %s" % (command,), child.returncode) Error: Command failed. See logs for output. # ['bash', '--login', '-c', 'rpmbuild -bb --target ppc --nodeps builddir/build/SPECS/erlang.spec'] LEAVE do --> EXCEPTION RAISED ========================================== Right now I have no clue what to do with it. Does someone have an idea? -- With best regards! From rvirding@REDACTED Sat Sep 27 22:36:56 2008 From: rvirding@REDACTED (Robert Virding) Date: Sat, 27 Sep 2008 22:36:56 +0200 Subject: [erlang-questions] Loading code generated on the fly In-Reply-To: <6c2563b20809271206t63e99a03sc66f519fc9dee1b4@mail.gmail.com> References: <3dbc6d1c0809271145v3f461df2h80ab6c431e66d438@mail.gmail.com> <6c2563b20809271206t63e99a03sc66f519fc9dee1b4@mail.gmail.com> Message-ID: <3dbc6d1c0809271336g689d0cefyf13396012bc40223@mail.gmail.com> 2008/9/27 Edwin Fine > This is what I have been using successfully for a short while now. Hope > this helps. > Thank you "generated" works like a charm. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Sat Sep 27 22:40:17 2008 From: rvirding@REDACTED (Robert Virding) Date: Sat, 27 Sep 2008 22:40:17 +0200 Subject: [erlang-questions] Loading code generated on the fly In-Reply-To: <48DE8695.8010402@hyber.org> References: <3dbc6d1c0809271145v3f461df2h80ab6c431e66d438@mail.gmail.com> <48DE8695.8010402@hyber.org> Message-ID: <3dbc6d1c0809271340h7a7ed3ebif9cd48e40afe5a8d@mail.gmail.com> 2008/9/27 Claes Wikstrom > Robert Virding wrote: > >> I am generating compiled erlang code on the fly without saving using files >> (using LFE) and need to load the compiled binary into the system. Now, I >> know how to do myself "by hand" but I would prefer to go through the normal >> code loader to keep it all clean. >> > > I have a similar situation in yaws, however I chose to > actually write the .erl file. In retrospect this has been > very good for debugging over the years. Yes, I do the same in leex for two reasons: - You can distribute the generated scan module to users without leex. - It is easier to print Erlang code than to build it, at least I think so. Here the problem was to not use files, and generating LFE is easier than printing it. I have an option to print the generated module if necessary. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Sat Sep 27 22:46:42 2008 From: vances@REDACTED (Vance Shipley) Date: Sat, 27 Sep 2008 16:46:42 -0400 Subject: [erlang-questions] Appmon not starting under ubuntu linux In-Reply-To: References: <1222510725.5895.4.camel@linux-box> <6c2563b20809271219u10855d72o26fa3415293c3fbe@mail.gmail.com> Message-ID: <20080927204641.GI48159@h216-235-12-173.host.egate.net> Specifically you need the "wish" program in your path. Probably "wish85" or "wish8.5" if it's a recent build. -Vance On Sat, Sep 27, 2008 at 10:21:54PM +0200, Kenneth Lundin wrote: } Appmon is written using the Gs application which is an interface } towards TCL/TK. You need TCL/TK in order to get } Gs working. I suspect that this is the missing thing. Either you don't } have TCL/TK, it is of wrong version or GS can't find it } in the path. From ulf.wiger@REDACTED Sat Sep 27 22:54:10 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Sat, 27 Sep 2008 22:54:10 +0200 Subject: [erlang-questions] Loading code generated on the fly In-Reply-To: <3dbc6d1c0809271145v3f461df2h80ab6c431e66d438@mail.gmail.com> References: <3dbc6d1c0809271145v3f461df2h80ab6c431e66d438@mail.gmail.com> Message-ID: <48DE9D72.9020203@ericsson.com> Robert Virding skrev: > I am generating compiled erlang code on the fly without saving using > files (using LFE) and need to load the compiled binary into the system. > Now, I know how to do myself "by hand" but I would prefer to go through > the normal code loader to keep it all clean. > > There is a call code:load_binary(Module, FileName, Binary) which seems > to do what I want, BUT there is this argument FileName. Now I don't > intend to save the module in a file unless I really have to as it seems > like a bit of unnecessary work to save it in a file just so I can load > it. What is the significance of the FileName argument and does it matter > what I set it to? Can I just call Module.beam and be done with? I usually invent a path to signify that the module has been generated, such as /lfe/generated/lfe.beam (or whatever). That helps a bit when calling m() in the shell, or code:which(Module). The FileName argument will have impact on these functions, as well as e.g. code:lib_dir(Module). This is what the 'code' man page says: "Filename is only used by the code server to keep a record of from which file the object code for Module comes. Accordingly, Filename is not opened and read by the code server." BR, Ulf W From babo.online@REDACTED Sat Sep 27 23:01:53 2008 From: babo.online@REDACTED (Attila Babo) Date: Sat, 27 Sep 2008 23:01:53 +0200 Subject: [erlang-questions] Writing my own REPL In-Reply-To: References: <597c69660809261455v69c947a4h904c5f1ab0bbbfbf@mail.gmail.com> <3dbc6d1c0809261501k1d93fc0bja61705b73e034b2c@mail.gmail.com> <597c69660809261506n6df10543k26aecfb2c5443901@mail.gmail.com> Message-ID: <597c69660809271401t19bdd307q93482511ff1edd22@mail.gmail.com> This minimal wrapper starts a custom shell as you requested and ^G works nicely. With Robert's hacked user_drv it's more convenient to start multiple copies of your own shell. With rlwrap it's pretty usable. :-) Is this what are you guys after? Cheers: Attila ------------- -module(lfe_wrap). -export([start/0]). start() -> user_drv:start(['tty_sl -c -e',{lfe_shell,start,[]}]). --------------- erl -noshell -noinput -s lfe_wrap start -pa ebin . Erlang (BEAM) emulator version 5.6.4 [source] [smp:2] [async-threads:0] [kernel-poll:false] LFE Shell V5.6.4 (abort with ^G) >(+ 1 2) 3 > User switch command --> s lfe_shell --> j 1 {lfe_shell,start,[]} 2* {lfe_shell,start,[]} --> c 2 LFE Shell V5.6.4 (abort with ^G) >(+ 3 4) 7 > User switch command --> c 1 (: c q) ok >% From rvirding@REDACTED Sat Sep 27 23:14:20 2008 From: rvirding@REDACTED (Robert Virding) Date: Sat, 27 Sep 2008 23:14:20 +0200 Subject: [erlang-questions] Writing my own REPL In-Reply-To: <597c69660809271401t19bdd307q93482511ff1edd22@mail.gmail.com> References: <597c69660809261455v69c947a4h904c5f1ab0bbbfbf@mail.gmail.com> <3dbc6d1c0809261501k1d93fc0bja61705b73e034b2c@mail.gmail.com> <597c69660809261506n6df10543k26aecfb2c5443901@mail.gmail.com> <597c69660809271401t19bdd307q93482511ff1edd22@mail.gmail.com> Message-ID: <3dbc6d1c0809271414q6a4cab6fobb416d0cbb70203@mail.gmail.com> Thank you, that is exactly what I am after. As an aside, I just googled rlwrap and on the same page as the first reference to it there was also a description of Emacs midi-input mode for taking input from a midi keyboard and writing it in a readable form in a buffer. :-) Robert 2008/9/27 Attila Babo > This minimal wrapper starts a custom shell as you requested and ^G > works nicely. With Robert's hacked user_drv it's more convenient to > start multiple copies of your own shell. With rlwrap it's pretty > usable. :-) > > Is this what are you guys after? > > Cheers: > Attila > > ------------- > -module(lfe_wrap). > -export([start/0]). > > start() -> > user_drv:start(['tty_sl -c -e',{lfe_shell,start,[]}]). > > --------------- > > erl -noshell -noinput -s lfe_wrap start -pa ebin . > Erlang (BEAM) emulator version 5.6.4 [source] [smp:2] > [async-threads:0] [kernel-poll:false] > > LFE Shell V5.6.4 (abort with ^G) > >(+ 1 2) > 3 > > > User switch command > --> s lfe_shell > --> j > 1 {lfe_shell,start,[]} > 2* {lfe_shell,start,[]} > --> c 2 > LFE Shell V5.6.4 (abort with ^G) > >(+ 3 4) > 7 > > > User switch command > --> c 1 > (: c q) > ok > >% > -------------- next part -------------- An HTML attachment was scrubbed... URL: From babo.online@REDACTED Sat Sep 27 23:26:12 2008 From: babo.online@REDACTED (Attila Babo) Date: Sat, 27 Sep 2008 23:26:12 +0200 Subject: [erlang-questions] Loading code generated on the fly In-Reply-To: <48DE9D72.9020203@ericsson.com> References: <3dbc6d1c0809271145v3f461df2h80ab6c431e66d438@mail.gmail.com> <48DE9D72.9020203@ericsson.com> Message-ID: <597c69660809271426u532c5977r23183d2b433fed2c@mail.gmail.com> We experienced in a long running production environment that generated code are sometimes unloaded, our current workaround is to check its presence and reload it from a database if needed. Is there a way to force to keep it in cache? A possibility to create a dummy process to keep a single reference to the module all way long. Is there a better way? From rvirding@REDACTED Sat Sep 27 23:38:18 2008 From: rvirding@REDACTED (Robert Virding) Date: Sat, 27 Sep 2008 23:38:18 +0200 Subject: [erlang-questions] Loading code generated on the fly In-Reply-To: <597c69660809271426u532c5977r23183d2b433fed2c@mail.gmail.com> References: <3dbc6d1c0809271145v3f461df2h80ab6c431e66d438@mail.gmail.com> <48DE9D72.9020203@ericsson.com> <597c69660809271426u532c5977r23183d2b433fed2c@mail.gmail.com> Message-ID: <3dbc6d1c0809271438u6a20ca74vf312b2b7e7836489@mail.gmail.com> 2008/9/27 Attila Babo > We experienced in a long running production environment that generated > code are sometimes unloaded, our current workaround is to check its > presence and reload it from a database if needed. Is there a way to > force to keep it in cache? A possibility to create a dummy process to > keep a single reference to the module all way long. Is there a better > way? Sorry I have absolutely no idea what the problem is and how to solve it. How do you mean unload? Like suddenly it is not there and can't be called? I personally think that is very strange if erlang decides to unload code, generated or otherwise, all by itself. I would raise this as a separate question so that more people see it. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Sat Sep 27 23:51:48 2008 From: rvirding@REDACTED (Robert Virding) Date: Sat, 27 Sep 2008 23:51:48 +0200 Subject: [erlang-questions] Writing my own REPL In-Reply-To: <597c69660809271401t19bdd307q93482511ff1edd22@mail.gmail.com> References: <597c69660809261455v69c947a4h904c5f1ab0bbbfbf@mail.gmail.com> <3dbc6d1c0809261501k1d93fc0bja61705b73e034b2c@mail.gmail.com> <597c69660809261506n6df10543k26aecfb2c5443901@mail.gmail.com> <597c69660809271401t19bdd307q93482511ff1edd22@mail.gmail.com> Message-ID: <3dbc6d1c0809271451l1d101ed1vf73b6b2103a16aad@mail.gmail.com> It works on Windows, which makes me happy as that is what I am running. Woohoo. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From klacke@REDACTED Sun Sep 28 00:25:18 2008 From: klacke@REDACTED (Claes Wikstrom) Date: Sun, 28 Sep 2008 00:25:18 +0200 Subject: [erlang-questions] term_to_binary and record improvements In-Reply-To: <6672d0160808290138l62d80086j6a5e78c8f0b6ffb4@mail.gmail.com> References: <27926_1219950001_m7SIxwgG006779_9b08084c0808281147u2c7d1ad5lb6df718e9b440d47@mail.gmail.com> <4CC5FE1B-AC71-4B35-B399-DC56EC003B08@cs.otago.ac.nz> <48B7AD6D.7070705@ericsson.com> <6672d0160808290138l62d80086j6a5e78c8f0b6ffb4@mail.gmail.com> Message-ID: <48DEB2CE.6070805@hyber.org> Bjorn Gustavsson wrote: > It is easy to preserve sharing if you are allowed to destroy the source > term (as in the garbage collector). > > Preserving sharing when copying a term (i.e. not destroying the source > term) is harder and > WILL be slower compared to not preserve sharing. Correctly, this is code that I remember Tony Rogavall and I stared at for years. I know of no good way to implement term_to_bianary/1 or the copying of spawn() args better than is done today. It would be possible to implement sharing, but it would cost dearly and the net effect would be bad in most cases. /klacke From babo.online@REDACTED Sun Sep 28 00:33:44 2008 From: babo.online@REDACTED (Attila Babo) Date: Sun, 28 Sep 2008 00:33:44 +0200 Subject: [erlang-questions] Writing my own REPL In-Reply-To: <3dbc6d1c0809271451l1d101ed1vf73b6b2103a16aad@mail.gmail.com> References: <597c69660809261455v69c947a4h904c5f1ab0bbbfbf@mail.gmail.com> <3dbc6d1c0809261501k1d93fc0bja61705b73e034b2c@mail.gmail.com> <597c69660809261506n6df10543k26aecfb2c5443901@mail.gmail.com> <597c69660809271401t19bdd307q93482511ff1edd22@mail.gmail.com> <3dbc6d1c0809271451l1d101ed1vf73b6b2103a16aad@mail.gmail.com> Message-ID: <597c69660809271533x7bcb7816m5791089620360980@mail.gmail.com> There is a strange bug here, order of command line parameters is important, -noshell -noinput is the right way to use. From rvirding@REDACTED Sun Sep 28 00:42:51 2008 From: rvirding@REDACTED (Robert Virding) Date: Sun, 28 Sep 2008 00:42:51 +0200 Subject: [erlang-questions] Writing my own REPL In-Reply-To: <597c69660809271533x7bcb7816m5791089620360980@mail.gmail.com> References: <597c69660809261455v69c947a4h904c5f1ab0bbbfbf@mail.gmail.com> <3dbc6d1c0809261501k1d93fc0bja61705b73e034b2c@mail.gmail.com> <597c69660809261506n6df10543k26aecfb2c5443901@mail.gmail.com> <597c69660809271401t19bdd307q93482511ff1edd22@mail.gmail.com> <3dbc6d1c0809271451l1d101ed1vf73b6b2103a16aad@mail.gmail.com> <597c69660809271533x7bcb7816m5791089620360980@mail.gmail.com> Message-ID: <3dbc6d1c0809271542l1086e63er296eda1bcc5b87a7@mail.gmail.com> 2008/9/28 Attila Babo > There is a strange bug here, order of command line parameters is > important, -noshell -noinput is the right way to use. > That is strange, fortunately I got them in the right order in my .bat file. :-) It sometimes seems as if the boot procedure has suffered a lot from feeping creaturism and would need redoing. Of course it would be difficult to clean it up and keep it backwards compatible. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From per@REDACTED Sun Sep 28 01:55:12 2008 From: per@REDACTED (Per Hedeland) Date: Sun, 28 Sep 2008 01:55:12 +0200 (CEST) Subject: [erlang-questions] Problems cross-compiling OTP on ARM In-Reply-To: <48DE84CB.7040608@hyber.org> Message-ID: <200809272355.m8RNtClU077528@pluto.hedeland.org> Claes Wikstrom wrote: > >The xcompile pain is ... well big. We now xcompile to one >additional cpu, I shudder to > >1. Port that stuff into latest greatest OTP >2. Have one additional xcompile cpu to support. Actually klacke, we already do 2 (for QNX on ppc - build system QNX on x86...) - plus the odd test/eval build with uClibc and other nasties. It's not such a big deal to do another once you have hacked the make system in a somewhat reasonable way - I can't say I have a lot of trust in it though, remember the bug we had where the result of running a test program on the host was used for the target... And as for 1, yes it will be a pain, but it will not be the biggest one... --Per From thomasl_erlang@REDACTED Sun Sep 28 01:07:26 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sat, 27 Sep 2008 16:07:26 -0700 (PDT) Subject: [erlang-questions] Loading code generated on the fly In-Reply-To: <597c69660809271426u532c5977r23183d2b433fed2c@mail.gmail.com> Message-ID: <943514.73972.qm@web38807.mail.mud.yahoo.com> --- On Sat, 9/27/08, Attila Babo wrote: > From: Attila Babo > We experienced in a long running production environment that > generated > code are sometimes unloaded, our current workaround is to > check its > presence and reload it from a database if needed. Is there > a way to > force to keep it in cache? A possibility to create a dummy > process to > keep a single reference to the module all way long. Is > there a better > way? The only way I know of to unload code on the sly is to replace it with a new module of the same name (twice). You wouldn't happen to reuse module names somewhere in your code generator? Best, Thomas From lloy0076@REDACTED Sun Sep 28 02:33:35 2008 From: lloy0076@REDACTED (David Lloyd) Date: Sun, 28 Sep 2008 10:03:35 +0930 Subject: [erlang-questions] Simle Erlang Question (Binary "String" to Erlang "String") Message-ID: <48DED0DF.9050104@adam.com.au> Hello, I've pasted an erlang shell session below but I'll ask my question here so you don't have to wade through it if you don't want to. I have gotten this: 3> {ok, File}=file:read_file("hello.b64"). {ok,<<"SGVsbG8sIHdvcmxkIQ==\n">>} I want to make File into an Erlang string so that effectively if I asked for its value in the shell I'd get something like this: 4> File. "SGVsbG8sIHdvcmxkIQ==\n" I've been reading "Programming Erlang" by Joe Armstrong, the online R12B reference manual, the "Stdlib" documentation and "Concurrent Programming in Erlang" (or at least the parts that are publically released) in which Joe Armstrong is one of the authors. However, I can't quite work out the right section or way to do what I'd like to do nor can I figure out a query to put to google that doesn't come back with too many answers (it seems erlang string and bit are quite common). Any pointers? DSL --- bash-3.2$ erl Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [kernel-poll:false] Eshell V5.5.5 (abort with ^G) ok 8> bash-3.2$ erl Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [kernel-poll:false] Eshell V5.5.5 (abort with ^G) 1> {ok, File} = file:read_file("hello.b64"). {ok,<<"SGVsbG8sIHdvcmxkIQ==\n">>} 2> File. <<"SGVsbG8sIHdvcmxkIQ==\n">> From anders.nygren@REDACTED Sun Sep 28 04:50:05 2008 From: anders.nygren@REDACTED (Anders Nygren) Date: Sat, 27 Sep 2008 21:50:05 -0500 Subject: [erlang-questions] Simle Erlang Question (Binary "String" to Erlang "String") In-Reply-To: <48DED0DF.9050104@adam.com.au> References: <48DED0DF.9050104@adam.com.au> Message-ID: On Sat, Sep 27, 2008 at 7:33 PM, David Lloyd wrote: > > Hello, > > I've pasted an erlang shell session below but I'll ask my question here > so you don't have to wade through it if you don't want to. > > I have gotten this: > > 3> {ok, File}=file:read_file("hello.b64"). > {ok,<<"SGVsbG8sIHdvcmxkIQ==\n">>} > 19> binary_to_list(<<"SGVsbG8sIHdvcmxkIQ==\n">>). "SGVsbG8sIHdvcmxkIQ==\n" > I want to make File into an Erlang string so that effectively if I asked > for its value in the shell I'd get something like this: > > 4> File. > "SGVsbG8sIHdvcmxkIQ==\n" > > I've been reading "Programming Erlang" by Joe Armstrong, the online R12B > reference manual, the "Stdlib" documentation and "Concurrent Programming > in Erlang" (or at least the parts that are publically released) in which > Joe Armstrong is one of the authors. In addition to the stdlib documentation, there are a lot of useful things hiding in the module erlang in the kernel application. That is where You will find binary_to_list. /Anders > > However, I can't quite work out the right section or way to do what I'd > like to do nor can I figure out a query to put to google that doesn't > come back with too many answers (it seems erlang string and bit are > quite common). > > Any pointers? > > DSL > > --- > > bash-3.2$ erl > Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] > [kernel-poll:false] > > Eshell V5.5.5 (abort with ^G) > ok > 8> bash-3.2$ erl > Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] > [kernel-poll:false] > > Eshell V5.5.5 (abort with ^G) > 1> {ok, File} = file:read_file("hello.b64"). > {ok,<<"SGVsbG8sIHdvcmxkIQ==\n">>} > 2> File. > <<"SGVsbG8sIHdvcmxkIQ==\n">> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From vances@REDACTED Sun Sep 28 05:02:30 2008 From: vances@REDACTED (Vance Shipley) Date: Sat, 27 Sep 2008 23:02:30 -0400 Subject: [erlang-questions] Simle Erlang Question (Binary "String" to Erlang "String") In-Reply-To: <48DED0DF.9050104@adam.com.au> References: <48DED0DF.9050104@adam.com.au> Message-ID: <20080928030230.GL48159@h216-235-12-173.host.egate.net> On Sun, Sep 28, 2008 at 10:03:35AM +0930, David Lloyd wrote: } I have gotten this: } } 3> {ok, File}=file:read_file("hello.b64"). } {ok,<<"SGVsbG8sIHdvcmxkIQ==\n">>} } } I want to make File into an Erlang string so that effectively if I asked } for its value in the shell I'd get something like this: } } 4> File. } "SGVsbG8sIHdvcmxkIQ==\n" You can use the built in function (BIF) binary_to_list/1. 5> binary_to_list(File). "SGVsbG8sIHdvcmxkIQ==\n" If you just want to read Erlang terms from a file of your design you can use file:consult/1. To do this you write the term(s) in erlang format: "SGVsbG8sIHdvcmxkIQ==\n". "Another string". an_atom. {tuple, a}. And read them with: 6> file:consult("foo.txt"). {ok,["SGVsbG8sIHdvcmxkIQ==\n","Anorther string",an_atom, {tuple,a}]} -Vance From webaccounts@REDACTED Sun Sep 28 12:58:08 2008 From: webaccounts@REDACTED (Dan Rubino) Date: Sun, 28 Sep 2008 11:58:08 +0100 Subject: [erlang-questions] Appmon not starting under ubuntu linux In-Reply-To: <6c2563b20809271219u10855d72o26fa3415293c3fbe@mail.gmail.com> References: <1222510725.5895.4.camel@linux-box> <6c2563b20809271219u10855d72o26fa3415293c3fbe@mail.gmail.com> Message-ID: <1222599488.5895.15.camel@linux-box> Thanks guys - got it sorted -great help as always! Dan On Sat, 2008-09-27 at 15:19 -0400, Edwin Fine wrote: > Dan, > > appmon uses graphics, which need X. In Windows, graphics are built in > so you need nothing special. I assume you are not logged in as > superuser. > > Try the following: > > $ xterm > > If you see an xterm, your appmon should have worked. If you get an > error message, there are two things I can think of off the top of my > head that might not be set up correctly. > > Is your DISPLAY variable set correctly? I am assuming that this is a > local Linux box and that you are not using ssh or telnet to a remote > box. If you are, that's another story. > > Try setting DISPLAY as follows: > > $ export DISPLAY=:0.0 > > Then try the xterm again. If it STILL doesn't work, there may be X > authority problems. Try this: > > $ xhost + > > Warning: this is a security risk, allowing any X system access to your > box. But we'll only be doing this for a moment and I assume you are > behind a firewall. > > Now try xterm again. If it works, appmon should work too. > > To make this work without having to open up using xhost +, Google > xauth and Xauthority and ensure you have a ~/.Xauthority file set up > correctly. > > Hope this helps. If you are still stuck, please post what happened > above with xterm when you try it. > > On Sat, Sep 27, 2008 at 6:18 AM, Dan Rubino > wrote: > Hi all, > > I normally develop my Erlang apps under windows but this > weekend am > having a go under Linux. > > My apps compile and start fine however when I try and run > appmon i.e. > appmon:start(). > > The console just hangs and doesnt open the appmon interface. > > I am running 5.5.5 - anyone come across this before? > > Thanks, > Dan > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > From webaccounts@REDACTED Sun Sep 28 13:04:13 2008 From: webaccounts@REDACTED (Dan Rubino) Date: Sun, 28 Sep 2008 12:04:13 +0100 Subject: [erlang-questions] Mnesia supervisor restart strategy... Message-ID: <1222599853.5895.22.camel@linux-box> Hi all, I have setup a release as suggested whilst specifying Mnesia in the list of required apps. This starts Mnesia automatically which is perfect. Now when I look at mnesia through the appmon, I see it has a supervisor attached to it - great. My question now is of course, am I able to specify the restart strategy for it? Can I see the settings it is currently running under perhaps (just so I can understand its behaviour)? Also, is there another way within a release to specify the directory of the Mnesia instance? So what I am saying is I currently use the commandline option -mnesia dir '"/path/to/mnesia/instance"' Is there another way to specify this in config perhaps? Many Thanks, Dan From saleyn@REDACTED Sun Sep 28 15:37:15 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Sun, 28 Sep 2008 09:37:15 -0400 Subject: [erlang-questions] Erlang & .NET In-Reply-To: <8209f740809271306v2c557cfaraf3d178fcff4de71@mail.gmail.com> References: <48DE4CF3.6090407@gmail.com> <8209f740809271306v2c557cfaraf3d178fcff4de71@mail.gmail.com> Message-ID: <48DF888B.60204@gmail.com> Actually this doesn't address the problem I stated, as otp.net project already has functions dealing with encoding/decoding terms to/from external binary format (similar to what erlocaml does). What I need is a .NET function with this signature: string_to_eterm(string()) -> term() I.e. the .NET code analogous to: {ok, Tokens} = erl_scan:string(Str), {ok, Term} = erl_parse:parse_term(Tokens), Term. I understand that writing an Erlang term parser is probably easier in OCaml / F# than in .NET, but before spending time on writing one, I figured I'd first ask the mailing list... Serge Ulf Wiger wrote: > You could stay within the FP fold and port the OCaml > Erlang term-to-caml type implementation in ErlOcaml > to F#. (: > > http://code.google.com/p/erlocaml/source/browse/trunk/lib/ocamerl/ocamerl/eterm.ml > > I have no intuition for whether or not this is a good idea... > > BR, > Ulf W > > > 2008/9/27 Serge Aleynikov : >> In a recent need to have a rich UI client for some of my UNIX processes, >> this week I was playing with the otp.net contribution (from jungerl) >> that implements an Erlang node in .NET. Given limited experience with >> .NET I was quite impressed with how easy it was to get a node running in >> .NET that exchanges terms with the Erlang VM. After making some >> improvements to otp.net I ran into a need to be able to have a shell in >> the UI to execute ad-hoc commands on a distributed node running >> elsewhere. I understand that this can be accomplished by passing a >> string to be evaluated to the Erlang node that would do the parsing and >> execution, but I'd rather have the parser on the C# side. >> >> This brings the question of whether anyone has an open-source >> implementation of the Erlang term parser in .NET. >> >> Serge >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > From babo.online@REDACTED Sun Sep 28 16:42:55 2008 From: babo.online@REDACTED (Attila Babo) Date: Sun, 28 Sep 2008 16:42:55 +0200 Subject: [erlang-questions] Loading code generated on the fly In-Reply-To: <943514.73972.qm@web38807.mail.mud.yahoo.com> References: <597c69660809271426u532c5977r23183d2b433fed2c@mail.gmail.com> <943514.73972.qm@web38807.mail.mud.yahoo.com> Message-ID: <597c69660809280742q13bf1ee3s193d6ffe81669624@mail.gmail.com> Mystery solved, an execution path was buggy in our code, thanks for the suggestions! /Attila From saleyn@REDACTED Sun Sep 28 16:53:46 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Sun, 28 Sep 2008 10:53:46 -0400 Subject: [erlang-questions] Erlang & .NET In-Reply-To: <48DF888B.60204@gmail.com> References: <48DE4CF3.6090407@gmail.com> <8209f740809271306v2c557cfaraf3d178fcff4de71@mail.gmail.com> <48DF888B.60204@gmail.com> Message-ID: <48DF9A7A.3080004@gmail.com> Serge Aleynikov wrote: > I understand that writing an Erlang term parser is probably easier in > OCaml / F# than in .NET ^^^ The above should've been "... in OCaml / F# than in C#" ... From saleyn@REDACTED Sun Sep 28 17:21:29 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Sun, 28 Sep 2008 11:21:29 -0400 Subject: [erlang-questions] Erlang & .NET In-Reply-To: <48DF888B.60204@gmail.com> References: <48DE4CF3.6090407@gmail.com> <8209f740809271306v2c557cfaraf3d178fcff4de71@mail.gmail.com> <48DF888B.60204@gmail.com> Message-ID: <48DFA0F9.5060307@gmail.com> Actually I found this project, that helped building an Erlang term parser in C# in less than an hour: http://www.devincook.com/goldparser/ Serge Serge Aleynikov wrote: > Actually this doesn't address the problem I stated, as otp.net project > already has functions dealing with encoding/decoding terms to/from > external binary format (similar to what erlocaml does). > > What I need is a .NET function with this signature: > > string_to_eterm(string()) -> term() > > I.e. the .NET code analogous to: > {ok, Tokens} = erl_scan:string(Str), > {ok, Term} = erl_parse:parse_term(Tokens), > Term. > > I understand that writing an Erlang term parser is probably easier in > OCaml / F# than in .NET, but before spending time on writing one, I > figured I'd first ask the mailing list... > > Serge > > Ulf Wiger wrote: >> You could stay within the FP fold and port the OCaml >> Erlang term-to-caml type implementation in ErlOcaml >> to F#. (: >> >> http://code.google.com/p/erlocaml/source/browse/trunk/lib/ocamerl/ocamerl/eterm.ml >> >> I have no intuition for whether or not this is a good idea... >> >> BR, >> Ulf W >> >> >> 2008/9/27 Serge Aleynikov : >>> In a recent need to have a rich UI client for some of my UNIX processes, >>> this week I was playing with the otp.net contribution (from jungerl) >>> that implements an Erlang node in .NET. Given limited experience with >>> .NET I was quite impressed with how easy it was to get a node running in >>> .NET that exchanges terms with the Erlang VM. After making some >>> improvements to otp.net I ran into a need to be able to have a shell in >>> the UI to execute ad-hoc commands on a distributed node running >>> elsewhere. I understand that this can be accomplished by passing a >>> string to be evaluated to the Erlang node that would do the parsing and >>> execution, but I'd rather have the parser on the C# side. >>> >>> This brings the question of whether anyone has an open-source >>> implementation of the Erlang term parser in .NET. >>> >>> Serge >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlang-questions_efine@REDACTED Sun Sep 28 18:12:35 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sun, 28 Sep 2008 12:12:35 -0400 Subject: [erlang-questions] Mnesia supervisor restart strategy... In-Reply-To: <1222599853.5895.22.camel@linux-box> References: <1222599853.5895.22.camel@linux-box> Message-ID: <6c2563b20809280912s6b44d166i1bccf58cee6c5fbb@mail.gmail.com> Dan, My understanding is that you can specify options for an application as follows: - On the command line as -MyAppName key value - In the config file as {MyAppName, [{key, value}]} - In the .app file The command line overrides the config file settings, which override the app file settings. On the command line, writing -mnesia foo bar simply inserts the key/value pair {foo, bar} into the application environment for mnesia. I expect (but am no expert) that you shoud be able to put the values in the config file just as you can for sasl and any other app. Example: [ {sasl, [ {sasl_error_logger, {file, "/tmp/foo.sasl_log"}} ] }, {mnesia, [ {dir, "/my/mnesia/dir"} ] } ] It's worth a try anyway. Regards, Ed On Sun, Sep 28, 2008 at 7:04 AM, Dan Rubino wrote: > Hi all, > > I have setup a release as suggested whilst specifying Mnesia in the list > of required apps. This starts Mnesia automatically which is perfect. > > Now when I look at mnesia through the appmon, I see it has a supervisor > attached to it - great. My question now is of course, am I able to > specify the restart strategy for it? Can I see the settings it is > currently running under perhaps (just so I can understand its > behaviour)? > > Also, is there another way within a release to specify the directory of > the Mnesia instance? So what I am saying is I currently use the > commandline option -mnesia dir '"/path/to/mnesia/instance"' > > Is there another way to specify this in config perhaps? > > Many Thanks, > Dan > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From oscar@REDACTED Sat Sep 27 18:47:34 2008 From: oscar@REDACTED (=?utf-8?Q?Oscar_Hellstr=C3=B6m?=) Date: Sat, 27 Sep 2008 17:47:34 +0100 (BST) Subject: [erlang-questions] Appmon not starting under ubuntu linux In-Reply-To: <8184517.3421222533939315.JavaMail.root@zimbra> Message-ID: <9905743.3441222534053889.JavaMail.root@zimbra> Hi, Have you installed the erlang-x11 package on the Ubuntu machine? Appmon is using the GS application, which needs the X11 package. ----- Original Message ----- From: "Dan Rubino" To: "Erlang-Questions (E-mail)" Sent: Saturday, 27 September, 2008 11:18:45 AM GMT +00:00 GMT Britain, Ireland, Portugal Subject: [erlang-questions] Appmon not starting under ubuntu linux Hi all, I normally develop my Erlang apps under windows but this weekend am having a go under Linux. My apps compile and start fine however when I try and run appmon i.e. appmon:start(). The console just hangs and doesnt open the appmon interface. I am running 5.5.5 - anyone come across this before? Thanks, Dan _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions Best regards -- Oscar Hellstr?m, oscar@REDACTED Phone: +44 (0)798 45 44 773 Mobile: +44 (0)207 65 50 337 Web: http://www.erlang-consulting.com From tobias.lindahl@REDACTED Sun Sep 28 22:11:45 2008 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Sun, 28 Sep 2008 22:11:45 +0200 Subject: [erlang-questions] Problems cross-compiling OTP on ARM In-Reply-To: <6672d0160809262315n72c52832l94b8ea3aa112b752@mail.gmail.com> References: <48DCC42D.70302@diit.unict.it> <20080926124850.GA28625@contorpis.lisalinda.com> <18653.6345.495590.200475@harpo.it.uu.se> <6672d0160809262315n72c52832l94b8ea3aa112b752@mail.gmail.com> Message-ID: <48DFE501.3020901@kreditor.se> Bjorn Gustavsson wrote: > Actually, I think that the current version of Dialyzer does not use HiPE as > much as it used to. > It used to run the first pass of HiPE compiler and do its analysis on the > icode format, but as > far as I know, Dialyzer now does the entire analysis using Core Erlang and > only uses a few > modules in hipe/cerl (which are pure Erlang, and not dependent on any HiPE > support in the > run-time system). > > Tobias or Kostis could confirm those details, but I think that it would be > enough to include > only the hipe/cerl sub-directory to support Dialyzer. It is almost true. There are a couple of dependencies on other parts of HiPE, but these can be removed. When this is done only two modules in hipe are necessary for Dialyzer, erl_bif_types and erl_types. Tobias From mark.geib@REDACTED Sun Sep 28 23:16:33 2008 From: mark.geib@REDACTED (Mark Geib) Date: Sun, 28 Sep 2008 15:16:33 -0600 Subject: [erlang-questions] managing multiple instances of a gen_server Message-ID: <48DFF431.50409@echostar.com> I am new to erlang and building a fairly simple system as a test/prototype. I need to be able to dynamically create one->many instances of a gen_server process to be used a temporary worker/server. I have be able in the supervisor of this gen_server to create the child spec using the simple_one_for_one type. I can create many of the gen_servers, but of course they are not registered, and since they are the same module I can not call "into" them. Is there is a best-practices method to handle this case, or do I need to simple use messaging, or calls to gen_server:call(Pid...) for these gen_servers.?? Thanks, Mark. -- Principal Engineer Cheyenne Software Engineering mark.geib@REDACTED / 35-215 From rvirding@REDACTED Sun Sep 28 23:18:30 2008 From: rvirding@REDACTED (Robert Virding) Date: Sun, 28 Sep 2008 23:18:30 +0200 Subject: [erlang-questions] New version of LFE, Lisp Flavoured Erlang Message-ID: <3dbc6d1c0809281418v16119b6crbd936f40033491db@mail.gmail.com> I have just released LFE v0.3. This is the first version with the modified internal core forms and macro interfaces for the new CL inspired style and the older Scheme inspired style. Two new modules have been added: lfe_boot allows you to start Erlang with the LFE shell running and still have ^G enabled and user_drv running. Use it as follows: erl -noshell -noinput -s lfe_boot start NOTE the order of commands important, must be -noshell -noinput! Add -pa to find modules if necessary. lfe_gen is a trial interface for using LFE for dynamic code generation. LFE is much easier to generate as an Erlang list than Erlang forms. This module delps defining and compiling a module. Note that, while it works, this module is very experimental and may change. To get you can either takr it from trapexit.org or from github, which ever you prefer. The links are: http://forum.trapexit.org/viewtopic.php?p=44168#44168 http://github.com/rvirding/lfe/tree Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From niravshah99@REDACTED Mon Sep 29 00:00:15 2008 From: niravshah99@REDACTED (Nirav Shah) Date: Sun, 28 Sep 2008 15:00:15 -0700 Subject: [erlang-questions] problems with eclispe erlide Message-ID: <912b20d90809281500m74eb032egb7e27f240f56f39@mail.gmail.com> hi , i have been trying to use Eclipse as an editor for erlang did install the plugin and set up the run time but dont know how to execute the Erlang project . Any help would be appreciated. Thanks, Nirav -------------- next part -------------- An HTML attachment was scrubbed... URL: From taavi@REDACTED Mon Sep 29 02:19:48 2008 From: taavi@REDACTED (Taavi Talvik) Date: Mon, 29 Sep 2008 03:19:48 +0300 Subject: [erlang-questions] managing multiple instances of a gen_server In-Reply-To: <48DFF431.50409@echostar.com> References: <48DFF431.50409@echostar.com> Message-ID: <6497FA58-A835-442F-9572-79649B32F623@uninet.ee> On Sep 29, 2008, at 12:16 AM, Mark Geib wrote: > I am new to erlang and building a fairly simple system as a test/ > prototype. > > I need to be able to dynamically create one->many instances of a > gen_server process to be used a temporary worker/server. > > I have be able in the supervisor of this gen_server to create the > child > spec using the simple_one_for_one type. I can create many of the > gen_servers, but of course they are not registered, and since they are > the same module I can not call "into" them. Is there is a best- > practices > method to handle this case, or do I need to simple use messaging, or > calls to gen_server:call(Pid...) for these gen_servers.?? You can do something like: {ok,SupervisorPid} = supervisor:start_link(...) % add new worker dynamically to allready running supervisor ChildSpec = {"worker_id1",{my_worker_module, start_link, Args}, transient, brutal_kill, worker, [my_worker_module]}, {ok, NewWorkerPid} = supervisor:start_child(SupervisorPid, ChildSpec) % "call" this new worker (hopefully no yet restarted and still has same pid) gen_server:call(NewWorkerPid, Arguments_for_worker_call) You can get list of allready running workers with supervisor:which_children(SupervisorPid) Calling into gen_server is just shortcut to gen_server:call(? MODULE,...). In this case you can have only one gen_server instance running, which typically is registered under ?MODULE name. However, name can be arbitrary atom. http://www.erlang.org/doc/man/gen_server.html#start-4 http://www.erlang.org/doc/man/gen_server.html#call-2 You can also register supervisor and then something like this in your gen_server module interface functions. But this works only when it does not matter which worker handles work. Otherwise worker name should be carried along and find_best_worker can use it to find appropriate process. do_job(Args) -> Pid = find_best_worker(my_registered_supervisor), gen_server:call(Pid, Args). % actually first worker.. find_best_worker(SupervisorName) -> {_, Pid, _, _} = hd(supervisor:which_children(SupervisorName)), Pid. best regards, taavi From yoursurrogategod@REDACTED Mon Sep 29 02:30:35 2008 From: yoursurrogategod@REDACTED (YourSurrogateGod) Date: Sun, 28 Sep 2008 17:30:35 -0700 (PDT) Subject: [erlang-questions] Millions of processes? In-Reply-To: <48D90C89.1080009@niclux.org> References: <48D9068A.7050200@niclux.org> <48D907DD.1030909@ericsson.com> <48D90C89.1080009@niclux.org> Message-ID: <2a33cf51-9f1f-4248-8b57-6dda36f105a5@59g2000hsb.googlegroups.com> This is somewhat off-topic, but I didn't know that there is a 64-bit erlang VM. How is it different than the 32-bit one? Also, how can I find out which one I'm running? On Sep 23, 11:34?am, Nicolas Niclausse wrote: > Ulf Wiger (TN/EAB) ecrivait le 23.09.2008 17:14: > > > > > > > Nicolas Niclausse skrev: > >> Bard Bloom ecrivait le 23.09.2008 15:22: > >>> I've seen in Erlang promotional materials some rather impressive claims > >>> about how cheap Erlang processes are, and how many of them one can > >>> spawn. Which is pretty cool. But, what Erlang programs take advantage of > >>> that kind of power? Are there any examples of programs which use huge > >>> numbers of processes in interesting ways? (I am the local Erlang > >>> fancier. I got challenged on that point, and didn't have a very good > >>> answer.) > > >> You can use tsung to simulate millions of users to do load/stress > >> testing. > >> It uses an erlang process for each simulated user. > > >> I tried to simulate ~1.3 million users, distributed on ~30 nodes, with > >> one > >> smp beam per node, to see if it works. it does :) > > > Yeah, but that's just some 43k processes per node then. (: > > Yes, i didn't have enough memory on nodes so i had to use many of them :) > (4GB per node with a 64 bit erlang VM) > > > Don't you also run into the problem that practically every > > process in tsung does network IO? > > No. But each node had a gigabit ethernet link, and not all users > (processes) were doing network IO simultaneously in the test (because of > "thinktimes" in the scenario ), it was something like 10% of them. > The cumulative bandwitdh was "only" 1Gbit/s > > -- > Nicolas > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From yoursurrogategod@REDACTED Mon Sep 29 02:37:57 2008 From: yoursurrogategod@REDACTED (YourSurrogateGod) Date: Sun, 28 Sep 2008 17:37:57 -0700 (PDT) Subject: [erlang-questions] Millions of processes? In-Reply-To: <1222251835.7604.58.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> References: <6a36e7290809230831i738b27c6n5de4b16e9e8867c1@mail.gmail.com> <19631434.post@talk.nabble.com> <48D922CA.8030309@ericsson.com> <1222251835.7604.58.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Message-ID: Purely out of curiosity, I'd like to read the said articles (if you have the links for them). I have a rought idea how micro-kernels work (mostly from Andrew Tannenbaum's website) and I'm fascinated by them. On Sep 24, 6:23?am, Bengt Kleberg wrote: > Greetings, > > It is not only _ideas_ in computer science that are held in contempt (as > quoted below). Ages ago (before 2000) I read an article about Linux in > embedded environments. The article quoted Linus Torvalds on why not to > use micro kernels. The reasons where that they are: > 1 Experimental > 2 Complex > 3 Slow > > After looking around for a while I found plenty of articles about > commercial micro kernels, and benchmarks showing micro kernels running > workloads faster than monolithic kernels. So 1 and 3 seemed to be > incorrect. > I submitted these findings to the magazine, which prompted an answer > from Mr Torvalds. He assert that all three where true, but did not > discuss what I had found. So (IMHO) it is also facts that are not held > in very high regard. > > bengt > > > > > > On Tue, 2008-09-23 at 19:09 +0200, Ulf Wiger (TN/EAB) wrote: > > NPTL is fast, but AFAIK uses a minimum stack size of 8KB > > per thread (the minimum heap size for erlang processes > > seems to be 932 bytes on a 32-bit system). There also seem > > to be other limits, making it very difficult in practice > > to reach anywhere near 100,000 threads, and it's not > > encouraged either. > > >http://nptl.bullopensource.org/Tests/NPTL-limits.html > > > In the Linux kernel FAQ, the philosophy on threads is > > explained thus: > > > "Avoid the temptation to create large numbers of threads in your > > application. Threads should only be used to take advantage of multiple > > processors or for specialised applications (i.e. low-latency real-time), > > not as a way of avoiding programmer effort (writing a state machine or > > an event callback system is quite easy). A good rule of thumb is to have > > up to 1.5 threads per processor and/or one thread per RT input stream. > > On a single processor system, a normal application would have at most > > two threads, over 10 threads is seriously flawed and hundreds or > > thousands of threads is progressively more insane. > > A common request is to modify the Linux scheduler to better handle large > > numbers of running processes/threads. This is always rejected by the > > kernel developer community because it is, frankly, stupid to have large > > numbers of threads. Many noted and respected people will extol the > > virtues of large numbers of threads. They are wrong. Some languages and > > toolkits create a thread for each object, because it fits into a > > particular ideology. A thread per object may be appealing in the > > abstract, but is in fact inefficient in the real world. Linux is not a > > good computer science project. It is, however, good engineering. > > Understand the distinction, and you will understand why many widely > > acclaimed ideas in computer science are held with contempt in the Linux > > kernel developer community. " > > >http://www.kernel.org/pub/linux/docs/lkml/#s7-21 > > > BR, > > Ulf W > > > Zvi skrev: > > > I'm no Linux expert, but > > > >http://en.wikipedia.org/wiki/Native_POSIX_Thread_Library > > > > "The Native POSIX Thread Library (NPTL) is a software feature that > > > enables the Linux kernel to run programs written to use POSIX Threads > > > fairly efficiently. In tests, NPTL succeeded in starting 100,000 > > > threads on a IA-32 in two seconds. In comparison, this test under a > > > kernel without NPTL would have taken around 15 minutes." > > > > I guess future Erlang VM will offer some more generic MxN threading > > > model, i.e. M Erlang user-level processes implemented on N > > > "schedulers" - native threads. Today in SMP Erlang is only limited > > > support (i.e. command line options) to specify number o scheduler and > > > no programmatic support for affinity of schedulers per core and > > > Erlang processes per schedulers. > > > > Zvi > > > > Bob Ippolito wrote: > > >> We've got a couple applications that use thousands of processes per > > >> ?node. If those were pthreads, we'd be out of RAM before actually > > >> doing anything. > > > >> 2008/9/23 Bard Bloom : > > >>> I've seen in Erlang promotional materials some rather impressive > > >>> claims about how cheap Erlang processes are, and how many of them > > >>> one can spawn. Which is pretty cool. But, what Erlang programs > > >>> take advantage of that kind of power? Are there any examples of > > >>> programs which use huge numbers of processes in interesting ways? > > >>> (I am the local Erlang fancier. I got challenged on that point, > > >>> and didn't have a very good answer.) > > > >>> Thanks very much, Bard Bloom > > > >>> _______________________________________________ erlang-questions > > >>> mailing list erlang-questi...@REDACTED > > >>>http://www.erlang.org/mailman/listinfo/erlang-questions > > > >> _______________________________________________ erlang-questions > > >> mailing list erlang-questi...@REDACTED > > >>http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED > >http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From matthias@REDACTED Mon Sep 29 08:24:15 2008 From: matthias@REDACTED (Matthias Lang) Date: Mon, 29 Sep 2008 08:24:15 +0200 Subject: [erlang-questions] Millions of processes? In-Reply-To: <2a33cf51-9f1f-4248-8b57-6dda36f105a5@59g2000hsb.googlegroups.com> References: <48D9068A.7050200@niclux.org> <48D907DD.1030909@ericsson.com> <48D90C89.1080009@niclux.org> <2a33cf51-9f1f-4248-8b57-6dda36f105a5@59g2000hsb.googlegroups.com> Message-ID: <20080929062415.GA4833@contorpis.lisalinda.com> On Sunday, September 28, YourSurrogateGod wrote: > This is somewhat off-topic, but I didn't know that there is a 64-bit > erlang VM. How is it different than the 32-bit one? Also, how can I > find out which one I'm running? The "64-bit emulator" is "just" the Erlang system compiled on and for a 64-bit system, e.g. an AMD-64, or a 64-bit Sun system, or... An important difference is that 'all' pointers are 64 bits wide instead of 32 bits wide, i.e. a 64 bit system can address (use) more memory than one compiled for a 32 bit system, which is what the original poster was talking about. Another effect is that it generally does. You can see if you're running a 64 bit emulator from the startup message. Here's what it looks like: ~ >erl Erlang (BEAM) emulator version 5.6.4 [source] [64-bit] [smp:2] [async-threads:0] [hipe] [kernel-poll:false] Another way is to look at erlang:system_info(wordsize). It returns 4 on 32 bit systems and 8 on 64-bit systems. Matt From jeffm@REDACTED Mon Sep 29 09:04:56 2008 From: jeffm@REDACTED (jm) Date: Mon, 29 Sep 2008 17:04:56 +1000 Subject: [erlang-questions] Monitoring changes in a directory tree In-Reply-To: References: <48D44059.2050305@ghostgun.com> Message-ID: <48E07E18.2050009@ghostgun.com> Done see http://forum.trapexit.org/viewtopic.php?p=44170#44170 I'll put a copy up on my website at some stage as well. Jeff. Torbjorn Tornkvist wrote: > Suggestion: Upload the code to the trapexit.org User Contrib area. > > Cheers, Tobbe > > From vladdu55@REDACTED Mon Sep 29 09:21:20 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 29 Sep 2008 09:21:20 +0200 Subject: [erlang-questions] problems with eclispe erlide In-Reply-To: <912b20d90809281500m74eb032egb7e27f240f56f39@mail.gmail.com> References: <912b20d90809281500m74eb032egb7e27f240f56f39@mail.gmail.com> Message-ID: <95be1d3b0809290021j60eefde0h6143976af7dec99e@mail.gmail.com> Hi! 2008/9/29 Nirav Shah : > i have been trying to use Eclipse as an editor for erlang > did install the plugin and set up the run time but dont know how to execute > the Erlang project . I suppose you are using the latest version available (0.3.80 or later). I am currently writing the documentation for this, I'll try to explain briefly. First of all, I assume that the project builds and that you get all the IDE functionality. To run or debug your code, you have to launch an Erlang node for it. This is done by going to Run->Run configurations... (or Run->Open Run dialog... for Eclipse 3.3), select Erlang application and create a new launch configuration. Give it a good name, check the needed projects in the list and on the "runtimes" tab choose a runtime, a name for the node and check "start the node if not running". These are the mandatory options. When you click Run (or later, when you choose this configuration in the Run menu), a node will be started (or an existing one will be contacted, if the name matches) and a console will be shown where you can start your program and check the results. Please note that: * this console has limited editing functionality for the input * the "normal" console that is shown in Eclipse is for now almost useless, as the projects' code is not loaded into it * the launch configuration can be used to start the debugger too, more detailed instructions on how to use it will be available soon, until then it's an unsupported feature. Please let me know if you have any other questions. best regards, Vlad From Mike.French@REDACTED Mon Sep 29 12:52:14 2008 From: Mike.French@REDACTED (French, Mike) Date: Mon, 29 Sep 2008 11:52:14 +0100 Subject: [erlang-questions] Reia Message-ID: http://wiki.reia-lang.org/wiki/Reia_Programming_Language Mik Thales UK Ltd (Wells) DISCLAIMER: The information contained in this e-mail is confidential. It may also be legally privileged. It is intended only for the stated addressee(s) and access to it by any other person is unauthorised. If you are not an addressee, you must not disclose, copy, circulate or in any other way use or rely on the information contained in this e-mail. Such unauthorised use may be unlawful. We may monitor all e-mail communications through our networks. If you have received this e-mail in error, please inform us immediately on +44 (0) 1749 672081 and delete it and all copies from your system. We accept no responsibility for changes to any e-mail which occur after it has been sent. Attachments to this e-mail may contain software viruses which could damage your system. We therefore recommend you virus-check all attachments before opening. A business of Thales UK Ltd. Registered Office: 2 Dashwood Lang Road, The Bourne Business Park, Addlestone, Weybridge, Surrey KT15 2NX Registered in England No. 868273 From Dana.RUBINO@REDACTED Mon Sep 29 13:15:11 2008 From: Dana.RUBINO@REDACTED (Dana.RUBINO@REDACTED) Date: Mon, 29 Sep 2008 12:15:11 +0100 Subject: [erlang-questions] Erlang Oracle ODBC connectivity question. Message-ID: Hi all, Now that I have Mnesia up and running well (thanks to everyone who helped out!) I am now trying to connect to an Oracle database. Working through the getting started guide on erlang.org for the odbc module. Problem is I fall over when trying to connect to the DB. I have created the ODBC connection in Windows and have tested it (so that's not an issue). When however I try to make the connection via the Erlang shell I get the following: Eshell V5.6.3 (abort with ^G) 1> odbc:start(). ok 2> {ok, Ref} = odbc:connect("DSN=HWHU;UID=auser;PWD=apwd", []). ** exception error: no match of right hand side value {error, "No SQL-driver information available. Connection to database failed."} Do I somehow have to point it to my installed ODBC driver as well? Has anyone come across this before? Also is there perhaps another way of accessing an Oracle DB in Erlang? (I don't need to use ODBC) Many Thanks, Dan *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbs.com/gbm www.rbsgc.com *********************************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From lemenkov@REDACTED Mon Sep 29 13:31:18 2008 From: lemenkov@REDACTED (Peter Lemenkov) Date: Mon, 29 Sep 2008 15:31:18 +0400 Subject: [erlang-questions] Erlang Oracle ODBC connectivity question. In-Reply-To: References: Message-ID: 2008/9/29 : > Hi all, > > Now that I have Mnesia up and running well (thanks to everyone who helped > out!) I am now trying to connect to an Oracle database. > > Working through the getting started guide on erlang.org for the odbc module. > > Problem is I fall over when trying to connect to the DB. I have created the > ODBC connection in Windows and have tested it (so that's not an issue). Please, ensure again, that you can connect to Oracle via standart ODBC link. I'm using isql for that purpose. > Also is there perhaps another way of accessing an Oracle DB in Erlang? (I > don't need to use ODBC) None, AFAIK. -- With best regards! From Dana.RUBINO@REDACTED Mon Sep 29 14:11:16 2008 From: Dana.RUBINO@REDACTED (Dana.RUBINO@REDACTED) Date: Mon, 29 Sep 2008 13:11:16 +0100 Subject: [erlang-questions] Erlang Oracle ODBC connectivity question. In-Reply-To: References: Message-ID: Hi Peter, I perform a test connection within the Microsoft Data source Administrator (it is successful) - is that what you mean? I saw somewhere, mention of having to point (read recompile) the C part of the odbc module at the installed ODBC driver. Does that sound familiar with anyone? Thanks, Dan -----Original Message----- From: Peter Lemenkov [mailto:lemenkov@REDACTED] Sent: 29 September 2008 12:31 To: RUBINO, Dana, GBM Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Erlang Oracle ODBC connectivity question. 2008/9/29 : > Hi all, > > Now that I have Mnesia up and running well (thanks to everyone who > helped > out!) I am now trying to connect to an Oracle database. > > Working through the getting started guide on erlang.org for the odbc module. > > Problem is I fall over when trying to connect to the DB. I have > created the ODBC connection in Windows and have tested it (so that's not an issue). Please, ensure again, that you can connect to Oracle via standart ODBC link. I'm using isql for that purpose. > Also is there perhaps another way of accessing an Oracle DB in Erlang? > (I don't need to use ODBC) None, AFAIK. -- With best regards! *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbs.com/gbm www.rbsgc.com *********************************************************************************** From mats.cronqvist@REDACTED Mon Sep 29 14:16:13 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Mon, 29 Sep 2008 14:16:13 +0200 Subject: [erlang-questions] GTK bindings In-Reply-To: <48D1FC87.8030601@it.uu.se> References: <48CF2F1B.3070003@lionet.info> <2ae3549f-f1cb-4e3c-b7e3-d805c6de372a@m36g2000hse.googlegroups.com> <48CFF05B.90401@lionet.info> <15b6a55b-956f-45c8-b412-76751fe630ab@e53g2000hsa.googlegroups.com> <087d239c-07b5-47ef-9372-ae097ca12bcd@m45g2000hsb.googlegroups.com> <3dbc6d1c0809161457v2ed4f29bxe16bcc124dbf06f5@mail.gmail.com> <14f0e3620809161547x32377a37ke4c9abee0a8c41e1@mail.gmail.com> <3dbc6d1c0809161643t33fb3a80l7cb4b330333a1ef7@mail.gmail.com> <4ac8254d0809170244s4ebd31b1y4d0b361cdf3cb76f@mail.gmail.com> <48D1FC87.8030601@it.uu.se> Message-ID: <48E0C70D.5020700@gmail.com> Richard Carlsson wrote: > YourSurrogateGod wrote: > >> Speaking of GTK bindings. Are there any so that one could make Gnome >> applications (use all of the widgets and such) with Erlang? I haven't >> heard of any at the moment... >> > > The most mature (and portable) alternative is probably WxErlang: > http://www.erlang.org/~dgud/wxerlang/ > http://sourceforge.net/projects/wxerlang/ > will, in all likelihood, eventually be bundled with OTP. > There are also a couple of attempts at direct GTK bindings, but > don't know what their status is: > > http://code.google.com/p/gtknode/ > gtknode works fine on all versions of GTK from 2.4 to 2.12 (compiled it last friday). > http://erlgtk.sourceforge.net/ dead AFAIK. mats From rtrlists@REDACTED Mon Sep 29 14:45:23 2008 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 29 Sep 2008 13:45:23 +0100 Subject: [erlang-questions] Erlang Oracle ODBC connectivity question. In-Reply-To: References: Message-ID: <6a3ae47e0809290545m3191f7b1ka872e4dd5da17cff@mail.gmail.com> Which ODBC Driver is your DSN HWHU using? I ask, because I have had difficulties using the Oracle ODBC driver in the past. I wasn't using Erlang at the time though, but got the same error message. For me, the Microsoft Oracle driver worked fine and I stopped investigating. Robby From Dana.RUBINO@REDACTED Mon Sep 29 14:49:20 2008 From: Dana.RUBINO@REDACTED (Dana.RUBINO@REDACTED) Date: Mon, 29 Sep 2008 13:49:20 +0100 Subject: [erlang-questions] Erlang Oracle ODBC connectivity question. In-Reply-To: <6a3ae47e0809290545m3191f7b1ka872e4dd5da17cff@mail.gmail.com> References: <6a3ae47e0809290545m3191f7b1ka872e4dd5da17cff@mail.gmail.com> Message-ID: Hi Robby, I have progressed slightly. Turns out I needed to set the %ORACLE_HOME% environment variable (this wasn't on the man page). It now produces the following error: 1> {ok, Ref} = odbc:connect("DSN=HWHU;UID=auid;PWD=apwd", []). =ERROR REPORT==== 29-Sep-2008::13:40:00 === ODBC: received unexpected info: {tcp_closed,#Port<0.106>} ** exception error: no match of right hand side value {error, connection_closed} =ERROR REPORT==== 29-Sep-2008::13:40:00 === ** Generic server <0.39.0> terminating ** Last message in was {#Port<0.104>,{exit_status,23}} ** When Server state == {state,#Port<0.104>, {<0.31.0>,#Ref<0.0.0.78>}, <0.31.0>,undefined,on,undefined,undefined,on, connecting,undefined,0, [#Port<0.102>,#Port<0.103>], #Port<0.105>,#Port<0.106>} ** Reason for termination == ** {port_exit,collecting_of_driver_information_faild} I am using 10g and have checked the correct ODBC driver is installed (version 10.0.2.0 from Oracle) Are you suggesting using an MS implementation of the Oracle ODBC driver? Many Thanks, Dan -----Original Message----- From: Robert Raschke [mailto:rtrlists@REDACTED] Sent: 29 September 2008 13:45 To: erlang-questions@REDACTED Cc: RUBINO, Dana, GBM Subject: Re: [erlang-questions] Erlang Oracle ODBC connectivity question. Which ODBC Driver is your DSN HWHU using? I ask, because I have had difficulties using the Oracle ODBC driver in the past. I wasn't using Erlang at the time though, but got the same error message. For me, the Microsoft Oracle driver worked fine and I stopped investigating. Robby *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbs.com/gbm www.rbsgc.com *********************************************************************************** From rtrlists@REDACTED Mon Sep 29 15:31:42 2008 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 29 Sep 2008 14:31:42 +0100 Subject: [erlang-questions] Erlang Oracle ODBC connectivity question. In-Reply-To: References: <6a3ae47e0809290545m3191f7b1ka872e4dd5da17cff@mail.gmail.com> Message-ID: <6a3ae47e0809290631h3871cfceie4bd5db04666d35c@mail.gmail.com> Hi Dana, > Are you suggesting using an MS implementation of the Oracle ODBC driver? Yes. I ended up using the "Microsoft ODBC for Oracle" driver. I'm not exactly sure if it is there by default or if it was something that got added to my system when I installed MSSQL. It shows up in the list of drivers when creating a new ODBC DSN in the Administrative Tools->Data Sources GUI. I think there may be some miscommunication going on between Microsoft's ODBC Driver Manager and the Oracle ODBC driver, which is tickled by the way the some ODBC interfaces use SQLGetInfo(). But I have not had the energy to go and figure out out. Robby From Dana.RUBINO@REDACTED Mon Sep 29 16:07:18 2008 From: Dana.RUBINO@REDACTED (Dana.RUBINO@REDACTED) Date: Mon, 29 Sep 2008 15:07:18 +0100 Subject: [erlang-questions] Erlang Oracle ODBC connectivity question. In-Reply-To: <6a3ae47e0809290631h3871cfceie4bd5db04666d35c@mail.gmail.com> References: <6a3ae47e0809290545m3191f7b1ka872e4dd5da17cff@mail.gmail.com> <6a3ae47e0809290631h3871cfceie4bd5db04666d35c@mail.gmail.com> Message-ID: Thanks Robby - I will take a look on the MS site and see if I can find it! Dan -----Original Message----- From: Robert Raschke [mailto:rtrlists@REDACTED] Sent: 29 September 2008 14:32 To: RUBINO, Dana, GBM; erlang-questions@REDACTED Subject: Re: [erlang-questions] Erlang Oracle ODBC connectivity question. Hi Dana, > Are you suggesting using an MS implementation of the Oracle ODBC driver? Yes. I ended up using the "Microsoft ODBC for Oracle" driver. I'm not exactly sure if it is there by default or if it was something that got added to my system when I installed MSSQL. It shows up in the list of drivers when creating a new ODBC DSN in the Administrative Tools->Data Sources GUI. I think there may be some miscommunication going on between Microsoft's ODBC Driver Manager and the Oracle ODBC driver, which is tickled by the way the some ODBC interfaces use SQLGetInfo(). But I have not had the energy to go and figure out out. Robby *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbs.com/gbm www.rbsgc.com *********************************************************************************** From daniel.goertzen@REDACTED Mon Sep 29 16:54:15 2008 From: daniel.goertzen@REDACTED (Daniel Goertzen) Date: Mon, 29 Sep 2008 09:54:15 -0500 Subject: [erlang-questions] Problems cross-compiling OTP on ARM In-Reply-To: <48DCC42D.70302@diit.unict.it> References: <48DCC42D.70302@diit.unict.it> Message-ID: A related question: Will a native ARM9 build of Erlang work? (no cross compiling) Dan. On Fri, Sep 26, 2008 at 6:14 AM, Corrado Santoro wrote: > Hello, > > I'm trying to cross-compile OTP on a ARM9 architecture and I'm > compiling R11B-5. > > The build stops generating the following linker error: > > obj/arm-unknown-linux-gnu/opt/hybrid/erl_bif_table.o:(.data+0x2c80): > undefined reference to `hipe_bifs_write_u8_2' > obj/arm-unknown-linux-gnu/opt/hybrid/erl_bif_table.o:(.data+0x2c94): > undefined reference to `hipe_bifs_write_u32_2' > obj/arm-unknown-linux-gnu/opt/hybrid/erl_bif_table.o:(.data+0x2ca8): > undefined reference to `hipe_bifs_bytearray_2' > obj/arm-unknown-linux-gnu/opt/hybrid/erl_bif_table.o:(.data+0x2cbc): > undefined reference to `hipe_bifs_bytearray_sub_2' > obj/arm-unknown-linux-gnu/opt/hybrid/erl_bif_table.o:(.data+0x2cd0): > undefined reference to `hipe_bifs_bytearray_update_3' > > ... > > The strange thing is that I've disabled hipe (./configure > --disable_hipe), but it seems that hipe is still considered? > > The "configure" line I'm using is: > > ./configure --target=arm-linux --host=arm-linux --disable-hipe > --without-jinterface > > Any hint? > > Thanks, > --Corrado > > > -- > ================================================================== > Eng. Corrado Santoro, Ph.D. > University of Catania - ITALY > Dept. of Mathematics and Informatics > > VoIP: sip:7035@REDACTED > > ================================================================== > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikpe@REDACTED Mon Sep 29 17:40:35 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Mon, 29 Sep 2008 17:40:35 +0200 Subject: [erlang-questions] Problems cross-compiling OTP on ARM In-Reply-To: References: <48DCC42D.70302@diit.unict.it> Message-ID: <18656.63219.945856.61080@harpo.it.uu.se> Daniel Goertzen writes: > A related question: Will a native ARM9 build of Erlang work? (no cross > compiling) If you --disable-hipe then yes it should work. With --enable-hipe you may need R12B-recent, as R11 possibly only supports big-endian v5te (xscale). Which generation is ARM9, v4? v5? -te? I'm not sure HiPE will support v4. I routinely build natively and test HiPE on a little-endian XScale 80219 and a big-endian XScale IXP420. From Dana.RUBINO@REDACTED Mon Sep 29 17:44:20 2008 From: Dana.RUBINO@REDACTED (Dana.RUBINO@REDACTED) Date: Mon, 29 Sep 2008 16:44:20 +0100 Subject: [erlang-questions] Erlang Oracle ODBC connectivity question. In-Reply-To: References: Message-ID: OK I have tried a number of things: 1) Used Oracle's own 10.0.2.0 ODBC (with no luck) 2) Used MS's Oracle ODBC driver but again with no luck. I have a feeling I am not pointing the erlang odbc module to the driver (looks like you can do this when making odbc module from src). I am not sure where this would be done though. Would it be possible for somebody who has this working to do a step by step setup guide for using erlang/odbc on Windows? I have searched the mailing list and haven't been able to find such a posting - I am sure many others would find this useful as well (I cant be the only one having probs with Erlang and odbc :-D). As far as steps go I have: 1) Installed Oracle odbc driver. 2) Set ORACLE_HOME -> 10.0.2.0 driver location Then in the Erlang shell I have tried to test: 1)odbc:start(). -> ok 2){ok, Ref} = odbc:connect("DSN=HWHU;UID=auid;PWD=apwd", []). -> ** exception error: no match of right hand side value {error, "No SQL-driver information available. Connection to database failed."} Am I missing a step somewhere? What steps have other who have got this working done to get going under windows? Thanks, Dan -----Original Message----- From: Peter Lemenkov [mailto:lemenkov@REDACTED] Sent: 29 September 2008 12:31 To: RUBINO, Dana, GBM Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Erlang Oracle ODBC connectivity question. 2008/9/29 : > Hi all, > > Now that I have Mnesia up and running well (thanks to everyone who > helped > out!) I am now trying to connect to an Oracle database. > > Working through the getting started guide on erlang.org for the odbc module. > > Problem is I fall over when trying to connect to the DB. I have > created the ODBC connection in Windows and have tested it (so that's not an issue). Please, ensure again, that you can connect to Oracle via standart ODBC link. I'm using isql for that purpose. > Also is there perhaps another way of accessing an Oracle DB in Erlang? > (I don't need to use ODBC) None, AFAIK. -- With best regards! *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbs.com/gbm www.rbsgc.com *********************************************************************************** From csanto@REDACTED Mon Sep 29 17:51:32 2008 From: csanto@REDACTED (Corrado Santoro) Date: Mon, 29 Sep 2008 17:51:32 +0200 Subject: [erlang-questions] Problems cross-compiling OTP on ARM In-Reply-To: References: <48DCC42D.70302@diit.unict.it> Message-ID: <48E0F984.8040206@diit.unict.it> Hi, Daniel Goertzen wrote: > A related question: Will a native ARM9 build of Erlang work? (no cross > compiling) Dunno! Anyway, I successful compiled OTP on my ARM9 box and it seems working! :-) The target board is: http://www.calao-systems.com/articles.php?lng=en&pg=76 No HIPE and no dialyzer. I've used Matthias' patches and some other patches made by myself. It could be very interesting to enable HIPE, but I haven't understood if HIPE for ARM9 is supported. Any answer from the HIPE group?? Cheers, --Corrado -- ================================================================== Eng. Corrado Santoro, Ph.D. University of Catania - ITALY Dept. of Mathematics and Informatics VoIP: sip:7035@REDACTED ================================================================== From Dana.RUBINO@REDACTED Mon Sep 29 18:18:22 2008 From: Dana.RUBINO@REDACTED (Dana.RUBINO@REDACTED) Date: Mon, 29 Sep 2008 17:18:22 +0100 Subject: [erlang-questions] Erlang Oracle ODBC connectivity question. In-Reply-To: References: Message-ID: Don't worry guys - all sorted. Seems that using the latest 10.0.2.0 Oracle ODBC driver you need to turn off scrollable cursors. This did the trick: {ok, Ref} = odbc:connect("DSN=HWHU;UID=hrzrptu1_to;PWD=Hrzwh_u1_0", [{scrollable_cursors, off}]). I had assumed this was something set at the driver level and not a parameter to odbc:connect/2 Once this is in place there are no issues. Thanks, dan -----Original Message----- From: RUBINO, Dana, GBM Sent: 29 September 2008 16:44 To: erlang-questions@REDACTED Subject: RE: [erlang-questions] Erlang Oracle ODBC connectivity question. OK I have tried a number of things: 1) Used Oracle's own 10.0.2.0 ODBC (with no luck) 2) Used MS's Oracle ODBC driver but again with no luck. I have a feeling I am not pointing the erlang odbc module to the driver (looks like you can do this when making odbc module from src). I am not sure where this would be done though. Would it be possible for somebody who has this working to do a step by step setup guide for using erlang/odbc on Windows? I have searched the mailing list and haven't been able to find such a posting - I am sure many others would find this useful as well (I cant be the only one having probs with Erlang and odbc :-D). As far as steps go I have: 1) Installed Oracle odbc driver. 2) Set ORACLE_HOME -> 10.0.2.0 driver location Then in the Erlang shell I have tried to test: 1)odbc:start(). -> ok 2){ok, Ref} = odbc:connect("DSN=HWHU;UID=auid;PWD=apwd", []). -> ** exception error: no match of right hand side value {error, "No SQL-driver information available. Connection to database failed."} Am I missing a step somewhere? What steps have other who have got this working done to get going under windows? Thanks, Dan -----Original Message----- From: Peter Lemenkov [mailto:lemenkov@REDACTED] Sent: 29 September 2008 12:31 To: RUBINO, Dana, GBM Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Erlang Oracle ODBC connectivity question. 2008/9/29 : > Hi all, > > Now that I have Mnesia up and running well (thanks to everyone who > helped > out!) I am now trying to connect to an Oracle database. > > Working through the getting started guide on erlang.org for the odbc module. > > Problem is I fall over when trying to connect to the DB. I have > created the ODBC connection in Windows and have tested it (so that's not an issue). Please, ensure again, that you can connect to Oracle via standart ODBC link. I'm using isql for that purpose. > Also is there perhaps another way of accessing an Oracle DB in Erlang? > (I don't need to use ODBC) None, AFAIK. -- With best regards! *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbs.com/gbm www.rbsgc.com *********************************************************************************** From luis.chiruzzo@REDACTED Mon Sep 29 18:20:04 2008 From: luis.chiruzzo@REDACTED (luis.chiruzzo@REDACTED) Date: 29 Sep 2008 12:20:04 -0400 Subject: [erlang-questions] =?utf-8?q?erlang-questions_Digest=2C_Vol_16=2C?= =?utf-8?q?_Issue_118?= Message-ID: <20080929162004.20639.qmail@ps03.vds2000.com> An HTML attachment was scrubbed... URL: From rtrlists@REDACTED Mon Sep 29 18:28:55 2008 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 29 Sep 2008 17:28:55 +0100 Subject: [erlang-questions] Erlang Oracle ODBC connectivity question. In-Reply-To: References: Message-ID: <6a3ae47e0809290928t1316893dwce541f8fe2adf8cd@mail.gmail.com> Hi Dana On Mon, Sep 29, 2008 at 4:44 PM, wrote: > I have a feeling I am not pointing the erlang odbc module to the driver (looks like you can do this when making odbc module from src). I am not sure where this would be done though. I think this is a red herring. You don't need to do anything special to the odbc module. Ah, I think there was something about an option needing to get set on the open. OK, here's what I did (all under WinXP): Installed Erlang R12B Created a test ODBC Data Source in Windows using the Driver "Oracle in OraClient10g_home1" (that's my local 10.0.3.0 client install of Oracle). Tested fine in the ODBC Admin window. Start erl. 1> odbc:start(). ok 2> {ok, Ref} = odbc:connect("DSN=test;UID=user;PWD=pwd",[{scrollable_cursors, off}]). {ok,<0.49.0>} So, you need to turn scrollable cursors off. Robby From mikpe@REDACTED Mon Sep 29 18:34:31 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Mon, 29 Sep 2008 18:34:31 +0200 Subject: [erlang-questions] Problems cross-compiling OTP on ARM In-Reply-To: <48E0F984.8040206@diit.unict.it> References: <48DCC42D.70302@diit.unict.it> <48E0F984.8040206@diit.unict.it> Message-ID: <18657.919.809825.354226@harpo.it.uu.se> Corrado Santoro writes: > Hi, > > Daniel Goertzen wrote: > > A related question: Will a native ARM9 build of Erlang work? (no cross > > compiling) > Dunno! > > Anyway, I successful compiled OTP on my ARM9 box and it seems working! :-) > > The target board is: http://www.calao-systems.com/articles.php?lng=en&pg=76 > > No HIPE and no dialyzer. I've used Matthias' patches and some other > patches made by myself. > > It could be very interesting to enable HIPE, but I haven't understood if > HIPE for ARM9 is supported. Any answer from the HIPE group?? See my response to Daniel's post. If you tell me what generation your ARM9 is (v4? v5? t? te? big- or little-endian?) I'll tell you if it works with HiPE. From tony@REDACTED Mon Sep 29 19:11:33 2008 From: tony@REDACTED (Tony Arcieri) Date: Mon, 29 Sep 2008 11:11:33 -0600 Subject: [erlang-questions] Writing my own REPL In-Reply-To: <597c69660809271401t19bdd307q93482511ff1edd22@mail.gmail.com> References: <597c69660809261455v69c947a4h904c5f1ab0bbbfbf@mail.gmail.com> <3dbc6d1c0809261501k1d93fc0bja61705b73e034b2c@mail.gmail.com> <597c69660809261506n6df10543k26aecfb2c5443901@mail.gmail.com> <597c69660809271401t19bdd307q93482511ff1edd22@mail.gmail.com> Message-ID: On Sat, Sep 27, 2008 at 3:01 PM, Attila Babo wrote: > This minimal wrapper starts a custom shell as you requested and ^G > works nicely. With Robert's hacked user_drv it's more convenient to > start multiple copies of your own shell. With rlwrap it's pretty > usable. :-) > > Is this what are you guys after? > That works, however it's still not using edlin :/ -- Tony Arcieri medioh.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.goertzen@REDACTED Mon Sep 29 21:49:01 2008 From: daniel.goertzen@REDACTED (Daniel Goertzen) Date: Mon, 29 Sep 2008 14:49:01 -0500 Subject: [erlang-questions] Problems cross-compiling OTP on ARM In-Reply-To: <48E0F984.8040206@diit.unict.it> References: <48DCC42D.70302@diit.unict.it> <48E0F984.8040206@diit.unict.it> Message-ID: Thanks, that board has the same cpu we've been looking at (AT91SAM9260), so I assume it will work for me then to. The core is an ARMv5TEJ. Dan. On Mon, Sep 29, 2008 at 10:51 AM, Corrado Santoro wrote: > Hi, > > Daniel Goertzen wrote: > > A related question: Will a native ARM9 build of Erlang work? (no cross > > compiling) > Dunno! > > Anyway, I successful compiled OTP on my ARM9 box and it seems working! :-) > > The target board is: > http://www.calao-systems.com/articles.php?lng=en&pg=76 > > No HIPE and no dialyzer. I've used Matthias' patches and some other > patches made by myself. > > It could be very interesting to enable HIPE, but I haven't understood if > HIPE for ARM9 is supported. Any answer from the HIPE group?? > > Cheers, > --Corrado > > -- > ================================================================== > Eng. Corrado Santoro, Ph.D. > University of Catania - ITALY > Dept. of Mathematics and Informatics > > VoIP: sip:7035@REDACTED > > ================================================================== > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Mon Sep 29 22:26:30 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Mon, 29 Sep 2008 16:26:30 -0400 Subject: [erlang-questions] Reia, or On The Evils Of Tabs And Indentation Sensitivity Message-ID: <6c2563b20809291326m3e982e1fg10d7a62af89206a8@mail.gmail.com> I was quite interested right up to the point where I read about indentation sensitivity, and then I lost interest. I don't want to start a religious flame war, but I am compelled to write this politically incorrect rant. I've trained my eyes to view block structure using aligned begin/end (open/close) pairs (or their brace/bracket/parenthesis equivalents), and cursed too many pieces of tab-infested source code files that have had multiple maintainers -- each of whom used different tab settings, resulting in a visual abortion -- for far too long now to want to use anything but languages that do not *require* leading whitespace characters. Regarding indentation sensitivity, remember "one of the worst design botches in the history of Unix"[1], the requirement for a semantically meaningful leading tab character in makefiles? I've been bitten by that nastiness enough times to be highly allergic to the whole leading whitespace concept, not to mention by having something in a makefile that should have been indented, or had a blank line (or not), but wasn't. Bah. Sadly, "tab rot" afflicts at least some of the OTP source code. Set your editor to highlight tabs, look through a few OTP source files, and you will see places where indentation is done using spaces, and others where it's done using a mixture of tabs and spaces. If your tab settings don't match the OTP team's, it will look as if it was written by a drunk with multiple personality disorder. Not that drunk MPD sufferers are necessarily bad people, mind you, but keep them away from my source code, please. I know that Reia *per se* is not to blame for the Great Tab Debacle, but I have shunned Python partly for the same reason. Erlang, I must admit, is the closest I have come to using indentation without using matching open/close block structuring at every level, but wrong indentation in Erlang does not lead to changes in semantics, so that's not too bad. I know, if I don't like it, don't use it, so I won't, but I do wish Reia success in its goals. So long as the tabs don't leak out of its files and into mine ;) ---------------- [1] The Art of UNIX Programming, Eric S. Raymond, p358 On Mon, Sep 29, 2008 at 6:52 AM, French, Mike < Mike.French@REDACTED> wrote: > > http://wiki.reia-lang.org/wiki/Reia_Programming_Language > > Mik > > Thales UK Ltd (Wells) DISCLAIMER: The information contained in this e-mail > is confidential. It may also be legally privileged. It is intended only for > the stated addressee(s) and access to it by any other person is > unauthorised. If you are not an addressee, you must not disclose, copy, > circulate or in any other way use or rely on the information contained in > this e-mail. Such unauthorised use may be unlawful. We may monitor all > e-mail communications through our networks. If you have received this > e-mail > in error, please inform us immediately on +44 (0) 1749 672081 and delete it > and all copies from your system. We accept no responsibility for changes to > any e-mail which occur after it has been sent. Attachments to this e-mail > may contain software viruses which could damage your system. We therefore > recommend you virus-check all attachments before opening. A business of > Thales UK Ltd. Registered Office: 2 Dashwood Lang Road, The Bourne Business > Park, Addlestone, Weybridge, Surrey KT15 2NX Registered in England No. > 868273 > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From luismarianoguerra@REDACTED Mon Sep 29 22:39:32 2008 From: luismarianoguerra@REDACTED (Mariano Guerra) Date: Mon, 29 Sep 2008 17:39:32 -0300 Subject: [erlang-questions] Reia, or On The Evils Of Tabs And Indentation Sensitivity In-Reply-To: <6c2563b20809291326m3e982e1fg10d7a62af89206a8@mail.gmail.com> References: <6c2563b20809291326m3e982e1fg10d7a62af89206a8@mail.gmail.com> Message-ID: 2008/9/29 Edwin Fine : > I was quite interested right up to the point where I read about indentation > sensitivity, and then I lost interest. > > I don't want to start a religious flame war, but I am compelled to write > this politically incorrect rant. [snip] The recomendation on python is to use only spaces and configure the tabs to use 4 spaces. In fact there is an option on the interpreter to warn you about mix of spaces and tabs. Once you configure your text editor and follow the recomendations, you forget about it. In fact, now I love python, and one of the reasons is because no begin/end {/} stuff is needed I'm not intending to start a flamewar, it's just that people tend to hate that about python but I dont know any python programmer that after a day of python programming will say it hates indentation sensitivity :) From chsu79@REDACTED Mon Sep 29 23:44:52 2008 From: chsu79@REDACTED (Christian) Date: Mon, 29 Sep 2008 23:44:52 +0200 Subject: [erlang-questions] Reia, or On The Evils Of Tabs And Indentation Sensitivity In-Reply-To: References: <6c2563b20809291326m3e982e1fg10d7a62af89206a8@mail.gmail.com> Message-ID: Guys, guys, guys! Threads like these is why god invented blogs. From rvirding@REDACTED Tue Sep 30 00:02:48 2008 From: rvirding@REDACTED (Robert Virding) Date: Tue, 30 Sep 2008 00:02:48 +0200 Subject: [erlang-questions] The Erlang Rationale Message-ID: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> I have just released a document called the Erlang Rationale. The Rationale is an attempt to explain why things look like they do in Erlang and our thinking behind many of the properties and features of the language. There is also some descriptions of part of the system which today seem to lack description, for example the i/o system and groups. The Rationale mainly deals with the core parts of the language and the older parts of the libraries and not OTP. It is to be considered to be work-in-progress and I will add to it when I find the time and get the urge. Please come with comments and suggestions on what is there and what you feel should be there. Sorry for it being in Word format but this is the best I can do for a simple editor which allows making diagrams and runs on Windows. It can be found on trapexit.org user contributions: http://forum.trapexit.org/viewtopic.php?p=44172#44172 Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Tue Sep 30 00:03:45 2008 From: rvirding@REDACTED (Robert Virding) Date: Tue, 30 Sep 2008 00:03:45 +0200 Subject: [erlang-questions] Reia, or On The Evils Of Tabs And Indentation Sensitivity In-Reply-To: References: <6c2563b20809291326m3e982e1fg10d7a62af89206a8@mail.gmail.com> Message-ID: <3dbc6d1c0809291503n77971578ie7e7cdfeefcedd83@mail.gmail.com> 2008/9/29 Christian > Guys, guys, guys! > > Threads like these is why god invented blogs. > Shouldn't erlang-questions be a blog instead? Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony@REDACTED Tue Sep 30 00:31:45 2008 From: tony@REDACTED (Tony Arcieri) Date: Mon, 29 Sep 2008 16:31:45 -0600 Subject: [erlang-questions] Reia, or On The Evils Of Tabs And Indentation Sensitivity In-Reply-To: References: <6c2563b20809291326m3e982e1fg10d7a62af89206a8@mail.gmail.com> Message-ID: On Mon, Sep 29, 2008 at 2:39 PM, Mariano Guerra wrote: > The recomendation on python is to use only spaces and configure the > tabs to use 4 spaces. > In fact there is an option on the interpreter to warn you about mix > of spaces and tabs. > Once you configure your text editor and follow the recomendations, > you forget about it. > Hi, I created Reia. I intend to pursue a bit more draconian policy than Python regarding the tabs/spaces issue. Mixing tabs and spaces will produce an error (which will point out "Hey, you switched from tabs to spaces on line N"). You have your choice (on a file-by-file basis) of using tabs or spaces, but not both in the same file. That said right now hard tabs generate an error as the lexer doesn't understand them. > In fact, now I love python, and one of the reasons is because no > begin/end {/} stuff is needed The analogue in Erlang is the elimination of the . , and ; markers. eol (or ;) acts as a statement separator and clauses can be grouped by indentation level. This is what Reia does to a certain extent. There's also Indentation Sensitive Erlang: http://ulf.wiger.net/weblog/2008/03/19/indentation-sensitive-erlang/ -- Tony Arcieri medioh.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony@REDACTED Tue Sep 30 00:35:17 2008 From: tony@REDACTED (Tony Arcieri) Date: Mon, 29 Sep 2008 16:35:17 -0600 Subject: [erlang-questions] Writing my own REPL In-Reply-To: References: <597c69660809261455v69c947a4h904c5f1ab0bbbfbf@mail.gmail.com> <3dbc6d1c0809261501k1d93fc0bja61705b73e034b2c@mail.gmail.com> <597c69660809261506n6df10543k26aecfb2c5443901@mail.gmail.com> <597c69660809271401t19bdd307q93482511ff1edd22@mail.gmail.com> Message-ID: On Mon, Sep 29, 2008 at 11:11 AM, Tony Arcieri wrote: > That works, however it's still not using edlin :/ > After looking at the updated LFE sources, I discovered I was using the wrong i/o server... whoops. Things seem to be working just dandy now. Now I'm wondering how hard it is to change edlin's behavior. I'd really like the ^D behavior exhibited by most other shells (i.e. if there are no characters in the buffer to delete, then exit) I suppose I could just hack on edlin.erl itself and ship my own version. -- Tony Arcieri medioh.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony@REDACTED Tue Sep 30 01:28:31 2008 From: tony@REDACTED (Tony Arcieri) Date: Mon, 29 Sep 2008 17:28:31 -0600 Subject: [erlang-questions] Writing my own REPL In-Reply-To: <597c69660809271401t19bdd307q93482511ff1edd22@mail.gmail.com> References: <597c69660809261455v69c947a4h904c5f1ab0bbbfbf@mail.gmail.com> <3dbc6d1c0809261501k1d93fc0bja61705b73e034b2c@mail.gmail.com> <597c69660809261506n6df10543k26aecfb2c5443901@mail.gmail.com> <597c69660809271401t19bdd307q93482511ff1edd22@mail.gmail.com> Message-ID: On Sat, Sep 27, 2008 at 3:01 PM, Attila Babo wrote: > erl -noshell -noinput -s lfe_wrap start -pa ebin . > Erlang (BEAM) emulator version 5.6.4 [source] [smp:2] > [async-threads:0] [kernel-poll:false] > Is there a way to suppress the system_version greeting? -- Tony Arcieri medioh.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin@REDACTED Tue Sep 30 01:45:25 2008 From: kevin@REDACTED (Kevin A. Smith) Date: Mon, 29 Sep 2008 19:45:25 -0400 Subject: [erlang-questions] The Erlang Rationale In-Reply-To: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> References: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> Message-ID: I've posted a PDF version of Robert's document in PDF format to the same topic. Hopefully even more people will be able to read this excellent document. --Kevin On Sep 29, 2008, at 6:02 PM, Robert Virding wrote: > I have just released a document called the Erlang Rationale. > > The Rationale is an attempt to explain why things look like they do > in Erlang and our thinking behind many of the properties and > features of the language. There is also some descriptions of part of > the system which today seem to lack description, for example the i/o > system and groups. The Rationale mainly deals with the core parts of > the language and the older parts of the libraries and not OTP. > > It is to be considered to be work-in-progress and I will add to it > when I find the time and get the urge. Please come with comments and > suggestions on what is there and what you feel should be there. > > Sorry for it being in Word format but this is the best I can do for > a simple editor which allows making diagrams and runs on Windows. > > It can be found on trapexit.org user contributions: > > http://forum.trapexit.org/viewtopic.php?p=44172#44172 > > Robert > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From devdoer2@REDACTED Tue Sep 30 05:25:54 2008 From: devdoer2@REDACTED (devdoer bird) Date: Tue, 30 Sep 2008 11:25:54 +0800 Subject: [erlang-questions] Why are the two strings outputed in diffrent format? Message-ID: HI: I have a utf8 encoded file y.erl: the source is : -module(y). -compile(export_all). output2()-> "??". And a latin encoded file x.erl, the source is: -module(x). -compile(export_all). output2()-> "??". When execute them in erlang shell, 1> x:output2(). "\326\320\271\372" 2>y:output2(). [228,184,173,229,155,189] I don't know why they are outupted in diffrent format, one is string-format, the other is list-format. Why aren't they birth outputed in string-format or both in list-format? -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Tue Sep 30 06:17:20 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Tue, 30 Sep 2008 00:17:20 -0400 Subject: [erlang-questions] Why are the two strings outputed in diffrent format? In-Reply-To: References: Message-ID: <6c2563b20809292117h3508a912g2ce92a3eb8e373a6@mail.gmail.com> It is because one of the integers in y (155) is not considered printable by Erlang. 17> X = "\326\320\271\372". "\326\320\271\372" 18> Y = [228,184,173,229,155,189]. [228,184,173,229,155,189] 19> [{I, io_lib:printable_list([I])} || I <- X]. [{214,true},{208,true},{185,true},{250,true}] 20> [{I, io_lib:printable_list([I])} || I <- Y]. [{228,true}, {184,true}, {173,true}, {229,true}, {155,false}, {189,true}] 21> 2008/9/29 devdoer bird > HI: > > I have a utf8 encoded file y.erl: the source is : > -module(y). > -compile(export_all). > output2()-> > "??". > > > And a latin encoded file x.erl, the source is: > -module(x). > -compile(export_all). > output2()-> > "??". > > When execute them in erlang shell, > 1> x:output2(). > "\326\320\271\372" > 2>y:output2(). > [228,184,173,229,155,189] > > I don't know why they are outupted in diffrent format, one is > string-format, the other is list-format. Why aren't they birth outputed in > string-format or both in list-format? > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cjsvance@REDACTED Tue Sep 30 06:22:33 2008 From: cjsvance@REDACTED (Christopher Vance) Date: Tue, 30 Sep 2008 14:22:33 +1000 Subject: [erlang-questions] Why are the two strings outputed in diffrent format? In-Reply-To: References: Message-ID: 2008/9/30 devdoer bird : > And a latin encoded file x.erl, the source is: > -module(x). > -compile(export_all). > output2()-> > "??". > I don't know why they are outupted in diffrent format, one is > string-format, the other is list-format. Why aren't they birth outputed in > string-format or both in list-format? You haven't told us the encoding actually used for x.erl. No "latin" encoding I know of includes CJKV characters. -- Christopher Vance From devdoer2@REDACTED Tue Sep 30 07:03:50 2008 From: devdoer2@REDACTED (devdoer bird) Date: Tue, 30 Sep 2008 13:03:50 +0800 Subject: [erlang-questions] Why are the two strings outputed in diffrent format? In-Reply-To: References: Message-ID: The encoding for x.erl is gbk 2008/9/30 Christopher Vance > 2008/9/30 devdoer bird : > > And a latin encoded file x.erl, the source is: > > -module(x). > > -compile(export_all). > > output2()-> > > "??". > > > I don't know why they are outupted in diffrent format, one is > > string-format, the other is list-format. Why aren't they birth outputed > in > > string-format or both in list-format? > > You haven't told us the encoding actually used for x.erl. No "latin" > encoding I know of includes CJKV characters. > > -- > Christopher Vance > -------------- next part -------------- An HTML attachment was scrubbed... URL: From devdoer2@REDACTED Tue Sep 30 07:08:34 2008 From: devdoer2@REDACTED (devdoer bird) Date: Tue, 30 Sep 2008 13:08:34 +0800 Subject: [erlang-questions] Why are the two strings outputed in diffrent format? In-Reply-To: <6c2563b20809292117h3508a912g2ce92a3eb8e373a6@mail.gmail.com> References: <6c2563b20809292117h3508a912g2ce92a3eb8e373a6@mail.gmail.com> Message-ID: OK. Then I 'll take a look at it io_lib.erl. But one more question: why the value 155 is unprintable while 228 is , considering they are both greater than 128. Thanks. 2008/9/30 Edwin Fine > It is because one of the integers in y (155) is not considered printable by > Erlang. > > 17> X = "\326\320\271\372". > "\326\320\271\372" > 18> Y = [228,184,173,229,155,189]. > [228,184,173,229,155,189] > 19> [{I, io_lib:printable_list([I])} || I <- X]. > [{214,true},{208,true},{185,true},{250,true}] > 20> [{I, io_lib:printable_list([I])} || I <- Y]. > [{228,true}, > {184,true}, > {173,true}, > {229,true}, > {155,false}, > {189,true}] > 21> > > 2008/9/29 devdoer bird > >> HI: >> >> I have a utf8 encoded file y.erl: the source is : >> -module(y). >> -compile(export_all). >> output2()-> >> "??". >> >> >> And a latin encoded file x.erl, the source is: >> -module(x). >> -compile(export_all). >> output2()-> >> "??". >> >> When execute them in erlang shell, >> 1> x:output2(). >> "\326\320\271\372" >> 2>y:output2(). >> [228,184,173,229,155,189] >> >> I don't know why they are outupted in diffrent format, one is >> string-format, the other is list-format. Why aren't they birth outputed in >> string-format or both in list-format? >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bgustavsson@REDACTED Tue Sep 30 07:35:09 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Tue, 30 Sep 2008 07:35:09 +0200 Subject: [erlang-questions] Why are the two strings outputed in diffrent format? In-Reply-To: References: <6c2563b20809292117h3508a912g2ce92a3eb8e373a6@mail.gmail.com> Message-ID: <6672d0160809292235j4ad58287mb1be75b1aadf5e97@mail.gmail.com> 2008/9/30 devdoer bird > OK. Then I 'll take a look at it io_lib.erl. But one more question: why > the value 155 is unprintable while 228 is , considering they are both > greater than 128. > Currently, Erlang assumes that all strings are in ISO latin1. 155 is a control character in ISO latin1. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Tue Sep 30 07:38:45 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Tue, 30 Sep 2008 01:38:45 -0400 Subject: [erlang-questions] Why are the two strings outputed in diffrent format? In-Reply-To: References: <6c2563b20809292117h3508a912g2ce92a3eb8e373a6@mail.gmail.com> Message-ID: <6c2563b20809292238q71860f52t14c9058744703522@mail.gmail.com> I would guess probably because Erlang uses ISO/IEC 8859-1, in which 155 is not defined while the others all are ( http://en.wikipedia.org/wiki/ISO_8859-1#Codepage_layout). Characters between 137 and 159 are excluded, while all the rest are printable included. 2008/9/30 devdoer bird > OK. Then I 'll take a look at it io_lib.erl. But one more question: why > the value 155 is unprintable while 228 is , considering they are both > greater than 128. > > Thanks. > > 2008/9/30 Edwin Fine > > It is because one of the integers in y (155) is not considered printable >> by Erlang. >> >> 17> X = "\326\320\271\372". >> "\326\320\271\372" >> 18> Y = [228,184,173,229,155,189]. >> [228,184,173,229,155,189] >> 19> [{I, io_lib:printable_list([I])} || I <- X]. >> [{214,true},{208,true},{185,true},{250,true}] >> 20> [{I, io_lib:printable_list([I])} || I <- Y]. >> [{228,true}, >> {184,true}, >> {173,true}, >> {229,true}, >> {155,false}, >> {189,true}] >> 21> >> >> 2008/9/29 devdoer bird >> >>> HI: >>> >>> I have a utf8 encoded file y.erl: the source is : >>> -module(y). >>> -compile(export_all). >>> output2()-> >>> "??". >>> >>> >>> And a latin encoded file x.erl, the source is: >>> -module(x). >>> -compile(export_all). >>> output2()-> >>> "??". >>> >>> When execute them in erlang shell, >>> 1> x:output2(). >>> "\326\320\271\372" >>> 2>y:output2(). >>> [228,184,173,229,155,189] >>> >>> I don't know why they are outupted in diffrent format, one is >>> string-format, the other is list-format. Why aren't they birth outputed in >>> string-format or both in list-format? >>> >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From devdoer2@REDACTED Tue Sep 30 07:53:46 2008 From: devdoer2@REDACTED (devdoer bird) Date: Tue, 30 Sep 2008 13:53:46 +0800 Subject: [erlang-questions] Why are the two strings outputed in diffrent format? In-Reply-To: <6c2563b20809292238q71860f52t14c9058744703522@mail.gmail.com> References: <6c2563b20809292117h3508a912g2ce92a3eb8e373a6@mail.gmail.com> <6c2563b20809292238q71860f52t14c9058744703522@mail.gmail.com> Message-ID: Got it! 2008/9/30 Edwin Fine > I would guess probably because Erlang uses ISO/IEC 8859-1, in which 155 is > not defined while the others all are ( > http://en.wikipedia.org/wiki/ISO_8859-1#Codepage_layout). Characters > between 137 and 159 are excluded, while all the rest are printable included. > > 2008/9/30 devdoer bird > > OK. Then I 'll take a look at it io_lib.erl. But one more question: why >> the value 155 is unprintable while 228 is , considering they are both >> greater than 128. >> >> Thanks. >> >> 2008/9/30 Edwin Fine >> >> It is because one of the integers in y (155) is not considered printable >>> by Erlang. >>> >>> 17> X = "\326\320\271\372". >>> "\326\320\271\372" >>> 18> Y = [228,184,173,229,155,189]. >>> [228,184,173,229,155,189] >>> 19> [{I, io_lib:printable_list([I])} || I <- X]. >>> [{214,true},{208,true},{185,true},{250,true}] >>> 20> [{I, io_lib:printable_list([I])} || I <- Y]. >>> [{228,true}, >>> {184,true}, >>> {173,true}, >>> {229,true}, >>> {155,false}, >>> {189,true}] >>> 21> >>> >>> 2008/9/29 devdoer bird >>> >>>> HI: >>>> >>>> I have a utf8 encoded file y.erl: the source is : >>>> -module(y). >>>> -compile(export_all). >>>> output2()-> >>>> "??". >>>> >>>> >>>> And a latin encoded file x.erl, the source is: >>>> -module(x). >>>> -compile(export_all). >>>> output2()-> >>>> "??". >>>> >>>> When execute them in erlang shell, >>>> 1> x:output2(). >>>> "\326\320\271\372" >>>> 2>y:output2(). >>>> [228,184,173,229,155,189] >>>> >>>> I don't know why they are outupted in diffrent format, one is >>>> string-format, the other is list-format. Why aren't they birth outputed in >>>> string-format or both in list-format? >>>> >>>> >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>> >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Tue Sep 30 08:07:34 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Tue, 30 Sep 2008 02:07:34 -0400 Subject: [erlang-questions] Why are the two strings outputed in diffrent format? In-Reply-To: <6c2563b20809292238q71860f52t14c9058744703522@mail.gmail.com> References: <6c2563b20809292117h3508a912g2ce92a3eb8e373a6@mail.gmail.com> <6c2563b20809292238q71860f52t14c9058744703522@mail.gmail.com> Message-ID: <6c2563b20809292307k1cc72316p67e3b31ae39def57@mail.gmail.com> Typos: 137 was supposed to be 127. And "printable included" should have been "included". On Tue, Sep 30, 2008 at 1:38 AM, Edwin Fine wrote: > I would guess probably because Erlang uses ISO/IEC 8859-1, in which 155 is > not defined while the others all are ( > http://en.wikipedia.org/wiki/ISO_8859-1#Codepage_layout). Characters > between 137 and 159 are excluded, while all the rest are printable included. > > 2008/9/30 devdoer bird > > OK. Then I 'll take a look at it io_lib.erl. But one more question: why >> the value 155 is unprintable while 228 is , considering they are both >> greater than 128. >> >> Thanks. >> >> 2008/9/30 Edwin Fine >> >> It is because one of the integers in y (155) is not considered printable >>> by Erlang. >>> >>> 17> X = "\326\320\271\372". >>> "\326\320\271\372" >>> 18> Y = [228,184,173,229,155,189]. >>> [228,184,173,229,155,189] >>> 19> [{I, io_lib:printable_list([I])} || I <- X]. >>> [{214,true},{208,true},{185,true},{250,true}] >>> 20> [{I, io_lib:printable_list([I])} || I <- Y]. >>> [{228,true}, >>> {184,true}, >>> {173,true}, >>> {229,true}, >>> {155,false}, >>> {189,true}] >>> 21> >>> >>> 2008/9/29 devdoer bird >>> >>>> HI: >>>> >>>> I have a utf8 encoded file y.erl: the source is : >>>> -module(y). >>>> -compile(export_all). >>>> output2()-> >>>> "??". >>>> >>>> >>>> And a latin encoded file x.erl, the source is: >>>> -module(x). >>>> -compile(export_all). >>>> output2()-> >>>> "??". >>>> >>>> When execute them in erlang shell, >>>> 1> x:output2(). >>>> "\326\320\271\372" >>>> 2>y:output2(). >>>> [228,184,173,229,155,189] >>>> >>>> I don't know why they are outupted in diffrent format, one is >>>> string-format, the other is list-format. Why aren't they birth outputed in >>>> string-format or both in list-format? >>>> >>>> >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>> >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Tue Sep 30 10:48:34 2008 From: rvirding@REDACTED (Robert Virding) Date: Tue, 30 Sep 2008 10:48:34 +0200 Subject: [erlang-questions] The Erlang Rationale In-Reply-To: References: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> Message-ID: <3dbc6d1c0809300148l76529902s256c1a384d145143@mail.gmail.com> 2008/9/30 Kevin A. Smith > I've posted a PDF version of Robert's document in PDF format to the same > topic. Hopefully even more people will be able to read this excellent > document. Thank you, Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From tuncer.ayaz@REDACTED Tue Sep 30 11:09:54 2008 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Tue, 30 Sep 2008 11:09:54 +0200 Subject: [erlang-questions] The Erlang Rationale In-Reply-To: References: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> Message-ID: <4ac8254d0809300209o375dee7ft2cec8f002d1224d1@mail.gmail.com> On Tue, Sep 30, 2008 at 1:45 AM, Kevin A. Smith wrote: > I've posted a PDF version of Robert's document in PDF format to the > same topic. Hopefully even more people will be able to read this > excellent document. I tried in two different viewers/readers and at least starting with the graphics the PDF seemed to be garbled. I've uploaded a new PDF which works better. > --Kevin > On Sep 29, 2008, at 6:02 PM, Robert Virding wrote: > >> I have just released a document called the Erlang Rationale. >> >> The Rationale is an attempt to explain why things look like they do >> in Erlang and our thinking behind many of the properties and >> features of the language. There is also some descriptions of part of >> the system which today seem to lack description, for example the i/o >> system and groups. The Rationale mainly deals with the core parts of >> the language and the older parts of the libraries and not OTP. >> >> It is to be considered to be work-in-progress and I will add to it >> when I find the time and get the urge. Please come with comments and >> suggestions on what is there and what you feel should be there. >> >> Sorry for it being in Word format but this is the best I can do for >> a simple editor which allows making diagrams and runs on Windows. >> >> It can be found on trapexit.org user contributions: >> >> http://forum.trapexit.org/viewtopic.php?p=44172#44172 >> >> Robert >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From twoggle@REDACTED Tue Sep 30 11:35:36 2008 From: twoggle@REDACTED (Tim Fletcher) Date: Tue, 30 Sep 2008 02:35:36 -0700 (PDT) Subject: [erlang-questions] The Erlang Rationale In-Reply-To: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> References: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> Message-ID: <360b1258-7f88-459b-b006-48c429494e7c@l42g2000hsc.googlegroups.com> > It is to be considered to be work-in-progress and I will add to it when I > find the time and get the urge. Please come with comments and suggestions on > what is there and what you feel should be there. Interesting read, thanks. Didn't know the JCL stuff existed. More about code upgrading ("Continuous evolution of the system") would be good. And what was the original motivation for strings as lists? Thanks kev/t for the PDFs. From Dana.RUBINO@REDACTED Tue Sep 30 11:42:35 2008 From: Dana.RUBINO@REDACTED (Dana.RUBINO@REDACTED) Date: Tue, 30 Sep 2008 10:42:35 +0100 Subject: [erlang-questions] ODBC memory usage Message-ID: Hi all, The ODBC trials and tribulations continue! I have a test method as such: get_tables() -> odbc:start(), {ok, Ref} = odbc:connect("DSN=HWHU;UID=auid;PWD=apwd", [{scrollable_cursors, off}]), {selected, ColNames, Data} = odbc:sql_query(Ref, "select * from Test"), Data. Now I can execute the query and the entire table is brought back - great that's what I expect. Also rather crudely it just returns the whole lot as Data (this is just a test after all). The problem I have is that after the method returns, even though I have not assigned Data to anything (i.e. I just want it to echo to the screen for a visual sanity check) the erlang shell still seems to be making use of the memory? How does garbage collection work in this instance? Thanks, Dan *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbs.com/gbm www.rbsgc.com *********************************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From mats.cronqvist@REDACTED Tue Sep 30 11:38:29 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 30 Sep 2008 11:38:29 +0200 Subject: [erlang-questions] The Erlang Rationale In-Reply-To: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> References: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> Message-ID: <48E1F395.5040501@gmail.com> Robert Virding wrote: > > Sorry for it being in Word format but this is the best I can do for a > simple editor which allows making diagrams and runs on Windows. zipped word file? not even the NSA can read that shit... mats From rtrlists@REDACTED Tue Sep 30 12:14:40 2008 From: rtrlists@REDACTED (Robert Raschke) Date: Tue, 30 Sep 2008 11:14:40 +0100 Subject: [erlang-questions] ODBC memory usage In-Reply-To: References: Message-ID: <6a3ae47e0809300314s5fe1de54t2719121184755dae@mail.gmail.com> 2008/9/30 : > Hi all, > > The ODBC trials and tribulations continue! > > I have a test method as such: > > > get_tables() -> > > odbc:start(), > > {ok, Ref} = odbc:connect("DSN=HWHU;UID=auid;PWD=apwd", > [{scrollable_cursors, off}]), > > {selected, ColNames, Data} = odbc:sql_query(Ref, "select * from Test"), > > Data. > > Now I can execute the query and the entire table is brought back - great that's what I expect. > > Also rather crudely it just returns the whole lot as Data (this is just a > test after all). > > The problem I have is that after the method returns, even though I have not > assigned Data to anything (i.e. I just want it to echo to the screen for a > visual sanity check) the erlang shell still seems to be making use of the > memory? > > How does garbage collection work in this instance? GC will kick in to reclaim the memory at a suitable point. I would not worry about it until you find that your app is running out of memory. Since you are starting out, I would presume that you aren't actually investigating memory problems of your app yet. So, leave that until your app has solidified and you feel that memory might be an issue. Premature optimization and all that ... Robby From ulf@REDACTED Tue Sep 30 13:38:42 2008 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 30 Sep 2008 13:38:42 +0200 Subject: [erlang-questions] Reia, or On The Evils Of Tabs And Indentation Sensitivity In-Reply-To: References: <6c2563b20809291326m3e982e1fg10d7a62af89206a8@mail.gmail.com> Message-ID: <8209f740809300438v2e63f83dqf1b98cd02e64b946@mail.gmail.com> 2008/9/30 Tony Arcieri : > > > http://ulf.wiger.net/weblog/2008/03/19/indentation-sensitive-erlang/ He he, just as long as people don't start referring to me as the guy who's crusading to make Erlang indentation-sensitive. (: There are three articles, btw: http://ulf.wiger.net/weblog/2008/03/19/indentation-sensitive-erlang/ http://ulf.wiger.net/weblog/2008/03/19/indentation-sensitive-erlang-2/ http://ulf.wiger.net/weblog/2008/06/11/indentation-sensitive-erlang-3/ and it was just an experiment, trying to see whether - I could get it to work with only minor extensions to the yecc grammar - it was possible to support all sensible use of delimiters even in indentation-sensitive mode. The answer to both questions was "close, but no cigar", I guess. The known quirks can be seen in the example of the 3rd version. I wouldn't use it myself, at least not in its current state, but it was a fun experiment, for a while. BR, Ulf W From devdoer2@REDACTED Tue Sep 30 13:46:01 2008 From: devdoer2@REDACTED (devdoer bird) Date: Tue, 30 Sep 2008 19:46:01 +0800 Subject: [erlang-questions] Load driver with "driver_incorrect_version " error Message-ID: HI: I've written a driver with the entry below: struct erl_drv_entry ttsl_driver_entry = { ttysl_init, ttysl_start, IF_IMPL(ttysl_stop), IF_IMPL(ttysl_from_erlang), IF_IMPL(ttysl_from_tty), NULL, "tty_sl20", NULL, NULL, IF_IMPL(ttysl_control), }; In fact ,the above code was stolen from erlang's emulator driver code, then I compiled it in my linux server with the gcc command "gcc -o ttsl_drv20.so -fpic -shared ttsl_drv20.c -I/usr/lib/erlang/erts-5.6.1/include/". Everything is ok except the error occurred while I try to load the driver with erl_ddll .I 'm blocked by the error "{error,driver_incorrect_version}". So I check the erlang manual, it says the "extend_marker" field should be ERL_DRV_EXTENDED_MARKER or 0. But my driver entry's extend_marker field is indeed 0. Why does it still throw the error? -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin@REDACTED Tue Sep 30 13:48:45 2008 From: kevin@REDACTED (Kevin A. Smith) Date: Tue, 30 Sep 2008 07:48:45 -0400 Subject: [erlang-questions] The Erlang Rationale In-Reply-To: <4ac8254d0809300209o375dee7ft2cec8f002d1224d1@mail.gmail.com> References: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> <4ac8254d0809300209o375dee7ft2cec8f002d1224d1@mail.gmail.com> Message-ID: Huh. That's weird. I used OS X's 'Print to PDF' feature. Thanks for posting a non-garbled version! --Kevin On Sep 30, 2008, at 5:09 AM, Tuncer Ayaz wrote: > On Tue, Sep 30, 2008 at 1:45 AM, Kevin A. Smith > wrote: >> I've posted a PDF version of Robert's document in PDF format to the >> same topic. Hopefully even more people will be able to read this >> excellent document. > > I tried in two different viewers/readers and at least starting with > the graphics > the PDF seemed to be garbled. I've uploaded a new PDF which works > better. > >> --Kevin >> On Sep 29, 2008, at 6:02 PM, Robert Virding wrote: >> >>> I have just released a document called the Erlang Rationale. >>> >>> The Rationale is an attempt to explain why things look like they do >>> in Erlang and our thinking behind many of the properties and >>> features of the language. There is also some descriptions of part of >>> the system which today seem to lack description, for example the i/o >>> system and groups. The Rationale mainly deals with the core parts of >>> the language and the older parts of the libraries and not OTP. >>> >>> It is to be considered to be work-in-progress and I will add to it >>> when I find the time and get the urge. Please come with comments and >>> suggestions on what is there and what you feel should be there. >>> >>> Sorry for it being in Word format but this is the best I can do for >>> a simple editor which allows making diagrams and runs on Windows. >>> >>> It can be found on trapexit.org user contributions: >>> >>> http://forum.trapexit.org/viewtopic.php?p=44172#44172 >>> >>> Robert >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> From rvirding@REDACTED Tue Sep 30 14:19:04 2008 From: rvirding@REDACTED (Robert Virding) Date: Tue, 30 Sep 2008 14:19:04 +0200 Subject: [erlang-questions] The Erlang Rationale In-Reply-To: <48E1F395.5040501@gmail.com> References: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> <48E1F395.5040501@gmail.com> Message-ID: <3dbc6d1c0809300519kd46dbadsdfb670f71865b5@mail.gmail.com> 2008/9/30 Mats Cronqvist > Robert Virding wrote: > >> >> Sorry for it being in Word format but this is the best I can do for a >> simple editor which allows making diagrams and runs on Windows. >> > zipped word file? not even the NSA can read that shit... Well, it's zipped as trapexit doesn't allow me upload a .doc file directly, and it's a word document because I am using a Windows box and it is the best (only) for creating simple documents containing pictures. Not ideal I know but what else is there to do? And if the NSA can't read it it will definitely make the site and Erlang "interesting". Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From mats.cronqvist@REDACTED Tue Sep 30 14:36:19 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 30 Sep 2008 14:36:19 +0200 Subject: [erlang-questions] The Erlang Rationale In-Reply-To: <3dbc6d1c0809300519kd46dbadsdfb670f71865b5@mail.gmail.com> References: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> <48E1F395.5040501@gmail.com> <3dbc6d1c0809300519kd46dbadsdfb670f71865b5@mail.gmail.com> Message-ID: <48E21D43.1040509@gmail.com> Robert Virding wrote: > 2008/9/30 Mats Cronqvist > > > Robert Virding wrote: > > > Sorry for it being in Word format but this is the best I can > do for a simple editor which allows making diagrams and runs > on Windows. > > zipped word file? not even the NSA can read that shit... > > > Well, it's zipped as trapexit doesn't allow me upload a .doc file > directly, and it's a word document because I am using a Windows box > and it is the best (only) for creating simple documents containing > pictures. Not ideal I know but what else is there to do? openoffice? or perhaps you could upload as PDF? i'm assuming that Word can export to PDF... > And if the NSA can't read it it will definitely make the site and > Erlang "interesting". a cunning plan... From erlang@REDACTED Tue Sep 30 14:40:42 2008 From: erlang@REDACTED (Dominic Williams) Date: Tue, 30 Sep 2008 08:40:42 -0400 (EDT) Subject: [erlang-questions] Paris ErlLounge In-Reply-To: <48CA9CBC.1040805@dominicwilliams.net> References: <48CA9CBC.1040805@dominicwilliams.net> Message-ID: <8a9ae7f20cadd92b7514f7952d7d4f45.squirrel@www.geekisp.com> Hello, The Paris ErlLounge is confirmed for tomorrow evening, as of 7.30pm. There is a table reserved in the pub area (not the restaurant area), there should be an "ErlLounge" sign, for those who don't have any familiar faces to spot. Look forward to seeing you there, Dominic. > Hello, > > We are holding an ErlLounge in Paris, on Wednesday 1st > October, at Carr's Pub, 1 rue du Mont Thabor, 75001 Paris. > > I hope to see many new and old Erlangers there ! > > If possible send me an email if you plan to come, so that I > can book enough space... > > Cheers, > > Dominic Williams From ulf@REDACTED Tue Sep 30 15:05:15 2008 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 30 Sep 2008 15:05:15 +0200 Subject: [erlang-questions] The Erlang Rationale In-Reply-To: <48E21D43.1040509@gmail.com> References: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> <48E1F395.5040501@gmail.com> <3dbc6d1c0809300519kd46dbadsdfb670f71865b5@mail.gmail.com> <48E21D43.1040509@gmail.com> Message-ID: <8209f740809300605u6847462buab2a531145576c63@mail.gmail.com> 2008/9/30 Mats Cronqvist : > Robert Virding wrote: >> >> Well, it's zipped as trapexit doesn't allow me upload a .doc file >> directly, and it's a word document because I am using a Windows box >> and it is the best (only) for creating simple documents containing >> pictures. Not ideal I know but what else is there to do? > > openoffice? or perhaps you could upload as PDF? i'm assuming that Word > can export to PDF... Not out of the box, but there are free utilities, like PrimoPDF, that do a good job. It appears as a printer target, so will work with any windows program (no, I don't get any kickbacks, but I also prefer docs to be pdf...) BR, Ulf W From tuncer.ayaz@REDACTED Tue Sep 30 15:09:09 2008 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Tue, 30 Sep 2008 15:09:09 +0200 Subject: [erlang-questions] The Erlang Rationale In-Reply-To: <48E21D43.1040509@gmail.com> References: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> <48E1F395.5040501@gmail.com> <3dbc6d1c0809300519kd46dbadsdfb670f71865b5@mail.gmail.com> <48E21D43.1040509@gmail.com> Message-ID: <4ac8254d0809300609m7c72c6b2je9774a70c629acf8@mail.gmail.com> On Tue, Sep 30, 2008 at 2:36 PM, Mats Cronqvist wrote: > > Robert Virding wrote: > > 2008/9/30 Mats Cronqvist > > > > > > Robert Virding wrote: > > > > > > Sorry for it being in Word format but this is the best I can > > do for a simple editor which allows making diagrams and runs > > on Windows. > > > > zipped word file? not even the NSA can read that shit... > > > > > > Well, it's zipped as trapexit doesn't allow me upload a .doc file > > directly, and it's a word document because I am using a Windows box > > and it is the best (only) for creating simple documents containing > > pictures. Not ideal I know but what else is there to do? > > openoffice? or perhaps you could upload as PDF? i'm assuming that Word > can export to PDF... MS Office 12 has an PDF Export Plugin which can be downloaded and installed separately. OOo has native PDF export. Nowadays I would draw SVG with a text editor or InkScape and inline that within HTML. It's a good compromise between being text-only (revision control) and still compact and portable. ASCII Art for the web: http://www.ragestorm.net/erezsh/parrot.html > > And if the NSA can't read it it will definitely make the site and > > Erlang "interesting". > a cunning plan... > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From rvirding@REDACTED Tue Sep 30 15:30:03 2008 From: rvirding@REDACTED (Robert Virding) Date: Tue, 30 Sep 2008 15:30:03 +0200 Subject: [erlang-questions] The Erlang Rationale In-Reply-To: <4ac8254d0809300609m7c72c6b2je9774a70c629acf8@mail.gmail.com> References: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> <48E1F395.5040501@gmail.com> <3dbc6d1c0809300519kd46dbadsdfb670f71865b5@mail.gmail.com> <48E21D43.1040509@gmail.com> <4ac8254d0809300609m7c72c6b2je9774a70c629acf8@mail.gmail.com> Message-ID: <3dbc6d1c0809300630q35221794jf0922f370de6dd04@mail.gmail.com> OK, OK, OK, enough already! :-) I will fix the next version in PDF. And I thought this was a bunch of computer savvy people who would just laugh at Word format. How about comments on content, both what is there and what is not? Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From tuncer.ayaz@REDACTED Tue Sep 30 15:34:50 2008 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Tue, 30 Sep 2008 15:34:50 +0200 Subject: [erlang-questions] The Erlang Rationale In-Reply-To: <3dbc6d1c0809300630q35221794jf0922f370de6dd04@mail.gmail.com> References: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> <48E1F395.5040501@gmail.com> <3dbc6d1c0809300519kd46dbadsdfb670f71865b5@mail.gmail.com> <48E21D43.1040509@gmail.com> <4ac8254d0809300609m7c72c6b2je9774a70c629acf8@mail.gmail.com> <3dbc6d1c0809300630q35221794jf0922f370de6dd04@mail.gmail.com> Message-ID: <4ac8254d0809300634n73f04c0bvbbb6794f3757087@mail.gmail.com> On Tue, Sep 30, 2008 at 3:30 PM, Robert Virding wrote: > OK, OK, OK, enough already! :-) I will fix the next version in PDF. And I > thought this was a bunch of computer savvy people who would just laugh at > Word format. Thanks for posting in Word format. It made me realize the inlined SVG idea and I like that a lot. > How about comments on content, both what is there and what is not? > > Robert From Bill.McKeeman@REDACTED Tue Sep 30 15:40:09 2008 From: Bill.McKeeman@REDACTED (Bill McKeeman) Date: Tue, 30 Sep 2008 09:40:09 -0400 Subject: [erlang-questions] The Erlang Rationale In-Reply-To: <48E1F395.5040501@gmail.com> References: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> <48E1F395.5040501@gmail.com> Message-ID: Despite the sterling origin of this doc I won't download it for fear of virus. Thanks for the PDF. Incidentally, my MSWORD makes PDF because I also have a version of Adobe Acrobat that adds a Convert-to-Adobe-PDF icon to the toolbar. /s/ Bill -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Mats Cronqvist Sent: Tuesday, September 30, 2008 5:38 AM To: Robert Virding Cc: Erlang Questions Subject: Re: [erlang-questions] The Erlang Rationale Robert Virding wrote: > > Sorry for it being in Word format but this is the best I can do for a > simple editor which allows making diagrams and runs on Windows. zipped word file? not even the NSA can read that shit... mats _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From vances@REDACTED Tue Sep 30 15:41:10 2008 From: vances@REDACTED (Vance Shipley) Date: Tue, 30 Sep 2008 09:41:10 -0400 Subject: [erlang-questions] The Erlang Rationale In-Reply-To: <8209f740809300605u6847462buab2a531145576c63@mail.gmail.com> References: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> <48E1F395.5040501@gmail.com> <3dbc6d1c0809300519kd46dbadsdfb670f71865b5@mail.gmail.com> <48E21D43.1040509@gmail.com> <8209f740809300605u6847462buab2a531145576c63@mail.gmail.com> Message-ID: <20080930134110.GP48159@h216-235-12-173.host.egate.net> Documents should be distributed in portable formats. With Windows there is one easy and very well functioning method to create portable documents. Download and install Adobe's Postscript printer drivers: http://kb.adobe.com/selfservice/viewContent.do?externalId=328539&sliceId=1 Now all you have to do is choose the Adobe Postscript printer and print to file to create a Postscript (.ps) version of your document. Postscript is the original portable document format which served the community very well indded until they created the now ubiquitous PDF. To get PDF you may install the free GhostView/GhostScript application, open the Postscript file and export it as PDF. -Vance On Tue, Sep 30, 2008 at 03:05:15PM +0200, Ulf Wiger wrote: } Not out of the box, but there are free utilities, like PrimoPDF, that do a } good job. It appears as a printer target, so will work with any windows } program (no, I don't get any kickbacks, but I also prefer docs to be pdf...) From sverker@REDACTED Tue Sep 30 15:55:35 2008 From: sverker@REDACTED (Sverker Eriksson) Date: Tue, 30 Sep 2008 15:55:35 +0200 Subject: [erlang-questions] Load driver with "driver_incorrect_version " error In-Reply-To: References: Message-ID: <48E22FD7.2000803@erix.ericsson.se> devdoer bird wrote: > I've written a driver with the entry below: > > struct erl_drv_entry ttsl_driver_entry = Hi Try rename your driver entry struct. It's probably conflicting with the existing "ttsl_driver_entry". /Sverker, Erlang/OTP Ericsson From richardc@REDACTED Tue Sep 30 16:12:35 2008 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 30 Sep 2008 16:12:35 +0200 Subject: [erlang-questions] The Erlang Rationale In-Reply-To: <20080930134110.GP48159@h216-235-12-173.host.egate.net> References: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> <48E1F395.5040501@gmail.com> <3dbc6d1c0809300519kd46dbadsdfb670f71865b5@mail.gmail.com> <48E21D43.1040509@gmail.com> <8209f740809300605u6847462buab2a531145576c63@mail.gmail.com> <20080930134110.GP48159@h216-235-12-173.host.egate.net> Message-ID: <48E233D3.7060605@it.uu.se> Vance Shipley wrote: > Documents should be distributed in portable formats. With Windows > there is one easy and very well functioning method to create portable > documents. Download and install Adobe's Postscript printer drivers > ... > To get PDF you may install the free GhostView/GhostScript application, > open the Postscript file and export it as PDF. This is easier: http://www.pdfforge.org/products/pdfcreator /Richard From bqt@REDACTED Tue Sep 30 16:50:28 2008 From: bqt@REDACTED (Johnny Billquist) Date: Tue, 30 Sep 2008 16:50:28 +0200 Subject: [erlang-questions] The Erlang Rationale In-Reply-To: <20080930134110.GP48159@h216-235-12-173.host.egate.net> References: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> <48E1F395.5040501@gmail.com> <3dbc6d1c0809300519kd46dbadsdfb670f71865b5@mail.gmail.com> <48E21D43.1040509@gmail.com> <8209f740809300605u6847462buab2a531145576c63@mail.gmail.com> <20080930134110.GP48159@h216-235-12-173.host.egate.net> Message-ID: <48E23CB4.3060408@softjar.se> Vance Shipley wrote: > Documents should be distributed in portable formats. With Windows > there is one easy and very well functioning method to create portable > documents. Download and install Adobe's Postscript printer drivers: > > http://kb.adobe.com/selfservice/viewContent.do?externalId=328539&sliceId=1 Or you install Adbobe's PDF printer driver, and get your PDF straight away. (Can't remember if it was included in Acrobat when I installed that a couple of years ago, or if I had to install it separately, but anyway, having a PDF "Printer" is definitely the easiest way of generating PDFs of anything you have.) Johnny > > Now all you have to do is choose the Adobe Postscript printer and > print to file to create a Postscript (.ps) version of your document. > Postscript is the original portable document format which served the > community very well indded until they created the now ubiquitous PDF. > > To get PDF you may install the free GhostView/GhostScript application, > open the Postscript file and export it as PDF. > > -Vance > > On Tue, Sep 30, 2008 at 03:05:15PM +0200, Ulf Wiger wrote: > } Not out of the box, but there are free utilities, like PrimoPDF, that do a > } good job. It appears as a printer target, so will work with any windows > } program (no, I don't get any kickbacks, but I also prefer docs to be pdf...) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From Dana.RUBINO@REDACTED Tue Sep 30 16:58:34 2008 From: Dana.RUBINO@REDACTED (Dana.RUBINO@REDACTED) Date: Tue, 30 Sep 2008 15:58:34 +0100 Subject: [erlang-questions] Extremely poor Mnesia performance In-Reply-To: <6a3ae47e0809290631h3871cfceie4bd5db04666d35c@mail.gmail.com> References: <6a3ae47e0809290545m3191f7b1ka872e4dd5da17cff@mail.gmail.com> <6a3ae47e0809290631h3871cfceie4bd5db04666d35c@mail.gmail.com> Message-ID: Hey all, I am doing some benchmarking with Mnesia at the moment and am pretty disappointed to say the least. I'm hoping I am doing something wrong. Running a 5 table join below: (two of the tables have ~50k rows the rest a couple of hundred) execute(qlc:q([I#i.user_id || I <- mnesia:table(i), C <- mnesia:table(c), I#i.user_id =:= C#c.user_id, I#i.group =:= "Group A", P <- mnesia:table(p), T <- mnesia:table(t), S <- mnesia:table(s), C#c.platform_id =:= P#p.platform_id, C#c.trans_id =:= T#t.trans_id, C#c.sales_id =:= S#s.sales_id ])). On a normal RDBMS this query returns in < 1min. I am yet to get a result from Mnesia and its been running for 10 mins. Is there anyway I can see what's going wrong with this query under the hood? Thanks, Dan *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbs.com/gbm www.rbsgc.com *********************************************************************************** From juanjo@REDACTED Tue Sep 30 17:37:28 2008 From: juanjo@REDACTED (Juan Jose Comellas) Date: Tue, 30 Sep 2008 12:37:28 -0300 Subject: [erlang-questions] Erlang SMTP module with support for attachments Message-ID: <1c3be50f0809300837h89038cfw7a2abbcec8888b9b@mail.gmail.com> Does anybody know if there's any open source Erlang module/library available for sending emails with attachments? -------------- next part -------------- An HTML attachment was scrubbed... URL: From devdoer2@REDACTED Tue Sep 30 17:39:17 2008 From: devdoer2@REDACTED (devdoer bird) Date: Tue, 30 Sep 2008 23:39:17 +0800 Subject: [erlang-questions] Load driver with "driver_incorrect_version " error In-Reply-To: <48E22FD7.2000803@erix.ericsson.se> References: <48E22FD7.2000803@erix.ericsson.se> Message-ID: Fix it . Thanks 2008/9/30 Sverker Eriksson > devdoer bird wrote: > >> I've written a driver with the entry below: >> >> struct erl_drv_entry ttsl_driver_entry = >> > Hi > > Try rename your driver entry struct. It's probably conflicting with the > existing "ttsl_driver_entry". > > /Sverker, Erlang/OTP Ericsson > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Dana.RUBINO@REDACTED Tue Sep 30 17:49:31 2008 From: Dana.RUBINO@REDACTED (Dana.RUBINO@REDACTED) Date: Tue, 30 Sep 2008 16:49:31 +0100 Subject: [erlang-questions] Mnesia multi-table joins In-Reply-To: References: <6a3ae47e0809290545m3191f7b1ka872e4dd5da17cff@mail.gmail.com> <6a3ae47e0809290631h3871cfceie4bd5db04666d35c@mail.gmail.com> Message-ID: Hi all, Changed subject of my last thread as it wasn't a performance issue! I have done some more digging and found that Mnesia appears to support only joins across two tables. I have tried a cut down version of the below query using the two big tables only and it is lightning quick. Does anyone know if there is a way to perform joins across more than two tables? I fear I will have tripped on the last hurdle (I am currently prototyping a proposed system) if I cant perform joins across more than two tables. Many Thanks, Dan -----Original Message----- From: RUBINO, Dana, GBM Sent: 30 September 2008 15:59 To: erlang-questions@REDACTED Subject: Extremely poor Mnesia performance Hey all, I am doing some benchmarking with Mnesia at the moment and am pretty disappointed to say the least. I'm hoping I am doing something wrong. Running a 5 table join below: (two of the tables have ~50k rows the rest a couple of hundred) execute(qlc:q([I#i.user_id || I <- mnesia:table(i), C <- mnesia:table(c), I#i.user_id =:= C#c.user_id, I#i.group =:= "Group A", P <- mnesia:table(p), T <- mnesia:table(t), S <- mnesia:table(s), C#c.platform_id =:= P#p.platform_id, C#c.trans_id =:= T#t.trans_id, C#c.sales_id =:= S#s.sales_id ])). On a normal RDBMS this query returns in < 1min. I am yet to get a result from Mnesia and its been running for 10 mins. Is there anyway I can see what's going wrong with this query under the hood? Thanks, Dan *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbs.com/gbm www.rbsgc.com *********************************************************************************** From vmitsner@REDACTED Tue Sep 30 18:11:01 2008 From: vmitsner@REDACTED (Vladimir Mitsner) Date: Tue, 30 Sep 2008 11:11:01 -0500 Subject: [erlang-questions] system defined flags Message-ID: <32e4cadb0809300911j48fdae75x80bb00fb8758ffad@mail.gmail.com> In the man-page for init module: http://www.erlang.org/doc/man/init.html, in the description of init:get_arguments/0, there is a reference to "system defined flags". Is it possible to edit "system defined flags?" (For example, is there a file with a special name where all of the "system defined flags" are defined?) And if so - how would I go about editing these flags? (In case there is a file - where is it?) Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From taavi@REDACTED Tue Sep 30 18:18:31 2008 From: taavi@REDACTED (Taavi Talvik) Date: Tue, 30 Sep 2008 19:18:31 +0300 Subject: [erlang-questions] Extremely poor Mnesia performance In-Reply-To: References: <6a3ae47e0809290545m3191f7b1ka872e4dd5da17cff@mail.gmail.com> <6a3ae47e0809290631h3871cfceie4bd5db04666d35c@mail.gmail.com> Message-ID: <1F1025A3-8734-4DD2-8A01-2B2F775A7D41@uninet.ee> On Sep 30, 2008, at 5:58 PM, wrote: > > Hey all, > > I am doing some benchmarking with Mnesia at the moment and am pretty > disappointed to say the least. > > I'm hoping I am doing something wrong. > > Running a 5 table join below: (two of the tables have ~50k rows the > rest a couple of hundred) Probably you are not doing anything wrong. From mnesia introduction (http://www.erlang.org/doc/apps/mnesia/ Mnesia_chap1.html#1), it design goals are: === In telecommunications applications there are different needs from the features provided by traditional DBMSs. The applications now implemented in the Erlang language need a mixture of a broad range of features, which generally are not satisfied by traditional DBMSs. Mnesia is designed with requirements like the following in mind: ? Fast real-time key/value lookup ? Complicated non real-time queries mainly for operation and maintenance ? Distributed data due to distributed applications ? High fault tolerance ? Dynamic re-configuration ? Complex objects === Mnesia is not designed as replacement for relational database. It is optimised for fast key-value lookup and distribution. With qlc:info(Qh) you can get more information, how query is actually handled. best regards, taavi From Dana.RUBINO@REDACTED Tue Sep 30 18:23:46 2008 From: Dana.RUBINO@REDACTED (Dana.RUBINO@REDACTED) Date: Tue, 30 Sep 2008 17:23:46 +0100 Subject: [erlang-questions] Extremely poor Mnesia performance In-Reply-To: <1F1025A3-8734-4DD2-8A01-2B2F775A7D41@uninet.ee> References: <6a3ae47e0809290545m3191f7b1ka872e4dd5da17cff@mail.gmail.com> <6a3ae47e0809290631h3871cfceie4bd5db04666d35c@mail.gmail.com> <1F1025A3-8734-4DD2-8A01-2B2F775A7D41@uninet.ee> Message-ID: Thanks Taavi, That wasn't the answer I was looking for! :-D Oh dear, well that leaves my plan for using Mnesia in tatters. I actually need an in memory db which at least has the core subset of RDBMS features. So I am essentially just looking for a small in memory DB for real-time access. Has anyone here had any experience using something like KDB with Erlang? Perhaps I could switch to using KDB as an alternative? Many Thanks, Dan -----Original Message----- From: Taavi Talvik [mailto:taavi@REDACTED] Sent: 30 September 2008 17:19 To: RUBINO, Dana, GBM Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Extremely poor Mnesia performance On Sep 30, 2008, at 5:58 PM, wrote: > > Hey all, > > I am doing some benchmarking with Mnesia at the moment and am pretty > disappointed to say the least. > > I'm hoping I am doing something wrong. > > Running a 5 table join below: (two of the tables have ~50k rows the > rest a couple of hundred) Probably you are not doing anything wrong. From mnesia introduction (http://www.erlang.org/doc/apps/mnesia/ Mnesia_chap1.html#1), it design goals are: === In telecommunications applications there are different needs from the features provided by traditional DBMSs. The applications now implemented in the Erlang language need a mixture of a broad range of features, which generally are not satisfied by traditional DBMSs. Mnesia is designed with requirements like the following in mind: * Fast real-time key/value lookup * Complicated non real-time queries mainly for operation and maintenance * Distributed data due to distributed applications * High fault tolerance * Dynamic re-configuration * Complex objects === Mnesia is not designed as replacement for relational database. It is optimised for fast key-value lookup and distribution. With qlc:info(Qh) you can get more information, how query is actually handled. best regards, taavi *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbs.com/gbm www.rbsgc.com *********************************************************************************** From rtrlists@REDACTED Tue Sep 30 18:36:38 2008 From: rtrlists@REDACTED (Robert Raschke) Date: Tue, 30 Sep 2008 17:36:38 +0100 Subject: [erlang-questions] Mnesia multi-table joins In-Reply-To: References: <6a3ae47e0809290545m3191f7b1ka872e4dd5da17cff@mail.gmail.com> <6a3ae47e0809290631h3871cfceie4bd5db04666d35c@mail.gmail.com> Message-ID: <6a3ae47e0809300936p5748e4a7k1934ea8c54c55c8b@mail.gmail.com> On Tue, Sep 30, 2008 at 4:49 PM, wrote: > Hi all, > > Changed subject of my last thread as it wasn't a performance issue! > > I have done some more digging and found that Mnesia appears to support only joins across two tables. > > I have tried a cut down version of the below query using the two big tables only and it is lightning quick. > > Does anyone know if there is a way to perform joins across more than two tables? > > I fear I will have tripped on the last hurdle (I am currently prototyping a proposed system) if I cant perform joins across more than two tables. > > Many Thanks, > Dan > > -----Original Message----- > From: RUBINO, Dana, GBM > Sent: 30 September 2008 15:59 > To: erlang-questions@REDACTED > Subject: Extremely poor Mnesia performance > > > Hey all, > > I am doing some benchmarking with Mnesia at the moment and am pretty disappointed to say the least. > > I'm hoping I am doing something wrong. > > Running a 5 table join below: (two of the tables have ~50k rows the rest a couple of hundred) > > execute(qlc:q([I#i.user_id || I <- mnesia:table(i), > C <- mnesia:table(c), > I#i.user_id =:= C#c.user_id, > I#i.group =:= "Group A", > P <- mnesia:table(p), > T <- mnesia:table(t), > S <- mnesia:table(s), > C#c.platform_id =:= P#p.platform_id, > C#c.trans_id =:= T#t.trans_id, > C#c.sales_id =:= S#s.sales_id > ])). > > On a normal RDBMS this query returns in < 1min. I am yet to get a result from Mnesia and its been running for 10 mins. > > Is there anyway I can see what's going wrong with this query under the hood? > > Thanks, > Dan > Do you really need one result set that makes use of values in all five tables? Is it possible to have a i.user_id that does not have a corresponding c.user_id, and can the c.platform_id, ... point to non-existant p, ... entries? If not, that is, you have (conceptual) foreign key constraints, then you can probably cut down the query to just the i and c tables with conditions that the c.platform_id, ... have values. Robby From erlang-questions_efine@REDACTED Tue Sep 30 18:40:46 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Tue, 30 Sep 2008 12:40:46 -0400 Subject: [erlang-questions] system defined flags In-Reply-To: <32e4cadb0809300911j48fdae75x80bb00fb8758ffad@mail.gmail.com> References: <32e4cadb0809300911j48fdae75x80bb00fb8758ffad@mail.gmail.com> Message-ID: <6c2563b20809300940p1b4c0051w7519cde0f361001e@mail.gmail.com> If you look at get_argument/1, I believe the system defined flags are root, progname, and home. These can be defined on the command line, and are automatically defined when using the "erl" command (which is a script on Linux), that looks something like /usr/local/lib/erlang/erts-5.6.4/bin/beam.smp -W w -K true -- -*root /usr/local/lib/erlang* *-progname erl* -- *-home /home/myhome* other stuff... If you're on Linux or Unix, try something like ps -elf|grep beam and take a look at the command lines there. 2008/9/30 Vladimir Mitsner > In the man-page for init module: > > http://www.erlang.org/doc/man/init.html, > > in the description of init:get_arguments/0, there is a reference to > "system defined flags". > Is it possible to edit "system defined flags?" (For example, is there a > file with a special name where all of the "system defined flags" are > defined?) > And if so - how would I go about editing these flags? (In case there is a > file - where is it?) > > Thank you. > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Tue Sep 30 18:47:49 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Tue, 30 Sep 2008 12:47:49 -0400 Subject: [erlang-questions] Extremely poor Mnesia performance In-Reply-To: References: <6a3ae47e0809290545m3191f7b1ka872e4dd5da17cff@mail.gmail.com> <6a3ae47e0809290631h3871cfceie4bd5db04666d35c@mail.gmail.com> <1F1025A3-8734-4DD2-8A01-2B2F775A7D41@uninet.ee> Message-ID: <6c2563b20809300947w3d77063ek9eefc2b507a0075b@mail.gmail.com> Is it possible to denormalize the data so that you don't have so many tables? Mnesia can behave as a hierarchical database because you can store arbitrarily complex terms, including what amounts to trees (lists of tuples of lists of.....). If your queries are likely to remain the same over time and you don't need ad-hoc queries, could you consider this approach? The problem with any hierarchy, of course, is that if you get it wrong it can be hell on wheels to fix. On Tue, Sep 30, 2008 at 12:23 PM, wrote: > Thanks Taavi, > > That wasn't the answer I was looking for! :-D > > Oh dear, well that leaves my plan for using Mnesia in tatters. > > I actually need an in memory db which at least has the core subset of RDBMS > features. So I am essentially just looking for a small in memory DB for > real-time access. > > Has anyone here had any experience using something like KDB with Erlang? > > Perhaps I could switch to using KDB as an alternative? > > Many Thanks, > Dan > > -----Original Message----- > From: Taavi Talvik [mailto:taavi@REDACTED] > Sent: 30 September 2008 17:19 > To: RUBINO, Dana, GBM > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Extremely poor Mnesia performance > > > On Sep 30, 2008, at 5:58 PM, wrote: > > > > > Hey all, > > > > I am doing some benchmarking with Mnesia at the moment and am pretty > > disappointed to say the least. > > > > I'm hoping I am doing something wrong. > > > > Running a 5 table join below: (two of the tables have ~50k rows the > > rest a couple of hundred) > > Probably you are not doing anything wrong. From mnesia introduction ( > http://www.erlang.org/doc/apps/mnesia/ > Mnesia_chap1.html#1 > ), > it design goals are: > === > In telecommunications applications there are different needs from the > features provided by traditional DBMSs. The applications now implemented in > the Erlang language need a mixture of a broad range of features, which > generally are not satisfied by traditional DBMSs. > Mnesia is designed with requirements like the following in mind: > > * Fast real-time key/value lookup > * Complicated non real-time queries mainly for operation and > maintenance > * Distributed data due to distributed applications > * High fault tolerance > * Dynamic re-configuration > * Complex objects > === > > Mnesia is not designed as replacement for relational database. It is > optimised for fast key-value lookup and distribution. > > With qlc:info(Qh) you can get more information, how query is actually > handled. > > best regards, > taavi > > > *********************************************************************************** > The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered > Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority > > This e-mail message is confidential and for use by the > addressee only. If the message is received by anyone other > than the addressee, please return the message to the sender > by replying to it and then delete the message from your > computer. Internet e-mails are not necessarily secure. The > Royal Bank of Scotland plc does not accept responsibility for > changes made to this message after it was sent. > > Whilst all reasonable care has been taken to avoid the > transmission of viruses, it is the responsibility of the recipient to > ensure that the onward transmission, opening or use of this > message and any attachments will not adversely affect its > systems or data. No responsibility is accepted by The > Royal Bank of Scotland plc in this regard and the recipient should carry > out such virus and other checks as it considers appropriate. > Visit our websites at: > www.rbs.com > www.rbs.com/gbm > www.rbsgc.com > > *********************************************************************************** > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Dana.RUBINO@REDACTED Tue Sep 30 18:52:22 2008 From: Dana.RUBINO@REDACTED (Dana.RUBINO@REDACTED) Date: Tue, 30 Sep 2008 17:52:22 +0100 Subject: [erlang-questions] Extremely poor Mnesia performance In-Reply-To: <6c2563b20809300947w3d77063ek9eefc2b507a0075b@mail.gmail.com> References: <6a3ae47e0809290545m3191f7b1ka872e4dd5da17cff@mail.gmail.com> <6a3ae47e0809290631h3871cfceie4bd5db04666d35c@mail.gmail.com> <1F1025A3-8734-4DD2-8A01-2B2F775A7D41@uninet.ee> <6c2563b20809300947w3d77063ek9eefc2b507a0075b@mail.gmail.com> Message-ID: Hi Edwin, Thanks and good idea - I am actually investigating that route right this moment! I think I could definitely do it, the problem being that after an initial bootstrap of the Mnesia tables I will be in a situation where I will be receiving live/real-time updates to the data. These unfortunately will need to be reflected in mnesia so that the queries performed against it are fully up-to-date whilst still enabling real-time response rates to the queries themselves. A bit of a mouthful I know! Many Thanks, Dan ________________________________ From: emofine@REDACTED [mailto:emofine@REDACTED] On Behalf Of Edwin Fine Sent: 30 September 2008 17:48 To: RUBINO, Dana, GBM Cc: taavi@REDACTED; erlang-questions@REDACTED Subject: Re: [erlang-questions] Extremely poor Mnesia performance Is it possible to denormalize the data so that you don't have so many tables? Mnesia can behave as a hierarchical database because you can store arbitrarily complex terms, including what amounts to trees (lists of tuples of lists of.....). If your queries are likely to remain the same over time and you don't need ad-hoc queries, could you consider this approach? The problem with any hierarchy, of course, is that if you get it wrong it can be hell on wheels to fix. On Tue, Sep 30, 2008 at 12:23 PM, > wrote: Thanks Taavi, That wasn't the answer I was looking for! :-D Oh dear, well that leaves my plan for using Mnesia in tatters. I actually need an in memory db which at least has the core subset of RDBMS features. So I am essentially just looking for a small in memory DB for real-time access. Has anyone here had any experience using something like KDB with Erlang? Perhaps I could switch to using KDB as an alternative? Many Thanks, Dan -----Original Message----- From: Taavi Talvik [mailto:taavi@REDACTED] Sent: 30 September 2008 17:19 To: RUBINO, Dana, GBM Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Extremely poor Mnesia performance On Sep 30, 2008, at 5:58 PM, > wrote: > > Hey all, > > I am doing some benchmarking with Mnesia at the moment and am pretty > disappointed to say the least. > > I'm hoping I am doing something wrong. > > Running a 5 table join below: (two of the tables have ~50k rows the > rest a couple of hundred) Probably you are not doing anything wrong. From mnesia introduction (http://www.erlang.org/doc/apps/mnesia/ Mnesia_chap1.html#1), it design goals are: === In telecommunications applications there are different needs from the features provided by traditional DBMSs. The applications now implemented in the Erlang language need a mixture of a broad range of features, which generally are not satisfied by traditional DBMSs. Mnesia is designed with requirements like the following in mind: * Fast real-time key/value lookup * Complicated non real-time queries mainly for operation and maintenance * Distributed data due to distributed applications * High fault tolerance * Dynamic re-configuration * Complex objects === Mnesia is not designed as replacement for relational database. It is optimised for fast key-value lookup and distribution. With qlc:info(Qh) you can get more information, how query is actually handled. best regards, taavi *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbs.com/gbm www.rbsgc.com *********************************************************************************** _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbs.com/gbm www.rbsgc.com *********************************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From vychodil.hynek@REDACTED Tue Sep 30 17:59:18 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Tue, 30 Sep 2008 17:59:18 +0200 Subject: [erlang-questions] Extremely poor Mnesia performance In-Reply-To: References: <6a3ae47e0809290545m3191f7b1ka872e4dd5da17cff@mail.gmail.com> <6a3ae47e0809290631h3871cfceie4bd5db04666d35c@mail.gmail.com> Message-ID: <20080930155918.C4D512407D@relay.gooddata.com> Mnesia is application database but general RDBMS. Mnesia is not optimized for works such as crunch thousands of rows and many joins for each. Application database means for example you can combine many different nontrivial tasks programed in application language (Erlang) in various ways with ability recursive including it in transactions. Mnesia is barely fast even you do complex tasks in reliable and maintainable fashion. You are able write your code in natural application way but you are still fast enough. You don't need make trade off readability and maintainability by performance or reliability and you gain all of this in distribute environment, partitioning, mirroring and so. If you start compare application using mnesia for many complex but not data expensive tasks with requirement of readability you found mnesia is light faster than classic RDBMS approach. If you need simple fast data intensive crunch, use classic RDBMS. If you need complex data non intensive and various tasks with distribution and reliability, use mnesia. That's all. Your task is nothing more than just relational data crunch. It is primitive from mnesia point of view and you don't use killer features of it. On Tue, Sep 30, 2008 at 4:58 PM, wrote: > > Hey all, > > I am doing some benchmarking with Mnesia at the moment and am pretty > disappointed to say the least. > > I'm hoping I am doing something wrong. > > Running a 5 table join below: (two of the tables have ~50k rows the rest a > couple of hundred) > > execute(qlc:q([I#i.user_id || I <- mnesia:table(i), > C <- mnesia:table(c), > I#i.user_id =:= C#c.user_id, > I#i.group =:= "Group A", > P <- mnesia:table(p), > T <- mnesia:table(t), > S <- mnesia:table(s), > C#c.platform_id =:= > P#p.platform_id, > C#c.trans_id =:= > T#t.trans_id, > C#c.sales_id =:= > S#s.sales_id > ])). > > On a normal RDBMS this query returns in < 1min. I am yet to get a result > from Mnesia and its been running for 10 mins. > > Is there anyway I can see what's going wrong with this query under the > hood? > > Thanks, > Dan > > > *********************************************************************************** > The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered > Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority > > This e-mail message is confidential and for use by the > addressee only. If the message is received by anyone other > than the addressee, please return the message to the sender > by replying to it and then delete the message from your > computer. Internet e-mails are not necessarily secure. The > Royal Bank of Scotland plc does not accept responsibility for > changes made to this message after it was sent. > > Whilst all reasonable care has been taken to avoid the > transmission of viruses, it is the responsibility of the recipient to > ensure that the onward transmission, opening or use of this > message and any attachments will not adversely affect its > systems or data. No responsibility is accepted by The > Royal Bank of Scotland plc in this regard and the recipient should carry > out such virus and other checks as it considers appropriate. > Visit our websites at: > www.rbs.com > www.rbs.com/gbm > www.rbsgc.com > > *********************************************************************************** > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From vychodil.hynek@REDACTED Tue Sep 30 17:56:08 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Tue, 30 Sep 2008 17:56:08 +0200 Subject: [erlang-questions] Extremely poor Mnesia performance In-Reply-To: References: <6a3ae47e0809290545m3191f7b1ka872e4dd5da17cff@mail.gmail.com> <6a3ae47e0809290631h3871cfceie4bd5db04666d35c@mail.gmail.com> Message-ID: <20080930155608.CF96E24064@relay.gooddata.com> Mnesia is application database but general RDBMS. Mnesia is not optimized for works such as crunch thousands of rows and many joins for each. Application database means for example you can combine many different nontrivial tasks programed in application language (Erlang) in various ways with ability recursive including it in transactions. Mnesia is barely fast even you do complex tasks in reliable and maintainable fashion. You are able write your code in natural application way but you are still fast enough. You don't need make trade off readability and maintainability by performance or reliability and you gain all of this in distribute environment, partitioning, mirroring and so. If you start compare application using mnesia for many complex but not data expensive tasks with requirement of readability you found mnesia is light faster than classic RDBMS approach. If you need simple fast data intensive crunch, use classic RDBMS. If you need complex data non intensive and various tasks with distribution and reliability, use mnesia. That's all. Your task is nothing more than just relational data crunch. It is primitive from mnesia point of view and you don't use killer features of it. On Tue, Sep 30, 2008 at 4:58 PM, wrote: > > Hey all, > > I am doing some benchmarking with Mnesia at the moment and am pretty > disappointed to say the least. > > I'm hoping I am doing something wrong. > > Running a 5 table join below: (two of the tables have ~50k rows the rest a > couple of hundred) > > execute(qlc:q([I#i.user_id || I <- mnesia:table(i), > C <- mnesia:table(c), > I#i.user_id =:= C#c.user_id, > I#i.group =:= "Group A", > P <- mnesia:table(p), > T <- mnesia:table(t), > S <- mnesia:table(s), > C#c.platform_id =:= > P#p.platform_id, > C#c.trans_id =:= > T#t.trans_id, > C#c.sales_id =:= > S#s.sales_id > ])). > > On a normal RDBMS this query returns in < 1min. I am yet to get a result > from Mnesia and its been running for 10 mins. > > Is there anyway I can see what's going wrong with this query under the > hood? > > Thanks, > Dan > > > *********************************************************************************** > The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered > Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority > > This e-mail message is confidential and for use by the > addressee only. If the message is received by anyone other > than the addressee, please return the message to the sender > by replying to it and then delete the message from your > computer. Internet e-mails are not necessarily secure. The > Royal Bank of Scotland plc does not accept responsibility for > changes made to this message after it was sent. > > Whilst all reasonable care has been taken to avoid the > transmission of viruses, it is the responsibility of the recipient to > ensure that the onward transmission, opening or use of this > message and any attachments will not adversely affect its > systems or data. No responsibility is accepted by The > Royal Bank of Scotland plc in this regard and the recipient should carry > out such virus and other checks as it considers appropriate. > Visit our websites at: > www.rbs.com > www.rbs.com/gbm > www.rbsgc.com > > *********************************************************************************** > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From toby@REDACTED Tue Sep 30 20:19:49 2008 From: toby@REDACTED (Toby Thain) Date: Tue, 30 Sep 2008 14:19:49 -0400 Subject: [erlang-questions] The Erlang Rationale In-Reply-To: <4ac8254d0809300634n73f04c0bvbbb6794f3757087@mail.gmail.com> References: <3dbc6d1c0809291502m3ad2147djfdc652a8e5c7a157@mail.gmail.com> <48E1F395.5040501@gmail.com> <3dbc6d1c0809300519kd46dbadsdfb670f71865b5@mail.gmail.com> <48E21D43.1040509@gmail.com> <4ac8254d0809300609m7c72c6b2je9774a70c629acf8@mail.gmail.com> <3dbc6d1c0809300630q35221794jf0922f370de6dd04@mail.gmail.com> <4ac8254d0809300634n73f04c0bvbbb6794f3757087@mail.gmail.com> Message-ID: On 30-Sep-08, at 9:34 AM, Tuncer Ayaz wrote: > On Tue, Sep 30, 2008 at 3:30 PM, Robert Virding > wrote: >> OK, OK, OK, enough already! :-) I will fix the next version in >> PDF. And I >> thought this was a bunch of computer savvy people who would just >> laugh at >> Word format. > > Thanks for posting in Word format. It made me realize the inlined > SVG idea > and I like that a lot. So will HTML. --Toby > >> How about comments on content, both what is there and what is not? >> >> Robert > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From vychodil.hynek@REDACTED Tue Sep 30 21:56:10 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Tue, 30 Sep 2008 21:56:10 +0200 Subject: [erlang-questions] Extremely poor Mnesia performance In-Reply-To: <20080930155608.CF96E24064@relay.gooddata.com> References: <6a3ae47e0809290545m3191f7b1ka872e4dd5da17cff@mail.gmail.com> <6a3ae47e0809290631h3871cfceie4bd5db04666d35c@mail.gmail.com> <20080930155608.CF96E24064@relay.gooddata.com> Message-ID: <20080930195611.3E9BF2407D@relay.gooddata.com> I'm sorry for multiply send but gmail was started stammering. I guess just twice send but those is worse. They should use Erlang :-) 2008/9/30 Hynek Vychodil > Mnesia is application database but general RDBMS. Mnesia is not optimized > for works such as crunch thousands of rows and many joins for each. > Application database means for example you can combine many different > nontrivial tasks programed in application language (Erlang) in various ways > with ability recursive including it in transactions. Mnesia is barely fast > even you do complex tasks in reliable and maintainable fashion. You are able > write your code in natural application way but you are still fast enough. > You don't need make trade off readability and maintainability by performance > or reliability and you gain all of this in distribute environment, > partitioning, mirroring and so. If you start compare application using > mnesia for many complex but not data expensive tasks with requirement of > readability you found mnesia is light faster than classic RDBMS approach. If > you need simple fast data intensive crunch, use classic RDBMS. If you need > complex data non intensive and various tasks with distribution and > reliability, use mnesia. That's all. Your task is nothing more than just > relational data crunch. It is primitive from mnesia point of view and you > don't use killer features of it. > > On Tue, Sep 30, 2008 at 4:58 PM, wrote: > >> >> Hey all, >> >> I am doing some benchmarking with Mnesia at the moment and am pretty >> disappointed to say the least. >> >> I'm hoping I am doing something wrong. >> >> Running a 5 table join below: (two of the tables have ~50k rows the rest a >> couple of hundred) >> >> execute(qlc:q([I#i.user_id || I <- mnesia:table(i), >> C <- mnesia:table(c), >> I#i.user_id =:= >> C#c.user_id, >> I#i.group =:= "Group A", >> P <- mnesia:table(p), >> T <- mnesia:table(t), >> S <- mnesia:table(s), >> C#c.platform_id =:= >> P#p.platform_id, >> C#c.trans_id =:= >> T#t.trans_id, >> C#c.sales_id =:= >> S#s.sales_id >> ])). >> >> On a normal RDBMS this query returns in < 1min. I am yet to get a result >> from Mnesia and its been running for 10 mins. >> >> Is there anyway I can see what's going wrong with this query under the >> hood? >> >> Thanks, >> Dan >> >> >> *********************************************************************************** >> The Royal Bank of Scotland plc. Registered in Scotland No 90312. >> Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. >> Authorised and regulated by the Financial Services Authority >> >> This e-mail message is confidential and for use by the >> addressee only. If the message is received by anyone other >> than the addressee, please return the message to the sender >> by replying to it and then delete the message from your >> computer. Internet e-mails are not necessarily secure. The >> Royal Bank of Scotland plc does not accept responsibility for >> changes made to this message after it was sent. >> >> Whilst all reasonable care has been taken to avoid the >> transmission of viruses, it is the responsibility of the recipient to >> ensure that the onward transmission, opening or use of this >> message and any attachments will not adversely affect its >> systems or data. No responsibility is accepted by The >> Royal Bank of Scotland plc in this regard and the recipient should carry >> out such virus and other checks as it considers appropriate. >> Visit our websites at: >> www.rbs.com >> www.rbs.com/gbm >> www.rbsgc.com >> >> *********************************************************************************** >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > --Hynek (Pichi) Vychodil > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From lloy0076@REDACTED Mon Sep 29 04:45:26 2008 From: lloy0076@REDACTED (David Lloyd) Date: Mon, 29 Sep 2008 12:15:26 +0930 Subject: [erlang-questions] Millions of processes? In-Reply-To: <2a33cf51-9f1f-4248-8b57-6dda36f105a5@59g2000hsb.googlegroups.com> References: <48D9068A.7050200@niclux.org> <48D907DD.1030909@ericsson.com> <48D90C89.1080009@niclux.org> <2a33cf51-9f1f-4248-8b57-6dda36f105a5@59g2000hsb.googlegroups.com> Message-ID: <48E04146.60503@adam.com.au> Errr, YourSurrogateGod wrote: > This is somewhat off-topic, but I didn't know that there is a 64-bit > erlang VM. How is it different than the 32-bit one? Also, how can I > find out which one I'm running? One takes advantage of a 32 bit architecture and the other of a 64 bit architecture...and some of the standard library understands the difference. For example, I understand that "ets" understand the 64 bit architecture and can take advantage of huge tables whereas "dets" is still 32 bit specific. There'd be other differences, too, I suppose. DSL