From robert.virding@REDACTED Fri Nov 1 02:46:12 2013 From: robert.virding@REDACTED (Robert Virding) Date: Fri, 1 Nov 2013 02:46:12 +0100 (CET) Subject: [erlang-questions] An answer: how does SASL know that a process died? In-Reply-To: References: <20131031102733.GA6528@corelatus.se> <527246C9.1080403@gmail.com> <334467983.529030.1383232337055.JavaMail.zimbra@erlang-solutions.com> Message-ID: <1040708384.538316.1383270372662.JavaMail.zimbra@erlang-solutions.com> No, how the error_handler works is well defined, it is written in erlang, and you can affect what it does. Which are 3 things the sending of messages to error_logger is not. You can also directly SEE what the error_handler does. Robert ----- Original Message ----- > From: "Anthony Ramine" > To: "Robert Virding" > Cc: "Richard Carlsson" , "Erlang Questions" > Sent: Thursday, 31 October, 2013 4:25:47 PM > Subject: Re: [erlang-questions] An answer: how does SASL know that a process died? > > Would you get rid of error_handler too? Because I find that worse than the > error_logger situation. At least a logger is just a logger, it can?t > masquerade a function call as another one or do fancy things like this. > > -- > Anthony Ramine > > Le 31 oct. 2013 ? 16:12, Robert Virding > a ?crit : > > > What a stupid thing for the system to do! Erlang is Erlang and OTP is > > something on top of Erlang. It was never written into the spec because we > > didn't know about it. How can we get rid of it? It is definitely a bug, at > > best a bad design decision! > > From dmkolesnikov@REDACTED Fri Nov 1 06:07:19 2013 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Fri, 1 Nov 2013 07:07:19 +0200 Subject: [erlang-questions] Arch Linux patches? In-Reply-To: <5272CA2C.1050908@ninenines.eu> References: <5272C2BF.5050808@online.fr> <5272CA2C.1050908@ninenines.eu> Message-ID: <922D5B5A-64A7-4A36-8F4C-45F8BDBEB813@gmail.com> What are test cases you run to validate performance? And What was environment? Best Regards, Dmitry >-|-|-*> > On 31.10.2013, at 23.22, Lo?c Hoguin wrote: > > I know the Makefile doesn't seem to do anything but last I checked (been a while) I had better performance with the precompiled version compared to compiling with kerl (I'm not sure if I tried with manual compilation). > > I'll check again tomorrow. > >> On 10/31/2013 10:04 PM, Aaron France wrote: >> Demonstrably false. >> >> ArchLinux uses https://gist.github.com/AeroNotix/7257133 this to build >> it's package, no patches, no wicked switches, just a plain makefile. >> >> Aaron >> >> >> On Thu, Oct 31, 2013 at 9:51 PM, Olivier Boudeville >> > wrote: >> >> Hi, >> >> I may be wrong but I think that, some time ago, someone (maybe >> Lo?c?) mentioned incidentally in this mailing list that the Arch >> Linux version of Erlang (obtained through pacman) was reported to >> be, at least in some cases, significantly more efficient than the >> stock, official version (the trouble is that I can't find that >> message from the list archives). >> >> I was wondering if it had been confirmed, and, if yes, if there were >> some patches sent upstream by the Arch maintainers that could be >> fruitfully applied to the official sources? >> >> Thanks for any information! >> >> Cheers, >> >> Olivier. >> >> >> >> >> >> _________________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/__listinfo/erlang-questions >> >> >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > http://ninenines.eu > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From aaron.l.france@REDACTED Fri Nov 1 10:28:49 2013 From: aaron.l.france@REDACTED (Aaron France) Date: Fri, 1 Nov 2013 10:28:49 +0100 Subject: [erlang-questions] Arch Linux patches? In-Reply-To: <922D5B5A-64A7-4A36-8F4C-45F8BDBEB813@gmail.com> References: <5272C2BF.5050808@online.fr> <5272CA2C.1050908@ninenines.eu> <922D5B5A-64A7-4A36-8F4C-45F8BDBEB813@gmail.com> Message-ID: Hi, I'd hate to sound like a party-pooper but I'm very much inclined to say that this endeavour is not a very fruitful one. Arch essentially just packages upstream. It's quite likely any performance gains you see are simply factors mainly a newer kernel and more up-to-date packages. That said, I'll happily entertain the idea that Arch is somehow a performance distro. Aaron On 01/11/13 06:07, Dmitry Kolesnikov wrote: > What are test cases you run to validate performance? And What was environment? > > > Best Regards, > Dmitry >-|-|-*> > > >> On 31.10.2013, at 23.22, Lo?c Hoguin wrote: >> >> I know the Makefile doesn't seem to do anything but last I checked (been a while) I had better performance with the precompiled version compared to compiling with kerl (I'm not sure if I tried with manual compilation). >> >> I'll check again tomorrow. >> >>> On 10/31/2013 10:04 PM, Aaron France wrote: >>> Demonstrably false. >>> >>> ArchLinux uses https://gist.github.com/AeroNotix/7257133 this to build >>> it's package, no patches, no wicked switches, just a plain makefile. >>> >>> Aaron >>> >>> >>> On Thu, Oct 31, 2013 at 9:51 PM, Olivier Boudeville >>> > wrote: >>> >>> Hi, >>> >>> I may be wrong but I think that, some time ago, someone (maybe >>> Lo?c?) mentioned incidentally in this mailing list that the Arch >>> Linux version of Erlang (obtained through pacman) was reported to >>> be, at least in some cases, significantly more efficient than the >>> stock, official version (the trouble is that I can't find that >>> message from the list archives). >>> >>> I was wondering if it had been confirmed, and, if yes, if there were >>> some patches sent upstream by the Arch maintainers that could be >>> fruitfully applied to the official sources? >>> >>> Thanks for any information! >>> >>> Cheers, >>> >>> Olivier. >>> >>> >>> >>> >>> >>> _________________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/__listinfo/erlang-questions >>> >>> >>> >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> -- >> Lo?c Hoguin >> Erlang Cowboy >> Nine Nines >> http://ninenines.eu >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From carlsson.richard@REDACTED Fri Nov 1 10:41:40 2013 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Fri, 01 Nov 2013 10:41:40 +0100 Subject: [erlang-questions] An answer: how does SASL know that a process died? In-Reply-To: <1040708384.538316.1383270372662.JavaMail.zimbra@erlang-solutions.com> References: <20131031102733.GA6528@corelatus.se> <527246C9.1080403@gmail.com> <334467983.529030.1383232337055.JavaMail.zimbra@erlang-solutions.com> <1040708384.538316.1383270372662.JavaMail.zimbra@erlang-solutions.com> Message-ID: <52737754.9040904@gmail.com> This could be improved by making it work in the same way as undefined functions etc.: by defining that a particular function in the error_handler module gets called with the error information as arguments. Then the formatting and sending to error_logger can be done in Erlang code, making it much more transparent and easier to change what it does, and no longer hard-coding a connection in the VM between process termination and a high level service like the logger. You can even avoid the whole send operation if you just want to drop these events. /Richard On 2013-11-01 02:46 , Robert Virding wrote: > No, how the error_handler works is well defined, it is written in erlang, and you can affect what it does. Which are 3 things the sending of messages to error_logger is not. You can also directly SEE what the error_handler does. > > Robert > > ----- Original Message ----- >> From: "Anthony Ramine" >> To: "Robert Virding" >> Cc: "Richard Carlsson" , "Erlang Questions" >> Sent: Thursday, 31 October, 2013 4:25:47 PM >> Subject: Re: [erlang-questions] An answer: how does SASL know that a process died? >> >> Would you get rid of error_handler too? Because I find that worse than the >> error_logger situation. At least a logger is just a logger, it can?t >> masquerade a function call as another one or do fancy things like this. >> >> -- >> Anthony Ramine >> >> Le 31 oct. 2013 ? 16:12, Robert Virding >> a ?crit : >> >>> What a stupid thing for the system to do! Erlang is Erlang and OTP is >>> something on top of Erlang. It was never written into the spec because we >>> didn't know about it. How can we get rid of it? It is definitely a bug, at >>> best a bad design decision! >> >> From carlsson.richard@REDACTED Fri Nov 1 10:49:15 2013 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Fri, 01 Nov 2013 10:49:15 +0100 Subject: [erlang-questions] An answer: how does SASL know that a process died? In-Reply-To: <20131031161539.GA15348@corelatus.se> References: <20131031102733.GA6528@corelatus.se> <527246C9.1080403@gmail.com> <334467983.529030.1383232337055.JavaMail.zimbra@erlang-solutions.com> <20131031161539.GA15348@corelatus.se> Message-ID: <5273791B.6010502@gmail.com> On 2013-10-31 17:15 , Matthias Lang wrote: > Hi, > > RC> I'm not sure if that can RC be changed or if it needs to remain > RC> backwards compatible with existing code out there. > > I think it would affect people, but not code. > > People might use the 'process X crashed...' message as part of their > development workflow, to see problems while hacking. > > I doubt removing it would affect code. The only thing it's likely to > affect is logging code, and logging code won't care if there's less to > log. The least farfetched idea I can come up with for useful code that > would be affected is if someone clever has built a "supervisor-less" > supervision system based on parsing those messages. Well, I wasn't going to suggest removing it entirely, but changing the format so that it's not just a string, and the formatting can be done by the handler after it decides that it actually cares about this event. But error loggers would need to handle the new message type. /Richard From matthias@REDACTED Fri Nov 1 11:12:04 2013 From: matthias@REDACTED (Matthias Lang) Date: Fri, 1 Nov 2013 11:12:04 +0100 Subject: [erlang-questions] An answer: how does SASL know that a process died? In-Reply-To: <5273791B.6010502@gmail.com> References: <20131031102733.GA6528@corelatus.se> <527246C9.1080403@gmail.com> <334467983.529030.1383232337055.JavaMail.zimbra@erlang-solutions.com> <20131031161539.GA15348@corelatus.se> <5273791B.6010502@gmail.com> Message-ID: <20131101101204.GA4871@corelatus.se> Hi, ML> >I doubt removing it would... RC> Well, I wasn't going to suggest removing it entirely, but changing I want to toss it. It's ugly and useless. But I'm hasty. I hoping someone would remember why the message-to-error-logger hack was added in the first place. In the absense of someone who can remember, I'll just make up some history: it came around the same time as supervision trees were being invented. People had a hazy idea that you needed to keep track of processes that went wrong, and the first idea was to print a message whenever that happened. Soon after, someone else came up with the idea of supervisors, but left the error-logger hack in so as not to step on the inventor's toes. Matthias From essen@REDACTED Fri Nov 1 11:18:54 2013 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Fri, 01 Nov 2013 11:18:54 +0100 Subject: [erlang-questions] Arch Linux patches? In-Reply-To: References: <5272C2BF.5050808@online.fr> <5272CA2C.1050908@ninenines.eu> <922D5B5A-64A7-4A36-8F4C-45F8BDBEB813@gmail.com> Message-ID: <5273800E.4050501@ninenines.eu> I'm sure there's a reasonable explanation. Trying with Cowboy's hello_world package, the dumbest benchmark you can do. Using siege for this, using the default conf file except verbose set to false. To compile the example: % make % ./_rel/bin/hello_world_example console You will have to recompile it when switching Erlang installs of course, as it's a release and the VM files are copied. Pacman install: % erl Erlang R16B02 (erts-5.10.3) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] ... % siege -b -c 100 -t 5s http://127.0.0.1:8080 ** SIEGE 3.0.5 ** Preparing 100 concurrent users for battle. The server is now under siege... Lifting the server siege... done. Transactions: 186841 hits Availability: 100.00 % Elapsed time: 14.41 secs Data transferred: 2.14 MB Response time: 0.01 secs Transaction rate: 12966.07 trans/sec Throughput: 0.15 MB/sec Concurrency: 99.52 Successful transactions: 186841 Failed transactions: 0 Longest transaction: 0.06 Shortest transaction: 0.00 Kerl install (no option, just build, install, activate, and of course example rebuilt from scratch): % erl Erlang R16B02 (erts-5.10.3) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] ... % siege -b -c 100 -t 5s http://127.0.0.1:8080 ** SIEGE 3.0.5 ** Preparing 100 concurrent users for battle. The server is now under siege... Lifting the server siege... done. Transactions: 121051 hits Availability: 100.00 % Elapsed time: 14.37 secs Data transferred: 1.39 MB Response time: 0.01 secs Transaction rate: 8423.87 trans/sec Throughput: 0.10 MB/sec Concurrency: 99.65 Successful transactions: 121051 Failed transactions: 0 Longest transaction: 0.04 Shortest transaction: 0.00 Your guess is as good as mine. On 11/01/2013 10:28 AM, Aaron France wrote: > Hi, > > I'd hate to sound like a party-pooper but I'm very much inclined to say > that this endeavour is not a very fruitful one. > > Arch essentially just packages upstream. It's quite likely any > performance gains you see are simply factors mainly a newer kernel and > more up-to-date packages. > > That said, I'll happily entertain the idea that Arch is somehow a > performance distro. > > Aaron > > > On 01/11/13 06:07, Dmitry Kolesnikov wrote: >> What are test cases you run to validate performance? And What was environment? >> >> >> Best Regards, >> Dmitry >-|-|-*> >> >> >>> On 31.10.2013, at 23.22, Lo?c Hoguin wrote: >>> >>> I know the Makefile doesn't seem to do anything but last I checked (been a while) I had better performance with the precompiled version compared to compiling with kerl (I'm not sure if I tried with manual compilation). >>> >>> I'll check again tomorrow. >>> >>>> On 10/31/2013 10:04 PM, Aaron France wrote: >>>> Demonstrably false. >>>> >>>> ArchLinux uses https://gist.github.com/AeroNotix/7257133 this to build >>>> it's package, no patches, no wicked switches, just a plain makefile. >>>> >>>> Aaron >>>> >>>> >>>> On Thu, Oct 31, 2013 at 9:51 PM, Olivier Boudeville >>>> > wrote: >>>> >>>> Hi, >>>> >>>> I may be wrong but I think that, some time ago, someone (maybe >>>> Lo?c?) mentioned incidentally in this mailing list that the Arch >>>> Linux version of Erlang (obtained through pacman) was reported to >>>> be, at least in some cases, significantly more efficient than the >>>> stock, official version (the trouble is that I can't find that >>>> message from the list archives). >>>> >>>> I was wondering if it had been confirmed, and, if yes, if there were >>>> some patches sent upstream by the Arch maintainers that could be >>>> fruitfully applied to the official sources? >>>> >>>> Thanks for any information! >>>> >>>> Cheers, >>>> >>>> Olivier. >>>> >>>> >>>> >>>> >>>> >>>> _________________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/__listinfo/erlang-questions >>>> >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> -- >>> Lo?c Hoguin >>> Erlang Cowboy >>> Nine Nines >>> http://ninenines.eu >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From aaron.l.france@REDACTED Fri Nov 1 12:37:06 2013 From: aaron.l.france@REDACTED (Aaron France) Date: Fri, 01 Nov 2013 12:37:06 +0100 Subject: [erlang-questions] Arch Linux patches? In-Reply-To: <5273800E.4050501@ninenines.eu> References: <5272C2BF.5050808@online.fr> <5272CA2C.1050908@ninenines.eu> <922D5B5A-64A7-4A36-8F4C-45F8BDBEB813@gmail.com> <5273800E.4050501@ninenines.eu> Message-ID: <52739262.5070402@gmail.com> Are they both using the exact same commit? On 01/11/13 11:18, Lo?c Hoguin wrote: > I'm sure there's a reasonable explanation. > > Trying with Cowboy's hello_world package, the dumbest benchmark you > can do. Using siege for this, using the default conf file except > verbose set to false. > > To compile the example: > > % make > % ./_rel/bin/hello_world_example console > > You will have to recompile it when switching Erlang installs of > course, as it's a release and the VM files are copied. > > Pacman install: > > % erl > Erlang R16B02 (erts-5.10.3) [source] [64-bit] [smp:4:4] > [async-threads:10] [hipe] [kernel-poll:false] > ... > % siege -b -c 100 -t 5s http://127.0.0.1:8080 > ** SIEGE 3.0.5 > ** Preparing 100 concurrent users for battle. > The server is now under siege... > Lifting the server siege... done. > > Transactions: 186841 hits > Availability: 100.00 % > Elapsed time: 14.41 secs > Data transferred: 2.14 MB > Response time: 0.01 secs > Transaction rate: 12966.07 trans/sec > Throughput: 0.15 MB/sec > Concurrency: 99.52 > Successful transactions: 186841 > Failed transactions: 0 > Longest transaction: 0.06 > Shortest transaction: 0.00 > > Kerl install (no option, just build, install, activate, and of course > example rebuilt from scratch): > > % erl > Erlang R16B02 (erts-5.10.3) [source] [64-bit] [smp:4:4] > [async-threads:10] [hipe] [kernel-poll:false] > ... > % siege -b -c 100 -t 5s http://127.0.0.1:8080 > ** SIEGE 3.0.5 > ** Preparing 100 concurrent users for battle. > The server is now under siege... > Lifting the server siege... done. > > Transactions: 121051 hits > Availability: 100.00 % > Elapsed time: 14.37 secs > Data transferred: 1.39 MB > Response time: 0.01 secs > Transaction rate: 8423.87 trans/sec > Throughput: 0.10 MB/sec > Concurrency: 99.65 > Successful transactions: 121051 > Failed transactions: 0 > Longest transaction: 0.04 > Shortest transaction: 0.00 > > Your guess is as good as mine. > > On 11/01/2013 10:28 AM, Aaron France wrote: >> Hi, >> >> I'd hate to sound like a party-pooper but I'm very much inclined to say >> that this endeavour is not a very fruitful one. >> >> Arch essentially just packages upstream. It's quite likely any >> performance gains you see are simply factors mainly a newer kernel and >> more up-to-date packages. >> >> That said, I'll happily entertain the idea that Arch is somehow a >> performance distro. >> >> Aaron >> >> >> On 01/11/13 06:07, Dmitry Kolesnikov wrote: >>> What are test cases you run to validate performance? And What was >>> environment? >>> >>> >>> Best Regards, >>> Dmitry >-|-|-*> >>> >>> >>>> On 31.10.2013, at 23.22, Lo?c Hoguin wrote: >>>> >>>> I know the Makefile doesn't seem to do anything but last I checked >>>> (been a while) I had better performance with the precompiled >>>> version compared to compiling with kerl (I'm not sure if I tried >>>> with manual compilation). >>>> >>>> I'll check again tomorrow. >>>> >>>>> On 10/31/2013 10:04 PM, Aaron France wrote: >>>>> Demonstrably false. >>>>> >>>>> ArchLinux uses https://gist.github.com/AeroNotix/7257133 this to >>>>> build >>>>> it's package, no patches, no wicked switches, just a plain makefile. >>>>> >>>>> Aaron >>>>> >>>>> >>>>> On Thu, Oct 31, 2013 at 9:51 PM, Olivier Boudeville >>>>> >>>> > wrote: >>>>> >>>>> Hi, >>>>> >>>>> I may be wrong but I think that, some time ago, someone (maybe >>>>> Lo?c?) mentioned incidentally in this mailing list that the Arch >>>>> Linux version of Erlang (obtained through pacman) was >>>>> reported to >>>>> be, at least in some cases, significantly more efficient than >>>>> the >>>>> stock, official version (the trouble is that I can't find that >>>>> message from the list archives). >>>>> >>>>> I was wondering if it had been confirmed, and, if yes, if >>>>> there were >>>>> some patches sent upstream by the Arch maintainers that could be >>>>> fruitfully applied to the official sources? >>>>> >>>>> Thanks for any information! >>>>> >>>>> Cheers, >>>>> >>>>> Olivier. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> _________________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://erlang.org/mailman/__listinfo/erlang-questions >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>> >>>> -- >>>> Lo?c Hoguin >>>> Erlang Cowboy >>>> Nine Nines >>>> http://ninenines.eu >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions > > From robert.virding@REDACTED Fri Nov 1 12:39:03 2013 From: robert.virding@REDACTED (Robert Virding) Date: Fri, 1 Nov 2013 12:39:03 +0100 (CET) Subject: [erlang-questions] An answer: how does SASL know that a process died? In-Reply-To: <52737754.9040904@gmail.com> References: <20131031102733.GA6528@corelatus.se> <527246C9.1080403@gmail.com> <334467983.529030.1383232337055.JavaMail.zimbra@erlang-solutions.com> <1040708384.538316.1383270372662.JavaMail.zimbra@erlang-solutions.com> <52737754.9040904@gmail.com> Message-ID: <740233295.545791.1383305943169.JavaMail.zimbra@erlang-solutions.com> I think that would be a reasonable solution if we want to keep the functionality. It would make it visible and programmable. And make me happy. :-) Would it need an EEP or could OTP team just fix it. Robert ----- Original Message ----- > From: "Richard Carlsson" > To: "Robert Virding" , "Anthony Ramine" > Cc: "Erlang Questions" > Sent: Friday, 1 November, 2013 10:41:40 AM > Subject: Re: [erlang-questions] An answer: how does SASL know that a process died? > > This could be improved by making it work in the same way as undefined > functions etc.: by defining that a particular function in the > error_handler module gets called with the error information as > arguments. Then the formatting and sending to error_logger can be done > in Erlang code, making it much more transparent and easier to change > what it does, and no longer hard-coding a connection in the VM between > process termination and a high level service like the logger. You can > even avoid the whole send operation if you just want to drop these events. > > /Richard > > On 2013-11-01 02:46 , Robert Virding wrote: > > No, how the error_handler works is well defined, it is written in erlang, > > and you can affect what it does. Which are 3 things the sending of > > messages to error_logger is not. You can also directly SEE what the > > error_handler does. > > > > Robert > > > > ----- Original Message ----- > >> From: "Anthony Ramine" > >> To: "Robert Virding" > >> Cc: "Richard Carlsson" , "Erlang Questions" > >> > >> Sent: Thursday, 31 October, 2013 4:25:47 PM > >> Subject: Re: [erlang-questions] An answer: how does SASL know that a > >> process died? > >> > >> Would you get rid of error_handler too? Because I find that worse than the > >> error_logger situation. At least a logger is just a logger, it can?t > >> masquerade a function call as another one or do fancy things like this. > >> > >> -- > >> Anthony Ramine > >> > >> Le 31 oct. 2013 ? 16:12, Robert Virding > >> > >> a ?crit : > >> > >>> What a stupid thing for the system to do! Erlang is Erlang and OTP is > >>> something on top of Erlang. It was never written into the spec because we > >>> didn't know about it. How can we get rid of it? It is definitely a bug, > >>> at > >>> best a bad design decision! > >> > >> > > From carlsson.richard@REDACTED Fri Nov 1 12:40:54 2013 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Fri, 01 Nov 2013 12:40:54 +0100 Subject: [erlang-questions] An answer: how does SASL know that a process died? In-Reply-To: <740233295.545791.1383305943169.JavaMail.zimbra@erlang-solutions.com> References: <20131031102733.GA6528@corelatus.se> <527246C9.1080403@gmail.com> <334467983.529030.1383232337055.JavaMail.zimbra@erlang-solutions.com> <1040708384.538316.1383270372662.JavaMail.zimbra@erlang-solutions.com> <52737754.9040904@gmail.com> <740233295.545791.1383305943169.JavaMail.zimbra@erlang-solutions.com> Message-ID: <52739346.7030300@gmail.com> If it doesn't change the current behaviour (as a first step), I don't see that it would need an EEP. /Richard On 2013-11-01 12:39 , Robert Virding wrote: > I think that would be a reasonable solution if we want to keep the functionality. It would make it visible and programmable. And make me happy. :-) Would it need an EEP or could OTP team just fix it. > > Robert > > ----- Original Message ----- >> From: "Richard Carlsson" >> To: "Robert Virding" , "Anthony Ramine" >> Cc: "Erlang Questions" >> Sent: Friday, 1 November, 2013 10:41:40 AM >> Subject: Re: [erlang-questions] An answer: how does SASL know that a process died? >> >> This could be improved by making it work in the same way as undefined >> functions etc.: by defining that a particular function in the >> error_handler module gets called with the error information as >> arguments. Then the formatting and sending to error_logger can be done >> in Erlang code, making it much more transparent and easier to change >> what it does, and no longer hard-coding a connection in the VM between >> process termination and a high level service like the logger. You can >> even avoid the whole send operation if you just want to drop these events. >> >> /Richard >> >> On 2013-11-01 02:46 , Robert Virding wrote: >>> No, how the error_handler works is well defined, it is written in erlang, >>> and you can affect what it does. Which are 3 things the sending of >>> messages to error_logger is not. You can also directly SEE what the >>> error_handler does. >>> >>> Robert >>> >>> ----- Original Message ----- >>>> From: "Anthony Ramine" >>>> To: "Robert Virding" >>>> Cc: "Richard Carlsson" , "Erlang Questions" >>>> >>>> Sent: Thursday, 31 October, 2013 4:25:47 PM >>>> Subject: Re: [erlang-questions] An answer: how does SASL know that a >>>> process died? >>>> >>>> Would you get rid of error_handler too? Because I find that worse than the >>>> error_logger situation. At least a logger is just a logger, it can?t >>>> masquerade a function call as another one or do fancy things like this. >>>> >>>> -- >>>> Anthony Ramine >>>> >>>> Le 31 oct. 2013 ? 16:12, Robert Virding >>>> >>>> a ?crit : >>>> >>>>> What a stupid thing for the system to do! Erlang is Erlang and OTP is >>>>> something on top of Erlang. It was never written into the spec because we >>>>> didn't know about it. How can we get rid of it? It is definitely a bug, >>>>> at >>>>> best a bad design decision! >>>> >>>> >> >> From akonsu@REDACTED Fri Nov 1 15:18:30 2013 From: akonsu@REDACTED (akonsu) Date: Fri, 1 Nov 2013 10:18:30 -0400 Subject: [erlang-questions] ETS-TRANSFER Message-ID: Hello, I am reading the code at https://github.com/DeadZen/etsgive that implements one of the ETS handling techniques mentioned in http://steve.vinoski.net/blog/2011/03/23/dont-lose-your-ets-tables/, and one thing (out of several) that I do not understand is this callback: https://github.com/DeadZen/etsgive/blob/master/src/etsgive_mgr.erl#L110. It handles ETS-TRANSFER message that the ETS table heir receives when the table owner terminates. Is this message received after the owner terminates? Is it guaranteed that the owner is dead by the time I receive this message? The code in the repo waits for a new owner to get started ( https://github.com/DeadZen/etsgive/blob/master/src/etsgive_mgr.erl#L111). Is it possible for this function call to return the dying owner's Pid instead? thanks for your help Konstantin -------------- next part -------------- An HTML attachment was scrubbed... URL: From eriksoe@REDACTED Fri Nov 1 20:25:28 2013 From: eriksoe@REDACTED (=?ISO-8859-1?Q?Erik_S=F8e_S=F8rensen?=) Date: Fri, 1 Nov 2013 20:25:28 +0100 Subject: [erlang-questions] emysql In-Reply-To: <20131031215532.GA18946@circlewave.net> References: <31204C3A-9188-400C-A71F-A12B6B86C01C@gmail.com> <5272C9E9.6080803@adinet.com.uy> <20131031215532.GA18946@circlewave.net> Message-ID: +1 for saying that with more humour and brevity than I would have thought of. :-) Den 31/10/2013 22.52 skrev "Jachym Holecek" : > # Bernardo Alvez 2013-10-31: > > Hi Thomas, > > > > Why not? > > > > Baz = <<"some_text">>, > > emysql:execute(hello_pool,<<"UPDATE hello_table SET hello_text = '", > > Baz/binary, "'">>). > > http://xkcd.com/327/ > > BR, > -- Jachym > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From john.ashmun@REDACTED Sat Nov 2 05:21:29 2013 From: john.ashmun@REDACTED (John R. Ashmun) Date: Fri, 1 Nov 2013 21:21:29 -0700 Subject: [erlang-questions] Mysterious gen_server timeouts in MIX Message-ID: I have implemented an emulator for MIX, Donald Knuth's notional 1960's computer, as an Erlang application, as a way of learning to use Erlang. As part of the emulator's startup currently, MIX loads Knuth's Program P into its memory, then jumps to the starting location of Program P. Program P calculates the first 500 prime numbers, pops them into a table, and then prints 10 prime numbers at a time on what it considers to be its line printer. The emulator usually runs fine, and when it does, it carries out Program P perfectly. Sometimes, however, things get stuck, and I have been unable to learn what goes wrong. When there is a problem, I usually see these two error reports: =ERROR REPORT==== 1-Nov-2013::11:33:54=== ** Generic server <0.38.0> terminating ** Last message in was timeout ** When server state == [] ** Reason for termination == ** {timeout,{gen_server,call,[io_controller,{wait_until_not_busy,18}]}} =ERROR REPORT==== 1-Nov-2013::11:33:54=== ** Generic server <0.4095.0> terminating ** Last message in was {'$gen_cast',{write,1995}} ** When Server state == {state,18,<0.4058.0>,24} ** Reason for termination == ** {timeout,{gen_server,call,[io_controller,{set_ready,18}]}} The first one seems clearly to tell me that MIX's io_controller gen_server's API wait_until_not_busy( ) function sent the message that it should have, but the handle_call( ) never found the readiness status for MIX device 18, its line printer, not to be busy, and then the gen_server was timed out. This should never happen, but then there is the second report to consider. The second report confuses me. Program P attempts to write a title (FIRST FIVE HUNDRED PRIMES) to MIX's line printer. This is what the $gen_cast is attempting to do (1995 is the MIX address of the first character of the title). A MIX I/O operation (in this case, the write) begins by waiting until the I/O unit that's addressed is not busy. Apparently that's not true over the timeout period on this run; here is the mystery: the emulator's I/O device gen_servers are all initialized with their readiness state set to ready, their readiness is changed to busy only by a request to perform an I/O operation, and the operation is actually carried out by an io_operation gen_server that is started by the I/O device gen_server. That io_operation gen_server is the entity that requests the io_controller to set the readiness of the device back to ready, once the io_operation has performed the I/O, or the output, in this case, to the file that plays the role of the line printer, in this case. It shouldn't be possible for io_controller:set_ready( Device ) to be called before io_controller:write( Device, Address ). Is this what the error report is telling me happened? All right, you say, you've programmed your emulator incompetently, and I suppose I may have. Why, then, does all this work perfectly, over and over again, on another machine, or even on the same machine, before going into failure mode? (I have been unable to identify anything causing things to start failing nor to start working, and I'm not making changes other than sometimes running using application:start( 'MIX' ) and sometimes booting MIX as an Erlang release -- sometimes compiling using +debug_info (or not) has seemed to change from success to failure (or, equally likely, the opposite). I need advice, please. Regards, John Ashmun -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Sat Nov 2 06:08:01 2013 From: bob@REDACTED (Bob Ippolito) Date: Fri, 1 Nov 2013 22:08:01 -0700 Subject: [erlang-questions] Mysterious gen_server timeouts in MIX In-Reply-To: References: Message-ID: gen_server has a default timeout of 2 seconds, so if your call takes long enough for whatever reason this can happen. Try changing all if your gen_server calls to explicitly specify a longer or infinite timeout. On Friday, November 1, 2013, John R. Ashmun wrote: > I have implemented an emulator for MIX, Donald Knuth's notional 1960's > computer, as an Erlang application, as a way of learning to use Erlang. > > As part of the emulator's startup currently, MIX loads Knuth's Program P > into its memory, then jumps to the starting location of Program P. Program > P calculates the first 500 prime numbers, pops them into a table, and then > prints 10 prime numbers at a time on what it considers to be its line > printer. > > The emulator usually runs fine, and when it does, it carries out Program P > perfectly. > > Sometimes, however, things get stuck, and I have been unable to learn what > goes wrong. When there is a problem, I usually see these two error reports: > > =ERROR REPORT==== 1-Nov-2013::11:33:54=== > ** Generic server <0.38.0> terminating > ** Last message in was timeout > ** When server state == [] > ** Reason for termination == > ** {timeout,{gen_server,call,[io_controller,{wait_until_not_busy,18}]}} > > =ERROR REPORT==== 1-Nov-2013::11:33:54=== > ** Generic server <0.4095.0> terminating > ** Last message in was {'$gen_cast',{write,1995}} > ** When Server state == {state,18,<0.4058.0>,24} > ** Reason for termination == > ** {timeout,{gen_server,call,[io_controller,{set_ready,18}]}} > > The first one seems clearly to tell me that MIX's io_controller > gen_server's API wait_until_not_busy( ) function sent the message that it > should have, but the handle_call( ) never found the readiness status for > MIX device 18, its line printer, not to be busy, and then the gen_server > was timed out. This should never happen, but then there is the second > report to consider. > > The second report confuses me. Program P attempts to write a title (FIRST > FIVE HUNDRED PRIMES) to MIX's line printer. This is what the $gen_cast is > attempting to do (1995 is the MIX address of the first character of the > title). A MIX I/O operation (in this case, the write) begins by waiting > until the I/O unit that's addressed is not busy. Apparently that's not > true over the timeout period on this run; here is the mystery: the > emulator's I/O device gen_servers are all initialized with their readiness > state set to ready, their readiness is changed to busy only by a request to > perform an I/O operation, and the operation is actually carried out by an > io_operation gen_server that is started by the I/O device gen_server. That > io_operation gen_server is the entity that requests the io_controller to > set the readiness of the device back to ready, once the io_operation has > performed the I/O, or the output, in this case, to the file that plays the > role of the line printer, in this case. It shouldn't be possible for > io_controller:set_ready( Device ) to be called before io_controller:write( > Device, Address ). Is this what the error report is telling me happened? > > All right, you say, you've programmed your emulator incompetently, and I > suppose I may have. Why, then, does all this work perfectly, over and over > again, on another machine, or even on the same machine, before going into > failure mode? (I have been unable to identify anything causing things to > start failing nor to start working, and I'm not making changes other than > sometimes running using application:start( 'MIX' ) and sometimes booting > MIX as an Erlang release -- sometimes compiling using +debug_info (or not) > has seemed to change from success to failure (or, equally likely, the > opposite). > > I need advice, please. > > Regards, > John Ashmun > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Sat Nov 2 08:29:02 2013 From: vances@REDACTED (Vance Shipley) Date: Sat, 2 Nov 2013 12:59:02 +0530 Subject: [erlang-questions] Mysterious gen_server timeouts in MIX In-Reply-To: References: Message-ID: <20131102072902.GA558@aluminium.local> On Fri, Nov 01, 2013 at 10:08:01PM -0700, Bob Ippolito wrote: } gen_server has a default timeout of 2 seconds, The default is actually 5 seconds. -- -Vance From vances@REDACTED Sat Nov 2 10:45:11 2013 From: vances@REDACTED (Vance Shipley) Date: Sat, 2 Nov 2013 15:15:11 +0530 Subject: [erlang-questions] Mysterious gen_server timeouts in MIX In-Reply-To: References: Message-ID: <20131102094511.GB558@aluminium.local> On Fri, Nov 01, 2013 at 09:21:29PM -0700, John R. Ashmun wrote: } sometimes running using application:start( 'MIX' ) and sometimes booting } MIX as an Erlang release -- sometimes compiling using +debug_info (or not) } has seemed to change from success to failure (or, equally likely, the } opposite). If your program is correct it's just too busy to respond before the timeout. In my experience however when you get to the point where a message roundtrip is over 5 seconds you are in bad design territory. You may have a race condition. You say you have several gen_server behaviour processes communicating with each other. Hopefully this communication is accomplished asynchronously. Whenever you use a receive statement, which you effectively do when you call a function like gen_server:call/2, your process stops being a generic behaviour until the call is completed. No system messages or any others will be processed during this time. Here is an example of a pathological program which will eventually deadlock: -module(race). -export([init/1, handle_info/2, handle_call/3, terminate/2]). -record(state, {name, count}). init([Name]) -> State = #state{name = Name, count = 0}, random:seed(now()), Timeout = random:uniform(4000) + 1000, {ok, State, Timeout}. handle_info(timeout, #state{name = Name, count = Count} = State) -> NewCount = gen_server:call(Name, Count), {noreply, State#state{count = NewCount}, random:uniform(1000)}. handle_call(N, _From, State) -> {reply, N + 1, State, 0}. terminate(_Reason, _State) -> ok. Run it like this: 1> gen_server:start({local, ping}, race, [pong], []), 1> gen_server:start({local, pong}, race, [ping], []). {ok,<0.35.0>} ... and some time later: =ERROR REPORT==== 2-Nov-2013::14:47:10 === ** Generic server pong terminating ** Last message in was timeout ** When Server state == {state,ping,103446400} ** Reason for termination == ** {timeout,{gen_server,call,[ping,103446400]}} =ERROR REPORT==== 2-Nov-2013::14:48:55 === ** Generic server ping terminating ** Last message in was timeout ** When Server state == {state,pong,103446400} ** Reason for termination == ** {{timeout,{gen_server,call,[ping,103446400]}}, {gen_server,call,[pong,103446400]}} Here the processes have called each other a hundred million times before deadlocking. -- -Vance From vances@REDACTED Sat Nov 2 12:35:28 2013 From: vances@REDACTED (Vance Shipley) Date: Sat, 2 Nov 2013 17:05:28 +0530 Subject: [erlang-questions] Mysterious gen_server timeouts in MIX In-Reply-To: <20131102094511.GB558@aluminium.local> References: <20131102094511.GB558@aluminium.local> Message-ID: <20131102113528.GA3446@aluminium.motivity.ca> On Sat, Nov 02, 2013 at 03:15:11PM +0530, Vance Shipley wrote: } Here is an example of a pathological program which will eventually } deadlock: ... } handle_call(N, _From, State) -> } {reply, N + 1, State, 0}. Small correction, the previous example probably timed out because my MacBookPro went to sleep. The small change here demonstrates the problem quicker and more reliably: handle_call(N, _From, State) -> {reply, N + 1, State, random:uniform(100)}. The small random timeout greatly increases the chance of entering a race. -- -Vance From peerst@REDACTED Sat Nov 2 17:17:05 2013 From: peerst@REDACTED (Peer Stritzinger) Date: Sat, 2 Nov 2013 17:17:05 +0100 Subject: [erlang-questions] On Pull Requests Comments References: <6460E241-AFB2-448C-A12E-789B94181EEC@gmail.com> <52650C85.50207@ninenines.eu> <52655631.3060909@erlang.org> <02716CCD-15FF-4936-80A3-DE2FB1A19C0A@gmail.com> <52666774.4030203@erlang.org> Message-ID: On 2013-10-22 13:18:27 +0000, Dave Cottlehuber said: >> I agree with you that archiving can be a problem. I actually get all >> PR's as mails. I think others can to by watching the PR's. That might >> solve your problem. >> >> I like others to weigh in too. >> >> Are PR's as bad as Anthony points out? Should we kill it and use mails only? >> >> // Bj?rn-Egil > > Hi Bj?rn-Egil, Anthony & all, > > Let's not paint this as an either-or choice. I think we can use both. > The Apache Software Foundation has already been down this path, for > projects like Cordova and CouchDB, successfully. > > TL;DR keep the PRs and forward all commentary to > erlang-bugs/patches/something-new and everybody should be happy. +1 to that. When all PR comments are archived in a mailinglist, the immutabilty, searchability by search engines and independence of GitHubs future moves is given. > Here's my personal view; > > - It's great that Ericsson's OTP team are continually improving their > engagement with the community. You are doing fantastic work and it's > winning all the way down. \o/ more please! > > - submitting changes via PR instead of directly on the mailing list is > clean and tidy, with better visibility when viewed in context like a > diff or changed files view. > > - However, the comments & discussions within the github thread are > easily lost. For those who are not interested in subscribing to a full > erlang-questions/patches/bugs list, it's ideal for keeping up to date > on a fix that individual submitted. > > - Subscribing (watching) the whole repo could be a lot of unwanted noise. +1 to all of that too. > > A+ > @dch > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From john.ashmun@REDACTED Sun Nov 3 16:34:29 2013 From: john.ashmun@REDACTED (John R. Ashmun) Date: Sun, 3 Nov 2013 07:34:29 -0800 Subject: [erlang-questions] Mysterious gen_server timeouts in MIX In-Reply-To: References: Message-ID: Thanks, Bob. I blush to write that I had considered this approach, but then I decided to try to learn why a gen_server timeout could ever happen to the emulator before making any changes. This is an emulation of a really simple CPU: It fetches an instruction, increments its program counter, carries out the instruction, and repeats. There are not a lot of moving parts, and everything except I/O instructions is synchronous. Regards, John Ashmun On Fri, Nov 1, 2013 at 10:08 PM, Bob Ippolito wrote: > gen_server has a default timeout of 2 seconds, so if your call takes long > enough for whatever reason this can happen. Try changing all if your > gen_server calls to explicitly specify a longer or infinite timeout. > > On Friday, November 1, 2013, John R. Ashmun wrote: > >> I have implemented an emulator for MIX, Donald Knuth's notional 1960's >> computer, as an Erlang application, as a way of learning to use Erlang. >> >> As part of the emulator's startup currently, MIX loads Knuth's Program P >> into its memory, then jumps to the starting location of Program P. Program >> P calculates the first 500 prime numbers, pops them into a table, and then >> prints 10 prime numbers at a time on what it considers to be its line >> printer. >> >> The emulator usually runs fine, and when it does, it carries out Program >> P perfectly. >> >> Sometimes, however, things get stuck, and I have been unable to learn >> what goes wrong. When there is a problem, I usually see these two error >> reports: >> >> =ERROR REPORT==== 1-Nov-2013::11:33:54=== >> ** Generic server <0.38.0> terminating >> ** Last message in was timeout >> ** When server state == [] >> ** Reason for termination == >> ** {timeout,{gen_server,call,[io_controller,{wait_until_not_busy,18}]}} >> >> =ERROR REPORT==== 1-Nov-2013::11:33:54=== >> ** Generic server <0.4095.0> terminating >> ** Last message in was {'$gen_cast',{write,1995}} >> ** When Server state == {state,18,<0.4058.0>,24} >> ** Reason for termination == >> ** {timeout,{gen_server,call,[io_controller,{set_ready,18}]}} >> >> The first one seems clearly to tell me that MIX's io_controller >> gen_server's API wait_until_not_busy( ) function sent the message that it >> should have, but the handle_call( ) never found the readiness status for >> MIX device 18, its line printer, not to be busy, and then the gen_server >> was timed out. This should never happen, but then there is the second >> report to consider. >> >> The second report confuses me. Program P attempts to write a title >> (FIRST FIVE HUNDRED PRIMES) to MIX's line printer. This is what the >> $gen_cast is attempting to do (1995 is the MIX address of the first >> character of the title). A MIX I/O operation (in this case, the write) >> begins by waiting until the I/O unit that's addressed is not busy. >> Apparently that's not true over the timeout period on this run; here is the >> mystery: the emulator's I/O device gen_servers are all initialized with >> their readiness state set to ready, their readiness is changed to busy only >> by a request to perform an I/O operation, and the operation is actually >> carried out by an io_operation gen_server that is started by the I/O device >> gen_server. That io_operation gen_server is the entity that requests the >> io_controller to set the readiness of the device back to ready, once the >> io_operation has performed the I/O, or the output, in this case, to the >> file that plays the role of the line printer, in this case. It shouldn't >> be possible for io_controller:set_ready( Device ) to be called before >> io_controller:write( Device, Address ). Is this what the error report is >> telling me happened? >> >> All right, you say, you've programmed your emulator incompetently, and I >> suppose I may have. Why, then, does all this work perfectly, over and over >> again, on another machine, or even on the same machine, before going into >> failure mode? (I have been unable to identify anything causing things to >> start failing nor to start working, and I'm not making changes other than >> sometimes running using application:start( 'MIX' ) and sometimes booting >> MIX as an Erlang release -- sometimes compiling using +debug_info (or not) >> has seemed to change from success to failure (or, equally likely, the >> opposite). >> >> I need advice, please. >> >> Regards, >> John Ashmun >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From john.ashmun@REDACTED Sun Nov 3 17:08:19 2013 From: john.ashmun@REDACTED (John R. Ashmun) Date: Sun, 3 Nov 2013 08:08:19 -0800 Subject: [erlang-questions] Mysterious gen_server timeouts in MIX In-Reply-To: <20131102113528.GA3446@aluminium.motivity.ca> References: <20131102094511.GB558@aluminium.local> <20131102113528.GA3446@aluminium.motivity.ca> Message-ID: Thank you, Vance. I have some experience with multithreaded applications and avoiding race conditions. I appreciate your providing examples. I probably ought to have provided a few more details, and I would like to stress that I see the Erlang VM/MIX emulator combination go into and come out of the regime of failing via gen_server timeouts without my having made any changes at all to my Erlang source files: I haven't changed anything in any of them since October 24. I see or have seen this baffling behavior on two machines using werl: HP Pavilion desktop with AMD A8-3800 APU w/8Gb RAM -- Microsoft Windows 7 Home Premium & erts5.9 Newer Dell laptop with Intel(R) Core(TM) i3-3217U w/6Gb RAM -- Microsoft Windows 8 & erts5.10.2 At the moment, the emulator runs as intended on the desktop. As I mentioned, it runs Program P, and in so doing, it consumes roughly 4 seconds on a wall clock. It has been doing this on this machine only since October 24, which was when I commented out several io:format( ) calls which had been announcing what instruction it was currently executing. Before I commented those out, it would run successfully sometimes and time out sometimes. It hasn't exhibited the timeouts since then. I run it here using -boot & -config options when starting werl. On the laptop, when the emulation of Program P succeeds, it consumes roughly 6 seconds on the wall clock. It began running successfully on October 26, without my having made any changes to sources, after having consistently failed with timeouts for two or three days of desultory attempts. For no very good reason, and because I couldn't think of any source code changes I could usefully make, I simply recompiled the sources using +debug_info, and it subsequently succeeded. I then took a trip to Las Vegas, Nevada, and when I came back, seeing that the session windows were still open, I ran the emulator again. On that attempt, the timeouts happened. Again for no very good reason, I recompiled things, this time without +debug_info, and now the emulator doesn't time out. On the laptop I start it using application:start( 'MIX' ). in the Erlang shell; I haven't written the .rel file for this installation yet. It looks to me as if the Erlang VM is starving for a resource sometimes. Anthony Molinaro recently reported here a mysterious freeze while trying to access a file. The MIX emulator opens a file for each of its 20 I/O devices. I don't know that I am encountering something similar, not am I certain what such a freeze would imply about the behavior of this emulator, although it could lead to a gen_server timeout, I imagine. Regards, John Ashmun On Sat, Nov 2, 2013 at 4:35 AM, Vance Shipley wrote: > On Sat, Nov 02, 2013 at 03:15:11PM +0530, Vance Shipley wrote: > } Here is an example of a pathological program which will eventually > } deadlock: > ... > } handle_call(N, _From, State) -> > } {reply, N + 1, State, 0}. > > Small correction, the previous example probably timed out because my > MacBookPro went to sleep. The small change here demonstrates the > problem quicker and more reliably: > > handle_call(N, _From, State) -> > {reply, N + 1, State, random:uniform(100)}. > > The small random timeout greatly increases the chance of entering a race. > > -- > -Vance > -------------- next part -------------- An HTML attachment was scrubbed... URL: From desired.mta@REDACTED Mon Nov 4 08:28:11 2013 From: desired.mta@REDACTED (=?UTF-8?Q?Motiejus_Jak=C5=A1tys?=) Date: Mon, 4 Nov 2013 08:28:11 +0100 Subject: [erlang-questions] Failed to compile erlang R15B03-1 on FreeBSD10 with DTrace Message-ID: Dear FreeBSD users, I get this error when trying to compile: gmake[5]: Entering directory `/usr/ports/lang/erlang/work/otp_src_R15B03/lib/hipe/rtl' erlc -W +debug_info +inline -o../ebin hipe_rtl.erl gmake[5]: *** [../ebin/hipe_rtl.beam] Segmentation fault (core dumped) Running: FreeBSD 10.0-BETA2 #0 r257166: This happens only when DTrace configuration option is set. If DTrace is off, all works fine. Looks like dtrace userland/kernelland are working: root@REDACTED:/usr/ports/lang/erlang # dtrace -n 'syscall:::entry { @num[execname] = count(); }' dtrace: description 'syscall:::entry ' matched 536 probes dtrace: buffer size lowered to 6m dtrace: aggregation size lowered to 3m gdb dump: (gdb) root@REDACTED:/usr/ports/lang/erlang/work/otp_src_R15B03/lib/hipe/main # gdb ../../../bin/i386-portbld-freebsd10.0/beam beam.core [8/1973] GNU gdb 6.1.1 [FreeBSD] Copyright 2004 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 "i386-marcel-freebsd"... Core was generated by `beam'. Program terminated with signal 11, Segmentation fault. Reading symbols from /lib/libutil.so.9...done. Loaded symbols for /lib/libutil.so.9 Reading symbols from /lib/libm.so.5...done. Loaded symbols for /lib/libm.so.5 Reading symbols from /usr/lib/libelf.so.1...done. Loaded symbols for /usr/lib/libelf.so.1 Reading symbols from /lib/libncurses.so.8...done. Loaded symbols for /lib/libncurses.so.8 Reading symbols from /lib/libthr.so.3...done. Loaded symbols for /lib/libthr.so.3 Reading symbols from /lib/libc.so.7...done. Loaded symbols for /lib/libc.so.7 Reading symbols from /libexec/ld-elf.so.1...done. Loaded symbols for /libexec/ld-elf.so.1 #0 0x080ed8bf in init_driver (drv=0x83bdee0, de=0x839d2c0, handle=0x0) at global.h:1171 1171 global.h: No such file or directory. in global.h [New Thread 28c03080 (LWP 100543/beam)] (gdb) bt #0 0x080ed8bf in init_driver (drv=0x83bdee0, de=0x839d2c0, handle=0x0) at global.h:1171 #1 0x080e71a2 in init_io () at global.h:1171 #2 0x080aa964 in erl_init (ncpu=1) at _ctype.h:125 #3 0x080acfb6 in erl_start (argc=34, argv=0xbfbfd798) at _ctype.h:125 #4 0x080935af in main (argc=34, argv=0xbfbfd798) at sys/unix/erl_main.c:29 (gdb) bt full #0 0x080ed8bf in init_driver (drv=0x83bdee0, de=0x839d2c0, handle=0x0) at global.h:1171 res = -1077947068 fpe_was_unmasked = 1 #1 0x080e71a2 in init_io () at global.h:1171 i = 65536 dp = (ErlDrvEntry **) 0x0 maxports = "?\017?\025\b|);\b\212\004-\bx???r?\020\b" maxportssize = 21 ports_bits = 28 port_extra_shift = 16 #2 0x080aa964 in erl_init (ncpu=1) at _ctype.h:125 No locals. #3 0x080acfb6 in erl_start (argc=34, argv=0xbfbfd798) at _ctype.h:125 i = 3 arg = 0xbfbfd9c9 "u" Parg = 0x0 have_break_handler = 1 envbuf = "?\000\000\000\000\030R6\b\001\000\000\000W\2056(??7(" envbufsz = 21 ncpu = 1 #4 0x080935af in main (argc=34, argv=0xbfbfd798) at sys/unix/erl_main.c:29 No locals. (gdb) Any clues? Thanks, Motiejus Jak?tys From stas@REDACTED Mon Nov 4 09:11:40 2013 From: stas@REDACTED (Stanislav Sedov) Date: Mon, 4 Nov 2013 00:11:40 -0800 Subject: [erlang-questions] Failed to compile erlang R15B03-1 on FreeBSD10 with DTrace In-Reply-To: References: Message-ID: <3F503E49-64F4-4A35-A5F5-3DE9587A2DE8@freebsd.org> On Nov 3, 2013, at 11:28 PM, Motiejus Jak?tys wrote: > Dear FreeBSD users, > > I get this error when trying to compile: > gmake[5]: Entering directory > `/usr/ports/lang/erlang/work/otp_src_R15B03/lib/hipe/rtl' > erlc -W +debug_info +inline -o../ebin hipe_rtl.erl > gmake[5]: *** [../ebin/hipe_rtl.beam] Segmentation fault (core dumped) > Hi, Motiejus! What other options do you have set? Do you use GCC or CLANG? Is HiPE enabled? I?d also suggest to contact the port maintainer, olgeni@REDACTED, and provide him with details. -- ST4096-RIPE From desired.mta@REDACTED Mon Nov 4 09:34:12 2013 From: desired.mta@REDACTED (=?UTF-8?Q?Motiejus_Jak=C5=A1tys?=) Date: Mon, 4 Nov 2013 09:34:12 +0100 Subject: [erlang-questions] Failed to compile erlang R15B03-1 on FreeBSD10 with DTrace In-Reply-To: <3F503E49-64F4-4A35-A5F5-3DE9587A2DE8@freebsd.org> References: <3F503E49-64F4-4A35-A5F5-3DE9587A2DE8@freebsd.org> Message-ID: On Mon, Nov 4, 2013 at 9:11 AM, Stanislav Sedov wrote: > > Hi, Motiejus! > > What other options do you have set? Do you use GCC or CLANG? > Is HiPE enabled? Hi, Stanislav, I am compiling with GCC 4.6, HiPE is enabled. The only extra CFLAG is '-g', so I can see the stack trace in gdb (though error is the same without it). It is a fresh FreeBSD installation, thus, IIRC, everything else are defaults. > I?d also suggest to contact the port maintainer, olgeni@REDACTED, > and provide him with details. Thanks! Giacomo, here is a link to the original post: http://erlang.org/pipermail/erlang-questions/2013-November/075913.html Should I report this to GNATS? An other DTrace related bug report[1] states a few steps how to enable DTrace on the system. As far as I understand, they are no longer needed in FreeBSD10? [1]: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/171556 -- Motiejus Jak?tys From stas@REDACTED Mon Nov 4 10:30:38 2013 From: stas@REDACTED (Stanislav Sedov) Date: Mon, 4 Nov 2013 01:30:38 -0800 Subject: [erlang-questions] Failed to compile erlang R15B03-1 on FreeBSD10 with DTrace In-Reply-To: References: <3F503E49-64F4-4A35-A5F5-3DE9587A2DE8@freebsd.org> Message-ID: On Nov 4, 2013, at 12:34 AM, Motiejus Jak?tys wrote: > On Mon, Nov 4, 2013 at 9:11 AM, Stanislav Sedov wrote: >> >> Hi, Motiejus! >> >> What other options do you have set? Do you use GCC or CLANG? >> Is HiPE enabled? > > Hi, Stanislav, > I am compiling with GCC 4.6, HiPE is enabled. The only extra CFLAG is > '-g', so I can see the stack trace in gdb (though error is the same > without it). It is a fresh FreeBSD installation, thus, IIRC, > everything else are defaults. I just managed to built on HEAD with gcc 4.6, HiPE and dtrace enabled. However, I?m running amd64. I suspect that might be i386 thing as i386 is definitely getting less testing exposure. > >> I?d also suggest to contact the port maintainer, olgeni@REDACTED, >> and provide him with details. > > Thanks! Giacomo, here is a link to the original post: > http://erlang.org/pipermail/erlang-questions/2013-November/075913.html > Should I report this to GNATS? Yes, I?d say this is the best way to go. > > An other DTrace related bug report[1] states a few steps how to enable > DTrace on the system. As far as I understand, they are no longer > needed in FreeBSD10? > I don?t have any of those set. As far as I know you don?t need frame pointers and symbols for dtrace to work as it uses CTF, but I may be wrong (I don?t know much about dtrace, unfortunately). -- ST4096-RIPE -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 455 bytes Desc: Message signed with OpenPGP using GPGMail URL: From cbenac@REDACTED Mon Nov 4 11:29:54 2013 From: cbenac@REDACTED (Clara Benac Earle) Date: Mon, 04 Nov 2013 11:29:54 +0100 Subject: [erlang-questions] Madrid Erlounge 6th of November Message-ID: <52777722.1040807@fi.upm.es> Dear all, It is with great pleasure that we announce the next Madrid Erlounge on the 6th of November. Details follow both in Spanish and English. See you there! Clara P.S. If you are interested in this event, please subscribe to the madrid-erlang-users mailing list. *Cu?ndo:* Mi?rcoles 6 de Noviembre 19:30 *D?nde:* Sala de Grados, Facultad de Inform?tica, Universidad Complutense de Madrid *Qui?n:* Miriam Pena Miriam Pena es una ingeniera de software especializada en el desarrollo de sistemas altamente concurrentes en Erlang. Es empleada de Nomasystems, una empresa gallega que utiliza este lenguaje para desarrollar el backend de sus aplicaciones m?viles y ofrecer consultor?a. Miriam ha participado en proyectos para empresas multinacionales, entre las que se encuentran Erlang Solutions y Ericsson. *Qu?: * En la Erlounge compartir? con nosotros detalles de los distintos e inusuales proyectos en los que ha participado, prestando especial atenci?n a Tuenti. El servidor de chat de esta red social est? basado en ejabberd, una soluci?n muy popular para jabber/XMPP. Miriam nos explicar? c?mo lo han hecho evolucionar y c?mo han ido resolviendo sus problemas de escalabilidad. --------------------------------- *When:* Wednesday 6th of November at 19:30 *Where: *Sala de Grados, Facultad de Inform?tica, Universidad Complutense de Madrid *Who:* Miriam Pena Miriam Pena is a software engineer who specialises in the development of highly-concurrent systems written in Erlang. She works for Nomasystems, a company that uses this language to develop the backend for its mobile apps and to offer consultancy. Miriam has has been involved in projects for multinational companies featuring Erlang Solutions and Ericsson. *What:* At the Erlounge she will share with us details from various and unusual projects she has worked on, paying special attention to Tuenti. This social network's chat server is based on ejabberd, a very popular jabber/XMPP solution. Miriam will walk us through how they have evolved ejabberd and solved scalability issues over the last couple of years. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tyron.zerafa@REDACTED Mon Nov 4 14:37:57 2013 From: tyron.zerafa@REDACTED (Tyron Zerafa) Date: Mon, 4 Nov 2013 14:37:57 +0100 Subject: [erlang-questions] Code Signing Message-ID: Hi, I'm wondering whether Erlang has got any form of code signature? Put simply, I would like to sign a module, transfer it to another node (through some intermediary nodes) and then ensure its authenticity on the receiving end. This would guarantee that no one tempered the code. Anyone knows of any extensions or mechanisms, I'm doing some research but haven't found anything yet? Thanks, Tyron -------------- next part -------------- An HTML attachment was scrubbed... URL: From sverker.eriksson@REDACTED Mon Nov 4 15:12:53 2013 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Mon, 4 Nov 2013 15:12:53 +0100 Subject: [erlang-questions] ETS-TRANSFER In-Reply-To: References: Message-ID: <5277AB65.1040008@erix.ericsson.se> On 11/01/2013 03:18 PM, akonsu wrote: > Hello, > > I am reading the code at https://github.com/DeadZen/etsgive that implements > one of the ETS handling techniques mentioned in > http://steve.vinoski.net/blog/2011/03/23/dont-lose-your-ets-tables/, and > one thing (out of several) that I do not understand is this callback: > https://github.com/DeadZen/etsgive/blob/master/src/etsgive_mgr.erl#L110. > > It handles ETS-TRANSFER message that the ETS table heir receives when the > table owner terminates. Is this message received after the owner > terminates? Is it guaranteed that the owner is dead by the time I receive > this message? The code in the repo waits for a new owner to get started ( > https://github.com/DeadZen/etsgive/blob/master/src/etsgive_mgr.erl#L111). > Is it possible for this function call to return the dying owner's Pid > instead? > Yes, it looks like its possible to get the Pid of the dying process when doing whereis after receiving an ETS-TRANSFER message. erlang:is_process_alive/1 will however return false for the dying process. I would probably be better if we changes this in order to guarantee that the process has released all resources when the ETS-TRANSFER message arrives, as is guaranteed for monitor and link messages. It's not a trivial fix though. /Sverker, Erlang/OTP From v@REDACTED Mon Nov 4 15:55:55 2013 From: v@REDACTED (Valentin Micic) Date: Mon, 4 Nov 2013 16:55:55 +0200 Subject: [erlang-questions] Code Signing In-Reply-To: References: Message-ID: <261E9BE3-7F76-45FE-AB08-9BDC0AD06E87@pharos-avantgard.com> Shooting from the hip? how about vsn attribute? AFAIK, it is a digest that changes only if the compiled code has been changed. Not sure, but it should change even if any of the included preprocessor files were subjected to a change (NOTE: adding or removing a comment, does not mean that code has been changed) To obtain VSN, run :module_info( attributes ) where represent the name of the module. This returns a list of attribute, having a the 'vsn' as the one of the attributes. Kind regards V/ On 04 Nov 2013, at 3:37 PM, Tyron Zerafa wrote: > Hi, > > I'm wondering whether Erlang has got any form of code signature? Put simply, I would like to sign a module, transfer it to another node (through some intermediary nodes) and then ensure its authenticity on the receiving end. This would guarantee that no one tempered the code. Anyone knows of any extensions or mechanisms, I'm doing some research but haven't found anything yet? > > Thanks, > Tyron > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From eriksoe@REDACTED Mon Nov 4 16:06:01 2013 From: eriksoe@REDACTED (=?ISO-8859-1?Q?Erik_S=F8e_S=F8rensen?=) Date: Mon, 4 Nov 2013 16:06:01 +0100 Subject: [erlang-questions] Code Signing In-Reply-To: References: Message-ID: Can't you simply sign the binary like you would any other binary? There is functionality for that, in public_key I believe. Den 04/11/2013 14.46 skrev "Tyron Zerafa" : Hi, I'm wondering whether Erlang has got any form of code signature? Put simply, I would like to sign a module, transfer it to another node (through some intermediary nodes) and then ensure its authenticity on the receiving end. This would guarantee that no one tempered the code. Anyone knows of any extensions or mechanisms, I'm doing some research but haven't found anything yet? Thanks, Tyron _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From psidrinal@REDACTED Mon Nov 4 16:05:37 2013 From: psidrinal@REDACTED (Raphael Korsoski) Date: Mon, 4 Nov 2013 16:05:37 +0100 Subject: [erlang-questions] What is this OOP-like construction doing in Erlang? Message-ID: I was writing some object oriented code over the weekend and upon returning to my Erlang coding, I accidentally discovered this rather odd construction: .... Dict = lists:foldr(...), % dict construction lists:map(fun(...) -> ... end, Dict:to_list() <<-- WHUT?! Testing it, it seems that the runtime has the following convention; If T is a tuple, then the Mod:Fun(Args) construction T:Fun(Args) will in fact be interpreted as element(1,T):Fun(Args, T). I would expect something like that in an OO language; although the convention in every language I have used is then to pass the 'self' reference as the _first_ argument. What is this construction doing in Erlang? An example: Erlang R16B01 (erts-5.10.2) [source] [64-bit halfword] [smp:32:32] [async-threads:10] [kernel-poll:false] [systemtap] Eshell V5.10.2 (abort with ^G) 1> T = {erlang, foo, bar, baz}. {erlang,foo,bar,baz} 2> T:tuple_to_list(). [erlang,foo,bar,baz] 3> BRs, Raphael K -------------- next part -------------- An HTML attachment was scrubbed... URL: From tyron.zerafa@REDACTED Mon Nov 4 16:23:08 2013 From: tyron.zerafa@REDACTED (Tyron Zerafa) Date: Mon, 4 Nov 2013 16:23:08 +0100 Subject: [erlang-questions] Code Signing In-Reply-To: References: Message-ID: Yeah, completely forgot about the public_key module, will look into it. I was wondering whether there is something already built in Erlang specific to code which I might use. On Mon, Nov 4, 2013 at 4:06 PM, Erik S?e S?rensen wrote: > Can't you simply sign the binary like you would any other binary? > There is functionality for that, in public_key I believe. > Den 04/11/2013 14.46 skrev "Tyron Zerafa" : > > Hi, > > I'm wondering whether Erlang has got any form of code signature? Put > simply, I would like to sign a module, transfer it to another node (through > some intermediary nodes) and then ensure its authenticity on the receiving > end. This would guarantee that no one tempered the code. Anyone knows of > any extensions or mechanisms, I'm doing some research but haven't found > anything yet? > > Thanks, > Tyron > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- Best Regards, Tyron Zerafa -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Mon Nov 4 16:46:39 2013 From: mononcqc@REDACTED (Fred Hebert) Date: Mon, 4 Nov 2013 10:46:39 -0500 Subject: [erlang-questions] What is this OOP-like construction doing in Erlang? In-Reply-To: References: Message-ID: <20131104154638.GJ5671@ferdair.local> This is history! So for a long while, Erlang had something called tuple funs, way before it had funs of the form 'fun Mod:Fun/Arity' or 'fun Fun/arity'. This format would allow you to represent funs as {Module, Fun}. At some point, Richard Carlsson proposed adding parametrized modules to Erlang. This would be done by re-using that functionality at runtime, and some compiler trickery so that a module could be declared as '-module(Mod, [Arg1, Arg2, ..., ArgN]).', and have a 'new' function which would return an opaque '{Mod, Args}' tuple. All functions of that module would have the implicit 'Args' list of argument, allowing to have globally defined arguments, themselves instantiated as part of the New function, iirc. At runtime, the VM would take that tuple call and insert the arguments in there. Then the Erlang community (myself included) got upset as more and more projects used that form, because it would introduce subtle inconsistencies in expectations -- for example, there was an implicit change of function arity of functions that made tracing a pain, and some unexpected shadowing when you worked with some functions. This has been debated a whole lot, and the OTP team ended up making a decision where they'd drop the parametrized modules feature from the official language (along with packages and whatnot). This deprecation came with a parse transform being released with the OTP team and the addition of the tuple call idiom so that projects using parametrized modules wouldn't suddenly be left impossible to upgrade on many VMs. This again didn't make everyone happy, but in the end, it's the situation we're in and that's why tuple calls are supported there. We're far from the original roots, but that's why it's there. Regards, Fred. On 11/04, Raphael Korsoski wrote: > I was writing some object oriented code over the weekend and upon returning > to my Erlang coding, I accidentally discovered this rather odd construction: > > .... > Dict = lists:foldr(...), % dict construction > lists:map(fun(...) -> ... end, Dict:to_list() <<-- WHUT?! > > Testing it, it seems that the runtime has the following convention; > > If T is a tuple, then the Mod:Fun(Args) construction T:Fun(Args) will in > fact be interpreted as element(1,T):Fun(Args, T). > > I would expect something like that in an OO language; although the > convention in every language I have used is then to pass the 'self' > reference as the _first_ argument. What is this construction doing in > Erlang? > > An example: > > Erlang R16B01 (erts-5.10.2) [source] [64-bit halfword] [smp:32:32] > [async-threads:10] [kernel-poll:false] [systemtap] > > Eshell V5.10.2 (abort with ^G) > 1> T = {erlang, foo, bar, baz}. > {erlang,foo,bar,baz} > 2> T:tuple_to_list(). > [erlang,foo,bar,baz] > 3> > > BRs, > Raphael K > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From psidrinal@REDACTED Mon Nov 4 18:06:24 2013 From: psidrinal@REDACTED (Raphael Korsoski) Date: Mon, 4 Nov 2013 18:06:24 +0100 Subject: [erlang-questions] What is this OOP-like construction doing in Erlang? In-Reply-To: <20131104154638.GJ5671@ferdair.local> References: <20131104154638.GJ5671@ferdair.local> Message-ID: Thank you for the detailed explanation! >From my perspective, having what amounts to an implicit constructor at the module level is a terrible idea and I'm glad it was removed. / Raphael On Mon, Nov 4, 2013 at 4:46 PM, Fred Hebert wrote: > This is history! > > So for a long while, Erlang had something called tuple funs, way before > it had funs of the form 'fun Mod:Fun/Arity' or 'fun Fun/arity'. This > format would allow you to represent funs as {Module, Fun}. > > At some point, Richard Carlsson proposed adding parametrized modules to > Erlang. This would be done by re-using that functionality at runtime, > and some compiler trickery so that a module could be declared as > '-module(Mod, [Arg1, Arg2, ..., ArgN]).', and have a 'new' function > which would return an opaque '{Mod, Args}' tuple. > > All functions of that module would have the implicit 'Args' list of > argument, allowing to have globally defined arguments, themselves > instantiated as part of the New function, iirc. > > At runtime, the VM would take that tuple call and insert the arguments > in there. > > Then the Erlang community (myself included) got upset as more and more > projects used that form, because it would introduce subtle > inconsistencies in expectations -- for example, there was an implicit > change of function arity of functions that made tracing a pain, and some > unexpected shadowing when you worked with some functions. > > This has been debated a whole lot, and the OTP team ended up making a > decision where they'd drop the parametrized modules feature from the > official language (along with packages and whatnot). > > This deprecation came with a parse transform being released with the OTP > team and the addition of the tuple call idiom so that projects using > parametrized modules wouldn't suddenly be left impossible to upgrade on > many VMs. > > This again didn't make everyone happy, but in the end, it's the > situation we're in and that's why tuple calls are supported there. We're > far from the original roots, but that's why it's there. > > Regards, > Fred. > > On 11/04, Raphael Korsoski wrote: > > I was writing some object oriented code over the weekend and upon > returning > > to my Erlang coding, I accidentally discovered this rather odd > construction: > > > > .... > > Dict = lists:foldr(...), % dict construction > > lists:map(fun(...) -> ... end, Dict:to_list() <<-- WHUT?! > > > > Testing it, it seems that the runtime has the following convention; > > > > If T is a tuple, then the Mod:Fun(Args) construction T:Fun(Args) will in > > fact be interpreted as element(1,T):Fun(Args, T). > > > > I would expect something like that in an OO language; although the > > convention in every language I have used is then to pass the 'self' > > reference as the _first_ argument. What is this construction doing in > > Erlang? > > > > An example: > > > > Erlang R16B01 (erts-5.10.2) [source] [64-bit halfword] [smp:32:32] > > [async-threads:10] [kernel-poll:false] [systemtap] > > > > Eshell V5.10.2 (abort with ^G) > > 1> T = {erlang, foo, bar, baz}. > > {erlang,foo,bar,baz} > > 2> T:tuple_to_list(). > > [erlang,foo,bar,baz] > > 3> > > > > BRs, > > Raphael K > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gumm@REDACTED Mon Nov 4 19:04:16 2013 From: gumm@REDACTED (Jesse Gumm) Date: Mon, 4 Nov 2013 12:04:16 -0600 Subject: [erlang-questions] What is this OOP-like construction doing in Erlang? In-Reply-To: References: <20131104154638.GJ5671@ferdair.local> Message-ID: For some light reading on a rainy day, here are a few other largish threads from erlang-questions related to pmods: https://groups.google.com/forum/#!topic/erlang-programming/PbvKUqXQ9II https://groups.google.com/d/msg/erlang-programming/3s_6jTVUW5c/EHyIOhWpAcMJ -Jesse On Mon, Nov 4, 2013 at 11:06 AM, Raphael Korsoski wrote: > Thank you for the detailed explanation! > > From my perspective, having what amounts to an implicit constructor at the > module level is a terrible idea and I'm glad it was removed. > > / Raphael > > > On Mon, Nov 4, 2013 at 4:46 PM, Fred Hebert wrote: >> >> This is history! >> >> So for a long while, Erlang had something called tuple funs, way before >> it had funs of the form 'fun Mod:Fun/Arity' or 'fun Fun/arity'. This >> format would allow you to represent funs as {Module, Fun}. >> >> At some point, Richard Carlsson proposed adding parametrized modules to >> Erlang. This would be done by re-using that functionality at runtime, >> and some compiler trickery so that a module could be declared as >> '-module(Mod, [Arg1, Arg2, ..., ArgN]).', and have a 'new' function >> which would return an opaque '{Mod, Args}' tuple. >> >> All functions of that module would have the implicit 'Args' list of >> argument, allowing to have globally defined arguments, themselves >> instantiated as part of the New function, iirc. >> >> At runtime, the VM would take that tuple call and insert the arguments >> in there. >> >> Then the Erlang community (myself included) got upset as more and more >> projects used that form, because it would introduce subtle >> inconsistencies in expectations -- for example, there was an implicit >> change of function arity of functions that made tracing a pain, and some >> unexpected shadowing when you worked with some functions. >> >> This has been debated a whole lot, and the OTP team ended up making a >> decision where they'd drop the parametrized modules feature from the >> official language (along with packages and whatnot). >> >> This deprecation came with a parse transform being released with the OTP >> team and the addition of the tuple call idiom so that projects using >> parametrized modules wouldn't suddenly be left impossible to upgrade on >> many VMs. >> >> This again didn't make everyone happy, but in the end, it's the >> situation we're in and that's why tuple calls are supported there. We're >> far from the original roots, but that's why it's there. >> >> Regards, >> Fred. >> >> On 11/04, Raphael Korsoski wrote: >> > I was writing some object oriented code over the weekend and upon >> > returning >> > to my Erlang coding, I accidentally discovered this rather odd >> > construction: >> > >> > .... >> > Dict = lists:foldr(...), % dict construction >> > lists:map(fun(...) -> ... end, Dict:to_list() <<-- WHUT?! >> > >> > Testing it, it seems that the runtime has the following convention; >> > >> > If T is a tuple, then the Mod:Fun(Args) construction T:Fun(Args) will in >> > fact be interpreted as element(1,T):Fun(Args, T). >> > >> > I would expect something like that in an OO language; although the >> > convention in every language I have used is then to pass the 'self' >> > reference as the _first_ argument. What is this construction doing in >> > Erlang? >> > >> > An example: >> > >> > Erlang R16B01 (erts-5.10.2) [source] [64-bit halfword] [smp:32:32] >> > [async-threads:10] [kernel-poll:false] [systemtap] >> > >> > Eshell V5.10.2 (abort with ^G) >> > 1> T = {erlang, foo, bar, baz}. >> > {erlang,foo,bar,baz} >> > 2> T:tuple_to_list(). >> > [erlang,foo,bar,baz] >> > 3> >> > >> > BRs, >> > Raphael K >> >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Jesse Gumm Owner, Sigma Star Systems 414.940.4866 || sigma-star.com || @jessegumm From max.lapshin@REDACTED Mon Nov 4 19:31:33 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 4 Nov 2013 22:31:33 +0400 Subject: [erlang-questions] ETS-TRANSFER In-Reply-To: <5277AB65.1040008@erix.ericsson.se> References: <5277AB65.1040008@erix.ericsson.se> Message-ID: Usually it is done via putting monitor on process pid and waiting for DOWN message -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlsson.richard@REDACTED Tue Nov 5 21:36:15 2013 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Tue, 05 Nov 2013 21:36:15 +0100 Subject: [erlang-questions] Heads-up: The cost of get_stacktrace() Message-ID: <527956BF.1000601@gmail.com> (Executive summary: exceptions cheap, but erlang:get_stacktrace() kind of expensive; also, avoid 'catch Expr'.) We have wrestled for some time with some very strange unresponsiveness and high amounts of garbage collection, and finally managed to track down the problem. It was in a piece of code that matches some input data against a number of different "patterns", trying one possibility at a time in a failure-driven loop. The actual problem was a wrapper that executed each call in a try/catch, with a default catch clause looking something like this: try match(Pattern, Data) catch ... Class:Term -> {foo_error, {Class, Term, erlang:get_stacktrace()}} end The stacktrace was usually discarded again further up and the whole thing was retried with another "pattern". This code got executed tens of thousands of times per second. When we removed the call to get_stacktrace(), the system instantly started to behave much better. The purpose of this mail, then, is both to warn about sloppy use of get_stacktrace() and to clarify how stack traces are handled and wherein the costs lie. First of all, triggering an exception is quite cheap. The necessary stack trace information (by default, 8 pointers) is quickly saved in an opaque blob, and control gets passed up to the nearest catch handler (if there is one). If there is a handler, normal Erlang execution will resume, trying to match the catch-clauses. If no catch clause matches, the exception state is unchanged and we look for the next catch handler, until either some catch clause matches or the top of the call stack is reached (which will terminate the process). If a catch clause matches, execution just continues and no extra cost is incurred as long as you don't try to inspect the stack trace. If none of the clauses match, the only cost was that of trying the clause patterns and guards. For example, terminating a process by "exit(normal)" has very little overhead even if it passes through a number of catch handlers that just pass it on upwards, because even the process exit signal will not contain the stack trace. And using throw/catch for nonlocal return out of a deep recursion is very cheap. *But* if someone wants to actually look at the stack trace of the exception, the "opaque blob" mentioned above must be reified as an Erlang term, by calling erlang:get_stacktrace(). This amounts to looking up the module and function name and arity corresponding to each of the saved code pointers, and creating a corresponding list of MFA tuples on the heap. (This also happens if the process terminates due to an exception of type 'error' or 'throw', to include the stack trace in the exit signal.) In addition, as of Erlang/OTP R15 this operation is 4-5 times(!) more expensive than it used to be pre-R15, because now the stack trace also includes file names and line numbers. That's more data to be allocated on the heap, but most of the cost is probably in traversing the tables that map bytecode regions to corresponding source file regions (these tables are created by the compiler and are included in the .beam files). For us, this difference meant that we went from "mysteriously high activity, but not critical" under R14 to "random bursts of unresponsiveness" under R15, and it took us a lot of effort to figure out what was going on. So the general advice is: Don't call erlang:get_stacktrace() just because you can. If you don't have a real reason for catching every possible exception, just let the uninteresting ones fall through. Avoid the temptation to have a catch-all clause like in the example above, that re-packages the exception wrapped in a tuple with some tag that you happen to like. In particular if there's a chance that the code will be re-tried over and over again. If you don't intend to handle the exception, then let it remain an exception for as long as possible and don't turn the stack trace into a term, because that's when you pay. It's of course still valid to call get_stacktrace() in many situations, e.g. when the process is on its way to give up, or to write the crash information to a log, or for something that only happens rarely and the stack trace information is useful - but never in a library function that might be used heavily in a loop. Finally, this is also another reason to rewrite old occurrences of 'catch Expr' into 'try Expr catch ... end', because it basically works like this: try Expr catch throw:Term -> Term; exit:Term -> {'EXIT', Term}; error:Term -> {'EXIT', {Term, erlang:get_stacktrace()}} end so what happens if you use one of the following old idioms?: ... catch foo(...), % for side effect, ignore the result ... or case catch foo(...) of {'EXIT', Reason} -> ...; Result -> ... end Well, when the exception type is 'error', the catch will build a result containing the symbolic stack trace, and this will then in the first case be immediately discarded, or in the second case matched on and then possibly discarded later. Whereas if you use try/catch, you can ensure that no stack trace is constructed at all to begin with. Sorry that this got a bit long, but I think that was all. /Richard From tony@REDACTED Wed Nov 6 08:20:41 2013 From: tony@REDACTED (Tony Rogvall) Date: Wed, 6 Nov 2013 08:20:41 +0100 Subject: [erlang-questions] Heads-up: The cost of get_stacktrace() In-Reply-To: <527956BF.1000601@gmail.com> References: <527956BF.1000601@gmail.com> Message-ID: Thank you for sharing. /Tony On 5 nov 2013, at 21:36, Richard Carlsson wrote: > (Executive summary: exceptions cheap, but erlang:get_stacktrace() kind of expensive; also, avoid 'catch Expr'.) > > We have wrestled for some time with some very strange unresponsiveness and high amounts of garbage collection, and finally managed to track down the problem. It was in a piece of code that matches some input data against a number of different "patterns", trying one possibility at a time in a failure-driven loop. The actual problem was a wrapper that executed each call in a try/catch, with a default catch clause looking something like this: > > try match(Pattern, Data) > catch > ... > Class:Term -> > {foo_error, {Class, Term, erlang:get_stacktrace()}} > end > > The stacktrace was usually discarded again further up and the whole thing was retried with another "pattern". This code got executed tens of thousands of times per second. When we removed the call to get_stacktrace(), the system instantly started to behave much better. > > The purpose of this mail, then, is both to warn about sloppy use of get_stacktrace() and to clarify how stack traces are handled and wherein the costs lie. > > First of all, triggering an exception is quite cheap. The necessary stack trace information (by default, 8 pointers) is quickly saved in an opaque blob, and control gets passed up to the nearest catch handler (if there is one). If there is a handler, normal Erlang execution will resume, trying to match the catch-clauses. If no catch clause matches, the exception state is unchanged and we look for the next catch handler, until either some catch clause matches or the top of the call stack is reached (which will terminate the process). > > If a catch clause matches, execution just continues and no extra cost is incurred as long as you don't try to inspect the stack trace. If none of the clauses match, the only cost was that of trying the clause patterns and guards. For example, terminating a process by "exit(normal)" has very little overhead even if it passes through a number of catch handlers that just pass it on upwards, because even the process exit signal will not contain the stack trace. And using throw/catch for nonlocal return out of a deep recursion is very cheap. > > *But* if someone wants to actually look at the stack trace of the exception, the "opaque blob" mentioned above must be reified as an Erlang term, by calling erlang:get_stacktrace(). This amounts to looking up the module and function name and arity corresponding to each of the saved code pointers, and creating a corresponding list of MFA tuples on the heap. (This also happens if the process terminates due to an exception of type 'error' or 'throw', to include the stack trace in the exit signal.) > > In addition, as of Erlang/OTP R15 this operation is 4-5 times(!) more expensive than it used to be pre-R15, because now the stack trace also includes file names and line numbers. That's more data to be allocated on the heap, but most of the cost is probably in traversing the tables that map bytecode regions to corresponding source file regions (these tables are created by the compiler and are included in the .beam files). For us, this difference meant that we went from "mysteriously high activity, but not critical" under R14 to "random bursts of unresponsiveness" under R15, and it took us a lot of effort to figure out what was going on. > > So the general advice is: Don't call erlang:get_stacktrace() just because you can. If you don't have a real reason for catching every possible exception, just let the uninteresting ones fall through. Avoid the temptation to have a catch-all clause like in the example above, that re-packages the exception wrapped in a tuple with some tag that you happen to like. In particular if there's a chance that the code will be re-tried over and over again. If you don't intend to handle the exception, then let it remain an exception for as long as possible and don't turn the stack trace into a term, because that's when you pay. > > It's of course still valid to call get_stacktrace() in many situations, e.g. when the process is on its way to give up, or to write the crash information to a log, or for something that only happens rarely and the stack trace information is useful - but never in a library function that might be used heavily in a loop. > > Finally, this is also another reason to rewrite old occurrences of 'catch Expr' into 'try Expr catch ... end', because it basically works like this: > > try Expr > catch > throw:Term -> Term; > exit:Term -> {'EXIT', Term}; > error:Term -> {'EXIT', {Term, erlang:get_stacktrace()}} > end > > so what happens if you use one of the following old idioms?: > > ... > catch foo(...), % for side effect, ignore the result > ... > > or > > case catch foo(...) of > {'EXIT', Reason} -> ...; > Result -> ... > end > > Well, when the exception type is 'error', the catch will build a result containing the symbolic stack trace, and this will then in the first case be immediately discarded, or in the second case matched on and then possibly discarded later. Whereas if you use try/catch, you can ensure that no stack trace is constructed at all to begin with. > > Sorry that this got a bit long, but I think that was all. > > /Richard > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Thu Nov 7 19:17:32 2013 From: mononcqc@REDACTED (Fred Hebert) Date: Thu, 7 Nov 2013 13:17:32 -0500 Subject: [erlang-questions] Get to know your Erlang memory allocation Message-ID: <20131107181731.GL5671@ferdair.local> In the same vein as Rich Carlsson's recent post on understanding how erlang:get_stacktrace() works, I decided that this list would probably be interested in reading this blog post about some of the work we do with Erlang at Heroku: https://blog.heroku.com/archives/2013/11/7/logplex-down-the-rabbit-hole The reason I post this here is that if you scroll down enough, you'll meet an entire section devoted to understanding (from afar) how Erlang's memory allocators work, and how they could be tuned. It's something I have to thank Lukas Larsson for, given he's the one who helped us understand all of this and solve important memory issues we had. I hope you enjoy the read! Regards, Fred. From bob@REDACTED Thu Nov 7 22:16:25 2013 From: bob@REDACTED (Bob Ippolito) Date: Thu, 7 Nov 2013 13:16:25 -0800 Subject: [erlang-questions] Get to know your Erlang memory allocation In-Reply-To: <20131107181731.GL5671@ferdair.local> References: <20131107181731.GL5671@ferdair.local> Message-ID: Did you try using binary:copy/1 at all? Last time I had this issue, that function wasn't around, but it seems like it might be useful for your use case. Some of the other strategies we've used to work around these kinds of issues are: * Use a temporary process for operations that will generate a lot of garbage * When that doesn't or can't work, include a manual hibernate or erlang:garbage_collect/0 On Thu, Nov 7, 2013 at 10:17 AM, Fred Hebert wrote: > In the same vein as Rich Carlsson's recent post on understanding how > erlang:get_stacktrace() works, I decided that this list would probably > be interested in reading this blog post about some of the work we do > with Erlang at Heroku: > https://blog.heroku.com/archives/2013/11/7/logplex-down-the-rabbit-hole > > The reason I post this here is that if you scroll down enough, you'll > meet an entire section devoted to understanding (from afar) how Erlang's > memory allocators work, and how they could be tuned. > > It's something I have to thank Lukas Larsson for, given he's the one who > helped us understand all of this and solve important memory issues we > had. > > I hope you enjoy the read! > Regards, > Fred. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Thu Nov 7 22:52:21 2013 From: mononcqc@REDACTED (Fred Hebert) Date: Thu, 7 Nov 2013 16:52:21 -0500 Subject: [erlang-questions] Get to know your Erlang memory allocation In-Reply-To: References: <20131107181731.GL5671@ferdair.local> Message-ID: <20131107215220.GM5671@ferdair.local> On 11/07, Bob Ippolito wrote: > Did you try using binary:copy/1 at all? Last time I had this issue, that > function wasn't around, but it seems like it might be useful for your use > case. > Yeah the problem with it is that our binary messages were often >64b, and we wanted them in full. If we were to copy these messages, they'd end up just on the binary heap again. As far as I can tell, binary:copy/1 is useful whenever the piece of binary you want to keep around is a subset of the large one you initially loaded. In our cases, that doesn't happen and there's little to gain there with that. > Some of the other strategies we've used to work around these kinds of > issues are: > > * Use a temporary process for operations that will generate a lot of garbage > * When that doesn't or can't work, include a manual hibernate or > erlang:garbage_collect/0 > Right. In our case the processes are long-lived -- they're buffers that have to be alive for a while. It's part of the entire problem. Manual hibernation is something we've injected all over the place on top of the last-resort global GC. Things are mostly stable since then, and on top of the memory allocation rework, we also added a dynamic buffer resizing based on whether we're able to ever empty the buffers or not to reduce the amount of very long-lived information stored on the node to free up as many carriers as possible. That seemed to work well for now, and we've got rid of most alerts we could have related to memory to this day. From fhunleth@REDACTED Fri Nov 8 02:32:43 2013 From: fhunleth@REDACTED (Frank Hunleth) Date: Thu, 7 Nov 2013 20:32:43 -0500 Subject: [erlang-questions] file:open/2 and non-regular files Message-ID: I was a little surprised when file:open/2 failed with {error,eisdir} when I tried to open a named pipe. It looks like the failure came from unix_efile.c which checks for a regular file or "/dev/null". While I can easily work around this, I was curious if anyone knew the rationale for the restriction. Thanks, Frank From ok@REDACTED Fri Nov 8 03:15:09 2013 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 8 Nov 2013 15:15:09 +1300 Subject: [erlang-questions] file:open/2 and non-regular files In-Reply-To: References: Message-ID: <63984993-34F4-4D97-B3A5-20A0B55FA551@cs.otago.ac.nz> On 8/11/2013, at 2:32 PM, Frank Hunleth wrote: > I was a little surprised when file:open/2 failed with {error,eisdir} > when I tried to open a named pipe. Basically, it's a division of the I/O world into "fast" and "slow" and limiting file:open/2 to "fast" things. This has been discussed several times before, so trawling the archives should find something. From janos.n.hary@REDACTED Fri Nov 8 08:55:09 2013 From: janos.n.hary@REDACTED (Janos Hary) Date: Fri, 8 Nov 2013 08:55:09 +0100 Subject: [erlang-questions] Stopping gen_server during processing Message-ID: <000801cedc57$d9a30c90$8ce925b0$@gmail.com> All, I have a gen_server process which periodically processes new records from a database. I use timer:send_after to schedule gathering and processing new records. I can gracefully stop the gen_server when it is waiting, but I need a way to stop it during processing. Of cause I only want to stop it at certain points of the processing, for example before starting to process the next record. I need to group the records, so I cannot ask them one by one from the db. What is the preferred way of doing this? Thanks for your answers in advance. Janos -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Fri Nov 8 09:00:31 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 8 Nov 2013 12:00:31 +0400 Subject: [erlang-questions] Memory allocation HOWTO from Fred Message-ID: https://blog.heroku.com/archives/2013/11/7/logplex-down-the-rabbit-hole Fred, at first: thank you for this tutorial. It is not just a blogpost, it looks more like a paper into journal =) I've experiencing similar problems in erlyvideo, because in some places reallocating memory on gigabits per second speed creates lots of binaries. For example: if I read from tcp socket with active,once mode, I get 1400 byte blocks, which are big enough to get into big heap, but too small to handle them and it ends in reallocation and copying hundreds times per second. There is no {active, 100K} mode that will send messages of 100K bytes, so the only way out is something like: handle_info({tcp, Sock, Bin}, State) -> {ok, Bin2} = gen_tcp:recv(Sock, 50000), handle(<>) Without such primitive patch I get about 500 new binaries per second and CPU is melting out. I don't know why, but it is clear: when there are 100 processes in system that creates about 500 small binaries per second, beam.smp is consuming lot of CPU power. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Fri Nov 8 09:27:55 2013 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 8 Nov 2013 09:27:55 +0100 Subject: [erlang-questions] Stopping gen_server during processing In-Reply-To: <000801cedc57$d9a30c90$8ce925b0$@gmail.com> References: <000801cedc57$d9a30c90$8ce925b0$@gmail.com> Message-ID: <1383899276.4806.4.camel@sekic1152.release> These are my opinions, not hard facts. Add a member to the gen_server state record that says that you are going to stop when possible. Use a cast to set it to true when you want to stop. If it is true and you can stop the gen_server, stop it. bengt On Fri, 2013-11-08 at 08:55 +0100, Janos Hary wrote: > All, > > > > I have a gen_server process which periodically processes new records > from a database. I use timer:send_after to schedule gathering and > processing new records. I can gracefully stop the gen_server when it > is waiting, but I need a way to stop it during processing. Of cause I > only want to stop it at certain points of the processing, for example > before starting to process the next record. I need to group the > records, so I cannot ask them one by one from the db. > > > > What is the preferred way of doing this? > > > > Thanks for your answers in advance. > > Janos > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From janos.n.hary@REDACTED Fri Nov 8 10:43:40 2013 From: janos.n.hary@REDACTED (Janos Hary) Date: Fri, 8 Nov 2013 10:43:40 +0100 Subject: [erlang-questions] Stopping gen_server during processing In-Reply-To: <1383899276.4806.4.camel@sekic1152.release> References: <000801cedc57$d9a30c90$8ce925b0$@gmail.com> <1383899276.4806.4.camel@sekic1152.release> Message-ID: <001d01cedc67$0257be10$07073a30$@gmail.com> Sorry, I cannot see how could it work in Erlang. I have a handle_info processing a large number of records: handle_info(check, State) -> check_records(State). check_records(State) -> do some work... case State#stop_flag of true -> {stop, normal, State}; _ -> check_records(State) end. The State in check_records cannot changed from another cast. I'm not even sure that the cast will execute before check_records finishes. Janos -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Bengt Kleberg Sent: Friday, November 08, 2013 9:28 AM To: undisclosed-recipients: Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Stopping gen_server during processing These are my opinions, not hard facts. Add a member to the gen_server state record that says that you are going to stop when possible. Use a cast to set it to true when you want to stop. If it is true and you can stop the gen_server, stop it. bengt On Fri, 2013-11-08 at 08:55 +0100, Janos Hary wrote: > All, > > > > I have a gen_server process which periodically processes new records > from a database. I use timer:send_after to schedule gathering and > processing new records. I can gracefully stop the gen_server when it > is waiting, but I need a way to stop it during processing. Of cause I > only want to stop it at certain points of the processing, for example > before starting to process the next record. I need to group the > records, so I cannot ask them one by one from the db. > > > > What is the preferred way of doing this? > > > > Thanks for your answers in advance. > > Janos > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From mangalaman93@REDACTED Fri Nov 8 10:51:56 2013 From: mangalaman93@REDACTED (aman mangal) Date: Fri, 8 Nov 2013 15:21:56 +0530 Subject: [erlang-questions] Stopping gen_server during processing In-Reply-To: <001d01cedc67$0257be10$07073a30$@gmail.com> References: <000801cedc57$d9a30c90$8ce925b0$@gmail.com> <1383899276.4806.4.camel@sekic1152.release> <001d01cedc67$0257be10$07073a30$@gmail.com> Message-ID: Hi, What you want is something like Interrupts. I don't think Erlang processes have interrupts. So there is no easy solution. But you can do it using message passing which will require multiple processes. To elaborate, you create another process to check records while this process waits for more messages. When you receive a stop message, you kill the process who is checking for records. On the other hand, if the process is done executing (i.e. done checking records) it simply sends a success message to the parent process. You can read more here http://stackoverflow.com/questions/10219058/interrupting-a-process-in-erlang Aman Mangal 4th year Undergraduate Student Department of Computer Science & Engineering IIT Bombay www.cse.iitb.ac.in/~amanmangal On Fri, Nov 8, 2013 at 3:13 PM, Janos Hary wrote: > Sorry, I cannot see how could it work in Erlang. > > I have a handle_info processing a large number of records: > handle_info(check, State) -> > check_records(State). > > check_records(State) -> > do some work... > case State#stop_flag of > true -> > {stop, normal, State}; > _ -> > check_records(State) > end. > > The State in check_records cannot changed from another cast. I'm not even > sure that the cast will execute before check_records finishes. > > Janos > > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Bengt Kleberg > Sent: Friday, November 08, 2013 9:28 AM > To: undisclosed-recipients: > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Stopping gen_server during processing > > These are my opinions, not hard facts. > > Add a member to the gen_server state record that says that you are going to > stop when possible. Use a cast to set it to true when you want to stop. If > it is true and you can stop the gen_server, stop it. > > > bengt > > On Fri, 2013-11-08 at 08:55 +0100, Janos Hary wrote: > > All, > > > > > > > > I have a gen_server process which periodically processes new records > > from a database. I use timer:send_after to schedule gathering and > > processing new records. I can gracefully stop the gen_server when it > > is waiting, but I need a way to stop it during processing. Of cause I > > only want to stop it at certain points of the processing, for example > > before starting to process the next record. I need to group the > > records, so I cannot ask them one by one from the db. > > > > > > > > What is the preferred way of doing this? > > > > > > > > Thanks for your answers in advance. > > > > Janos > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony@REDACTED Fri Nov 8 11:03:36 2013 From: tony@REDACTED (Tony Rogvall) Date: Fri, 8 Nov 2013 11:03:36 +0100 Subject: [erlang-questions] Stopping gen_server during processing In-Reply-To: <001d01cedc67$0257be10$07073a30$@gmail.com> References: <000801cedc57$d9a30c90$8ce925b0$@gmail.com> <1383899276.4806.4.camel@sekic1152.release> <001d01cedc67$0257be10$07073a30$@gmail.com> Message-ID: <353A45F6-8BA0-47F8-A6D9-BE7100D89F38@rogvall.se> Maybe you just want to kill it ? exit(Pid, die_now). or if the little bugger is trapping exit you may have to be brutal. exit(Pid, kill). http://www.erlang.org/doc/man/erlang.html#exit-2 You can send the process normal messages: Pid ! stop_processing_now. Then while doing processing loop: check_records(State) -> do some work... receive stop_processing_now -> {stop, normal, State}; after 0 -> check_records(State) end The after 0 make sure that the process will not wait for messages, also the selective receive approach here will guarantee that messages to the gen_server (call and casts etc) will stay where they are. You may have to add a clause in handle_info to handle the case where the message is receive by the gen_server dispatcher. handle_info(stop_processing_now, State) -> Stop? or something /Tony On 8 nov 2013, at 10:43, Janos Hary wrote: > Sorry, I cannot see how could it work in Erlang. > > I have a handle_info processing a large number of records: > handle_info(check, State) -> > check_records(State). > > check_records(State) -> > do some work... > case State#stop_flag of > true -> > {stop, normal, State}; > _ -> > check_records(State) > end. > > The State in check_records cannot changed from another cast. I'm not even > sure that the cast will execute before check_records finishes. > > Janos > > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Bengt Kleberg > Sent: Friday, November 08, 2013 9:28 AM > To: undisclosed-recipients: > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Stopping gen_server during processing > > These are my opinions, not hard facts. > > Add a member to the gen_server state record that says that you are going to > stop when possible. Use a cast to set it to true when you want to stop. If > it is true and you can stop the gen_server, stop it. > > > bengt > > On Fri, 2013-11-08 at 08:55 +0100, Janos Hary wrote: >> All, >> >> >> >> I have a gen_server process which periodically processes new records >> from a database. I use timer:send_after to schedule gathering and >> processing new records. I can gracefully stop the gen_server when it >> is waiting, but I need a way to stop it during processing. Of cause I >> only want to stop it at certain points of the processing, for example >> before starting to process the next record. I need to group the >> records, so I cannot ask them one by one from the db. >> >> >> >> What is the preferred way of doing this? >> >> >> >> Thanks for your answers in advance. >> >> Janos >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" -------------- next part -------------- An HTML attachment was scrubbed... URL: From Christopher.Phillips@REDACTED Fri Nov 8 14:17:18 2013 From: Christopher.Phillips@REDACTED (Phillips, Christopher) Date: Fri, 8 Nov 2013 13:17:18 +0000 Subject: [erlang-questions] Stopping gen_server during processing In-Reply-To: Message-ID: I suspect the right thing to do here is going to be to break up the work. You said you have to group the records, but there's still no reason to process them all in one go in the gen_server. That is, elaborating a bit on what other people have said, have one process that receives the timer message. Have it spin up another gen_server with the records that need processing. Have this spun up gen_server process records one at a time, calling cast on itself with the remaining records after each step. Have cast handle both this self-referential call to continue processing, and a stop message. At any point you can send a stop message, which will always be the next message. That is, the new gen_server will have something roughly like (usual caveats apply to code written in an email and not run) - init(Records) -> gen_server:cast(..., process_record), {ok, Records}. handle_cast(process_record, State) -> case State of [H | T] -> #do whatever with H, gen_server:cast(..., process_record), {noreply, T}; [] -> {stop, normal, State} end; handle_cast(stop, State) -> {stop, normal, State}. At any point, then, you can call gen_server:cast(..., stop), and after the gen_server finishes processing the record it is on, it will handle the stop message, stopping the gen_server (and with State containing the list of unprocessed records, if you want to do something with them in the terminate). Also note that when self-referencing like this, you need to cast, not call (as waiting for a response from yourself will always timeout). On 11/8/13, 6:00 AM, "erlang-questions-request@REDACTED" wrote: >On 8 nov 2013, at 10:43, Janos Hary wrote: > >>Sorry, I cannot see how could it work in Erlang. >>I have a handle_info processing a large number of records: >>handle_info(check, State) -> >> check_records(State). >>check_records(State) -> >> do some work... >> case State#stop_flag of >> true -> >> {stop, normal, State}; >> _ -> >> check_records(State) >> end. >>The State in check_records cannot changed from another cast. I'm not even >>sure that the cast will execute before check_records finishes. >>Janos >>-----Original Message----- >>From: erlang-questions-bounces@REDACTED >>[mailto:erlang-questions-bounces@REDACTED] On Behalf Of Bengt Kleberg >>Sent: Friday, November 08, 2013 9:28 AM >>To: undisclosed-recipients: >>Cc: erlang-questions@REDACTED >>Subject: Re: [erlang-questions] Stopping gen_server during processing >>These are my opinions, not hard facts. >>Add a member to the gen_server state record that says that you are going >>to >>stop when possible. Use a cast to set it to true when you want to stop. >>If >>it is true and you can stop the gen_server, stop it. >>bengt >>On Fri, 2013-11-08 at 08:55 +0100, Janos Hary wrote: >>>All, >>>I have a gen_server process which periodically processes new records >>>from a database. I use timer:send_after to schedule gathering and >>>processing new records. I can gracefully stop the gen_server when it >>>is waiting, but I need a way to stop it during processing. Of cause I >>>only want to stop it at certain points of the processing, for example >>>before starting to process the next record. I need to group the >>>records, so I cannot ask them one by one from the db. >>>What is the preferred way of doing this? >>>Thanks for your answers in advance. >>>Janos >>>_______________________________________________ >>>erlang-questions mailing list >>>erlang-questions@REDACTED >>>http://erlang.org/mailman/listinfo/erlang-questions >>_______________________________________________ >>erlang-questions mailing list >>erlang-questions@REDACTED >>http://erlang.org/mailman/listinfo/erlang-questions >>_______________________________________________ >>erlang-questions mailing list >>erlang-questions@REDACTED >>http://erlang.org/mailman/listinfo/erlang-questions From mononcqc@REDACTED Fri Nov 8 19:29:55 2013 From: mononcqc@REDACTED (Fred Hebert) Date: Fri, 8 Nov 2013 13:29:55 -0500 Subject: [erlang-questions] Memory allocation HOWTO from Fred In-Reply-To: References: Message-ID: <20131108182953.GN5671@ferdair.local> Hi Max, Thanks for the good comments. Have you found any pattern that helped in your case? I remember seeing Lukas recommending a few tweaks here and there and wondered if you ever found suitable settings. I'm guessing just the churn is gonna hurt a lot in your case -- would it be worth having a middle-man process that does blocking receives with a bound size and messages them to your main process? [ recv(Sock, 50000) ] --> Bin --> [ gen_server ] It sounds like having ~100 of these messaging refc bins would be a huge gain overall given the alternatives and the low cost of message passing in that case. Regards, Fred. On 11/08, Max Lapshin wrote: > https://blog.heroku.com/archives/2013/11/7/logplex-down-the-rabbit-hole > > Fred, at first: thank you for this tutorial. > > It is not just a blogpost, it looks more like a paper into journal =) > > > > I've experiencing similar problems in erlyvideo, because in some places > reallocating memory on gigabits per second speed creates lots of binaries. > > For example: if I read from tcp socket with active,once mode, I get 1400 > byte blocks, which are big enough to get into big heap, but too small to > handle them and it ends in reallocation and copying hundreds times per > second. > > There is no {active, 100K} mode that will send messages of 100K bytes, so > the only way out is something like: > > handle_info({tcp, Sock, Bin}, State) -> > {ok, Bin2} = gen_tcp:recv(Sock, 50000), > handle(<>) > > Without such primitive patch I get about 500 new binaries per second and > CPU is melting out. > I don't know why, but it is clear: when there are 100 processes in system > that creates about 500 small binaries per second, beam.smp is consuming lot > of CPU power. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From max.lapshin@REDACTED Fri Nov 8 21:33:44 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Sat, 9 Nov 2013 00:33:44 +0400 Subject: [erlang-questions] Memory allocation HOWTO from Fred In-Reply-To: <20131108182953.GN5671@ferdair.local> References: <20131108182953.GN5671@ferdair.local> Message-ID: Fred, I haven't found yet any good solution, because I've just read your article. My problem is that I write software that should be used in at least 20 different use cases with different profiles of usage and I have absolutely no control over protocols that are used =) Most horrible situations are something like accepting 1500 byte packets via UDP multicast. Erlang without special C driver cannot handle this load and I need to write special driver in C to accumulate packets. Also there are many problems with situations when I cannot use iolists because one protocol needs to be converted to other and it involves very complicated bit parsing with saving intermediate state. It is definitely clear that on my usecases appending binaries works better than iolists and especially than iolist + reverse. I suppose it happens because small binaries are collected faster and gets out of young generation, but it is only a suppose. I've even written small code in .S to preallocate binary when I can guess size: https://gist.github.com/maxlapshin/5531424 -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenji@REDACTED Sat Nov 9 07:43:07 2013 From: kenji@REDACTED (Kenji Rikitake) Date: Sat, 9 Nov 2013 15:43:07 +0900 Subject: [erlang-questions] Failed to compile erlang R15B03-1 on FreeBSD10 with DTrace In-Reply-To: References: Message-ID: <20131109064307.GA34704@k2r.org> I've tested building R15B03-1 with kerl on FreeBSD amd64 10.0-BETA3 r257847 with DTrace, *DISABLED HiPE*, and no problem. See https://github.com/jj1bdx/kerl/blob/master/kerl-k2r.md for the details of the configuration script. I've been using clang these days for testing OTP builds on kerl. I haven't been following the Giacomo Olgeni's Port lang/erlang these days, but as I rebuilt in a past userland r257290 and r257386 on amd64, I found no problem detected. I also find lang/erlang15-runtime and lang/erlang16-runtime ports compiled fine. Disabling the HiPE option would make a difference. Kenji Rikitake ++> Motiejus Jak?tys [2013-11-04 08:28:11 +0100]: > Dear FreeBSD users, > > I get this error when trying to compile: > gmake[5]: Entering directory > `/usr/ports/lang/erlang/work/otp_src_R15B03/lib/hipe/rtl' > erlc -W +debug_info +inline -o../ebin hipe_rtl.erl > gmake[5]: *** [../ebin/hipe_rtl.beam] Segmentation fault (core dumped) > > Running: FreeBSD 10.0-BETA2 #0 r257166: [rest deleted] From kenji@REDACTED Sat Nov 9 07:47:59 2013 From: kenji@REDACTED (Kenji Rikitake) Date: Sat, 9 Nov 2013 15:47:59 +0900 Subject: [erlang-questions] R16B02 error on FreeBSD In-Reply-To: References: Message-ID: Referring to the FreeBSD Port lang/erlang or lang/erlang16-runtime will help you solve the compilation options. Also see https://github.com/jj1bdx/kerl/blob/master/kerl-k2r.md for performing test building with kerl. Kenji Rikitake On Thu, Oct 31, 2013 at 12:20 AM, Lukas Larsson wrote: > Hello, > > R16B02 compiles fine on our FreeBSD 9.1 with the same gcc version as you > have. > > What seems to happen is that when including "pcre.h" gcc decides to use the > system "pcre.h" rather then the erts version. I found a potential workaround > here: https://github.com/iriscouch/build-couchdb/issues/56. i.e. move the > $(INCLUDE) found here[1] to before the $(subst, ...). Let me know if that > works for you. > > Lukas > > [1]: > https://github.com/erlang/otp/blob/maint/erts/emulator/Makefile.in#L656 > > > On Wed, Oct 30, 2013 at 2:19 PM, z_axis wrote: >> >> $ uname -a >> FreeBSD mybsd.zsoft.com 9.1-RELEASE-p4 FreeBSD 9.1-RELEASE-p4 #3 ... >> >> $ gcc -v >> Using built-in specs. >> Target: i386-undermydesk-freebsd >> Configured with: FreeBSD/i386 system compiler >> Thread model: posix >> gcc version 4.2.1 20070831 patched [FreeBSD] >> >> Regards! >> >> ? Wed, 30 Oct 2013 17:11:46 +0800?Lukas Larsson ??: >> >>> Hello, >>> >>> You forgot to mention which gcc and FreeBSD version you are using. >>> >>> Lukas >>> >>> >>> On Wed, Oct 30, 2013 at 3:10 AM, z_axis wrote: >>> >>>> I am frustrated by R16B02 : "beam/erl_bif_re.c:984: error: >>>> 'PCRE_EXTRA_LOOP_LIMIT' undeclared (first use in this function)\n >>>> beam/erl_bif_re.c:986: error: 'pcre_extra' has no member named >>>> 'loop_limit' ..." when compiling on FreeBSD >>>> >>>> Sincerely! >>>> >>>> ______________________________**_________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> >>>> http://erlang.org/mailman/**listinfo/erlang-questions >>>> >> >> >> -- >> ?? Opera ????????????: http://www.opera.com/mail/ >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From jose.valim@REDACTED Sat Nov 9 11:56:19 2013 From: jose.valim@REDACTED (=?ISO-8859-1?Q?Jos=E9_Valim?=) Date: Sat, 9 Nov 2013 11:56:19 +0100 Subject: [erlang-questions] Memory allocation HOWTO from Fred In-Reply-To: References: <20131108182953.GN5671@ferdair.local> Message-ID: > > I've even written small code in .S to preallocate binary when I can guess > size: https://gist.github.com/maxlapshin/5531424 > I wonder if it would make sense to expose this as a function in the binary module? You are not the first one I hear of doing such and once we start to compile comprehensions directly in Elixir, skipping the erlang abstract format, we would also need it. Would the OTP team agree with exposing such functionality? -------------- next part -------------- An HTML attachment was scrubbed... URL: From jose.valim@REDACTED Sat Nov 9 15:10:50 2013 From: jose.valim@REDACTED (=?ISO-8859-1?Q?Jos=E9_Valim?=) Date: Sat, 9 Nov 2013 15:10:50 +0100 Subject: [erlang-questions] Memory allocation HOWTO from Fred In-Reply-To: References: <20131108182953.GN5671@ferdair.local> Message-ID: I disagree, otherwise developers need to continue writing the 'S' module and compiling them to have access to the feature. You may disagree with Elixir use-case, which could compile to core, but that is not an answer and does not invalidate the other cases. Anyway, whatever the OTP Team agrees with I will happily tag along. -- *Jos? Valim* www.plataformatec.com.br Skype: jv.ptec Founder and Lead Developer -------------- next part -------------- An HTML attachment was scrubbed... URL: From akshatjiwan@REDACTED Sat Nov 9 09:54:03 2013 From: akshatjiwan@REDACTED (Akshat Jiwan Sharma) Date: Sat, 9 Nov 2013 14:24:03 +0530 Subject: [erlang-questions] Is gproc pub/sub pattern good for status notification? Message-ID: HI guys, This is my first post to the group. You will be seeing a lot more of me from now on as I have started using erlang actively :) Here is the question Consider a very common scenario 1.A user comes online/or goes offline (i.e his status changes) 2.His friends are notified of the status change. I am trying to solve the notification problem in erlang using gproc There are two solutions which immediately come to mind Solution 1 1.Create a channel for the user 2.Subscribe his friends to his channel(iterative process). 3.Notify them on state change. Solution 2 1. Create a channel for the user. 2. Send messages using gproc:send/2 on state change(again an iterative process) It seems to me in both cases looping can not be avoided. So I am leaning towards second approach myself as there is less over head(single channel for every user no subscriptions) Which approach is better? Relevant article Facebook chat blog The naive implementation of sending a notification to all friends whenever a user comes online or goes offline has a worst case cost of O(average friendlist size * peak users * churn rate) messages/second, where churn rate is the frequency with which users come online and go offline, in events/second. This is wildly inefficient to the point of being untenable, given that the average number of friends per user is measured in the hundreds, and the number of concurrent users during peak site usage is on the order of several millions. With regard to above comment my question is the same. If you use pub/sub you save on sending notification but incur cost on subscribing in the first place so how does pub/sub benefit over normal sending. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cmeiklejohn@REDACTED Sat Nov 9 17:02:44 2013 From: cmeiklejohn@REDACTED (Christopher Meiklejohn) Date: Sat, 9 Nov 2013 11:02:44 -0500 Subject: [erlang-questions] Is gproc pub/sub pattern good for status notification? In-Reply-To: References: Message-ID: <7D7692FC56CC44BCA7D4FE70F863689F@basho.com> On Saturday, November 9, 2013 at 3:54 AM, Akshat Jiwan Sharma wrote: > I am trying to solve the notification problem in erlang using gproc (https://github.com/uwiger/gproc) > > > There are two solutions which immediately come to mind > > Solution 1 > > 1.Create a channel for the user > > > 2.Subscribe his friends to his channel(iterative process). > > > 3.Notify them on state change. > > Solution 2 > > Create a channel for the user. > > > > Send messages using gproc:send/2 on state change(again an iterative process) Out of curiosity, are you planning on using gproc locally or with the global distribution as provided by gen_leader? - Chris -- Christopher Meiklejohn Software Engineer Basho Technologies, Inc. From kenji@REDACTED Sun Nov 10 08:40:49 2013 From: kenji@REDACTED (Kenji Rikitake) Date: Sun, 10 Nov 2013 16:40:49 +0900 Subject: [erlang-questions] Memory allocation HOWTO from Fred In-Reply-To: References: Message-ID: I just read through the Fred's article. It's worth becoming a part of (to-be-revised) LYSE, and well-written at the level of an accepted draft of a journal paper or a conference article of the ACM Erlang Workshop (provided more formal references are added, though that shouldn't be required for a blog posting). The article is highly recommended for all production programmers and devops. Memory allocation and garbage collection are such a complicated pair of issues indeed. Kenji Rikitake On Fri, Nov 8, 2013 at 5:00 PM, Max Lapshin wrote: > https://blog.heroku.com/archives/2013/11/7/logplex-down-the-rabbit-hole > > Fred, at first: thank you for this tutorial. > > It is not just a blogpost, it looks more like a paper into journal =) From n.oxyde@REDACTED Sun Nov 10 13:39:03 2013 From: n.oxyde@REDACTED (Anthony Ramine) Date: Sun, 10 Nov 2013 13:39:03 +0100 Subject: [erlang-questions] Heads-up: The cost of get_stacktrace() In-Reply-To: <527956BF.1000601@gmail.com> References: <527956BF.1000601@gmail.com> Message-ID: <54930EAA-E87F-4AF2-8A65-B44F8E88CC51@gmail.com> Could your system use erlang:raise(error, {foo,{Class,Term}}, erlang:get_stacktrace()) instead of returning things? The call to erlang:get_stacktrace() could then be optimized away by the compiler and no informations would be lost ever. -- Anthony Ramine Le 5 nov. 2013 ? 21:36, Richard Carlsson a ?crit : > {foo_error, {Class, Term, erlang:get_stacktrace()}} From carlsson.richard@REDACTED Sun Nov 10 15:15:37 2013 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Sun, 10 Nov 2013 15:15:37 +0100 Subject: [erlang-questions] Heads-up: The cost of get_stacktrace() In-Reply-To: <54930EAA-E87F-4AF2-8A65-B44F8E88CC51@gmail.com> References: <527956BF.1000601@gmail.com> <54930EAA-E87F-4AF2-8A65-B44F8E88CC51@gmail.com> Message-ID: <527F9509.90504@gmail.com> On 2013-11-10 13:39, Anthony Ramine wrote: > Could your system use erlang:raise(error, {foo,{Class,Term}}, erlang:get_stacktrace()) instead of returning things? Probably, but the (somewhat convoluted) logic needs to be rewritten to catch that exception further up instead of expecting an error tuple as the return value. We'll either be doing something along those lines, or avoid the need for an intermediate catch altogether. > The call to erlang:get_stacktrace() could then be optimized away by the compiler and no informations would be lost ever. Interesting idea, and might be worth doing. You'd have to be sure that the un-expanded stack dump only gets passed into the third arg of raise/3, and doesn't escape to any other Erlang code. Just note that re-throwing with raise/3 should be used very carefully. If you substitute the exception class and term while keeping the stack trace pointing to where the original exception occurred, someone trying to debug the crash might then look at the source code at that point, realize there's no way it could result in that kind of exception, and be greatly confused. It's generally preferable to re-throw only with the exact same class/term. /Richard From freza@REDACTED Mon Nov 11 04:09:59 2013 From: freza@REDACTED (Jachym Holecek) Date: Sun, 10 Nov 2013 22:09:59 -0500 Subject: [erlang-questions] [ANN] salt - Erlang bindings for NaCl Message-ID: <20131111030959.GA1709@circlewave.net> Hi, I though it might be of interest to share this early (first release). o What: NIF-based Erlang bindings for NaCl cryptography library as packaged by libsodium. o Where: https://github.com/freza/salt Seems to work well but need more operational experience. Don't expect further development other than bug fixes, the architecture is solid (and simple), API coverage pretty complete (I miss only BLAKE2b, might add SipHash too, maybe). All public API is in 'salt.erl' and follows NaCl very closely. All 0-padding is handled internally where required (same as with C++ NaCl). Have fun, -- Jachym From bchesneau@REDACTED Mon Nov 11 14:57:38 2013 From: bchesneau@REDACTED (Benoit Chesneau) Date: Mon, 11 Nov 2013 14:57:38 +0100 Subject: [erlang-questions] [ANN] salt - Erlang bindings for NaCl In-Reply-To: <20131111030959.GA1709@circlewave.net> References: <20131111030959.GA1709@circlewave.net> Message-ID: Where you aware of https://github.com/tonyg/erlang-nacl ? How it differs from it? - benoit On Mon, Nov 11, 2013 at 4:09 AM, Jachym Holecek wrote: > Hi, > > I though it might be of interest to share this early (first release). > > o What: > > NIF-based Erlang bindings for NaCl cryptography library as packaged > by libsodium. > > o Where: > > https://github.com/freza/salt > > Seems to work well but need more operational experience. Don't expect > further > development other than bug fixes, the architecture is solid (and simple), > API > coverage pretty complete (I miss only BLAKE2b, might add SipHash too, > maybe). > > All public API is in 'salt.erl' and follows NaCl very closely. All > 0-padding > is handled internally where required (same as with C++ NaCl). > > Have fun, > -- Jachym > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bchesneau@REDACTED Mon Nov 11 15:18:51 2013 From: bchesneau@REDACTED (Benoit Chesneau) Date: Mon, 11 Nov 2013 15:18:51 +0100 Subject: [erlang-questions] reload application configuration Message-ID: Hi all, Until now I was using either an ini file (using http://github.com/benoitc/econfig) to handle the config on my app. Econfig allows me to reload the config and update it in live relatively easily . But INI is a rather limited format and I don't really want to use something YAML or TOML. Instead I was thinking to use pur application config and maybe cuttlefish (https://github.com/basho/cuttlefish) . But I wonder how to change the config in live. Say for example having a an HTTP config handler that allows the user to change some settings, triggering the config changes in the applications and writing them on the disk. Is there a way to do that? I found an old mail that was suggestiing to use `application_controller:change_application_data` like this reload_config(AppNames, ConfigFile) -> {ok, [Config]} = file:consult(ConfigFile), Apps = [{application, A, element(2,application:get_all_key(A))} || {A,_,_} <- application:while_applications()], application_controller:change_application_data(Apps,Config). http://erlang.2086793.n4.nabble.com/Loading-application-variables-td2089610.html though `application_controller:change_application_data` is not public. Should I update the config using `application:set_env` instead? Any other way? - benoit -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Mon Nov 11 15:30:09 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 11 Nov 2013 18:30:09 +0400 Subject: [erlang-questions] reload application configuration In-Reply-To: References: Message-ID: I've tried different ways and now I'm working with very complicated set_config/1 function that propagate new config to all subsystems. Any subsystem must handle idempotently new config and must be able either to restart, either to set its state according to new config. So, initial config loading and config reloading work in the same way. -------------- next part -------------- An HTML attachment was scrubbed... URL: From andra.dinu@REDACTED Mon Nov 11 16:03:00 2013 From: andra.dinu@REDACTED (Andra Dinu) Date: Mon, 11 Nov 2013 16:03:00 +0100 (CET) Subject: [erlang-questions] Erlang talks at Code Mesh 3-5 Dec London/3 days till Early Bird ends In-Reply-To: <859775333.730971.1384180126787.JavaMail.zimbra@erlang-solutions.com> Message-ID: <1336977185.732001.1384182180730.JavaMail.zimbra@erlang-solutions.com> Hi, The programme for Code Mesh London is up and there are a lot of talks of interest to Erlang developers: Fault Tolerance 101 - Joe Armstrong http://codemesh.io/#joe-armstrong Grisp: Building Space Ships With Erlang - Peer Stritzinger http://codemesh.io/#peer-stritzinger Going Reactive, New and Old ideas for your 21st century architectures - Francesco Cesarini & Jonas Bon?r http://codemesh.io/#francesco-cesarini Game of Threads - You Spawn or You Die - Torben Hoffmann http://codemesh.io/#torben-hoffmann Ecto: A Language Integrated Query for Elixir - Jos? Valim http://codemesh.io/#jose-valim Tutorial: Tinkering with the Raspberry Pi using Erlang - Omer Kilic http://codemesh.io/#omer-kilic Tutorial: Erlang - A Language for programming Reliable Systems - Francesco Cesarini http://codemesh.io/#francesco-cesarini Tutorial: Programming Elixir - Dave Thomas http://codemesh.io/#dave-thomas Check out over 50 talks on the website http://codemesh.io/ Best, Andra -- Andra Dinu Community & Social ERLANG SOLUTIONS LTD New Loom House 101 Back Church Lane London, E1 1LU United Kingdom Tel +44(0)2076550344 Mob +44(0)7983484387 www.erlang-solutions.com From bchesneau@REDACTED Mon Nov 11 16:54:09 2013 From: bchesneau@REDACTED (Benoit Chesneau) Date: Mon, 11 Nov 2013 16:54:09 +0100 Subject: [erlang-questions] reload application configuration In-Reply-To: References: Message-ID: On Mon, Nov 11, 2013 at 3:30 PM, Max Lapshin wrote: > I've tried different ways and now I'm working with very complicated > set_config/1 function that propagate new config to all subsystems. > > Any subsystem must handle idempotently new config and must be able either > to restart, either to set its state according to new config. > > So, initial config loading and config reloading work in the same way. > > Do you mean that you are using a custom c =onfig handler and not application env? - benoit -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Mon Nov 11 17:02:45 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 11 Nov 2013 20:02:45 +0400 Subject: [erlang-questions] reload application configuration In-Reply-To: References: Message-ID: I save resulting config in application env, but in fact I'm not using erlang application system. I don't understand how to use it if you need something more complicated than setting one integer value once on statup time. -------------- next part -------------- An HTML attachment was scrubbed... URL: From freza@REDACTED Mon Nov 11 17:06:35 2013 From: freza@REDACTED (Jachym Holecek) Date: Mon, 11 Nov 2013 11:06:35 -0500 Subject: [erlang-questions] [ANN] salt - Erlang bindings for NaCl In-Reply-To: References: <20131111030959.GA1709@circlewave.net> Message-ID: <20131111160635.GA2797@circlewave.net> # Benoit Chesneau 2013-11-11: > Where you aware of https://github.com/tonyg/erlang-nacl ? How it differs > from it? I became aware of it very late in the process. It could have been a good start had I noticed it earlier. Salt is much more complete with regards to API coverage. Erlang-nacl only has 'box', 'secretbox', 'hash' and 'randombytes' -- missing 'sign', 'auth', 'onetimeauth', 'scalarmult', 'stream', 'verify' which are present in Salt, and 'shorthash', 'generichash' which are not (yet) supported therein. Salt is safer in that it correctly offloads all (potentially) blocking operations to a background thread. With erlang-nacl, scheduler thread could at least in principle end up being stuck in /dev/random read. Salt also has a hard (though indirect) limit on latency of non-blocking operations, something left for the user to worry about with erlang-nacl. Finally, salt has something that may pass as documentation and tests, though only on a good day. :-) BR, -- Jachym From vladimir.kirichenko@REDACTED Mon Nov 11 17:08:33 2013 From: vladimir.kirichenko@REDACTED (Volodymyr Kyrychenko) Date: Mon, 11 Nov 2013 18:08:33 +0200 Subject: [erlang-questions] enif_free_env crashes VM Message-ID: <52810101.40304@gmail.com> Heya, I have big data structure and need to have massively parallel access to it. SO i invented the wheel called references. Here is how it supposed to work - it is NIF copying this BDS into process independent environment and giving processes reference to the term in that env. Sometimes structure gets updated and reference supposed to be destroyed in NIF destructor. Everything was fine until things got real with massive access. VM just gets silently crushed w/o crash_dump. It was discovered that enif_free_env do not crashes vm itself but calling it crashes VM elsewhere - probably someone tries to read dereferenced value. Am I missing something or its a bug? R15B3 Linux. Here is the code: == xl_ref.c ========================================================= #include #include ERL_NIF_TERM xl_ref_new(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); ERL_NIF_TERM xl_ref_value(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); void xl_ref_dtor(ErlNifEnv* env, void* arg); int on_load(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info); static ErlNifFunc nif_funcs[] = { {"new", 1, xl_ref_new}, {"value", 1, xl_ref_value} }; ERL_NIF_INIT(xl_ref, nif_funcs, &on_load, NULL, NULL, NULL) typedef struct { ErlNifEnv* env; ERL_NIF_TERM value; } ref_t; static ErlNifResourceType* XL_REF_RESOURCE; ERL_NIF_TERM xl_ref_new(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) { ERL_NIF_TERM object = argv[0]; ref_t* ref = (ref_t*)enif_alloc_resource(XL_REF_RESOURCE, sizeof(ref_t)); ref->env = enif_alloc_env(); ref->value = enif_make_copy(ref->env, object); ERL_NIF_TERM ref_term = enif_make_resource(env, ref); enif_release_resource(ref); return ref_term; } ERL_NIF_TERM xl_ref_value(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) { ref_t* ref; if (enif_get_resource(env, argv[0], XL_REF_RESOURCE, (void**)&ref)) return ref->value; else return enif_make_badarg(env); } void xl_ref_dtor(ErlNifEnv* env, void* arg) { ref_t* ref = (ref_t*) arg; //Here is the problem enif_free_env(ref->env); } int on_load(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info) { ErlNifResourceFlags flags = (ErlNifResourceFlags)(ERL_NIF_RT_CREATE | ERL_NIF_RT_TAKEOVER); XL_REF_RESOURCE = enif_open_resource_type(env, NULL, "xl_ref_resource", &xl_ref_dtor, flags, 0); return 0; } == xl_ref.erl ============================================== -module(xl_ref). -author("volodymyr.kyrychenko@REDACTED"). -on_load(init/0). %% API -export([new/1, value/1]). -export_type([ref/0]). -opaque(ref() :: reference()). init() -> erlang:load_nif(find_nif(xl_stdlib, ?MODULE), 0). -spec(new(term()) -> ref()). new(_X) -> erlang:nif_error(nif_not_loaded). -spec(value(ref()) -> term()). value(_R) -> erlang:nif_error(nif_not_loaded). find_nif(App, Module) -> filename:join(priv_dir(App, Module), atom_to_list(Module)). priv_dir(App, Module) -> case code:priv_dir(App) of {error, _} -> EbinDir = filename:dirname(code:which(Module)), AppPath = filename:dirname(EbinDir), filename:join(AppPath, "priv"); Path -> Path end. === xl_ref_tests.erl ========================================= -module(xl_ref_tests). -author("Volodymyr Kyrychenko "). -include_lib("eunit/include/eunit.hrl"). ref_test() -> ets:new(test, [named_table, public]), ets:insert(test, {status, false}), tree_refresh(1), spawn_link(fun() -> tree_refresh(20) end), access(self(), 100000), receive ok -> ok end, io:format(user, "done~n", []), ets:delete(t). access(Pid, 0) -> Pid ! ok; access(Pid, X) -> spawn_link(fun() -> [{t, Ref}] = ets:lookup(test, t), io:format(user, "~p\taccess start~n", [self()]), gb_trees:values(xl_ref:value(Ref)), io:format(user, "~p\taccess done~n", [self()]) end), access(Pid, X - 1). tree_refresh(0) -> ok; tree_refresh(X) -> T = lists:foldl(fun(I, Tree) -> gb_trees:insert(I, I, Tree) end, gb_trees:empty(), lists:seq(1, 10000)), Ref = xl_ref:new(T), ets:insert(test, {t, Ref}), timer:sleep(100), tree_refresh(X - 1). ================================================================= -- Volodymyr Kyrychenko From 06jameskingsbery@REDACTED Mon Nov 11 17:13:59 2013 From: 06jameskingsbery@REDACTED (James Kingsbery) Date: Mon, 11 Nov 2013 11:13:59 -0500 Subject: [erlang-questions] No producing crash dump file Message-ID: Hi All, I'm relatively new to Erlang and there's a problem I don't quite understand. I'm running ejabberd, and every so often it crashes. To figure out why it crashed, I know to look in the erl_crash.dump. The problem is, there doesn't seem to be any erl_crash.dump file. There is a core dump file though. Loading it into gdb and running "bt full," here are the top two frames: (gdb) bt full #0 0x000000000054df83 in prepare_crash_dump (secs=) at sys/unix/sys.c:735 max = env = "\005", '\000' "\200, \373!?" heart_port = 0x7fb46f31eab0 hp = 0x7fb4d6efb938 heart_fd = {865035, -1} has_heart = 0 i = envsz = heap = {4460060, 140412855877120, 1} list = 18446744073709551611 #1 erts_sys_prepare_crash_dump (secs=) at sys/unix/sys.c:780 So, it appears that it crashed while it was trying to write the crash dump, but didn't get all the way. I did some research, and it sounds a lot like a problem that had been posted earlier ( https://groups.google.com/forum/#!msg/erlang-programming/XH2Uly6hsLY/aeR2Yx2UkZMJ). Heart was not enabled on the command line, which means this shouldn't be the problem, but... in the core dump, heart_port is set to something non-null. This should mean that heart is lurking somewhere, shouldn't it? If so, is there a way to tell heart to *really* not run? Any help anyone has to offer would be greatly appreciated. Best, Jamie -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjarvstrand@REDACTED Mon Nov 11 17:25:24 2013 From: tjarvstrand@REDACTED (=?ISO-8859-1?Q?Thomas_J=E4rvstrand?=) Date: Mon, 11 Nov 2013 17:25:24 +0100 Subject: [erlang-questions] Column information in Erlang abstract format Message-ID: In http://www.erlang.org/news/35 it is stated that compiler messages will contain information about column numbers and that this will break backwards compatibility of the abstract format. Is there currently any way to access an abstract format code representation that contains information about column numbers? Thomas -------------- next part -------------- An HTML attachment was scrubbed... URL: From freza@REDACTED Mon Nov 11 17:43:10 2013 From: freza@REDACTED (Jachym Holecek) Date: Mon, 11 Nov 2013 11:43:10 -0500 Subject: [erlang-questions] enif_free_env crashes VM In-Reply-To: <52810101.40304@gmail.com> References: <52810101.40304@gmail.com> Message-ID: <20131111164310.GA11635@circlewave.net> Hi, # Volodymyr Kyrychenko 2013-11-11: > I have big data structure and need to have massively parallel access to > it. SO i invented the wheel called references. Here is how it supposed > to work - it is NIF copying this BDS into process independent > environment and giving processes reference to the term in that env. This is not allowed. Excerpt from erl_nif(3): A process bound environment is passed as the first argument to all NIFs. All function arguments passed to a NIF will belong to that environment. The return value from a NIF must also be a term belonging to the same environment. I'm looking at R14B04 version of the manpage. > == xl_ref.c ========================================================= > > #include > #include > > [...] > > ERL_NIF_TERM xl_ref_value(ErlNifEnv* env, int argc, const ERL_NIF_TERM > argv[]) { > ref_t* ref; > if (enif_get_resource(env, argv[0], XL_REF_RESOURCE, (void**)&ref)) > return ref->value; This is where the violation happens. > else > return enif_make_badarg(env); > } BR, -- Jachym From lukas@REDACTED Mon Nov 11 18:07:12 2013 From: lukas@REDACTED (Lukas Larsson) Date: Mon, 11 Nov 2013 18:07:12 +0100 Subject: [erlang-questions] Column information in Erlang abstract format In-Reply-To: References: Message-ID: Hello Thomas, That patch has been delayed and has not been included yet. To follow the progress of the patch see this thread on erlang-patches: http://erlang.org/pipermail/erlang-patches/2013-October/004358.html Lukas On Mon, Nov 11, 2013 at 5:25 PM, Thomas J?rvstrand wrote: > In http://www.erlang.org/news/35 it is stated that compiler messages will > contain information about column numbers and that this will break > backwards compatibility of the abstract format. > > Is there currently any way to access an abstract format code > representation that contains information about column numbers? > > Thomas > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tthread@REDACTED Tue Nov 12 03:00:52 2013 From: tthread@REDACTED (Ilya Shcherbak) Date: Tue, 12 Nov 2013 09:00:52 +0700 Subject: [erlang-questions] EPMD enhancement Message-ID: Hello, well known that EPMD has a some challenges. The main issue that the control connection and data transfer is the same. So that it would be great to have another EPMD implementation. List do you know the sort of that? -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgolovan@REDACTED Tue Nov 12 06:07:05 2013 From: sgolovan@REDACTED (Sergei Golovan) Date: Tue, 12 Nov 2013 09:07:05 +0400 Subject: [erlang-questions] EPMD enhancement In-Reply-To: References: Message-ID: Hi! On Tue, Nov 12, 2013 at 6:00 AM, Ilya Shcherbak wrote: > Hello, > well known that EPMD has a some challenges. The main issue that the control > connection and data transfer is the same. So that it would be great to have > another EPMD implementation. If we talk about EPMD, I'd like to add another problem with the current design. It really can't be used in multiuser environment because the first user who runs a distributed Erlang node will spawn a epmd process (and will be able to kill it bringing the entire node down). Cheers! -- Sergei Golovan From bchesneau@REDACTED Tue Nov 12 08:41:59 2013 From: bchesneau@REDACTED (Benoit Chesneau) Date: Tue, 12 Nov 2013 08:41:59 +0100 Subject: [erlang-questions] [ANN] salt - Erlang bindings for NaCl In-Reply-To: <20131111160635.GA2797@circlewave.net> References: <20131111030959.GA1709@circlewave.net> <20131111160635.GA2797@circlewave.net> Message-ID: On Mon, Nov 11, 2013 at 5:06 PM, Jachym Holecek wrote: > # Benoit Chesneau 2013-11-11: > > Where you aware of https://github.com/tonyg/erlang-nacl ? How it differs > > from it? > > I became aware of it very late in the process. It could have been a good > start had I noticed it earlier. > > Salt is much more complete with regards to API coverage. Erlang-nacl only > has 'box', 'secretbox', 'hash' and 'randombytes' -- missing 'sign', 'auth', > 'onetimeauth', 'scalarmult', 'stream', 'verify' which are present in Salt, > and 'shorthash', 'generichash' which are not (yet) supported therein. > > Salt is safer in that it correctly offloads all (potentially) blocking > operations to a background thread. With erlang-nacl, scheduler thread > could at least in principle end up being stuck in /dev/random read. > > Salt also has a hard (though indirect) limit on latency of non-blocking > operations, something left for the user to worry about with erlang-nacl. > > Finally, salt has something that may pass as documentation and tests, > though only on a good day. :-) > > BR, > -- Jachym > Thanks for the explanations. I will try! :) - benoit -------------- next part -------------- An HTML attachment was scrubbed... URL: From lemenkov@REDACTED Tue Nov 12 09:13:43 2013 From: lemenkov@REDACTED (Peter Lemenkov) Date: Tue, 12 Nov 2013 12:13:43 +0400 Subject: [erlang-questions] EPMD enhancement In-Reply-To: References: Message-ID: Hello All! 2013/11/12 Sergei Golovan : > If we talk about EPMD, I'd like to add another problem with the > current design. It really can't be used in multiuser environment > because the first user who runs a distributed Erlang node will spawn a > epmd process (and will be able to kill it bringing the entire node > down). Sergei, are you in Moscow by any chance? If yes, then I'd like to invite you to the next Moscow Golang Users Meetup which is scheduled for 20, November: http://www.meetup.com/Golang-Moscow/events/147393632/ I plan to introduce our approach to this problem (which becomes even more visible when using systemd or Upstart): http://peter.fedorapeople.org/presentations/Moscow%20Golang%20Users%20Meetup%202013-11-20%20Fedora%20and%20Golang.en.pdf Perhaps this would be interesting to the Debian Community as well. -- With best regards, Peter Lemenkov. From sgolovan@REDACTED Tue Nov 12 09:37:43 2013 From: sgolovan@REDACTED (Sergei Golovan) Date: Tue, 12 Nov 2013 12:37:43 +0400 Subject: [erlang-questions] EPMD enhancement In-Reply-To: References: Message-ID: Hi Peter, On Tue, Nov 12, 2013 at 12:13 PM, Peter Lemenkov wrote: > Hello All! > > 2013/11/12 Sergei Golovan : > >> If we talk about EPMD, I'd like to add another problem with the >> current design. It really can't be used in multiuser environment >> because the first user who runs a distributed Erlang node will spawn a >> epmd process (and will be able to kill it bringing the entire node >> down). > > Sergei, are you in Moscow by any chance? If yes, then I'd like to > invite you to the next Moscow Golang Users Meetup which is scheduled > for 20, November: I am in Moscow, but Wednesday is my busy day, so I'm not sure if I could go to the meetup. I'll try though. Cheers! -- Sergei Golovan From baliulia@REDACTED Tue Nov 12 11:17:25 2013 From: baliulia@REDACTED (=?UTF-8?B?SWduYXMgVnnFoW5pYXVza2Fz?=) Date: Tue, 12 Nov 2013 11:17:25 +0100 Subject: [erlang-questions] reload application configuration In-Reply-To: References: Message-ID: <52820035.2060004@gmail.com> Hi, I've too struggled with this problem quite a few times. One thing I never got to try out: What about pushing relups with only configuration data changed? Then you get versioning for free, you can also specify how each application should deal with the new configuration data (just update it / stop / restart gen_servers, etc). You get all the release goodies and would basically just need to write some scripts to generate "light" relups. Your application's would also need to have a proper `config_changed/2` callback, but this IMHO is much nicer than rolling your own thing. If you are doing releases and relups already (and you should!) then this seems like a decent path to follow. -- Ignas From serge@REDACTED Tue Nov 12 14:17:35 2013 From: serge@REDACTED (Serge Aleynikov) Date: Tue, 12 Nov 2013 08:17:35 -0500 Subject: [erlang-questions] EPMD enhancement In-Reply-To: References: Message-ID: You may also want to take a look at my patch (*) that extends functionality of EPMD and net_kernel by allowing nodes to register multiple transport protocols, and adds finer control over which transport to use for connecting to a given node. Regards, Serge (*) https://github.com/erlang/otp/pull/121 On Tue, Nov 12, 2013 at 3:13 AM, Peter Lemenkov wrote: > Hello All! > > 2013/11/12 Sergei Golovan : > > > If we talk about EPMD, I'd like to add another problem with the > > current design. It really can't be used in multiuser environment > > because the first user who runs a distributed Erlang node will spawn a > > epmd process (and will be able to kill it bringing the entire node > > down). > > Sergei, are you in Moscow by any chance? If yes, then I'd like to > invite you to the next Moscow Golang Users Meetup which is scheduled > for 20, November: > > http://www.meetup.com/Golang-Moscow/events/147393632/ > > I plan to introduce our approach to this problem (which becomes even > more visible when using systemd or Upstart): > > > http://peter.fedorapeople.org/presentations/Moscow%20Golang%20Users%20Meetup%202013-11-20%20Fedora%20and%20Golang.en.pdf > > Perhaps this would be interesting to the Debian Community as well. > > > -- > With best regards, Peter Lemenkov. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From akonsu@REDACTED Tue Nov 12 19:38:49 2013 From: akonsu@REDACTED (akonsu) Date: Tue, 12 Nov 2013 13:38:49 -0500 Subject: [erlang-questions] ETS tables and pubsub Message-ID: I have a pubsub system which has a single publisher process that maintains all its subscriber processes' Pid's in an ETS table. The publisher monitors its subscribers and when the publisher receives DOWN message, it removes the subscriber Pid from the table. The table entries are tuples of the form {MonitorRef, SubscriberPid}, and the MonitorRef is used as the key. Now I would like to make sure that if the publisher dies, and gets restarted by its supervisor, the subscriber table is preserved. So I created a process that creates the ETS table, sets the table's heir to self(), and then gives away the table to the publisher. The problem is that I do not know how to handle transfer of the table from the heir to the publisher: when publisher receives the table, the table contains a list of tuples {MonitorRef, SubscriberPid}, but the MonitorRefs were created by the previous publisher instance, so when the new publisher receives ETS_TRANSFER it needs to monitor all these SubscriberPids again. what is the best way to do it? Loop over all ETS entries, attach a monitor to each and reenter the new MonitorRefs into the table? This might be slow, no? Maybe my architecture can be improved? Any advice? thanks Konstantin -------------- next part -------------- An HTML attachment was scrubbed... URL: From nem@REDACTED Tue Nov 12 22:09:02 2013 From: nem@REDACTED (Geoff Cant) Date: Tue, 12 Nov 2013 13:09:02 -0800 Subject: [erlang-questions] reload application configuration In-Reply-To: <52820035.2060004@gmail.com> References: <52820035.2060004@gmail.com> Message-ID: <2F0F21C0-E644-4E19-87CF-B9487AA4A25B@erlang.geek.nz> We use the OTP application environment for configuration data almost exclusively in the systems we build at Heroku. Logplex ( https://github.com/heroku/logplex ) is an example of one of these. We do a few things to make it more usable for us. * application:get_env(my_app, key). is really fast - it's just an ETS read, so do it pretty much everywhere except in a tight loop. -- https://github.com/heroku/logplex/blob/master/src/logplex_message.erl#L73 * This means your app automatically pick up and use changes in this configuration. * If you have a tcp listener, don't pass its Port configuration via supervisor start arguments, have the init routine for the listener read application:get_env -- https://github.com/heroku/logplex/blob/master/src/tcp_acceptor.erl#L57 * This allows you to update the app_env config and then apply it by doing a terminate_child and restart_child on the listener process from the supervisor. * If you read configuration from the unix environment into your OTP app environment, maybe use a library to make that less painful. https://github.com/heroku/logplex/blob/master/src/logplex_app.erl#L84 and https://github.com/heroku/stillir When we used to cache configuration all over the place in gen_server state and supervisor child specs, updating the configuration was really difficult. Now that we avoid that, we find the OTP app env really good for configuration data and like the centralised storage in ETS, the ability to inspect it with get_all_env, quick updates and all the support for -app env_key env_value, -config .config and so on. Cheers, -- Geoff Cant On 2013-11-12, at 02:17 , Ignas Vy?niauskas wrote: > Hi, > > I've too struggled with this problem quite a few times. > > One thing I never got to try out: What about pushing relups with only > configuration data changed? Then you get versioning for free, you can > also specify how each application should deal with the new configuration > data (just update it / stop / restart gen_servers, etc). > > You get all the release goodies and would basically just need to write > some scripts to generate "light" relups. > > Your application's would also need to have a proper `config_changed/2` > callback, but this IMHO is much nicer than rolling your own thing. > > If you are doing releases and relups already (and you should!) then this > seems like a decent path to follow. > > -- > Ignas > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mangalaman93@REDACTED Wed Nov 13 01:04:07 2013 From: mangalaman93@REDACTED (aman mangal) Date: Wed, 13 Nov 2013 05:34:07 +0530 Subject: [erlang-questions] lager error because of update in goldrush Message-ID: Hi, I recompiled one of my old erlang project and found out that due to recent update in goldrush and lager, I am not able to start lager. when I run application:start(lager) I get the following error- {error,{not_started,goldrush}} any help would be appreciated. Thank you! Aman Mangal 4th year Undergraduate Student Department of Computer Science & Engineering IIT Bombay www.cse.iitb.ac.in/~amanmangal -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Wed Nov 13 01:09:40 2013 From: mononcqc@REDACTED (Fred Hebert) Date: Tue, 12 Nov 2013 19:09:40 -0500 Subject: [erlang-questions] lager error because of update in goldrush In-Reply-To: References: Message-ID: <20131113000939.GB21093@ferdmbp.local> Hi, The solution is to also start goldrush before starting lager, as the message says. Since R16B02 you can get it out of the way for good by calling application:ensure_all_started(lager), which will recursively boot the lager dependencies and return a list of all started apps. Regards, Fred. On 11/13, aman mangal wrote: > Hi, > > I recompiled one of my old erlang project and found out that due to recent > update in goldrush and lager, I am not able to start lager. when I run > application:start(lager) I get the following > error- {error,{not_started,goldrush}} > > any help would be appreciated. > Thank you! > > Aman Mangal > 4th year Undergraduate Student > Department of Computer Science & Engineering > IIT Bombay > www.cse.iitb.ac.in/~amanmangal > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mangalaman93@REDACTED Wed Nov 13 02:35:56 2013 From: mangalaman93@REDACTED (aman mangal) Date: Wed, 13 Nov 2013 07:05:56 +0530 Subject: [erlang-questions] lager error because of update in goldrush In-Reply-To: <20131113000939.GB21093@ferdmbp.local> References: <20131113000939.GB21093@ferdmbp.local> Message-ID: Hi, yup, thank you so much! I forgot to update my erlang version. Aman Mangal 4th year Undergraduate Student Department of Computer Science & Engineering IIT Bombay www.cse.iitb.ac.in/~amanmangal On Wed, Nov 13, 2013 at 5:39 AM, Fred Hebert wrote: > Hi, > > The solution is to also start goldrush before starting lager, as the > message says. > > Since R16B02 you can get it out of the way for good by calling > application:ensure_all_started(lager), which will recursively boot the > lager dependencies and return a list of all started apps. > > Regards, > Fred. > > On 11/13, aman mangal wrote: > > Hi, > > > > I recompiled one of my old erlang project and found out that due to > recent > > update in goldrush and lager, I am not able to start lager. when I run > > application:start(lager) I get the following > > error- {error,{not_started,goldrush}} > > > > any help would be appreciated. > > Thank you! > > > > Aman Mangal > > 4th year Undergraduate Student > > Department of Computer Science & Engineering > > IIT Bombay > > www.cse.iitb.ac.in/~amanmangal > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew@REDACTED Wed Nov 13 03:40:02 2013 From: andrew@REDACTED (Andrew Thompson) Date: Tue, 12 Nov 2013 21:40:02 -0500 Subject: [erlang-questions] lager error because of update in goldrush In-Reply-To: References: <20131113000939.GB21093@ferdmbp.local> Message-ID: <20131113024002.GE8377@hijacked.us> On Wed, Nov 13, 2013 at 07:05:56AM +0530, aman mangal wrote: > Hi, > > yup, thank you so much! I forgot to update my erlang version. > lager:start() is provided for this reason (also so you can do -s lager from the command line). Andrew From barcojie@REDACTED Wed Nov 13 06:19:41 2013 From: barcojie@REDACTED (Barco You) Date: Wed, 13 Nov 2013 13:19:41 +0800 Subject: [erlang-questions] ETS tables and pubsub In-Reply-To: References: Message-ID: Why don't you use gproc? On Wed, Nov 13, 2013 at 2:38 AM, akonsu wrote: > I have a pubsub system which has a single publisher process that maintains > all its subscriber processes' Pid's in an ETS table. > > The publisher monitors its subscribers and when the publisher receives > DOWN message, it removes the subscriber Pid from the table. > > The table entries are tuples of the form {MonitorRef, SubscriberPid}, and > the MonitorRef is used as the key. > > Now I would like to make sure that if the publisher dies, and gets > restarted by its supervisor, the subscriber table is preserved. So I > created a process that creates the ETS table, sets the table's heir to > self(), and then gives away the table to the publisher. > > The problem is that I do not know how to handle transfer of the table from > the heir to the publisher: > > when publisher receives the table, the table contains a list of tuples > {MonitorRef, SubscriberPid}, but the MonitorRefs were created by the > previous publisher instance, so when the new publisher receives > ETS_TRANSFER it needs to monitor all these SubscriberPids again. > > what is the best way to do it? Loop over all ETS entries, attach a monitor > to each and reenter the new MonitorRefs into the table? This might be slow, > no? Maybe my architecture can be improved? Any advice? > > thanks > Konstantin > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tthread@REDACTED Wed Nov 13 03:53:51 2013 From: tthread@REDACTED (Ilya Shcherbak) Date: Wed, 13 Nov 2013 09:53:51 +0700 Subject: [erlang-questions] EPMD enhancement In-Reply-To: References: Message-ID: Serge, thanks a lot. That is what I need and I'll take a look at it. I hope that the patch will be in the OTP as soon as possible. 2013/11/12 Serge Aleynikov > You may also want to take a look at my patch (*) that extends > functionality of EPMD and net_kernel by allowing nodes to register multiple > transport protocols, and adds finer control over which transport to use for > connecting to a given node. > > Regards, > > Serge > > (*) https://github.com/erlang/otp/pull/121 > > > On Tue, Nov 12, 2013 at 3:13 AM, Peter Lemenkov wrote: > >> Hello All! >> >> 2013/11/12 Sergei Golovan : >> >> > If we talk about EPMD, I'd like to add another problem with the >> > current design. It really can't be used in multiuser environment >> > because the first user who runs a distributed Erlang node will spawn a >> > epmd process (and will be able to kill it bringing the entire node >> > down). >> >> Sergei, are you in Moscow by any chance? If yes, then I'd like to >> invite you to the next Moscow Golang Users Meetup which is scheduled >> for 20, November: >> >> http://www.meetup.com/Golang-Moscow/events/147393632/ >> >> I plan to introduce our approach to this problem (which becomes even >> more visible when using systemd or Upstart): >> >> >> http://peter.fedorapeople.org/presentations/Moscow%20Golang%20Users%20Meetup%202013-11-20%20Fedora%20and%20Golang.en.pdf >> >> Perhaps this would be interesting to the Debian Community as well. >> >> >> -- >> With best regards, Peter Lemenkov. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From desired.mta@REDACTED Wed Nov 13 16:01:32 2013 From: desired.mta@REDACTED (=?UTF-8?Q?Motiejus_Jak=C5=A1tys?=) Date: Wed, 13 Nov 2013 16:01:32 +0100 Subject: [erlang-questions] need Debian Mentor (to package piqi) Message-ID: Hello all, I am an active user of piqi[1]. It is an Erlang/OCaml software package created by Anton Lavrik to work with structured data (mainly JSON, XML and google protocol buffers). 7 months ago I packaged it to DEB and RPM and put it to public repositories[2][3]. We have been using the packaged version since then and it works very reliably. We believe piqi(-deb) is stable enough and it is time to upload it to debian packages. However, I am not a Debian Developer, thus looking for a mentor. If you know me and/or are interested in helping to package piqi, I ask you to "mentor" me. I am familiar enough around Debian, so "mentoring" is basically checking & uploading a package prepared by me. If you can mentor me (or even better, if you know me, recommend for a Debian Maintainer, even less hassle), it would be highly appreciated by me and piqi community as it would make its installation and usage one bit easier. Thanks! Motiejus Jak?tys [1]: http://piqi.org/ [2]: https://launchpad.net/~motiejus/+archive/piqi [3]: https://build.opensuse.org/package/show?package=piqi&project=home%3Amotiejusj From Mark.deVilliers@REDACTED Wed Nov 13 16:01:40 2013 From: Mark.deVilliers@REDACTED (Mark DeVilliers) Date: Wed, 13 Nov 2013 15:01:40 +0000 Subject: [erlang-questions] ETS tables and pubsub In-Reply-To: References: Message-ID: Does this help - http://steve.vinoski.net/blog/2011/03/23/dont-lose-your-ets-tables/ and http://steve.vinoski.net/blog/2013/05/08/implementation-of-dont-lose-your-ets-tables/ Mark From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Barco You Sent: 13 November 2013 05:20 To: akonsu Cc: erlang-questions Subject: Re: [erlang-questions] ETS tables and pubsub Why don't you use gproc? On Wed, Nov 13, 2013 at 2:38 AM, akonsu > wrote: I have a pubsub system which has a single publisher process that maintains all its subscriber processes' Pid's in an ETS table. The publisher monitors its subscribers and when the publisher receives DOWN message, it removes the subscriber Pid from the table. The table entries are tuples of the form {MonitorRef, SubscriberPid}, and the MonitorRef is used as the key. Now I would like to make sure that if the publisher dies, and gets restarted by its supervisor, the subscriber table is preserved. So I created a process that creates the ETS table, sets the table's heir to self(), and then gives away the table to the publisher. The problem is that I do not know how to handle transfer of the table from the heir to the publisher: when publisher receives the table, the table contains a list of tuples {MonitorRef, SubscriberPid}, but the MonitorRefs were created by the previous publisher instance, so when the new publisher receives ETS_TRANSFER it needs to monitor all these SubscriberPids again. what is the best way to do it? Loop over all ETS entries, attach a monitor to each and reenter the new MonitorRefs into the table? This might be slow, no? Maybe my architecture can be improved? Any advice? thanks Konstantin _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From cmeiklejohn@REDACTED Wed Nov 13 18:50:19 2013 From: cmeiklejohn@REDACTED (Christopher Meiklejohn) Date: Wed, 13 Nov 2013 12:50:19 -0500 Subject: [erlang-questions] ETS tables and pubsub In-Reply-To: References: Message-ID: On Wednesday, November 13, 2013 at 12:19 AM, Barco You wrote: > Why don't you use gproc? Last time I checked, gproc isn?t super reliable under failure conditions in global distribution mode. Garret and Ulf have discussed it on erlang-questions [1], section 10 of Ulf?s Erlang Workshop paper [2] covers quite a bit about it, and I?ve also written about it [3]. [1] http://erlang.org/pipermail/erlang-questions/2012-July/067749.html [2] http://svn.ulf.wiger.net/gproc/doc/erlang07-wiger.pdf [3] http://christophermeiklejohn.com/erlang/2013/06/05/erlang-gproc-failure-semantics.html - Chris > On Wed, Nov 13, 2013 at 2:38 AM, akonsu wrote: > > I have a pubsub system which has a single publisher process that maintains all its subscriber processes' Pid's in an ETS table. > > > > The publisher monitors its subscribers and when the publisher receives DOWN message, it removes the subscriber Pid from the table. > > > > The table entries are tuples of the form {MonitorRef, SubscriberPid}, and the MonitorRef is used as the key. > > > > Now I would like to make sure that if the publisher dies, and gets restarted by its supervisor, the subscriber table is preserved. So I created a process that creates the ETS table, sets the table's heir to self(), and then gives away the table to the publisher. > > > > The problem is that I do not know how to handle transfer of the table from the heir to the publisher: > > > > when publisher receives the table, the table contains a list of tuples {MonitorRef, SubscriberPid}, but the MonitorRefs were created by the previous publisher instance, so when the new publisher receives ETS_TRANSFER it needs to monitor all these SubscriberPids again. > > > > what is the best way to do it? Loop over all ETS entries, attach a monitor to each and reenter the new MonitorRefs into the table? This might be slow, no? Maybe my architecture can be improved? Any advice? > > > > thanks > > Konstantin > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > http://erlang.org/mailman/listinfo/erlang-questions From bile@REDACTED Wed Nov 13 19:11:24 2013 From: bile@REDACTED (Antonio SJ Musumeci) Date: Wed, 13 Nov 2013 13:11:24 -0500 Subject: [erlang-questions] Arch Linux patches? In-Reply-To: <52739262.5070402@gmail.com> References: <5272C2BF.5050808@online.fr> <5272CA2C.1050908@ninenines.eu> <922D5B5A-64A7-4A36-8F4C-45F8BDBEB813@gmail.com> <5273800E.4050501@ninenines.eu> <52739262.5070402@gmail.com> Message-ID: Any developments? Curious to find the reason for this. On Fri, Nov 1, 2013 at 7:37 AM, Aaron France wrote: > Are they both using the exact same commit? > > > On 01/11/13 11:18, Lo?c Hoguin wrote: >> >> I'm sure there's a reasonable explanation. >> >> Trying with Cowboy's hello_world package, the dumbest benchmark you can >> do. Using siege for this, using the default conf file except verbose set to >> false. >> >> To compile the example: >> >> % make >> % ./_rel/bin/hello_world_example console >> >> You will have to recompile it when switching Erlang installs of course, as >> it's a release and the VM files are copied. >> >> Pacman install: >> >> % erl >> Erlang R16B02 (erts-5.10.3) [source] [64-bit] [smp:4:4] [async-threads:10] >> [hipe] [kernel-poll:false] >> ... >> % siege -b -c 100 -t 5s http://127.0.0.1:8080 >> ** SIEGE 3.0.5 >> ** Preparing 100 concurrent users for battle. >> The server is now under siege... >> Lifting the server siege... done. >> >> Transactions: 186841 hits >> Availability: 100.00 % >> Elapsed time: 14.41 secs >> Data transferred: 2.14 MB >> Response time: 0.01 secs >> Transaction rate: 12966.07 trans/sec >> Throughput: 0.15 MB/sec >> Concurrency: 99.52 >> Successful transactions: 186841 >> Failed transactions: 0 >> Longest transaction: 0.06 >> Shortest transaction: 0.00 >> >> Kerl install (no option, just build, install, activate, and of course >> example rebuilt from scratch): >> >> % erl >> Erlang R16B02 (erts-5.10.3) [source] [64-bit] [smp:4:4] [async-threads:10] >> [hipe] [kernel-poll:false] >> ... >> % siege -b -c 100 -t 5s http://127.0.0.1:8080 >> ** SIEGE 3.0.5 >> ** Preparing 100 concurrent users for battle. >> The server is now under siege... >> Lifting the server siege... done. >> >> Transactions: 121051 hits >> Availability: 100.00 % >> Elapsed time: 14.37 secs >> Data transferred: 1.39 MB >> Response time: 0.01 secs >> Transaction rate: 8423.87 trans/sec >> Throughput: 0.10 MB/sec >> Concurrency: 99.65 >> Successful transactions: 121051 >> Failed transactions: 0 >> Longest transaction: 0.04 >> Shortest transaction: 0.00 >> >> Your guess is as good as mine. >> >> On 11/01/2013 10:28 AM, Aaron France wrote: >>> >>> Hi, >>> >>> I'd hate to sound like a party-pooper but I'm very much inclined to say >>> that this endeavour is not a very fruitful one. >>> >>> Arch essentially just packages upstream. It's quite likely any >>> performance gains you see are simply factors mainly a newer kernel and >>> more up-to-date packages. >>> >>> That said, I'll happily entertain the idea that Arch is somehow a >>> performance distro. >>> >>> Aaron >>> >>> >>> On 01/11/13 06:07, Dmitry Kolesnikov wrote: >>>> >>>> What are test cases you run to validate performance? And What was >>>> environment? >>>> >>>> >>>> Best Regards, >>>> Dmitry >-|-|-*> >>>> >>>> >>>>> On 31.10.2013, at 23.22, Lo?c Hoguin wrote: >>>>> >>>>> I know the Makefile doesn't seem to do anything but last I checked >>>>> (been a while) I had better performance with the precompiled version >>>>> compared to compiling with kerl (I'm not sure if I tried with manual >>>>> compilation). >>>>> >>>>> I'll check again tomorrow. >>>>> >>>>>> On 10/31/2013 10:04 PM, Aaron France wrote: >>>>>> Demonstrably false. >>>>>> >>>>>> ArchLinux uses https://gist.github.com/AeroNotix/7257133 this to build >>>>>> it's package, no patches, no wicked switches, just a plain makefile. >>>>>> >>>>>> Aaron >>>>>> >>>>>> >>>>>> On Thu, Oct 31, 2013 at 9:51 PM, Olivier Boudeville >>>>>> > >>>>>> wrote: >>>>>> >>>>>> Hi, >>>>>> >>>>>> I may be wrong but I think that, some time ago, someone (maybe >>>>>> Lo?c?) mentioned incidentally in this mailing list that the Arch >>>>>> Linux version of Erlang (obtained through pacman) was reported to >>>>>> be, at least in some cases, significantly more efficient than the >>>>>> stock, official version (the trouble is that I can't find that >>>>>> message from the list archives). >>>>>> >>>>>> I was wondering if it had been confirmed, and, if yes, if there >>>>>> were >>>>>> some patches sent upstream by the Arch maintainers that could be >>>>>> fruitfully applied to the official sources? >>>>>> >>>>>> Thanks for any information! >>>>>> >>>>>> Cheers, >>>>>> >>>>>> Olivier. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> _________________________________________________ >>>>>> erlang-questions mailing list >>>>>> erlang-questions@REDACTED >>>>>> http://erlang.org/mailman/__listinfo/erlang-questions >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> erlang-questions mailing list >>>>>> erlang-questions@REDACTED >>>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>> >>>>> >>>>> -- >>>>> Lo?c Hoguin >>>>> Erlang Cowboy >>>>> Nine Nines >>>>> http://ninenines.eu >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From aaron.l.france@REDACTED Wed Nov 13 19:40:25 2013 From: aaron.l.france@REDACTED (Aaron France) Date: Wed, 13 Nov 2013 19:40:25 +0100 Subject: [erlang-questions] Arch Linux patches? In-Reply-To: References: <5272C2BF.5050808@online.fr> <5272CA2C.1050908@ninenines.eu> <922D5B5A-64A7-4A36-8F4C-45F8BDBEB813@gmail.com> <5273800E.4050501@ninenines.eu> <52739262.5070402@gmail.com> Message-ID: Hi, I didn't really have time to get into this. I'd be interesting what the build parameters are for kerl on Arch. How do I extract them? On Wed, Nov 13, 2013 at 7:11 PM, Antonio SJ Musumeci wrote: > Any developments? Curious to find the reason for this. > > On Fri, Nov 1, 2013 at 7:37 AM, Aaron France > wrote: > > Are they both using the exact same commit? > > > > > > On 01/11/13 11:18, Lo?c Hoguin wrote: > >> > >> I'm sure there's a reasonable explanation. > >> > >> Trying with Cowboy's hello_world package, the dumbest benchmark you can > >> do. Using siege for this, using the default conf file except verbose > set to > >> false. > >> > >> To compile the example: > >> > >> % make > >> % ./_rel/bin/hello_world_example console > >> > >> You will have to recompile it when switching Erlang installs of course, > as > >> it's a release and the VM files are copied. > >> > >> Pacman install: > >> > >> % erl > >> Erlang R16B02 (erts-5.10.3) [source] [64-bit] [smp:4:4] > [async-threads:10] > >> [hipe] [kernel-poll:false] > >> ... > >> % siege -b -c 100 -t 5s http://127.0.0.1:8080 > >> ** SIEGE 3.0.5 > >> ** Preparing 100 concurrent users for battle. > >> The server is now under siege... > >> Lifting the server siege... done. > >> > >> Transactions: 186841 hits > >> Availability: 100.00 % > >> Elapsed time: 14.41 secs > >> Data transferred: 2.14 MB > >> Response time: 0.01 secs > >> Transaction rate: 12966.07 trans/sec > >> Throughput: 0.15 MB/sec > >> Concurrency: 99.52 > >> Successful transactions: 186841 > >> Failed transactions: 0 > >> Longest transaction: 0.06 > >> Shortest transaction: 0.00 > >> > >> Kerl install (no option, just build, install, activate, and of course > >> example rebuilt from scratch): > >> > >> % erl > >> Erlang R16B02 (erts-5.10.3) [source] [64-bit] [smp:4:4] > [async-threads:10] > >> [hipe] [kernel-poll:false] > >> ... > >> % siege -b -c 100 -t 5s http://127.0.0.1:8080 > >> ** SIEGE 3.0.5 > >> ** Preparing 100 concurrent users for battle. > >> The server is now under siege... > >> Lifting the server siege... done. > >> > >> Transactions: 121051 hits > >> Availability: 100.00 % > >> Elapsed time: 14.37 secs > >> Data transferred: 1.39 MB > >> Response time: 0.01 secs > >> Transaction rate: 8423.87 trans/sec > >> Throughput: 0.10 MB/sec > >> Concurrency: 99.65 > >> Successful transactions: 121051 > >> Failed transactions: 0 > >> Longest transaction: 0.04 > >> Shortest transaction: 0.00 > >> > >> Your guess is as good as mine. > >> > >> On 11/01/2013 10:28 AM, Aaron France wrote: > >>> > >>> Hi, > >>> > >>> I'd hate to sound like a party-pooper but I'm very much inclined to say > >>> that this endeavour is not a very fruitful one. > >>> > >>> Arch essentially just packages upstream. It's quite likely any > >>> performance gains you see are simply factors mainly a newer kernel and > >>> more up-to-date packages. > >>> > >>> That said, I'll happily entertain the idea that Arch is somehow a > >>> performance distro. > >>> > >>> Aaron > >>> > >>> > >>> On 01/11/13 06:07, Dmitry Kolesnikov wrote: > >>>> > >>>> What are test cases you run to validate performance? And What was > >>>> environment? > >>>> > >>>> > >>>> Best Regards, > >>>> Dmitry >-|-|-*> > >>>> > >>>> > >>>>> On 31.10.2013, at 23.22, Lo?c Hoguin wrote: > >>>>> > >>>>> I know the Makefile doesn't seem to do anything but last I checked > >>>>> (been a while) I had better performance with the precompiled version > >>>>> compared to compiling with kerl (I'm not sure if I tried with manual > >>>>> compilation). > >>>>> > >>>>> I'll check again tomorrow. > >>>>> > >>>>>> On 10/31/2013 10:04 PM, Aaron France wrote: > >>>>>> Demonstrably false. > >>>>>> > >>>>>> ArchLinux uses https://gist.github.com/AeroNotix/7257133 this to > build > >>>>>> it's package, no patches, no wicked switches, just a plain makefile. > >>>>>> > >>>>>> Aaron > >>>>>> > >>>>>> > >>>>>> On Thu, Oct 31, 2013 at 9:51 PM, Olivier Boudeville > >>>>>> >> > >>>>>> wrote: > >>>>>> > >>>>>> Hi, > >>>>>> > >>>>>> I may be wrong but I think that, some time ago, someone (maybe > >>>>>> Lo?c?) mentioned incidentally in this mailing list that the > Arch > >>>>>> Linux version of Erlang (obtained through pacman) was reported > to > >>>>>> be, at least in some cases, significantly more efficient than > the > >>>>>> stock, official version (the trouble is that I can't find that > >>>>>> message from the list archives). > >>>>>> > >>>>>> I was wondering if it had been confirmed, and, if yes, if there > >>>>>> were > >>>>>> some patches sent upstream by the Arch maintainers that could > be > >>>>>> fruitfully applied to the official sources? > >>>>>> > >>>>>> Thanks for any information! > >>>>>> > >>>>>> Cheers, > >>>>>> > >>>>>> Olivier. > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> _________________________________________________ > >>>>>> erlang-questions mailing list > >>>>>> erlang-questions@REDACTED erlang-questions@REDACTED> > >>>>>> http://erlang.org/mailman/__listinfo/erlang-questions > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> _______________________________________________ > >>>>>> erlang-questions mailing list > >>>>>> erlang-questions@REDACTED > >>>>>> http://erlang.org/mailman/listinfo/erlang-questions > >>>>> > >>>>> > >>>>> -- > >>>>> Lo?c Hoguin > >>>>> Erlang Cowboy > >>>>> Nine Nines > >>>>> http://ninenines.eu > >>>>> _______________________________________________ > >>>>> erlang-questions mailing list > >>>>> erlang-questions@REDACTED > >>>>> http://erlang.org/mailman/listinfo/erlang-questions > >> > >> > >> > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From garret.smith@REDACTED Wed Nov 13 20:13:08 2013 From: garret.smith@REDACTED (Garret Smith) Date: Wed, 13 Nov 2013 11:13:08 -0800 Subject: [erlang-questions] ETS tables and pubsub In-Reply-To: References: Message-ID: I know Ulf has been doing some work on gproc to make it handle netsplits better. I keep meaning to try it out... http://erlang.org/pipermail/erlang-questions/2013-June/074345.html For me, I'm using a combination of gen_leader and local-only gproc. My application has partitioned graphs of data flow & process interaction, so I can use gen_leader to manage moving entire graphs between nodes and local gproc for processes within a graph to find each other. A generic process registry that handles netsplit and nodes entering and leaving the cluster is a Very Hard Problem(TM). You'd still have to write some bits yourself, like how to merge registries after a netsplit. That's why a lot of application-specific solutions (like mine) exist to exploit the inherent properties of the problem. -Garret Smith On Wed, Nov 13, 2013 at 9:50 AM, Christopher Meiklejohn < cmeiklejohn@REDACTED> wrote: > On Wednesday, November 13, 2013 at 12:19 AM, Barco You wrote: > > Why don't you use gproc? > > Last time I checked, gproc isn?t super reliable under failure conditions > in global distribution mode. > > Garret and Ulf have discussed it on erlang-questions [1], section 10 of > Ulf?s Erlang Workshop paper [2] covers quite a bit about it, and I?ve also > written about it [3]. > > [1] http://erlang.org/pipermail/erlang-questions/2012-July/067749.html > [2] http://svn.ulf.wiger.net/gproc/doc/erlang07-wiger.pdf > [3] > http://christophermeiklejohn.com/erlang/2013/06/05/erlang-gproc-failure-semantics.html > > - Chris > > > On Wed, Nov 13, 2013 at 2:38 AM, akonsu akonsu@REDACTED)> wrote: > > > I have a pubsub system which has a single publisher process that > maintains all its subscriber processes' Pid's in an ETS table. > > > > > > The publisher monitors its subscribers and when the publisher receives > DOWN message, it removes the subscriber Pid from the table. > > > > > > The table entries are tuples of the form {MonitorRef, SubscriberPid}, > and the MonitorRef is used as the key. > > > > > > Now I would like to make sure that if the publisher dies, and gets > restarted by its supervisor, the subscriber table is preserved. So I > created a process that creates the ETS table, sets the table's heir to > self(), and then gives away the table to the publisher. > > > > > > The problem is that I do not know how to handle transfer of the table > from the heir to the publisher: > > > > > > when publisher receives the table, the table contains a list of tuples > {MonitorRef, SubscriberPid}, but the MonitorRefs were created by the > previous publisher instance, so when the new publisher receives > ETS_TRANSFER it needs to monitor all these SubscriberPids again. > > > > > > what is the best way to do it? Loop over all ETS entries, attach a > monitor to each and reenter the new MonitorRefs into the table? This might > be slow, no? Maybe my architecture can be improved? Any advice? > > > > > > thanks > > > Konstantin > > > > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > > http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cmeiklejohn@REDACTED Wed Nov 13 20:27:28 2013 From: cmeiklejohn@REDACTED (Christopher Meiklejohn) Date: Wed, 13 Nov 2013 14:27:28 -0500 Subject: [erlang-questions] ETS tables and pubsub In-Reply-To: References: Message-ID: On Wednesday, November 13, 2013 at 2:13 PM, Garret Smith wrote: > I know Ulf has been doing some work on gproc to make it handle netsplits better. I keep meaning to try it out... > > http://erlang.org/pipermail/erlang-questions/2013-June/074345.html > For me, I'm using a combination of gen_leader and local-only gproc. My application has partitioned graphs of data flow & process interaction, so I can use gen_leader to manage moving entire graphs between nodes and local gproc for processes within a graph to find each other. Right, there are two fundamental problems here with the existing gproc: 1. It?s reliance on gen_leader, and it?s problems with deadlocks, dynamic membership and network partitions. 2. gproc?s resolution strategies for conflicting values after resolution of a network partition. Ulf has done a ton of work on the second, but I haven?t had a chance to look at it myself. Ulf?s also left some comments [3] on my blog regarding gen_leader and the conflict resolution strategies. > A generic process registry that handles netsplit and nodes entering and leaving the cluster is a Very Hard Problem(TM). You'd still have to write some bits yourself, like how to merge registries after a netsplit. That's why a lot of application-specific solutions (like mine) exist to exploit the inherent properties of the problem. Agreed; however if you?re willing to relax your requirements on consistency, there are alternative approaches. That being said, I recently published a paper on trying to make a more robust, fault-tolerant process registry [1] [2], in which I was able to handle the merge operations through the use of CRDTs, ensuring the registry converged to the correct value. I have another prototype somewhere which used Riak Core to manage replicated gproc instances, which was the original start to Riak PG, however I abandoned it when I realized that portions of the API would be hard to either implement or reconcile, which lead to my current approach. [1] http://dl.acm.org/citation.cfm?id=2505309 [2] http://christophermeiklejohn.com/erlang/riak/crdt/2013/06/24/introducing-riak-pg-distributed-process-groups-for-erlang.html [3] http://christophermeiklejohn.com/erlang/2013/06/05/erlang-gproc-failure-semantics.html#comment-922065906 -- Christopher Meiklejohn Software Engineer Basho Technologies, Inc. From ulf@REDACTED Wed Nov 13 20:28:53 2013 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 13 Nov 2013 20:28:53 +0100 Subject: [erlang-questions] ETS tables and pubsub In-Reply-To: References: Message-ID: <6D5605EB-42B0-4EDD-832A-A92A6A3EE423@feuerlabs.com> Do you need the global mode for your example? If so, how are you replicating the information now? Otherwise, gproc will default to NOT enabling the global mode. A branch of gproc, https://github.com/uwiger/gproc/tree/uw-locks_leader, uses my ?locks?-based leader election implementation. I will not say that it?s more reliable, but it does seem to fit better to dynamically changing clusters. There is also a branch, https://github.com/uwiger/gproc/tree/split-brain, which resolves inconsistencies based on gen_leader. Barring insistent requests to the contrary, or disappointing feedback, I will personally focus my efforts on testing and improving the former. BR, Ulf W On 13 Nov 2013, at 18:50, Christopher Meiklejohn wrote: > On Wednesday, November 13, 2013 at 12:19 AM, Barco You wrote: >> Why don't you use gproc? > > Last time I checked, gproc isn?t super reliable under failure conditions in global distribution mode. > > Garret and Ulf have discussed it on erlang-questions [1], section 10 of Ulf?s Erlang Workshop paper [2] covers quite a bit about it, and I?ve also written about it [3]. > > [1] http://erlang.org/pipermail/erlang-questions/2012-July/067749.html > [2] http://svn.ulf.wiger.net/gproc/doc/erlang07-wiger.pdf > [3] http://christophermeiklejohn.com/erlang/2013/06/05/erlang-gproc-failure-semantics.html > > - Chris > >> On Wed, Nov 13, 2013 at 2:38 AM, akonsu wrote: >>> I have a pubsub system which has a single publisher process that maintains all its subscriber processes' Pid's in an ETS table. >>> >>> The publisher monitors its subscribers and when the publisher receives DOWN message, it removes the subscriber Pid from the table. >>> >>> The table entries are tuples of the form {MonitorRef, SubscriberPid}, and the MonitorRef is used as the key. >>> >>> Now I would like to make sure that if the publisher dies, and gets restarted by its supervisor, the subscriber table is preserved. So I created a process that creates the ETS table, sets the table's heir to self(), and then gives away the table to the publisher. >>> >>> The problem is that I do not know how to handle transfer of the table from the heir to the publisher: >>> >>> when publisher receives the table, the table contains a list of tuples {MonitorRef, SubscriberPid}, but the MonitorRefs were created by the previous publisher instance, so when the new publisher receives ETS_TRANSFER it needs to monitor all these SubscriberPids again. >>> >>> what is the best way to do it? Loop over all ETS entries, attach a monitor to each and reenter the new MonitorRefs into the table? This might be slow, no? Maybe my architecture can be improved? Any advice? >>> >>> thanks >>> Konstantin >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) >> http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From akonsu@REDACTED Wed Nov 13 18:47:43 2013 From: akonsu@REDACTED (akonsu) Date: Wed, 13 Nov 2013 12:47:43 -0500 Subject: [erlang-questions] ETS tables and pubsub In-Reply-To: References: Message-ID: thanks. yes, these links are what got me started. it looks like for my problem, gproc (or maybe gp2) is a good solution. 2013/11/13 Mark DeVilliers > Does this help - > http://steve.vinoski.net/blog/2011/03/23/dont-lose-your-ets-tables/ and > http://steve.vinoski.net/blog/2013/05/08/implementation-of-dont-lose-your-ets-tables/ > > > > Mark > > > > *From:* erlang-questions-bounces@REDACTED [mailto: > erlang-questions-bounces@REDACTED] *On Behalf Of *Barco You > *Sent:* 13 November 2013 05:20 > *To:* akonsu > *Cc:* erlang-questions > *Subject:* Re: [erlang-questions] ETS tables and pubsub > > > > Why don't you use gproc? > > > > On Wed, Nov 13, 2013 at 2:38 AM, akonsu wrote: > > I have a pubsub system which has a single publisher process that > maintains all its subscriber processes' Pid's in an ETS table. > > > > The publisher monitors its subscribers and when the publisher receives > DOWN message, it removes the subscriber Pid from the table. > > > > The table entries are tuples of the form {MonitorRef, SubscriberPid}, and > the MonitorRef is used as the key. > > > > Now I would like to make sure that if the publisher dies, and gets > restarted by its supervisor, the subscriber table is preserved. So I > created a process that creates the ETS table, sets the table's heir to > self(), and then gives away the table to the publisher. > > > > The problem is that I do not know how to handle transfer of the table from > the heir to the publisher: > > > > when publisher receives the table, the table contains a list of tuples > {MonitorRef, SubscriberPid}, but the MonitorRefs were created by the > previous publisher instance, so when the new publisher receives > ETS_TRANSFER it needs to monitor all these SubscriberPids again. > > > > what is the best way to do it? Loop over all ETS entries, attach a monitor > to each and reenter the new MonitorRefs into the table? This might be slow, > no? Maybe my architecture can be improved? Any advice? > > > > thanks > > Konstantin > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From akonsu@REDACTED Wed Nov 13 20:05:13 2013 From: akonsu@REDACTED (akonsu) Date: Wed, 13 Nov 2013 14:05:13 -0500 Subject: [erlang-questions] ETS tables and pubsub In-Reply-To: References: Message-ID: Very informative. Thanks. Having no experience with either gproc or pg2, I am trying to decide on which one to use. So far I am only working with a single node, but still I need to understand how things would work when I have to distribute them, and what will have to be changed. If I use pg2, then to broadcast a message I need to manually iterate over the list returned from pg2::get_members. Is it a viable alternative to gproc::send? I assume it creates a copy of each item. what if I have many items? Konstantin 2013/11/13 Christopher Meiklejohn > On Wednesday, November 13, 2013 at 12:19 AM, Barco You wrote: > > Why don't you use gproc? > > Last time I checked, gproc isn?t super reliable under failure conditions > in global distribution mode. > > Garret and Ulf have discussed it on erlang-questions [1], section 10 of > Ulf?s Erlang Workshop paper [2] covers quite a bit about it, and I?ve also > written about it [3]. > > [1] http://erlang.org/pipermail/erlang-questions/2012-July/067749.html > [2] http://svn.ulf.wiger.net/gproc/doc/erlang07-wiger.pdf > [3] > http://christophermeiklejohn.com/erlang/2013/06/05/erlang-gproc-failure-semantics.html > > - Chris > > > On Wed, Nov 13, 2013 at 2:38 AM, akonsu akonsu@REDACTED)> wrote: > > > I have a pubsub system which has a single publisher process that > maintains all its subscriber processes' Pid's in an ETS table. > > > > > > The publisher monitors its subscribers and when the publisher receives > DOWN message, it removes the subscriber Pid from the table. > > > > > > The table entries are tuples of the form {MonitorRef, SubscriberPid}, > and the MonitorRef is used as the key. > > > > > > Now I would like to make sure that if the publisher dies, and gets > restarted by its supervisor, the subscriber table is preserved. So I > created a process that creates the ETS table, sets the table's heir to > self(), and then gives away the table to the publisher. > > > > > > The problem is that I do not know how to handle transfer of the table > from the heir to the publisher: > > > > > > when publisher receives the table, the table contains a list of tuples > {MonitorRef, SubscriberPid}, but the MonitorRefs were created by the > previous publisher instance, so when the new publisher receives > ETS_TRANSFER it needs to monitor all these SubscriberPids again. > > > > > > what is the best way to do it? Loop over all ETS entries, attach a > monitor to each and reenter the new MonitorRefs into the table? This might > be slow, no? Maybe my architecture can be improved? Any advice? > > > > > > thanks > > > Konstantin > > > > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > > http://erlang.org/mailman/listinfo/erlang-questions > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Wed Nov 13 21:03:03 2013 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 13 Nov 2013 21:03:03 +0100 Subject: [erlang-questions] ETS tables and pubsub In-Reply-To: References: Message-ID: <2A24DED8-D0E3-4DC9-8B95-739F1991D5AE@feuerlabs.com> On 13 Nov 2013, at 20:27, Christopher Meiklejohn wrote: > 1. It?s reliance on gen_leader, and it?s problems with deadlocks, dynamic membership and network partitions. > 2. gproc?s resolution strategies for conflicting values after resolution of a network partition. This is partly why I prefer the locks_leader version. The locks_leader actually *only* supports dynamic membership right now, but could evolve to support a more restrictive strategy. It also has some added facilities for addressing the other candidates from within the elected() callback, in order to merge inside a protected state. This is used in the gdict example, but not in gproc. Gproc doesn?t use it, since its dictionary isn?t transaction-consistent anyway. The deconflict method in gproc is selected at registration time. Currently, three methods are supported: exit_all, smallest_pid and largest_pid. It would be easy to add more, as long as they are well-defined and safe in a distributed setting. Global has one alternative where a user-provided function is called with the conflicting entries, and one entry is expected to be picked. I?ll gladly take suggestions here. BR, Ulf BTW, in locks_leader, I?m currently experimenting with additions for supporting the RAFT consensus algorithm. First, I added leader surrender, which seems to work well. I?ve also added an ?info? attribute in lock entries, which could be used to select the ?best? leader candidate (which would be done in the elected() callback, possibly leading to a surrender to that candidate. Of course, one doesn?t have to use locks_leader for a RAFT implementation (I?m aware of rafter), but it was a fun challenge to see if it could be done. Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From garret.smith@REDACTED Wed Nov 13 21:19:06 2013 From: garret.smith@REDACTED (Garret Smith) Date: Wed, 13 Nov 2013 12:19:06 -0800 Subject: [erlang-questions] ETS tables and pubsub In-Reply-To: <2A24DED8-D0E3-4DC9-8B95-739F1991D5AE@feuerlabs.com> References: <2A24DED8-D0E3-4DC9-8B95-739F1991D5AE@feuerlabs.com> Message-ID: Ulf, I need to up the priority of replacing gen_leader with your distributed locker. I've certainly experienced some of the problems Christopher is talking about with gen_leader. Christopher, great blog posts! I need to go read some more, my first skimming wasn't enough... -G On Wed, Nov 13, 2013 at 12:03 PM, Ulf Wiger wrote: > > On 13 Nov 2013, at 20:27, Christopher Meiklejohn > wrote: > > > 1. It?s reliance on gen_leader, and it?s problems with deadlocks, > dynamic membership and network partitions. > > 2. gproc?s resolution strategies for conflicting values after resolution > of a network partition. > > This is partly why I prefer the locks_leader version. > > The locks_leader actually *only* supports dynamic membership right now, > but could evolve to support a more restrictive strategy. It also has some > added facilities for addressing the other candidates from within the > elected() callback, in order to merge inside a protected state. This is > used in the gdict example, but not in gproc. > > Gproc doesn?t use it, since its dictionary isn?t transaction-consistent > anyway. > The deconflict method in gproc is selected at registration time. > Currently, three methods > are supported: exit_all, smallest_pid and largest_pid. It would be easy to > add more, as > long as they are well-defined and safe in a distributed setting. Global > has one alternative > where a user-provided function is called with the conflicting entries, and > one entry is > expected to be picked. > > I?ll gladly take suggestions here. > > BR, > Ulf > > BTW, in locks_leader, I?m currently experimenting with additions for > supporting the > RAFT consensus algorithm. First, I added leader surrender, which seems to > work > well. I?ve also added an ?info? attribute in lock entries, which could be > used to select > the ?best? leader candidate (which would be done in the elected() > callback, possibly > leading to a surrender to that candidate. > > Of course, one doesn?t have to use locks_leader for a RAFT implementation > (I?m aware of rafter), but it was a fun challenge to see if it could be > done. > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Wed Nov 13 21:47:43 2013 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 13 Nov 2013 21:47:43 +0100 Subject: [erlang-questions] ETS tables and pubsub In-Reply-To: References: <2A24DED8-D0E3-4DC9-8B95-739F1991D5AE@feuerlabs.com> Message-ID: <01FE0C40-7029-4A91-AA53-085B8090A413@feuerlabs.com> Of course, locks_leader has no obvious deficiencies. ;-) BR, Ulf W On 13 Nov 2013, at 21:19, Garret Smith wrote: > Ulf, I need to up the priority of replacing gen_leader with your distributed locker. I've certainly experienced some of the problems Christopher is talking about with gen_leader. > > Christopher, great blog posts! I need to go read some more, my first skimming wasn't enough... > > -G > > > On Wed, Nov 13, 2013 at 12:03 PM, Ulf Wiger wrote: > > On 13 Nov 2013, at 20:27, Christopher Meiklejohn wrote: > > > 1. It?s reliance on gen_leader, and it?s problems with deadlocks, dynamic membership and network partitions. > > 2. gproc?s resolution strategies for conflicting values after resolution of a network partition. > > This is partly why I prefer the locks_leader version. > > The locks_leader actually *only* supports dynamic membership right now, but could evolve to support a more restrictive strategy. It also has some added facilities for addressing the other candidates from within the elected() callback, in order to merge inside a protected state. This is used in the gdict example, but not in gproc. > > Gproc doesn?t use it, since its dictionary isn?t transaction-consistent anyway. > The deconflict method in gproc is selected at registration time. Currently, three methods > are supported: exit_all, smallest_pid and largest_pid. It would be easy to add more, as > long as they are well-defined and safe in a distributed setting. Global has one alternative > where a user-provided function is called with the conflicting entries, and one entry is > expected to be picked. > > I?ll gladly take suggestions here. > > BR, > Ulf > > BTW, in locks_leader, I?m currently experimenting with additions for supporting the > RAFT consensus algorithm. First, I added leader surrender, which seems to work > well. I?ve also added an ?info? attribute in lock entries, which could be used to select > the ?best? leader candidate (which would be done in the elected() callback, possibly > leading to a surrender to that candidate. > > Of course, one doesn?t have to use locks_leader for a RAFT implementation > (I?m aware of rafter), but it was a fun challenge to see if it could be done. > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From noah.schwartz1@REDACTED Wed Nov 13 23:26:57 2013 From: noah.schwartz1@REDACTED (Noah Schwartz) Date: Wed, 13 Nov 2013 17:26:57 -0500 Subject: [erlang-questions] Secure delete of data from an mnesia table Message-ID: Hello all, Looking to "securely" delete data from an mnesia table. We have a fragmented table that contains sensitive user information that gets deleted after 28 days. This all works fine but, I am looking to make sure that the data is actually purged so that data forensics wouldn't be able to recover the data. Something like this unix util: http://www.slac.stanford.edu/comp/unix/secure-erase.html. -- Noah -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.pennebaker@REDACTED Thu Nov 14 04:33:49 2013 From: andrew.pennebaker@REDACTED (Andrew Pennebaker) Date: Wed, 13 Nov 2013 22:33:49 -0500 Subject: [erlang-questions] Can't run my command line Erlang program Message-ID: I'm trying to get my command line Erlang program, ios7crypt.erl, to compile and run, but I'm getting an error. Source: https://github.com/mcandre/ios7crypt/blob/master/erlang/ios7crypt.erl Trace: $ make erlc -Wall +debug_info ios7crypt.erl erl -noshell -s ios7crypt -- -e monkey {"init terminating in do_boot",{undef,[{ios7crypt,start,[],[]},{init,start_it,1,[]},{init,start_em,1,[]}]}} Crash dump was written to: erl_crash.dump init terminating in do_boot () make: *** [test] Error 1 Am I using the wrong syntax to run ios7crypt, or am I declaring the start/1 function incorrectly? -- Cheers, Andrew Pennebaker www.yellosoft.us -------------- next part -------------- An HTML attachment was scrubbed... URL: From vinoski@REDACTED Thu Nov 14 04:47:17 2013 From: vinoski@REDACTED (Steve Vinoski) Date: Wed, 13 Nov 2013 22:47:17 -0500 Subject: [erlang-questions] Can't run my command line Erlang program In-Reply-To: References: Message-ID: On Wed, Nov 13, 2013 at 10:33 PM, Andrew Pennebaker < andrew.pennebaker@REDACTED> wrote: > I'm trying to get my command line Erlang program, ios7crypt.erl, to > compile and run, but I'm getting an error. > > Source: > > https://github.com/mcandre/ios7crypt/blob/master/erlang/ios7crypt.erl > > Trace: > > $ make > erlc -Wall +debug_info ios7crypt.erl > erl -noshell -s ios7crypt -- -e monkey > {"init terminating in > do_boot",{undef,[{ios7crypt,start,[],[]},{init,start_it,1,[]},{init,start_em,1,[]}]}} > > Crash dump was written to: erl_crash.dump > init terminating in do_boot () > make: *** [test] Error 1 > > Am I using the wrong syntax to run ios7crypt, or am I declaring the > start/1 function incorrectly? > Your command line calls start/0, not start/1. If you want the latter, you need to pass an argument on your command line. Or maybe you could add a start/0 function. See the doc for -s here: http://erlang.org/doc/man/erl.html --steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From wbin00@REDACTED Thu Nov 14 07:08:00 2013 From: wbin00@REDACTED (Bin Wang) Date: Thu, 14 Nov 2013 14:08:00 +0800 Subject: [erlang-questions] Start two same applications at the same time with rebar Message-ID: Hi, I'm compiling my application with rebar. My question is: after I generated the files, how could I start two applications at the same time? I use "./rel/app/bin/app console -sname app2" to start the second one. It is OK. But I want to run it as a daemon. Then I use "./rel/app/bin/app start -name app2", it cames with the error: "Node is already running!" So how to start the second one at the same time? And if I have started them, how could I attach to the specified one? Thanks. Bin Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: From freza@REDACTED Thu Nov 14 09:39:58 2013 From: freza@REDACTED (Jachym Holecek) Date: Thu, 14 Nov 2013 03:39:58 -0500 Subject: [erlang-questions] Can't run my command line Erlang program In-Reply-To: References: Message-ID: <20131114083958.GA10608@circlewave.net> # Andrew Pennebaker 2013-11-13: > I'm trying to get my command line Erlang program [...] Not sure it fits your use case, but escript might come in handy: $ cat /tmp/foo #!/home/jh/R16B01/bin/escript main(Args) -> io:format("~p~n", [Args]), init:stop(). $ /tmp/foo hi there ["hi","there"] See 'erl -man escript'. BR, -- Jachym From tomas.kukosa@REDACTED Thu Nov 14 13:50:41 2013 From: tomas.kukosa@REDACTED (Kukosa, Tomas) Date: Thu, 14 Nov 2013 12:50:41 +0000 Subject: [erlang-questions] Phased start - bug or misconception? Message-ID: <771808E86A57134A85559759DD60290117ABE72F@MCHP01MSX.global-ad.net> Hi, I have the same problem as mentioned in this old (unfortunately unreplied) message: http://erlang.org/pipermail/erlang-questions/2010-March/050243.html Does anybody have any idea how to solve it? Tomas From essen@REDACTED Thu Nov 14 17:23:36 2013 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Thu, 14 Nov 2013 17:23:36 +0100 Subject: [erlang-questions] Cowboy and Ranch 0.9.0 released Message-ID: <5284F908.9000605@ninenines.eu> Hello shiny people, Cowboy 0.9.0 has been released. Ranch 0.9.0 has been released too! So let's start with that. Ranch 0.9.0 is just stability improvements, better error reporting and a couple new SSL options. Cowboy 0.9.0 is using it of course, and also has official SPDY support (documented and everything!), a revamped cowboy_static (built-in mimetypes support, and also documented), tons of additions to the guide, tons of user patches and other changes you can find here: * https://github.com/extend/cowboy/blob/master/CHANGELOG.md Which reminds me, I want to thank all 70 awesome contributors (myself included) that make the Cowboy project so fun to work on! So, thank you! When upgrading, please be aware that: * A dependency has been added, cowlib * Various undocumented functions have been moved to cowlib * The options for cowboy_static changed a lot, so read the guide * You need to set ERL_LIBS or equivalent for cowboy_static to find your private directory now You can find the updated guide on http://ninenines.eu BUT do note that I'm migrating the site so if you do not see "Contribute to this site" in the bottom left next to "Contact", then you are on the old version and should probably head to github for your documentation needs, or use the files in your clone directly. I also have improvements left to make to the site to make navigating documentation easier, so stay tuned! Speaking of the guide, now all the examples, but also the getting started chapter of the guide, are releases. I am hopeful that this will make more people use releases by default instead of an awful start.sh script. For details on what's coming up next, see the ROADMAP. Next step (0.10) is finishing the request body work, fixing some timeout issues and adding proper multipart support for both requests and responses. This will be the last significant step before 1.0. I have hopes that all this will be ready around the time R17 is released. So yeah, enjoy! And as always please forward any feedback, especially related to the user guide as this is my main focus now. -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From dszoboszlay@REDACTED Thu Nov 14 18:45:37 2013 From: dszoboszlay@REDACTED (=?utf-8?Q?Szoboszlay_D=C3=A1niel?=) Date: Thu, 14 Nov 2013 17:45:37 -0000 Subject: [erlang-questions] Start two same applications at the same time with rebar In-Reply-To: References: Message-ID: Hi, The default runner script generated by rebar does not support starting two or more daemons. The problem is that each daemon should have a unique pipe directory, but the PIPE_DIR only contains RUNNER_BASE_DIR. I would modify the script to recognize the -sname or -name argument and append the node's name to PIPE_DIR. (For my project I use a heavily customized start script, but I think this was the crucial part in enabling multi-node startup.) Daniel On Thu, 14 Nov 2013 06:08:00 -0000, Bin Wang wrote: > Hi, > > I'm compiling my application with rebar. My question is: after I > generated the files, how could I start two applications at the same time? > > I use "./rel/app/bin/app console -sname app2" to start the second one. > It is OK. But I want to run it as a daemon. Then I use > "./rel/app/bin/app start -name app2", it cames with the error: "Node is > >already running!" > > So how to start the second one at the same time? And if I have started > them, how could I attach to the specified one? > > Thanks. > > Bin Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: From awang@REDACTED Thu Nov 14 22:36:39 2013 From: awang@REDACTED (Andy Wang) Date: Thu, 14 Nov 2013 16:36:39 -0500 Subject: [erlang-questions] question regarding compiling with erl_interface.lib and ei.lib for windows application Message-ID: <13B290A06827324E9ADB71AA314F8189027BE70A@otis.burlington.evertz.tv> Hi there, I was trying to compile the port example program from otp documentation. Upon implementing all the routines, I tried to compile with cygwin and got the error that the functions like erl_init are undefined. I was able to determine that MS C/C++ compiler was used to compile the .lib files. I then tried to compile with that and the compiler is complaining about the linux headers like netdb.h in ei.h... I'm wondering if you guys are using a different header for the library compilation? If not, what was the setup during the windows library compilation? I'm not planning to build .exe on linux nor would I build it on PC with linux header. I'm hoping to find a solution so we can distribute this within the organization. Thanks. Regards, Andy x2230 -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.pennebaker@REDACTED Fri Nov 15 01:46:52 2013 From: andrew.pennebaker@REDACTED (Andrew Pennebaker) Date: Thu, 14 Nov 2013 19:46:52 -0500 Subject: [erlang-questions] Can't run my command line Erlang program In-Reply-To: <20131114083958.GA10608@circlewave.net> References: <20131114083958.GA10608@circlewave.net> Message-ID: I'm switched to start/0 and using init:get_plain_arguments(), and using -extra instead of --. It works now! Source: https://github.com/mcandre/ios7crypt/tree/master/erlang Test: $ make erlc -Wall +debug_info ios7crypt.erl erl -noshell -s ios7crypt -extra -e monkey 1104160b1c1712 erl -noshell -s ios7crypt -extra -d 020b0b55000316 monkey Now that my code seems to work, I took a look with dialyzer for potential trouble spots. I'm not sure what to make of the output.$ make lint Dialyzer: erlc -Wall +debug_info ios7crypt.erl dialyzer *.beam --build_plt --quiet dialyzer *.beam Checking whether the PLT /Users/andrew/.dialyzer_plt is up-to-date... yes Proceeding with analysis... ios7crypt.erl:60: The pattern 'true' can never match the type 'false' ... In particular, I'm confused what dialyzer doesn't like about line 60. 59 FirstOne = case is_binary(FirstTemp) of 60 true -> binary_to_list(FirstTemp); 61 false -> FirstOneRaw 62 end, Not sure what's wrong. I tried using `_` instead of `false`, but got the same warning. Should I use an if/else instead of case? On Thu, Nov 14, 2013 at 3:39 AM, Jachym Holecek wrote: > # Andrew Pennebaker 2013-11-13: > > I'm trying to get my command line Erlang program [...] > > Not sure it fits your use case, but escript might come in handy: > > $ cat /tmp/foo > #!/home/jh/R16B01/bin/escript > > main(Args) -> > io:format("~p~n", [Args]), > init:stop(). > > $ /tmp/foo hi there > ["hi","there"] > > See 'erl -man escript'. > > BR, > -- Jachym > -- Cheers, Andrew Pennebaker www.yellosoft.us -------------- next part -------------- An HTML attachment was scrubbed... URL: From vinoski@REDACTED Fri Nov 15 01:57:14 2013 From: vinoski@REDACTED (Steve Vinoski) Date: Thu, 14 Nov 2013 19:57:14 -0500 Subject: [erlang-questions] Can't run my command line Erlang program In-Reply-To: References: <20131114083958.GA10608@circlewave.net> Message-ID: On Thu, Nov 14, 2013 at 7:46 PM, Andrew Pennebaker < andrew.pennebaker@REDACTED> wrote: > Dialyzer: > > erlc -Wall +debug_info ios7crypt.erl > dialyzer *.beam --build_plt --quiet > dialyzer *.beam > Checking whether the PLT /Users/andrew/.dialyzer_plt is up-to-date... yes > Proceeding with analysis... > ios7crypt.erl:60: The pattern 'true' can never match the type 'false' > ... > > In particular, I'm confused what dialyzer doesn't like about line 60. > > 59 FirstOne = case is_binary(FirstTemp) of > 60 true -> binary_to_list(FirstTemp); > 61 false -> FirstOneRaw > 62 end, > > Not sure what's wrong. I tried using `_` instead of `false`, but got the > same warning. Should I use an if/else instead of case? > The code preceding this (on line 57) calls lists:nthtail, which returns a list. Therefore the is_binary test on line 59 will always return false, so the true branch will never be taken. --steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Fri Nov 15 02:00:34 2013 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 15 Nov 2013 02:00:34 +0100 Subject: [erlang-questions] Can't run my command line Erlang program In-Reply-To: References: <20131114083958.GA10608@circlewave.net> Message-ID: <52857232.2020700@cs.ntua.gr> On 11/15/2013 01:46 AM, Andrew Pennebaker wrote: > In particular, I'm confused what dialyzer doesn't like about line 60. > > 59 FirstOne = case is_binary(FirstTemp) of > 60 true -> binary_to_list(FirstTemp); > 61 false -> FirstOneRaw > 62 end, > > Not sure what's wrong. I tried using `_` instead of `false`, but got the > same warning. Should I use an if/else instead of case? Dialyzer is telling you that it thinks FirstTemp will never be a binary in your program, so the case statement you have there is unnecessary. So, effectively it tells you that you can rewrite the code above to: FirstOne = FirstOneRaw, The question is why do you expect that FirstTemp may be a binary at that point? Kostis From barcojie@REDACTED Fri Nov 15 02:57:17 2013 From: barcojie@REDACTED (Barco You) Date: Fri, 15 Nov 2013 09:57:17 +0800 Subject: [erlang-questions] Cowboy and Ranch 0.9.0 released In-Reply-To: <5284F908.9000605@ninenines.eu> References: <5284F908.9000605@ninenines.eu> Message-ID: Very excited to hear of this. Cowboy is very good to use. On Nov 15, 2013 12:23 AM, "Lo?c Hoguin" wrote: > Hello shiny people, > > Cowboy 0.9.0 has been released. Ranch 0.9.0 has been released too! So > let's start with that. > > Ranch 0.9.0 is just stability improvements, better error reporting and a > couple new SSL options. > > Cowboy 0.9.0 is using it of course, and also has official SPDY support > (documented and everything!), a revamped cowboy_static (built-in mimetypes > support, and also documented), tons of additions to the guide, tons of user > patches and other changes you can find here: > > * https://github.com/extend/cowboy/blob/master/CHANGELOG.md > > Which reminds me, I want to thank all 70 awesome contributors (myself > included) that make the Cowboy project so fun to work on! So, thank you! > > When upgrading, please be aware that: > > * A dependency has been added, cowlib > * Various undocumented functions have been moved to cowlib > * The options for cowboy_static changed a lot, so read the guide > * You need to set ERL_LIBS or equivalent for cowboy_static to find your > private directory now > > You can find the updated guide on http://ninenines.eu BUT do note that > I'm migrating the site so if you do not see "Contribute to this site" in > the bottom left next to "Contact", then you are on the old version and > should probably head to github for your documentation needs, or use the > files in your clone directly. I also have improvements left to make to the > site to make navigating documentation easier, so stay tuned! > > Speaking of the guide, now all the examples, but also the getting started > chapter of the guide, are releases. I am hopeful that this will make more > people use releases by default instead of an awful start.sh script. > > For details on what's coming up next, see the ROADMAP. Next step (0.10) is > finishing the request body work, fixing some timeout issues and adding > proper multipart support for both requests and responses. This will be the > last significant step before 1.0. I have hopes that all this will be ready > around the time R17 is released. > > So yeah, enjoy! And as always please forward any feedback, especially > related to the user guide as this is my main focus now. > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > http://ninenines.eu > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wbin00@REDACTED Fri Nov 15 04:12:59 2013 From: wbin00@REDACTED (Bin Wang) Date: Fri, 15 Nov 2013 11:12:59 +0800 Subject: [erlang-questions] Start two same applications at the same time with rebar In-Reply-To: References: Message-ID: Thanks, Daniel. I found riak's solution in its source file. It use a script to generate many release directories, which uses a template to do some configuration. https://github.com/basho/riak/blob/develop/rel/gen_dev I think this way is just a workaround. Rebar should have an option to support this. 2013/11/15 Szoboszlay D?niel > Hi, > > The default runner script generated by rebar does not support starting two > or more daemons. The problem is that each daemon should have a unique pipe > directory, but the PIPE_DIR only contains RUNNER_BASE_DIR. > > I would modify the script to recognize the -sname or -name argument and > append the node's name to PIPE_DIR. (For my project I use a heavily > customized start script, but I think this was the crucial part in enabling > multi-node startup.) > > Daniel > > On Thu, 14 Nov 2013 06:08:00 -0000, Bin Wang wrote: > > Hi, > > I'm compiling my application with rebar. My question is: after I generated > the files, how could I start two applications at the same time? > > I use "./rel/app/bin/app console -sname app2" to start the second one. It > is OK. But I want to run it as a daemon. Then I use "./rel/app/bin/app > start -name app2", it cames with the error: "Node is already running!" > > So how to start the second one at the same time? And if I have started > them, how could I attach to the specified one? > > Thanks. > > Bin Wang > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.pennebaker@REDACTED Fri Nov 15 04:59:48 2013 From: andrew.pennebaker@REDACTED (Andrew Pennebaker) Date: Thu, 14 Nov 2013 22:59:48 -0500 Subject: [erlang-questions] Can't run my command line Erlang program In-Reply-To: <52857232.2020700@cs.ntua.gr> References: <20131114083958.GA10608@circlewave.net> <52857232.2020700@cs.ntua.gr> Message-ID: I think I was trying to account for errors in parsing integers. In any case, I think my program still works fine without this check, especially as we agree that dialyzer proves it's unnecessary. https://github.com/mcandre/ios7crypt/commit/8d7f7760b15ffa48a5113356803f620f3935c256#diff-7f4a95d512e55854e52ac3744eaafeb1L52 On Thu, Nov 14, 2013 at 8:00 PM, Kostis Sagonas wrote: > On 11/15/2013 01:46 AM, Andrew Pennebaker wrote: > >> In particular, I'm confused what dialyzer doesn't like about line 60. >> >> 59 FirstOne = case is_binary(FirstTemp) of >> 60 true -> binary_to_list(FirstTemp); >> 61 false -> FirstOneRaw >> 62 end, >> >> Not sure what's wrong. I tried using `_` instead of `false`, but got the >> same warning. Should I use an if/else instead of case? >> > > Dialyzer is telling you that it thinks FirstTemp will never be a binary in > your program, so the case statement you have there is unnecessary. So, > effectively it tells you that you can rewrite the code above to: > > FirstOne = FirstOneRaw, > > The question is why do you expect that FirstTemp may be a binary at that > point? > > Kostis > -- Cheers, Andrew Pennebaker www.yellosoft.us -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.pennebaker@REDACTED Fri Nov 15 05:03:07 2013 From: andrew.pennebaker@REDACTED (Andrew Pennebaker) Date: Thu, 14 Nov 2013 23:03:07 -0500 Subject: [erlang-questions] Can't run my command line Erlang program In-Reply-To: References: <20131114083958.GA10608@circlewave.net> <52857232.2020700@cs.ntua.gr> Message-ID: Is there a way to clear the "unknown functions" from dialyzer output? They tend to distract from any warnings I'm trying to find. $ make lint erlc -Wall +debug_info ios7crypt.erl dialyzer *.beam --build_plt --quiet dialyzer *.beam Checking whether the PLT /Users/andrew/.dialyzer_plt is up-to-date... yes Proceeding with analysis... Unknown functions: crypto:exor/2 erlang:binary_to_list/1 erlang:get_module_info/1 erlang:get_module_info/2 erlang:list_to_integer/2 erlang:now/0 getopt:parse/2 getopt:usage/2 init:get_plain_arguments/0 init:stop/0 io:format/1 io:format/2 io_lib:format/2 proper:forall/2 proper:quickcheck/1 proper_types:int/0 proper_types:list/1 random:seed/3 random:uniform/1 string:concat/2 string:substr/3 done in 0m0.17s done (passed successfully) On Thu, Nov 14, 2013 at 10:59 PM, Andrew Pennebaker < andrew.pennebaker@REDACTED> wrote: > I think I was trying to account for errors in parsing integers. In any > case, I think my program still works fine without this check, especially as > we agree that dialyzer proves it's unnecessary. > > > https://github.com/mcandre/ios7crypt/commit/8d7f7760b15ffa48a5113356803f620f3935c256#diff-7f4a95d512e55854e52ac3744eaafeb1L52 > > > On Thu, Nov 14, 2013 at 8:00 PM, Kostis Sagonas wrote: > >> On 11/15/2013 01:46 AM, Andrew Pennebaker wrote: >> >>> In particular, I'm confused what dialyzer doesn't like about line 60. >>> >>> 59 FirstOne = case is_binary(FirstTemp) of >>> 60 true -> binary_to_list(FirstTemp); >>> 61 false -> FirstOneRaw >>> 62 end, >>> >>> Not sure what's wrong. I tried using `_` instead of `false`, but got the >>> same warning. Should I use an if/else instead of case? >>> >> >> Dialyzer is telling you that it thinks FirstTemp will never be a binary >> in your program, so the case statement you have there is unnecessary. So, >> effectively it tells you that you can rewrite the code above to: >> >> FirstOne = FirstOneRaw, >> >> The question is why do you expect that FirstTemp may be a binary at that >> point? >> >> Kostis >> > > > > -- > Cheers, > > Andrew Pennebaker > www.yellosoft.us > -- Cheers, Andrew Pennebaker www.yellosoft.us -------------- next part -------------- An HTML attachment was scrubbed... URL: From musicdenotation@REDACTED Fri Nov 15 07:06:19 2013 From: musicdenotation@REDACTED (Kalinni Gorzkis) Date: Fri, 15 Nov 2013 13:06:19 +0700 Subject: [erlang-questions] Proposal to change Erlang's license Message-ID: <278C7393-2DE4-4774-A109-FDC26DCB15AA@gmail.com> Currently, Erlang uses the Erlang Public License, a modification of the Mozilla Public License version 1.1. Neither is compatible with the GPL. Recently Mozilla published version 2.0 and I think you should switch to that for compatibility. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From francesco@REDACTED Fri Nov 15 08:50:53 2013 From: francesco@REDACTED (francesco@REDACTED) Date: Fri, 15 Nov 2013 07:50:53 +0000 Subject: [erlang-questions] Proposal to change Erlang's license In-Reply-To: <278C7393-2DE4-4774-A109-FDC26DCB15AA@gmail.com> References: <278C7393-2DE4-4774-A109-FDC26DCB15AA@gmail.com> Message-ID: There have been suggestions by the Erlang Industrial User Group to change license for quite some time. Indeed, the suggestion was taken onboard and it looks like MPL 2.0 is the chosen one. Expect an official announcement soon. Francesco Kalinni Gorzkis wrote: >Currently, Erlang uses the Erlang Public License, a modification of the >Mozilla Public License version 1.1. Neither is compatible with the GPL. >Recently Mozilla published version 2.0 and I think you should switch to >that for compatibility. Thanks! > >------------------------------------------------------------------------ > >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://erlang.org/mailman/listinfo/erlang-questions -- Sent from my Android device with K-9 Mail. Please excuse my brevity. -------------- next part -------------- An HTML attachment was scrubbed... URL: From anthonym@REDACTED Fri Nov 15 08:52:08 2013 From: anthonym@REDACTED (Anthony Molinaro) Date: Thu, 14 Nov 2013 23:52:08 -0800 Subject: [erlang-questions] Can't run my command line Erlang program In-Reply-To: References: <20131114083958.GA10608@circlewave.net> <52857232.2020700@cs.ntua.gr> Message-ID: <046ECC8C-A31C-4AF7-B8BC-EB197C1B000F@alumni.caltech.edu> You can add them to your .plt with something like # dialyzer --add_to_plt --apps crypto stdlib proper ... Which should get rid of the warnings. -Anthony On Nov 14, 2013, at 8:03 PM, Andrew Pennebaker wrote: > Is there a way to clear the "unknown functions" from dialyzer output? They tend to distract from any warnings I'm trying to find. > > $ make lint > erlc -Wall +debug_info ios7crypt.erl > dialyzer *.beam --build_plt --quiet > dialyzer *.beam > Checking whether the PLT /Users/andrew/.dialyzer_plt is up-to-date... yes > Proceeding with analysis... > Unknown functions: > crypto:exor/2 > erlang:binary_to_list/1 > erlang:get_module_info/1 > erlang:get_module_info/2 > erlang:list_to_integer/2 > erlang:now/0 > getopt:parse/2 > getopt:usage/2 > init:get_plain_arguments/0 > init:stop/0 > io:format/1 > io:format/2 > io_lib:format/2 > proper:forall/2 > proper:quickcheck/1 > proper_types:int/0 > proper_types:list/1 > random:seed/3 > random:uniform/1 > string:concat/2 > string:substr/3 > done in 0m0.17s > done (passed successfully) > > > On Thu, Nov 14, 2013 at 10:59 PM, Andrew Pennebaker wrote: >> I think I was trying to account for errors in parsing integers. In any case, I think my program still works fine without this check, especially as we agree that dialyzer proves it's unnecessary. >> >> https://github.com/mcandre/ios7crypt/commit/8d7f7760b15ffa48a5113356803f620f3935c256#diff-7f4a95d512e55854e52ac3744eaafeb1L52 >> >> >> On Thu, Nov 14, 2013 at 8:00 PM, Kostis Sagonas wrote: >>> On 11/15/2013 01:46 AM, Andrew Pennebaker wrote: >>>> In particular, I'm confused what dialyzer doesn't like about line 60. >>>> >>>> 59 FirstOne = case is_binary(FirstTemp) of >>>> 60 true -> binary_to_list(FirstTemp); >>>> 61 false -> FirstOneRaw >>>> 62 end, >>>> >>>> Not sure what's wrong. I tried using `_` instead of `false`, but got the >>>> same warning. Should I use an if/else instead of case? >>> >>> Dialyzer is telling you that it thinks FirstTemp will never be a binary in your program, so the case statement you have there is unnecessary. So, effectively it tells you that you can rewrite the code above to: >>> >>> FirstOne = FirstOneRaw, >>> >>> The question is why do you expect that FirstTemp may be a binary at that point? >>> >>> Kostis >> >> >> >> -- >> Cheers, >> >> Andrew Pennebaker >> www.yellosoft.us > > > > -- > Cheers, > > Andrew Pennebaker > www.yellosoft.us > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgolovan@REDACTED Fri Nov 15 09:46:53 2013 From: sgolovan@REDACTED (Sergei Golovan) Date: Fri, 15 Nov 2013 12:46:53 +0400 Subject: [erlang-questions] wxErlang and wxWidgets 3.0 Message-ID: Hi! Debian GNU/Linux distribution is currently working on a replacing wxWidgets 2.8 by 3.0 (and subsequent removal of 2.8 next year). So, I'd like to ask what is the status of support for wxWidgets 3.0 in wxErlang? As far as I can see in configure script, it checks for >= 2.8.4. Also, HOWTO/INSTALL.md mentions wxWidgets only for MacOS X (>= 2.9.4 is required). I've tried to build wxErland using wxWidgets 3.0 and run demos. They seems to work fine, with the exception of a notebook with colorful pages. Their background is just plain grey (with 2.8 colors are fine). Cheers! -- Sergei Golovan From dgud@REDACTED Fri Nov 15 10:14:00 2013 From: dgud@REDACTED (Dan Gudmundsson) Date: Fri, 15 Nov 2013 10:14:00 +0100 Subject: [erlang-questions] wxErlang and wxWidgets 3.0 In-Reply-To: References: Message-ID: The intention is that is should work with both. But I only test it occasionally. I personally try to link against 3.0, or rather their master branch, when doing development. But we don't support newer functionality, and some erlang code may need to be rewritten to work on both 2.8 and 3.0, btw SUSE 10 and thus wxWidgets 2.6 is still used here internally, sigh. I have not noticed the notebook problem, don't know if that is a wxWidgets problem or a demo problem. Cheers On Fri, Nov 15, 2013 at 9:46 AM, Sergei Golovan wrote: > Hi! > > Debian GNU/Linux distribution is currently working on a replacing > wxWidgets 2.8 by 3.0 (and subsequent removal of 2.8 next year). So, > I'd like to ask what is the status of support for wxWidgets 3.0 in > wxErlang? > > As far as I can see in configure script, it checks for >= 2.8.4. Also, > HOWTO/INSTALL.md mentions wxWidgets only for MacOS X (>= 2.9.4 is > required). > > I've tried to build wxErland using wxWidgets 3.0 and run demos. They > seems to work fine, with the exception of a notebook with colorful > pages. Their background is just plain grey (with 2.8 colors are fine). > > Cheers! > -- > Sergei Golovan > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrzej.sliwa@REDACTED Fri Nov 15 10:18:45 2013 From: andrzej.sliwa@REDACTED (=?utf-8?Q?Andrzej_=C5=9Aliwa?=) Date: Fri, 15 Nov 2013 10:18:45 +0100 Subject: [erlang-questions] wxErlang and wxWidgets 3.0 In-Reply-To: References: Message-ID: but running old versions somewhere on production should not stops us from making progress??right? ;) Cheers On 15 Nov 2013 at 10:14:16, Dan Gudmundsson (dgud@REDACTED) wrote: to be rewritten to work on both 2.8 and 3.0, btw SUSE 10 and thus wxWidgets 2.6 is still used here internally, sigh. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Maxim.Minin@REDACTED Fri Nov 15 11:23:32 2013 From: Maxim.Minin@REDACTED (Minin Maxim) Date: Fri, 15 Nov 2013 11:23:32 +0100 Subject: [erlang-questions] jinterface and epmd Message-ID: Hello, i have a little question about jinterface - the communication between an erlang app and an java app (on two different machines) needs epmd on both machines. In my environment there are no possibility to install epmd on the java-machine. That's why I rewrote epmd in java. It can be started as singlton in jvm and acts as normal epmd. Is anyone interested on that solution and what is the best way to pull this implementation to otp standard lib (if there is one)? Thanks Maxim Minin -------------- next part -------------- An HTML attachment was scrubbed... URL: From musicdenotation@REDACTED Fri Nov 15 11:31:21 2013 From: musicdenotation@REDACTED (Kalinni Gorzkis) Date: Fri, 15 Nov 2013 17:31:21 +0700 Subject: [erlang-questions] Proposal to change Erlang's license In-Reply-To: References: <278C7393-2DE4-4774-A109-FDC26DCB15AA@gmail.com> Message-ID: On Nov 15, 2013 2:51 PM, wrote: > > There have been suggestions by the Erlang Industrial User Group to change license for quite some time. Indeed, the suggestion was taken onboard and it looks like MPL 2.0 is the chosen one. Expect an official announcement soon. > > Francesco > > Kalinni Gorzkis wrote: >> >> Currently, Erlang uses the Erlang Public License, a modification of the Mozilla Public License version 1.1. Neither is compatible with the GPL. Recently Mozilla published version 2.0 and I think you should switch to that for compatibility. Thanks! >> >> ________________________________ >> >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > -- > Sent from my Android device with K-9 Mail. Please excuse my brevity. The original MPL 2.0 or a modified version? Don't modify the license, the modified version will be GPL-incompatible, and the MPL 2.0 is designed to be international. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bchesneau@REDACTED Fri Nov 15 12:05:17 2013 From: bchesneau@REDACTED (Benoit Chesneau) Date: Fri, 15 Nov 2013 12:05:17 +0100 Subject: [erlang-questions] Proposal to change Erlang's license In-Reply-To: <278C7393-2DE4-4774-A109-FDC26DCB15AA@gmail.com> References: <278C7393-2DE4-4774-A109-FDC26DCB15AA@gmail.com> Message-ID: Imo a language should use a liberal license to be widely accepted. What is the point of using a copy-left license? The Erlang Public License is not really clear on that, not sure if you have to make public the changes or just keep it opensourced and freely used. Even mozilla for rust is providing an Apache and MIT license. my 2 cents. - benoit On Fri, Nov 15, 2013 at 7:06 AM, Kalinni Gorzkis wrote: > Currently, Erlang uses the Erlang Public License, a modification of the > Mozilla Public License version 1.1. Neither is compatible with the GPL. > Recently Mozilla published version 2.0 and > I think you should switch to that for compatibility. Thanks! > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Fri Nov 15 12:32:12 2013 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Fri, 15 Nov 2013 12:32:12 +0100 Subject: [erlang-questions] Proposal to change Erlang's license In-Reply-To: References: <278C7393-2DE4-4774-A109-FDC26DCB15AA@gmail.com> Message-ID: <5286063C.1040805@ninenines.eu> On 11/15/2013 11:31 AM, Kalinni Gorzkis wrote: > The original MPL 2.0 or a modified version? Don't modify the license, > the modified version will be GPL-incompatible, and the MPL 2.0 is > designed to be international. The goal is to have a well known unmodified license to make it easier to use Erlang in commercial projects. Choice is MPL 2.0 because the current license is derived from MPL 1.0. -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From francesco@REDACTED Fri Nov 15 12:38:13 2013 From: francesco@REDACTED (Francesco Cesarini) Date: Fri, 15 Nov 2013 11:38:13 +0000 Subject: [erlang-questions] Proposal to change Erlang's license In-Reply-To: <5286063C.1040805@ninenines.eu> References: <278C7393-2DE4-4774-A109-FDC26DCB15AA@gmail.com> <5286063C.1040805@ninenines.eu> Message-ID: <528607A5.3020206@erlang-solutions.com> The original MPL 2.0, no a modified one. What Loic says is correct, and from what I understand, Ericsson legal is ok with this approach. Contributors who have submitted changes have already been contacted, and the response was favorable. Francesco On 15/11/2013 11:32, Lo?c Hoguin wrote: > On 11/15/2013 11:31 AM, Kalinni Gorzkis wrote: >> The original MPL 2.0 or a modified version? Don't modify the license, >> the modified version will be GPL-incompatible, and the MPL 2.0 is >> designed to be international. > > The goal is to have a well known unmodified license to make it easier > to use Erlang in commercial projects. Choice is MPL 2.0 because the > current license is derived from MPL 1.0. > -- Erlang Solutions Ltd. http://www.erlang-solutions.com From musicdenotation@REDACTED Fri Nov 15 13:14:11 2013 From: musicdenotation@REDACTED (Kalinni Gorzkis) Date: Fri, 15 Nov 2013 19:14:11 +0700 Subject: [erlang-questions] Proposal to change Erlang's license In-Reply-To: <528607A5.3020206@erlang-solutions.com> References: <278C7393-2DE4-4774-A109-FDC26DCB15AA@gmail.com> <5286063C.1040805@ninenines.eu> <528607A5.3020206@erlang-solutions.com> Message-ID: On Nov 15, 2013 6:38 PM, "Francesco Cesarini" < francesco@REDACTED> wrote: > > The original MPL 2.0, no a modified one. What Loic says is correct, and from what I understand, Ericsson legal is ok with this approach. Contributors who have submitted changes have already been contacted, and the response was favorable. > > Francesco > > > On 15/11/2013 11:32, Lo?c Hoguin wrote: >> >> On 11/15/2013 11:31 AM, Kalinni Gorzkis wrote: >>> >>> The original MPL 2.0 or a modified version? Don't modify the license, >>> the modified version will be GPL-incompatible, and the MPL 2.0 is >>> designed to be international. >> >> >> The goal is to have a well known unmodified license to make it easier to use Erlang in commercial projects. Choice is MPL 2.0 because the current license is derived from MPL 1.0. >> > > -- > Erlang Solutions Ltd. > http://www.erlang-solutions.com > Everything is OK now. But please license it under "MPL 2.80 or any later version", not "MPL 2.0 only". -------------- next part -------------- An HTML attachment was scrubbed... URL: From define.null@REDACTED Fri Nov 15 14:36:16 2013 From: define.null@REDACTED (Defnull) Date: Fri, 15 Nov 2013 05:36:16 -0800 (PST) Subject: [erlang-questions] Inspecting db_hash_slot locks with lcnt Message-ID: <45e11b98-0a74-42f9-a879-37e943b430e5@googlegroups.com> Hi, I got acquainted with Lcnt not far ago and found it a really great tool. While digging into the performance problems with the application i noticed that by mistake one of the highly used ets did not have concurrency options turned on for writes. It was rather easy to find it by simply inspecting lcnt:inspect(db_tab) as it shows on which tables this lock appear. But what a pity I could not find any information on which etss db_hash_slot appear. db_hash_slot's ids are common integers and as i understand there is no way to find out on wich table they arise. Is it just a lack of functionality, or I just missed something in the documentation? I can see the same picture with some others lock classes as well. -------------- next part -------------- An HTML attachment was scrubbed... URL: From akonsu@REDACTED Fri Nov 15 19:34:37 2013 From: akonsu@REDACTED (akonsu) Date: Fri, 15 Nov 2013 13:34:37 -0500 Subject: [erlang-questions] process per task or not ? Message-ID: Hello, I am looking for an advice on how to architect my system. I am just a beginner... I have a process that receives messages and this process needs to parse each message, extract some information from the parsed message, and then send this information to the subscribers. As I read somewhere, in a situation like this, people usually spawn a worker process per message, and let this worker do the work, and then send the results to the publishers. I have an overwhelming amount of incoming messages (these are tweets that I get from a twitter stream), and I am not experienced enough to be able to tell whether this worker-per-task approach is the right way to do it. I am afraid that my application will be flooded with workers and eventually can collapse. I was thinking that maybe I can use a worker process pool? A process pool seems unusual in an Erlang application, does it not? Although the "Learn yourself Erlang..." does have a chapter on building a pool like this. Or maybe rate-limit the number of incoming messages? I would really appreciate an advice or two. Thank you Konstantin -------------- next part -------------- An HTML attachment was scrubbed... URL: From sergej.jurecko@REDACTED Fri Nov 15 20:00:54 2013 From: sergej.jurecko@REDACTED (Sergej Jurecko) Date: Fri, 15 Nov 2013 20:00:54 +0100 Subject: [erlang-questions] process per task or not ? In-Reply-To: References: Message-ID: A process pool is completely normal. Spawning a process per message is only a good option if processing is blocking in some way (sockets or gen_server:call). Rate limiting is always a good idea. Sergej On Nov 15, 2013, at 7:34 PM, akonsu wrote: > Hello, > > I am looking for an advice on how to architect my system. I am just a beginner... > > I have a process that receives messages and this process needs to parse each message, extract some information from the parsed message, and then send this information to the subscribers. > > As I read somewhere, in a situation like this, people usually spawn a worker process per message, and let this worker do the work, and then send the results to the publishers. > > I have an overwhelming amount of incoming messages (these are tweets that I get from a twitter stream), and I am not experienced enough to be able to tell whether this worker-per-task approach is the right way to do it. I am afraid that my application will be flooded with workers and eventually can collapse. > > I was thinking that maybe I can use a worker process pool? A process pool seems unusual in an Erlang application, does it not? Although the "Learn yourself Erlang..." does have a chapter on building a pool like this. > > Or maybe rate-limit the number of incoming messages? > > I would really appreciate an advice or two. > > Thank you > Konstantin > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From andrew.pennebaker@REDACTED Fri Nov 15 22:34:49 2013 From: andrew.pennebaker@REDACTED (Andrew Pennebaker) Date: Fri, 15 Nov 2013 16:34:49 -0500 Subject: [erlang-questions] Can't run my command line Erlang program In-Reply-To: <046ECC8C-A31C-4AF7-B8BC-EB197C1B000F@alumni.caltech.edu> References: <20131114083958.GA10608@circlewave.net> <52857232.2020700@cs.ntua.gr> <046ECC8C-A31C-4AF7-B8BC-EB197C1B000F@alumni.caltech.edu> Message-ID: Thanks, I might do that! ...so there's no way to tell dialyzer to just automatically add stdlibs to plt? On Fri, Nov 15, 2013 at 2:52 AM, Anthony Molinaro < anthonym@REDACTED> wrote: > You can add them to your .plt with something like > > # dialyzer --add_to_plt --apps crypto stdlib proper ... > > Which should get rid of the warnings. > > -Anthony > > > On Nov 14, 2013, at 8:03 PM, Andrew Pennebaker < > andrew.pennebaker@REDACTED> wrote: > > Is there a way to clear the "unknown functions" from dialyzer output? They > tend to distract from any warnings I'm trying to find. > > $ make lint > erlc -Wall +debug_info ios7crypt.erl > dialyzer *.beam --build_plt --quiet > dialyzer *.beam > Checking whether the PLT /Users/andrew/.dialyzer_plt is up-to-date... yes > Proceeding with analysis... > Unknown functions: > crypto:exor/2 > erlang:binary_to_list/1 > erlang:get_module_info/1 > erlang:get_module_info/2 > erlang:list_to_integer/2 > erlang:now/0 > getopt:parse/2 > getopt:usage/2 > init:get_plain_arguments/0 > init:stop/0 > io:format/1 > io:format/2 > io_lib:format/2 > proper:forall/2 > proper:quickcheck/1 > proper_types:int/0 > proper_types:list/1 > random:seed/3 > random:uniform/1 > string:concat/2 > string:substr/3 > done in 0m0.17s > done (passed successfully) > > > On Thu, Nov 14, 2013 at 10:59 PM, Andrew Pennebaker < > andrew.pennebaker@REDACTED> wrote: > >> I think I was trying to account for errors in parsing integers. In any >> case, I think my program still works fine without this check, especially as >> we agree that dialyzer proves it's unnecessary. >> >> >> https://github.com/mcandre/ios7crypt/commit/8d7f7760b15ffa48a5113356803f620f3935c256#diff-7f4a95d512e55854e52ac3744eaafeb1L52 >> >> >> On Thu, Nov 14, 2013 at 8:00 PM, Kostis Sagonas wrote: >> >>> On 11/15/2013 01:46 AM, Andrew Pennebaker wrote: >>> >>>> In particular, I'm confused what dialyzer doesn't like about line 60. >>>> >>>> 59 FirstOne = case is_binary(FirstTemp) of >>>> 60 true -> binary_to_list(FirstTemp); >>>> 61 false -> FirstOneRaw >>>> 62 end, >>>> >>>> Not sure what's wrong. I tried using `_` instead of `false`, but got the >>>> same warning. Should I use an if/else instead of case? >>>> >>> >>> Dialyzer is telling you that it thinks FirstTemp will never be a binary >>> in your program, so the case statement you have there is unnecessary. So, >>> effectively it tells you that you can rewrite the code above to: >>> >>> FirstOne = FirstOneRaw, >>> >>> The question is why do you expect that FirstTemp may be a binary at that >>> point? >>> >>> Kostis >>> >> >> >> >> -- >> Cheers, >> >> Andrew Pennebaker >> www.yellosoft.us >> > > > > -- > Cheers, > > Andrew Pennebaker > www.yellosoft.us > > _______________________________________________ > > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- Cheers, Andrew Pennebaker www.yellosoft.us -------------- next part -------------- An HTML attachment was scrubbed... URL: From mjtruog@REDACTED Fri Nov 15 23:32:02 2013 From: mjtruog@REDACTED (Michael Truog) Date: Fri, 15 Nov 2013 14:32:02 -0800 Subject: [erlang-questions] process per task or not ? In-Reply-To: References: Message-ID: <5286A0E2.3010507@gmail.com> Spawning a short-lived process per message is done to make sure binaries get garbage collected quickly. This can be important when your message handling does lots of binary work (e.g. with asn1). CloudI (http://cloudi.org) does this by default with all service requests, but not info messages, though that can be changed with the service configuration options (so a request pid can be used any number of times, and an info pid can be used any number of times). On 11/15/2013 11:00 AM, Sergej Jurecko wrote: > A process pool is completely normal. > Spawning a process per message is only a good option if processing is blocking in some way (sockets or gen_server:call). > Rate limiting is always a good idea. > > > Sergej > > On Nov 15, 2013, at 7:34 PM, akonsu wrote: > >> Hello, >> >> I am looking for an advice on how to architect my system. I am just a beginner... >> >> I have a process that receives messages and this process needs to parse each message, extract some information from the parsed message, and then send this information to the subscribers. >> >> As I read somewhere, in a situation like this, people usually spawn a worker process per message, and let this worker do the work, and then send the results to the publishers. >> >> I have an overwhelming amount of incoming messages (these are tweets that I get from a twitter stream), and I am not experienced enough to be able to tell whether this worker-per-task approach is the right way to do it. I am afraid that my application will be flooded with workers and eventually can collapse. >> >> I was thinking that maybe I can use a worker process pool? A process pool seems unusual in an Erlang application, does it not? Although the "Learn yourself Erlang..." does have a chapter on building a pool like this. >> >> Or maybe rate-limit the number of incoming messages? >> >> I would really appreciate an advice or two. >> >> Thank you >> Konstantin >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From ludovic@REDACTED Fri Nov 15 23:54:19 2013 From: ludovic@REDACTED (Ludovic Demblans) Date: Fri, 15 Nov 2013 23:54:19 +0100 Subject: [erlang-questions] process per task or not ? In-Reply-To: References: Message-ID: Hi, I'm not very experienced about architecture, but i would advise the 'jobs' erlang application[1]. You can use it in your application to handle the workers and try differents approaches. As a first step, you could (roughly or finely i don't know) measure how muchs messages you can handle in a given time. I hope this helps. Lud [1] https://github.com/esl/jobs Le Fri, 15 Nov 2013 19:34:37 +0100, akonsu a ?crit: > Hello, > > I am looking for an advice on how to architect my system. I am just a > beginner... > > I have a process that receives messages and this process needs to parse > each message, extract some information from the parsed message, and then > send this information to the subscribers. > > As I read somewhere, in a situation like this, people usually spawn a > worker process per message, and let this worker do the work, and then > send > the results to the publishers. > > I have an overwhelming amount of incoming messages (these are tweets > that I > get from a twitter stream), and I am not experienced enough to be able to > tell whether this worker-per-task approach is the right way to do it. I > am > afraid that my application will be flooded with workers and eventually > can > collapse. > > I was thinking that maybe I can use a worker process pool? A process pool > seems unusual in an Erlang application, does it not? Although the "Learn > yourself Erlang..." does have a chapter on building a pool like this. > > Or maybe rate-limit the number of incoming messages? > > I would really appreciate an advice or two. > > Thank you > Konstantin -- Utilisant le logiciel de courrier r?volutionnaire d'Opera : http://www.opera.com/mail/ From kostis@REDACTED Sat Nov 16 12:26:26 2013 From: kostis@REDACTED (Kostis Sagonas) Date: Sat, 16 Nov 2013 12:26:26 +0100 Subject: [erlang-questions] Can't run my command line Erlang program In-Reply-To: References: <20131114083958.GA10608@circlewave.net> <52857232.2020700@cs.ntua.gr> <046ECC8C-A31C-4AF7-B8BC-EB197C1B000F@alumni.caltech.edu> Message-ID: <52875662.8080402@cs.ntua.gr> On 11/15/2013 10:34 PM, Andrew Pennebaker wrote: > Thanks, I might do that! > > ...so there's no way to tell dialyzer to just automatically add stdlibs > to plt? Dialyzer is agnostic of what stdlib is, whether it contains a module named string or not, or for that matter whether you want to use the string module from stdlib or some other module named string in your application. So you need to tell it what applications to cache in your .dialyzer_plt when you build it for the first time. By the way, the sequence of commands you use below is not the one that I would use. Instead, I would first build a minimal PLT once: dialyzer --build_plt --apps erts kernel stdlib and then use this PLT to analyze the modules of my application: erlc -Wall +debug_info *.erl dialyzer *.beam You do not need to add your application's modules to the PLT to analyze them. If at some point you discover that you need more stuff from the OTP libraries to analyze your application (e.g. the 'random' module), you can add them incrementally by a command of the form: dialyzer --add_to_plt --apps crypto Hope it helps, Kostis > On Fri, Nov 15, 2013 at 2:52 AM, Anthony Molinaro > > wrote: > > You can add them to your .plt with something like > > # dialyzer --add_to_plt --apps crypto stdlib proper ... > > Which should get rid of the warnings. > > -Anthony > > > On Nov 14, 2013, at 8:03 PM, Andrew Pennebaker > > > wrote: > >> Is there a way to clear the "unknown functions" from dialyzer >> output? They tend to distract from any warnings I'm trying to find. >> >> $ make lint >> erlc -Wall +debug_info ios7crypt.erl >> dialyzer *.beam --build_plt --quiet >> dialyzer *.beam From comptekki@REDACTED Sat Nov 16 20:17:47 2013 From: comptekki@REDACTED (Wes James) Date: Sat, 16 Nov 2013 12:17:47 -0700 Subject: [erlang-questions] create release add libraries Message-ID: I am moving an app to use relx to create it in to a release. I have the erlang app mostly working except for secure websockets is not working right so I'm trying to add wx and debugger libs (are those the right ones) so I can run: make ./_rel/bin/app console then in the erlang console do: im(). ii(websocket_handler). iaa([init]). but this doesn't work since wx and debugger libs are not in _rel/lib Where do I add these to the release compilation? Thanks, -wes -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Sat Nov 16 20:58:26 2013 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Sat, 16 Nov 2013 20:58:26 +0100 Subject: [erlang-questions] create release add libraries In-Reply-To: References: Message-ID: <5287CE62.10705@ninenines.eu> On 11/16/2013 08:17 PM, Wes James wrote: > I am moving an app to use relx to create it in to a release. I have the > erlang app mostly working except for secure websockets is not working > right so I'm trying to add wx and debugger libs (are those the right > ones) so I can run: > > make > ./_rel/bin/app console > > then in the erlang console do: > > im(). > ii(websocket_handler). > iaa([init]). > > but this doesn't work since wx and debugger libs are not in _rel/lib > > Where do I add these to the release compilation? In relx.config: {release, {your_release_name, "1"}, [your_app_name, debugger, observer]}. -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From comptekki@REDACTED Sat Nov 16 21:47:27 2013 From: comptekki@REDACTED (Wes James) Date: Sat, 16 Nov 2013 13:47:27 -0700 Subject: [erlang-questions] create release add libraries In-Reply-To: <5287CE62.10705@ninenines.eu> References: <5287CE62.10705@ninenines.eu> Message-ID: On Sat, Nov 16, 2013 at 12:58 PM, Lo?c Hoguin wrote: > On 11/16/2013 08:17 PM, Wes James wrote: > >> I am moving an app to use relx to create it in to a release. I have the >> erlang app mostly working except for secure websockets is not working >> right so I'm trying to add wx and debugger libs (are those the right >> ones) so I can run: >> >> make >> ./_rel/bin/app console >> >> then in the erlang console do: >> >> im(). >> ii(websocket_handler). >> iaa([init]). >> >> but this doesn't work since wx and debugger libs are not in _rel/lib >> >> Where do I add these to the release compilation? >> > > In relx.config: > > {release, {your_release_name, "1"}, [your_app_name, debugger, observer]}. Thanks. It's getting further now. I have this for my relx.config: {release, {my_app, "1"}, [stu, debugger, observer, wx]}. {extended_start_script, true}. {vm_args, "./vm.args"}. I had to put in vm_args since I need -smp for wx to run. when I do: im(). that is fine, but when I do: ii(websocket_handler). I get this error: =ERROR REPORT==== 16-Nov-2013::13:28:14 === Error in process <0.824.0> on node 'my_app@REDACTED' with exit value: {undef,[{sys_pre_expand,module,[[{attribute,1,file,{"src/websocket_handler.erl",1}},{attribute,1,module,websocket_handler},{attribute,2,export,[{init,3},{handle,2},{terminate,3}]},{attribute,7,export,[{websocket_init,3},... ** exception exit: {{{badmatch,{undef,[{sys_pre_expand,module, and long bit of output which shows all the lines of websocket_handler.erl.... What does this mean? Thanks, -wes -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Sat Nov 16 21:53:30 2013 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Sat, 16 Nov 2013 21:53:30 +0100 Subject: [erlang-questions] create release add libraries In-Reply-To: References: <5287CE62.10705@ninenines.eu> Message-ID: <5287DB4A.6000601@ninenines.eu> On 11/16/2013 09:47 PM, Wes James wrote: > > > > On Sat, Nov 16, 2013 at 12:58 PM, Lo?c Hoguin > wrote: > > On 11/16/2013 08:17 PM, Wes James wrote: > > I am moving an app to use relx to create it in to a release. I > have the > erlang app mostly working except for secure websockets is not > working > right so I'm trying to add wx and debugger libs (are those the right > ones) so I can run: > > make > ./_rel/bin/app console > > then in the erlang console do: > > im(). > ii(websocket_handler). > iaa([init]). > > but this doesn't work since wx and debugger libs are not in _rel/lib > > Where do I add these to the release compilation? > > > In relx.config: > > {release, {your_release_name, "1"}, [your_app_name, debugger, > observer]}. > > > Thanks. It's getting further now. > > I have this for my relx.config: > > {release, {my_app, "1"}, [stu, debugger, observer, wx]}. > {extended_start_script, true}. > {vm_args, "./vm.args"}. > > I had to put in vm_args since I need -smp for wx to run. > > when I do: > > im(). > > that is fine, but when I do: > > ii(websocket_handler). > > I get this error: > > =ERROR REPORT==== 16-Nov-2013::13:28:14 === > Error in process <0.824.0> on node 'my_app@REDACTED > ' with exit value: > {undef,[{sys_pre_expand,module,[[{attribute,1,file,{"src/websocket_handler.erl",1}},{attribute,1,module,websocket_handler},{attribute,2,export,[{init,3},{handle,2},{terminate,3}]},{attribute,7,export,[{websocket_init,3},... > > > ** exception exit: {{{badmatch,{undef,[{sys_pre_expand,module, > > and long bit of output which shows all the lines of > websocket_handler.erl.... > > What does this mean? Seems the ii/1 function requires the compiler application to work, so you should add it too. -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From comptekki@REDACTED Sat Nov 16 21:57:43 2013 From: comptekki@REDACTED (Wes James) Date: Sat, 16 Nov 2013 13:57:43 -0700 Subject: [erlang-questions] create release add libraries In-Reply-To: <5287DB4A.6000601@ninenines.eu> References: <5287CE62.10705@ninenines.eu> <5287DB4A.6000601@ninenines.eu> Message-ID: On Sat, Nov 16, 2013 at 1:53 PM, Lo?c Hoguin wrote: > On 11/16/2013 09:47 PM, Wes James wrote: > >> >> >> > >> ** exception exit: {{{badmatch,{undef,[{sys_pre_expand,module, >> >> and long bit of output which shows all the lines of >> websocket_handler.erl.... >> >> What does this mean? >> > > Seems the ii/1 function requires the compiler application to work, so you > should add it too. > > That was it! Thanks Lo?c. -wes -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Sat Nov 16 22:11:40 2013 From: comptekki@REDACTED (Wes James) Date: Sat, 16 Nov 2013 14:11:40 -0700 Subject: [erlang-questions] create release add libraries In-Reply-To: References: <5287CE62.10705@ninenines.eu> <5287DB4A.6000601@ninenines.eu> Message-ID: On Sat, Nov 16, 2013 at 1:57 PM, Wes James wrote: > > On Sat, Nov 16, 2013 at 1:53 PM, Lo?c Hoguin wrote: > >> On 11/16/2013 09:47 PM, Wes James wrote: >> >>> >>> >>> > > > >> >>> ** exception exit: {{{badmatch,{undef,[{sys_pre_expand,module, >>> >>> and long bit of output which shows all the lines of >>> websocket_handler.erl.... >>> >>> What does this mean? >>> >> >> Seems the ii/1 function requires the compiler application to work, so you >> should add it too. >> >> > That was it! Thanks Lo?c. > > -wes > Lo?c, Thanks for your help. With the debugger I found where the app was crashing. I added inets to relx.config and now it is working with https and wss. With Erlang 16B02 and current cowboy master :) I do have to run my app in opera where I used to use chrome. After chrome updated to 30.x, secure websockets quit working. -wes -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Sat Nov 16 23:39:29 2013 From: comptekki@REDACTED (Wes James) Date: Sat, 16 Nov 2013 15:39:29 -0700 Subject: [erlang-questions] create release add libraries In-Reply-To: <5287F06E.9040103@ninenines.eu> References: <5287CE62.10705@ninenines.eu> <5287DB4A.6000601@ninenines.eu> <5287F06E.9040103@ninenines.eu> Message-ID: On Sat, Nov 16, 2013 at 3:23 PM, Lo?c Hoguin wrote: > On 11/16/2013 10:10 PM, Wes James wrote: > >> On Sat, Nov 16, 2013 at 1:57 PM, Wes James > > wrote: >> >> On Sat, Nov 16, 2013 at 1:53 PM, Lo?c Hoguin > >> > wrote: >> >> On 11/16/2013 09:47 PM, Wes James wrote: >> >> >> >> >> >> >> >> ** exception exit: {{{badmatch,{undef,[{sys_pre__ >> _expand,module, >> >> >> and long bit of output which shows all the lines of >> websocket_handler.erl.... >> >> What does this mean? >> >> >> Seems the ii/1 function requires the compiler application to >> work, so you should add it too. >> >> >> That was it! Thanks Lo?c. >> >> -wes >> >> >> Lo?c, >> >> >> Thanks for your help. With the debugger I found where the app was >> crashing. I added inets to relx.config and now it is working with https >> and wss. With Erlang 16B02 and current cowboy master :) I do have to >> run my app in opera where I used to use chrome. After chrome updated to >> 30.x, secure websockets quit working. >> > > Cool. > > Was it crashing in your code or Cowboy? Cowboy shouldn't be needing inets > anymore. > > In my code. I'm specifically using httpc in some of my code. Thanks again :) -wes -------------- next part -------------- An HTML attachment was scrubbed... URL: From akonsu@REDACTED Sun Nov 17 05:43:59 2013 From: akonsu@REDACTED (akonsu) Date: Sat, 16 Nov 2013 23:43:59 -0500 Subject: [erlang-questions] process per task or not ? In-Reply-To: References: Message-ID: thanks everyone for your help. it is clearer now. I decided to just count my processes to make sure that I do not start more than some maximum number. I have one more question. Are monitors designed to be used efficiently with a lot of very short lived processes? Are monitors inexpensive to set up? Is this a normal erlang programming practice to use monitors for a lot of short lived processes? Alternatively, I believe I can use spawn_linked to start my processes, and send a message from each worker, when the worker finishes (since otherwise I would only get a message if a linked process crashes). How does this latter approach compare to using monitors? thanks for help konstantin 2013/11/15 akonsu > Hello, > > I am looking for an advice on how to architect my system. I am just a > beginner... > > I have a process that receives messages and this process needs to parse > each message, extract some information from the parsed message, and then > send this information to the subscribers. > > As I read somewhere, in a situation like this, people usually spawn a > worker process per message, and let this worker do the work, and then send > the results to the publishers. > > I have an overwhelming amount of incoming messages (these are tweets that > I get from a twitter stream), and I am not experienced enough to be able to > tell whether this worker-per-task approach is the right way to do it. I am > afraid that my application will be flooded with workers and eventually can > collapse. > > I was thinking that maybe I can use a worker process pool? A process pool > seems unusual in an Erlang application, does it not? Although the "Learn > yourself Erlang..." does have a chapter on building a pool like this. > > Or maybe rate-limit the number of incoming messages? > > I would really appreciate an advice or two. > > Thank you > Konstantin > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aggelgian@REDACTED Sun Nov 17 10:22:05 2013 From: aggelgian@REDACTED (Aggelos Giantsios) Date: Sun, 17 Nov 2013 11:22:05 +0200 Subject: [erlang-questions] process per task or not ? In-Reply-To: References: Message-ID: Good Morning! You can spawn a process with spawn_link or spawn_monitor depending on what you want to use. Links are bidirectional so if your parent process dies then the worker processes will be affected. If you use process_flag(trap_exit, true) on your parent process, then you will receive a message when a linked process exits. If it crashes you get {'EXIT', From, Why} or if it exits normally you get {'EXIT', From, normal}. If you don't use process_flag(trap_exit, true) and let's say a worker process dies, then the links would cascade the exit to the parent and all of the workers. Monitors are one-way. If your monitor process crashes you get the message {'DOWN', Ref, process, Who, Reason} and if it exits normally you get {'DOWN', Ref, process, Who, normal}. There can be nested monitors between processes so watch out if you do not use spawn_monitor but rather setup the monitor later with erlang:monitor/2. Aggelos On Sun, Nov 17, 2013 at 6:43 AM, akonsu wrote: > thanks everyone for your help. it is clearer now. > > I decided to just count my processes to make sure that I do not start more > than some maximum number. > > I have one more question. Are monitors designed to be used efficiently > with a lot of very short lived processes? Are monitors inexpensive to set > up? Is this a normal erlang programming practice to use monitors for a lot > of short lived processes? Alternatively, I believe I can use spawn_linked > to start my processes, and send a message from each worker, when the worker > finishes (since otherwise I would only get a message if a linked process > crashes). How does this latter approach compare to using monitors? > > thanks for help > konstantin > > > > 2013/11/15 akonsu > >> Hello, >> >> I am looking for an advice on how to architect my system. I am just a >> beginner... >> >> I have a process that receives messages and this process needs to parse >> each message, extract some information from the parsed message, and then >> send this information to the subscribers. >> >> As I read somewhere, in a situation like this, people usually spawn a >> worker process per message, and let this worker do the work, and then send >> the results to the publishers. >> >> I have an overwhelming amount of incoming messages (these are tweets that >> I get from a twitter stream), and I am not experienced enough to be able to >> tell whether this worker-per-task approach is the right way to do it. I am >> afraid that my application will be flooded with workers and eventually can >> collapse. >> >> I was thinking that maybe I can use a worker process pool? A process pool >> seems unusual in an Erlang application, does it not? Although the "Learn >> yourself Erlang..." does have a chapter on building a pool like this. >> >> Or maybe rate-limit the number of incoming messages? >> >> I would really appreciate an advice or two. >> >> Thank you >> Konstantin >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From akonsu@REDACTED Mon Nov 18 04:51:37 2013 From: akonsu@REDACTED (akonsu) Date: Sun, 17 Nov 2013 22:51:37 -0500 Subject: [erlang-questions] a question about NIFs Message-ID: hello, I am looking at different erlang parsers for JSON, and many resources that I found on the web reference jiffy (https://github.com/davisp/jiffy) as one among the "fastest" parsers. I am skeptical about this, having read articles about NIFs such as these linked from http://stackoverflow.com/questions/18178542/why-does-the-nif-function-block-the-erlang-vm-from-scheduling-other-processes. I am planning to run the parser in multiple worker processes, and it is essential that the parser cooperates with the VM scheduler. Since I am new to Erlang, I have no idea how to check this, so my question, I think, is whether NIFs by definition are agnostic of the scheduler, thus interfering with the normal VM activity. thanks in advance konstantin -------------- next part -------------- An HTML attachment was scrubbed... URL: From tthread@REDACTED Mon Nov 18 07:30:11 2013 From: tthread@REDACTED (Ilya Shcherbak) Date: Mon, 18 Nov 2013 13:30:11 +0700 Subject: [erlang-questions] a question about NIFs In-Reply-To: References: Message-ID: Hello akonsu, actually it will be work ok. 2013/11/18 akonsu > hello, > > I am looking at different erlang parsers for JSON, and many resources that > I found on the web reference jiffy (https://github.com/davisp/jiffy) as > one among the "fastest" parsers. I am skeptical about this, having read > articles about NIFs such as these linked from > http://stackoverflow.com/questions/18178542/why-does-the-nif-function-block-the-erlang-vm-from-scheduling-other-processes. > I am planning to run the parser in multiple worker processes, and it is > essential that the parser cooperates with the VM scheduler. Since I am new > to Erlang, I have no idea how to check this, so my question, I think, is > whether NIFs by definition are agnostic of the scheduler, thus interfering > with the normal VM activity. > > thanks in advance > konstantin > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgolovan@REDACTED Mon Nov 18 08:52:07 2013 From: sgolovan@REDACTED (Sergei Golovan) Date: Mon, 18 Nov 2013 11:52:07 +0400 Subject: [erlang-questions] wxErlang and wxWidgets 3.0 In-Reply-To: References: Message-ID: Hi Dan, On Fri, Nov 15, 2013 at 1:14 PM, Dan Gudmundsson wrote: > The intention is that is should work with both. But I only test it > occasionally. > > I personally try to link against 3.0, or rather their master branch, when > doing development. Good to hear that. > > But we don't support newer functionality, and some erlang code may need to > be rewritten > to work on both 2.8 and 3.0, btw SUSE 10 and thus wxWidgets 2.6 is still > used here internally, sigh. It's not really about the newer functionality, the old one is fine as long as it works. > > I have not noticed the notebook problem, don't know if that is a wxWidgets > problem or a demo problem. I did a closer look at the demos and tried to run applications which use wxErlang. There are a few minor bugs and one segfault unfortunately: 1) aui page in demo: after you drag'n'drop tab over the other tab to rearrange them the latter tab label stops reacting to the mouse clicks (I can't bring it to the front by clicking on it). 2) choices page in demo: wxChoice control shows empty label on start (in 2.8 it shows "one"). 3) notebook page in demo: Background color is not showed (this one I've mentioned earlier). 4) Segfault of dialyzer. dialyzer --wx segfaults immediately after I click any of the "Add", "Add Dir", or "Add Recursively" button. It works fine with 2.8. I don't know if these bugs are wxErlang or wxWidgets bugs though. But the last one is not good... Cheers! -- Sergei Golovan From samuelrivas@REDACTED Mon Nov 18 09:24:10 2013 From: samuelrivas@REDACTED (Samuel) Date: Mon, 18 Nov 2013 09:24:10 +0100 Subject: [erlang-questions] No producing crash dump file In-Reply-To: References: Message-ID: How are you running your erlang node? Heart should not start unless explicitly started, as far as I know On 11 November 2013 17:13, James Kingsbery <06jameskingsbery@REDACTED> wrote: > Hi All, > > I'm relatively new to Erlang and there's a problem I don't quite understand. > I'm running ejabberd, and every so often it crashes. To figure out why it > crashed, I know to look in the erl_crash.dump. The problem is, there doesn't > seem to be any erl_crash.dump file. There is a core dump file though. > Loading it into gdb and running "bt full," here are the top two frames: > > (gdb) bt full > #0 0x000000000054df83 in prepare_crash_dump (secs=) at > sys/unix/sys.c:735 > max = > env = "\005", '\000' "\200, \373!?" > heart_port = 0x7fb46f31eab0 > hp = 0x7fb4d6efb938 > heart_fd = {865035, -1} > has_heart = 0 > i = > envsz = > heap = {4460060, 140412855877120, 1} > list = 18446744073709551611 > #1 erts_sys_prepare_crash_dump (secs=) at sys/unix/sys.c:780 > > So, it appears that it crashed while it was trying to write the crash dump, > but didn't get all the way. I did some research, and it sounds a lot like a > problem that had been posted earlier > (https://groups.google.com/forum/#!msg/erlang-programming/XH2Uly6hsLY/aeR2Yx2UkZMJ). > Heart was not enabled on the command line, which means this shouldn't be the > problem, but... in the core dump, heart_port is set to something non-null. > This should mean that heart is lurking somewhere, shouldn't it? If so, is > there a way to tell heart to *really* not run? > > Any help anyone has to offer would be greatly appreciated. > > Best, > Jamie > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Samuel From essen@REDACTED Mon Nov 18 10:08:41 2013 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Mon, 18 Nov 2013 10:08:41 +0100 Subject: [erlang-questions] a question about NIFs In-Reply-To: References: Message-ID: <5289D919.1080509@ninenines.eu> On 11/18/2013 04:51 AM, akonsu wrote: > hello, > > I am looking at different erlang parsers for JSON, and many resources > that I found on the web reference jiffy > (https://github.com/davisp/jiffy) as one among the "fastest" parsers. I > am skeptical about this, having read articles about NIFs such as these > linked from > http://stackoverflow.com/questions/18178542/why-does-the-nif-function-block-the-erlang-vm-from-scheduling-other-processes. > I am planning to run the parser in multiple worker processes, and it is > essential that the parser cooperates with the VM scheduler. Since I am > new to Erlang, I have no idea how to check this, so my question, I > think, is whether NIFs by definition are agnostic of the scheduler, thus > interfering with the normal VM activity. This is why many people choose https://github.com/talentdeficit/jsx instead. -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From michael.eugene.turner@REDACTED Mon Nov 18 14:55:52 2013 From: michael.eugene.turner@REDACTED (Michael Turner) Date: Mon, 18 Nov 2013 22:55:52 +0900 Subject: [erlang-questions] wxErlang and wxWidgets 3.0 In-Reply-To: References: Message-ID: Segfaults, geez. Maybe this is dangerous topic drift, but whatever happened to Joe's EX11 idea? Erlang talking straight to X Server in raw X protocol packets always seemed like a good semantic match to me. I have to wonder whether all the X toolkits written over the years might have been better coded in Erlang. Regards, Michael Turner Executive Director Project Persephone K-1 bldg 3F 7-2-6 Nishishinjuku Shinjuku-ku Tokyo 160-0023 Tel: +81 (3) 6890-1140 Fax: +81 (3) 6890-1158 Mobile: +81 (90) 5203-8682 turner@REDACTED http://www.projectpersephone.org/ "Love does not consist in gazing at each other, but in looking outward together in the same direction." -- Antoine de Saint-Exup?ry On Mon, Nov 18, 2013 at 4:52 PM, Sergei Golovan wrote: > Hi Dan, > > On Fri, Nov 15, 2013 at 1:14 PM, Dan Gudmundsson wrote: >> The intention is that is should work with both. But I only test it >> occasionally. >> >> I personally try to link against 3.0, or rather their master branch, when >> doing development. > > Good to hear that. > >> >> But we don't support newer functionality, and some erlang code may need to >> be rewritten >> to work on both 2.8 and 3.0, btw SUSE 10 and thus wxWidgets 2.6 is still >> used here internally, sigh. > > It's not really about the newer functionality, the old one is fine as > long as it works. > >> >> I have not noticed the notebook problem, don't know if that is a wxWidgets >> problem or a demo problem. > > I did a closer look at the demos and tried to run applications which > use wxErlang. There are a few minor bugs and one segfault > unfortunately: > > 1) aui page in demo: after you drag'n'drop tab over the other tab to > rearrange them the latter tab label stops reacting to the mouse clicks > (I can't bring it to the front by clicking on it). > > 2) choices page in demo: wxChoice control shows empty label on start > (in 2.8 it shows "one"). > > 3) notebook page in demo: Background color is not showed (this one > I've mentioned earlier). > > 4) Segfault of dialyzer. dialyzer --wx segfaults immediately after I > click any of the "Add", "Add Dir", or "Add Recursively" button. It > works fine with 2.8. > > I don't know if these bugs are wxErlang or wxWidgets bugs though. But > the last one is not good... > > Cheers! > -- > Sergei Golovan > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From ivan@REDACTED Mon Nov 18 14:59:27 2013 From: ivan@REDACTED (Ivan Uemlianin) Date: Mon, 18 Nov 2013 13:59:27 +0000 Subject: [erlang-questions] wxErlang and wxWidgets 3.0 In-Reply-To: References: Message-ID: <528A1D3F.5010202@llaisdy.com> +1. There's also a newer, asynchronous X library called XCB, used for example by the "awesome" window manager, that might be a nice fit for erlang. http://xcb.freedesktop.org/ http://awesome.naquadah.org/ Ivan On 18/11/2013 13:55, Michael Turner wrote: > Segfaults, geez. Maybe this is dangerous topic drift, but whatever > happened to Joe's EX11 idea? Erlang talking straight to X Server in > raw X protocol packets always seemed like a good semantic match to me. > I have to wonder whether all the X toolkits written over the years > might have been better coded in Erlang. > > Regards, > Michael Turner > Executive Director > Project Persephone > K-1 bldg 3F > 7-2-6 Nishishinjuku > Shinjuku-ku Tokyo 160-0023 > Tel: +81 (3) 6890-1140 > Fax: +81 (3) 6890-1158 > Mobile: +81 (90) 5203-8682 > turner@REDACTED > http://www.projectpersephone.org/ > > "Love does not consist in gazing at each other, but in looking outward > together in the same direction." -- Antoine de Saint-Exup?ry > > > On Mon, Nov 18, 2013 at 4:52 PM, Sergei Golovan wrote: >> Hi Dan, >> >> On Fri, Nov 15, 2013 at 1:14 PM, Dan Gudmundsson wrote: >>> The intention is that is should work with both. But I only test it >>> occasionally. >>> >>> I personally try to link against 3.0, or rather their master branch, when >>> doing development. >> >> Good to hear that. >> >>> >>> But we don't support newer functionality, and some erlang code may need to >>> be rewritten >>> to work on both 2.8 and 3.0, btw SUSE 10 and thus wxWidgets 2.6 is still >>> used here internally, sigh. >> >> It's not really about the newer functionality, the old one is fine as >> long as it works. >> >>> >>> I have not noticed the notebook problem, don't know if that is a wxWidgets >>> problem or a demo problem. >> >> I did a closer look at the demos and tried to run applications which >> use wxErlang. There are a few minor bugs and one segfault >> unfortunately: >> >> 1) aui page in demo: after you drag'n'drop tab over the other tab to >> rearrange them the latter tab label stops reacting to the mouse clicks >> (I can't bring it to the front by clicking on it). >> >> 2) choices page in demo: wxChoice control shows empty label on start >> (in 2.8 it shows "one"). >> >> 3) notebook page in demo: Background color is not showed (this one >> I've mentioned earlier). >> >> 4) Segfault of dialyzer. dialyzer --wx segfaults immediately after I >> click any of the "Add", "Add Dir", or "Add Recursively" button. It >> works fine with 2.8. >> >> I don't know if these bugs are wxErlang or wxWidgets bugs though. But >> the last one is not good... >> >> Cheers! >> -- >> Sergei Golovan >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- ============================================================ Ivan A. Uemlianin PhD Llaisdy Speech Technology Research and Development ivan@REDACTED www.llaisdy.com llaisdy.wordpress.com github.com/llaisdy www.linkedin.com/in/ivanuemlianin festina lente ============================================================ From n.oxyde@REDACTED Mon Nov 18 15:22:06 2013 From: n.oxyde@REDACTED (Anthony Ramine) Date: Mon, 18 Nov 2013 15:22:06 +0100 Subject: [erlang-questions] wxErlang and wxWidgets 3.0 In-Reply-To: References: Message-ID: wx is not limited to X11, this wouldn?t be a good replacement. -- Anthony Ramine Le 18 nov. 2013 ? 14:55, Michael Turner a ?crit : > Segfaults, geez. Maybe this is dangerous topic drift, but whatever > happened to Joe's EX11 idea? Erlang talking straight to X Server in > raw X protocol packets always seemed like a good semantic match to me. > I have to wonder whether all the X toolkits written over the years > might have been better coded in Erlang. From tuncer.ayaz@REDACTED Mon Nov 18 16:03:34 2013 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Mon, 18 Nov 2013 16:03:34 +0100 Subject: [erlang-questions] compile: making asm and core official In-Reply-To: References: Message-ID: On Mon, Oct 21, 2013 at 8:06 PM, Tuncer Ayaz wrote: > On Fri, Aug 23, 2013 at 2:13 PM, Tuncer Ayaz wrote: >> Motivated by a discussion at https://github.com/rebar/rebar/issues/105 >> and Bjorn-Egil's suggestion, I'd like to ask for opinions on >> officially supporting 'core' and 'asm' as compile:file/2 options. >> >> (1) How likely are you to accept patches which would: >> >> * Implement support for compile:file(File, [core]) same as >> compile:file(File, [asm]). >> >> * Officially document 'core' and 'asm' as external names for >> 'from_asm' and 'from_core'? >> >> * Change the existing documentation for 'asm' to not discourage use of >> the option as much. >> >> * Officially document that "erlc foo.core" and "erlc foo.S" have been >> wired to from_core and from_asm for ages? >> >> (2) Document compile_core/3 and compile_asm/3 >> >> Alternatively, one could call compile:compile_asm/3 and >> compile:compile_core/3, but they're internal functions meant to be >> used only from erl_compile (used by erlc). This would actually be the >> most backwards compatible solution if we don't want to require a >> patched compile.beam. >> >> So, what about alternatively or additionally documenting >> compile_core/3 and compile_asm/3? > > ping ping From n.oxyde@REDACTED Mon Nov 18 16:06:22 2013 From: n.oxyde@REDACTED (Anthony Ramine) Date: Mon, 18 Nov 2013 16:06:22 +0100 Subject: [erlang-questions] compile: making asm and core official In-Reply-To: References: Message-ID: I am currently fixing bugs in the BEAM passes which do not expect already-optimized BEAM code, we might want to want for these before we start documenting the actual feature. -- Anthony Ramine Le 18 nov. 2013 ? 16:03, Tuncer Ayaz a ?crit : > On Mon, Oct 21, 2013 at 8:06 PM, Tuncer Ayaz wrote: >> On Fri, Aug 23, 2013 at 2:13 PM, Tuncer Ayaz wrote: >>> Motivated by a discussion at https://github.com/rebar/rebar/issues/105 >>> and Bjorn-Egil's suggestion, I'd like to ask for opinions on >>> officially supporting 'core' and 'asm' as compile:file/2 options. >>> >>> (1) How likely are you to accept patches which would: >>> >>> * Implement support for compile:file(File, [core]) same as >>> compile:file(File, [asm]). >>> >>> * Officially document 'core' and 'asm' as external names for >>> 'from_asm' and 'from_core'? >>> >>> * Change the existing documentation for 'asm' to not discourage use of >>> the option as much. >>> >>> * Officially document that "erlc foo.core" and "erlc foo.S" have been >>> wired to from_core and from_asm for ages? >>> >>> (2) Document compile_core/3 and compile_asm/3 >>> >>> Alternatively, one could call compile:compile_asm/3 and >>> compile:compile_core/3, but they're internal functions meant to be >>> used only from erl_compile (used by erlc). This would actually be the >>> most backwards compatible solution if we don't want to require a >>> patched compile.beam. >>> >>> So, what about alternatively or additionally documenting >>> compile_core/3 and compile_asm/3? >> >> ping > > ping > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From paul.joseph.davis@REDACTED Mon Nov 18 18:23:53 2013 From: paul.joseph.davis@REDACTED (Paul Davis) Date: Mon, 18 Nov 2013 11:23:53 -0600 Subject: [erlang-questions] a question about NIFs In-Reply-To: <5289D919.1080509@ninenines.eu> References: <5289D919.1080509@ninenines.eu> Message-ID: For Jiffy specifically, there was some work [1] on getting it to yield back to the VM more regularly. I haven't had enough time lately to test it thoroughly but Sergey Urbanovich has done some important ground work there. I'd also point out that I've never actually had a report that Jiffy was the cause of scheduler issues. There's also the "+scl false +zdss true" VM flags [2] that disable some of the scheduling logic that caused issues in the first place if you're in a bind with a given NIF. [1] https://github.com/davisp/jiffy/pull/49 [2] https://gist.github.com/slfritchie/5624609 On Mon, Nov 18, 2013 at 3:08 AM, Lo?c Hoguin wrote: > On 11/18/2013 04:51 AM, akonsu wrote: >> >> hello, >> >> I am looking at different erlang parsers for JSON, and many resources >> that I found on the web reference jiffy >> (https://github.com/davisp/jiffy) as one among the "fastest" parsers. I >> am skeptical about this, having read articles about NIFs such as these >> linked from >> >> http://stackoverflow.com/questions/18178542/why-does-the-nif-function-block-the-erlang-vm-from-scheduling-other-processes. >> I am planning to run the parser in multiple worker processes, and it is >> essential that the parser cooperates with the VM scheduler. Since I am >> new to Erlang, I have no idea how to check this, so my question, I >> think, is whether NIFs by definition are agnostic of the scheduler, thus >> interfering with the normal VM activity. > > > This is why many people choose https://github.com/talentdeficit/jsx instead. > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > http://ninenines.eu > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From comptekki@REDACTED Mon Nov 18 19:11:22 2013 From: comptekki@REDACTED (Wes James) Date: Mon, 18 Nov 2013 11:11:22 -0700 Subject: [erlang-questions] move from centos to xubuntu - no error Message-ID: I copied the cowboy project that I got working to another machine (centos to xubuntu), but it crashes with the same code when accessing the web site. I see a bunch of handshake errors. I see this also: =ERROR REPORT==== 18-Nov-2013::10:45:50 === ** State machine <0.594.0> terminating ** Last message in was {tcp,#Port<0.1311>, ..... ** When State == hello ** Data == {state,server, ...... ** Reason for termination = ** {'function not exported', [{crypto,sign, [rsa,sha, {digest, Any idea what this means? I have deleted deps, and _rel folders, recompiled, recreated certs, still same errors. Thanks, -wes -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Mon Nov 18 22:57:42 2013 From: comptekki@REDACTED (Wes James) Date: Mon, 18 Nov 2013 14:57:42 -0700 Subject: [erlang-questions] move from centos to xubuntu - no error In-Reply-To: References: Message-ID: Never mind. I had 15/16B of erlang on this box in the past. I went in to /usr/local/bin and removed the sym links and then renamed /usr/local/lib/erlang to erlang0 and did make install of 16B02 again and now it works. Go figure.... :) Thanks, -wes On Mon, Nov 18, 2013 at 11:11 AM, Wes James wrote: > I copied the cowboy project that I got working to another machine (centos > to xubuntu), but it crashes with the same code when accessing the web > site. I see a bunch of handshake errors. I see this also: > > > =ERROR REPORT==== 18-Nov-2013::10:45:50 === > ** State machine <0.594.0> terminating > ** Last message in was {tcp,#Port<0.1311>, > > ..... > > ** When State == hello > ** Data == {state,server, > > ...... > > ** Reason for termination = > ** {'function not exported', > [{crypto,sign, > [rsa,sha, > {digest, > > > Any idea what this means? > > I have deleted deps, and _rel folders, recompiled, recreated certs, still > same errors. > > Thanks, > > -wes > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From 06jameskingsbery@REDACTED Mon Nov 18 21:58:07 2013 From: 06jameskingsbery@REDACTED (James Kingsbery) Date: Mon, 18 Nov 2013 15:58:07 -0500 Subject: [erlang-questions] No producing crash dump file In-Reply-To: References: Message-ID: Here is the full command used to start ejabberd, as one would get from ps -ef: /home/goodson/goodson/usr/local/lib/erlang/erts-5.10.1/bin/beam.smp -K true -P 250000 -A64 -sbt ps -- -root /home/goodson/goodson/usr/local/lib/erlang -progname start.sh -- -home /home/jamie -- -name ejabberd@REDACTED -setcookie -noshell -noinput -config /home/jamie/goodson/opt/svc.ejabberd/ejabberd/etc/ejabberd/app.config -pa /home/jamie/goodson/opt/svc.ejabberd/ejabberd/lib/ejabberd/ebin -mnesia dir "/home/jamie/goodson/var/lib/ejabberd/database@REDACTED" -kernel inet_dist_listen_min 4200 inet_dist_listen_max 4210 -s lager -s sighandler -s ejabberd -s ecrn_app manual_start -sasl sasl_error_logger -smp enable -mnesia dc_dump_limit 40 dump_log_write_threshold 50000 no_table_loaders 50 extra_db_nodes ['ejabberd@REDACTED'] -s mnesia start As you can see there's no -heart. Also, if you ps -ef | grep heart, there is no heart process running. But, as I mentioned earlier, the core dump shows heart port as non-null. On Mon, Nov 18, 2013 at 3:24 AM, Samuel wrote: > How are you running your erlang node? Heart should not start unless > explicitly started, as far as I know > > On 11 November 2013 17:13, James Kingsbery <06jameskingsbery@REDACTED> > wrote: > > Hi All, > > > > I'm relatively new to Erlang and there's a problem I don't quite > understand. > > I'm running ejabberd, and every so often it crashes. To figure out why it > > crashed, I know to look in the erl_crash.dump. The problem is, there > doesn't > > seem to be any erl_crash.dump file. There is a core dump file though. > > Loading it into gdb and running "bt full," here are the top two frames: > > > > (gdb) bt full > > #0 0x000000000054df83 in prepare_crash_dump (secs=) at > > sys/unix/sys.c:735 > > max = > > env = "\005", '\000' "\200, \373!?" > > heart_port = 0x7fb46f31eab0 > > hp = 0x7fb4d6efb938 > > heart_fd = {865035, -1} > > has_heart = 0 > > i = > > envsz = > > heap = {4460060, 140412855877120, 1} > > list = 18446744073709551611 > > #1 erts_sys_prepare_crash_dump (secs=) at > sys/unix/sys.c:780 > > > > So, it appears that it crashed while it was trying to write the crash > dump, > > but didn't get all the way. I did some research, and it sounds a lot > like a > > problem that had been posted earlier > > ( > https://groups.google.com/forum/#!msg/erlang-programming/XH2Uly6hsLY/aeR2Yx2UkZMJ > ). > > Heart was not enabled on the command line, which means this shouldn't be > the > > problem, but... in the core dump, heart_port is set to something > non-null. > > This should mean that heart is lurking somewhere, shouldn't it? If so, is > > there a way to tell heart to *really* not run? > > > > Any help anyone has to offer would be greatly appreciated. > > > > Best, > > Jamie > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > Samuel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Tue Nov 19 01:10:18 2013 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 19 Nov 2013 13:10:18 +1300 Subject: [erlang-questions] process per task or not ? In-Reply-To: References: Message-ID: <8EAC180B-30AD-4F0F-8127-CEC7D16A1163@cs.otago.ac.nz> On 16/11/2013, at 7:34 AM, akonsu wrote: > I am looking for an advice on how to architect my system. I am just a beginner... I'm going to advise at the meta-level. Start with the simplest thing that has a chance of working. Don't expect it to be RIGHT. As Brooks put it, "Expect to throw one (design) away." Expect profiling to surprise you. From rabbe.fogelholm@REDACTED Tue Nov 19 10:17:32 2013 From: rabbe.fogelholm@REDACTED (Rabbe Fogelholm) Date: Tue, 19 Nov 2013 10:17:32 +0100 Subject: [erlang-questions] Decoding integers serialised by Erlang Message-ID: <528B2CAC.2050209@ericsson.com> The ei library has functions for decoding Erlang terms in binary format. One of these functions is ei_get_type(const char *buf, const int *index, int *type, int *size). The returned value for "type" may be ERL_SMALL_INTEGER_EXT, which indicates that the data is an 8-bit item. My question: Do the 8 bits represent an integer 0..255? Or -128..127? And, is the representation always the same, or does it depend on the platform that the encoding took place on? Rabbe Fogelholm, Ericsson AB From pierrefenoll@REDACTED Tue Nov 19 11:06:11 2013 From: pierrefenoll@REDACTED (Pierre Fenoll) Date: Tue, 19 Nov 2013 10:06:11 +0000 Subject: [erlang-questions] reload application configuration In-Reply-To: References: Message-ID: <3978212C-1FF2-4E25-B665-BC1BC49DE308@gmail.com> Hi, Why not use functions defined in a conf module? Combined with hot code swapping that should do, shouldn't it? Ah, maybe not with releases... > On 11 nov. 2013, at 14:18, Benoit Chesneau wrote: > > Hi all, > > Until now I was using either an ini file (using http://github.com/benoitc/econfig) to handle the config on my app. Econfig allows me to reload the config and update it in live relatively easily . > > But INI is a rather limited format and I don't really want to use something YAML or TOML. Instead I was thinking to use pur application config and maybe cuttlefish (https://github.com/basho/cuttlefish) . But I wonder how to change the config in live. Say for example having a an HTTP config handler that allows the user to change some settings, triggering the config changes in the applications and writing them on the disk. Is there a way to do that? > > > I found an old mail that was suggestiing to use `application_controller:change_application_data` like this > > > reload_config(AppNames, ConfigFile) -> > {ok, [Config]} = file:consult(ConfigFile), > Apps = [{application, A, element(2,application:get_all_key(A))} > || {A,_,_} <- application:while_applications()], > application_controller:change_application_data(Apps,Config). > > > http://erlang.2086793.n4.nabble.com/Loading-application-variables-td2089610.html > > though `application_controller:change_application_data` is not public. Should I update the config using `application:set_env` instead? Any other way? > > - benoit > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From bchesneau@REDACTED Tue Nov 19 11:21:52 2013 From: bchesneau@REDACTED (Benoit Chesneau) Date: Tue, 19 Nov 2013 11:21:52 +0100 Subject: [erlang-questions] reload application configuration In-Reply-To: <2F0F21C0-E644-4E19-87CF-B9487AA4A25B@erlang.geek.nz> References: <52820035.2060004@gmail.com> <2F0F21C0-E644-4E19-87CF-B9487AA4A25B@erlang.geek.nz> Message-ID: On Tue, Nov 12, 2013 at 10:09 PM, Geoff Cant wrote: > We use the OTP application environment for configuration data almost > exclusively in the systems we build at Heroku. Logplex ( > https://github.com/heroku/logplex ) is an example of one of these. We do > a few things to make it more usable for us. > > * application:get_env(my_app, key). is really fast - it's just an ETS > read, so do it pretty much everywhere except in a tight loop. -- > https://github.com/heroku/logplex/blob/master/src/logplex_message.erl#L73 > * This means your app automatically pick up and use changes in this > configuration. > * If you have a tcp listener, don't pass its Port configuration via > supervisor start arguments, have the init routine for the listener read > application:get_env -- > https://github.com/heroku/logplex/blob/master/src/tcp_acceptor.erl#L57 > * This allows you to update the app_env config and then apply it by > doing a terminate_child and restart_child on the listener process from the > supervisor. > * If you read configuration from the unix environment into your OTP app > environment, maybe use a library to make that less painful. > https://github.com/heroku/logplex/blob/master/src/logplex_app.erl#L84 and > https://github.com/heroku/stillir > > When we used to cache configuration all over the place in gen_server state > and supervisor child specs, updating the configuration was really > difficult. Now that we avoid that, we find the OTP app env really good for > configuration data and like the centralised storage in ETS, the ability to > inspect it with get_all_env, quick updates and all the support for -app > env_key env_value, -config .config and so on. > > Cheers, > -- > Geoff Cant > Sorry for the late answer. Thanks for the useful information and links, stillir was the bit I was missing. With that your method and the one proposed by Max Lapshin I think I will be able to do something. It will reduce a little the number of conf levels I need. The last thing I need to figure is to find a way to mix that with cuttlefish (https://github.com/basho/cuttlefish) so the end user will have a human friendly configuration file (or sort of). - benoit > On 2013-11-12, at 02:17 , Ignas Vy?niauskas wrote: > > > Hi, > > > > I've too struggled with this problem quite a few times. > > > > One thing I never got to try out: What about pushing relups with only > > configuration data changed? Then you get versioning for free, you can > > also specify how each application should deal with the new configuration > > data (just update it / stop / restart gen_servers, etc). > > > > You get all the release goodies and would basically just need to write > > some scripts to generate "light" relups. > > > > Your application's would also need to have a proper `config_changed/2` > > callback, but this IMHO is much nicer than rolling your own thing. > > > > If you are doing releases and relups already (and you should!) then this > > seems like a decent path to follow. > > > > -- > > Ignas > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sverker.eriksson@REDACTED Tue Nov 19 11:23:46 2013 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Tue, 19 Nov 2013 11:23:46 +0100 Subject: [erlang-questions] Decoding integers serialised by Erlang In-Reply-To: <528B2CAC.2050209@ericsson.com> References: <528B2CAC.2050209@ericsson.com> Message-ID: <528B3C32.50101@erix.ericsson.se> http://www.erlang.org/doc/apps/erts/erl_ext_dist.html#id86712 The external format is platform independent. /Sverker, Erlang/OTP On 11/19/2013 10:17 AM, Rabbe Fogelholm wrote: > The ei library has functions for decoding Erlang terms in binary > format. One of > these functions is ei_get_type(const char *buf, const int *index, int > *type, int *size). > The returned value for "type" may be ERL_SMALL_INTEGER_EXT, which > indicates that > the data is an 8-bit item. > > My question: Do the 8 bits represent an integer 0..255? Or -128..127? > And, is the > representation always the same, or does it depend on the platform that > the encoding > took place on? > > Rabbe Fogelholm, Ericsson AB > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > From mikpelinux@REDACTED Tue Nov 19 11:07:06 2013 From: mikpelinux@REDACTED (Mikael Pettersson) Date: Tue, 19 Nov 2013 11:07:06 +0100 Subject: [erlang-questions] Decoding integers serialised by Erlang In-Reply-To: <528B2CAC.2050209@ericsson.com> References: <528B2CAC.2050209@ericsson.com> Message-ID: <21131.14410.344848.739236@gargle.gargle.HOWL> Rabbe Fogelholm writes: > The ei library has functions for decoding Erlang terms in binary format. One of > these functions is ei_get_type(const char *buf, const int *index, int *type, int *size). > The returned value for "type" may be ERL_SMALL_INTEGER_EXT, which indicates that > the data is an 8-bit item. > > My question: Do the 8 bits represent an integer 0..255? Or -128..127? A quick grep in the otp sources reveal that it's the former, i.e. [0,255]. > And, is the > representation always the same, or does it depend on the platform that the encoding > took place on? There should be no platform dependencies in the encoding, and I don't see any, apart from the common 'char is 8 bits'. From Tobias.Schlager@REDACTED Tue Nov 19 11:52:05 2013 From: Tobias.Schlager@REDACTED (Tobias Schlager) Date: Tue, 19 Nov 2013 10:52:05 +0000 Subject: [erlang-questions] Release upgrades anyone? Message-ID: <12F2115FD1CCEE4294943B2608A18FA3D0D657A3@MAIL01.win.lbaum.eu> Hi all, I'm currently trying to generate an upgrade for a new software release based on a recent OTP release. The release to update from is based on OTP-R16B01, the target release is based on OTP-R16B02. I don't want to update only my apps but also the standard apps. Unfortunately, I found that the vast majority of standard OTP appup files is simply unmaintained. Most of them are totally out of date concerning the update/downgrade clauses, e.g. you can't even go from mnesia 4.9 to 4.10 (although its a simple restart_application advice when looking at the past advices). Some others appup files can't even be parsed. I know that upgrading to a new stdlib or kernel does require an emulator restart anyways, but currently I can't even generate an update for this case (at least when using systools). For me, this means I can't generate individual updates for OTP application's containing serious bugfixes or improvements, e.g. stay with the R16B01 base and only update the mnesia application to it's R16B02 version. Is anybody else using release updates this way? I'm currently preparing a set of pull requests addressing this issue. Maybe I've just misunderstood how upgrades are supposed to work. If I'm just doing it wrong, please point me to the right direction. Regards Tobias From pablo.platt@REDACTED Tue Nov 19 12:09:42 2013 From: pablo.platt@REDACTED (pablo platt) Date: Tue, 19 Nov 2013 13:09:42 +0200 Subject: [erlang-questions] Use new crypto functions Message-ID: Hi, I'm trying to replace the deprecated crypto functions dh_generate_key/1 and dh_compute_key/3 with the new functions generate_key/2 and compute_key/3 but my app fails. The byte_size of the results are different between the old and new API: Old: PublicKey - 132 Bytes PrivateKey - 132 Bytes Shared - 128 Bytes New PublicKey - 129 Bytes PrivateKey - 129 Bytes Shared - 129 Bytes Shouldn't the functionality and the size of the keys be the same? Do I need to change something to make it work? Code: Old functions: {PublicKey, PrivateKey} = crypto:dh_generate_key([?DH_P, ?DH_G]), Shared = crypto:dh_compute_key(ClientKey, PrivateKey, [?DH_P, ?DH_G]), <<_:32, PublicKey2/binary>> = PublicKey. % Needed for my app with the old API New functions: {PublicKey, PrivateKey} = crypto:generate_key(dh, [?DH_P, ?DH_G]), Shared = crypto:compute_key(dh, ClientKey, PrivateKey, [?DH_P, ?DH_G]), <<_:32, PublicKey2/binary>> = PublicKey. % ?DH_P size is 132 Bytes % ?DH_G size is 5 Bytes Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From Tobias.Schlager@REDACTED Tue Nov 19 12:22:51 2013 From: Tobias.Schlager@REDACTED (Tobias Schlager) Date: Tue, 19 Nov 2013 11:22:51 +0000 Subject: [erlang-questions] Release upgrades anyone? In-Reply-To: <12F2115FD1CCEE4294943B2608A18FA3D0D657A3@MAIL01.win.lbaum.eu> References: <12F2115FD1CCEE4294943B2608A18FA3D0D657A3@MAIL01.win.lbaum.eu> Message-ID: <12F2115FD1CCEE4294943B2608A18FA3D0D657C7@MAIL01.win.lbaum.eu> Hi again, I'm sorry, I have to correct myself. Of course, this does not apply to the 'vast majority' of appup files. Most of them are actually extremely well maintained, e.g. megaco, diameter. There are only a few broken/outdated ones. However, important applications like mnesia and crypto are amongst them. Regards Tobias ________________________________________ Von: erlang-questions-bounces@REDACTED [erlang-questions-bounces@REDACTED]" im Auftrag von "Tobias Schlager [Tobias.Schlager@REDACTED] Gesendet: Dienstag, 19. November 2013 11:52 An: erlang-questions Betreff: [erlang-questions] Release upgrades anyone? Hi all, I'm currently trying to generate an upgrade for a new software release based on a recent OTP release. The release to update from is based on OTP-R16B01, the target release is based on OTP-R16B02. I don't want to update only my apps but also the standard apps. Unfortunately, I found that the vast majority of standard OTP appup files is simply unmaintained. Most of them are totally out of date concerning the update/downgrade clauses, e.g. you can't even go from mnesia 4.9 to 4.10 (although its a simple restart_application advice when looking at the past advices). Some others appup files can't even be parsed. I know that upgrading to a new stdlib or kernel does require an emulator restart anyways, but currently I can't even generate an update for this case (at least when using systools). For me, this means I can't generate individual updates for OTP application's containing serious bugfixes or improvements, e.g. stay with the R16B01 base and only update the mnesia application to it's R16B02 version. Is anybody else using release updates this way? I'm currently preparing a set of pull requests addressing this issue. Maybe I've just misunderstood how upgrades are supposed to work. If I'm just doing it wrong, please point me to the right direction. Regards Tobias _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From ingela.andin@REDACTED Tue Nov 19 15:54:38 2013 From: ingela.andin@REDACTED (Ingela Andin) Date: Tue, 19 Nov 2013 15:54:38 +0100 Subject: [erlang-questions] Use new crypto functions In-Reply-To: References: Message-ID: Hi! The new API does not want any mpints (binaries with size tags) so if you hade mpints as input you will have to remove the size tag. If you used erlang integers there will not be any need to make any changes. Regards Ingela Erlang/OTP team - Ericsson AB 2013/11/19 pablo platt > Hi, > > I'm trying to replace the deprecated crypto functions dh_generate_key/1 > and dh_compute_key/3 with the new functions generate_key/2 and > compute_key/3 but my app fails. > > The byte_size of the results are different between the old and new API: > Old: > PublicKey - 132 Bytes > PrivateKey - 132 Bytes > Shared - 128 Bytes > > New > PublicKey - 129 Bytes > PrivateKey - 129 Bytes > Shared - 129 Bytes > > Shouldn't the functionality and the size of the keys be the same? > Do I need to change something to make it work? > > Code: > > Old functions: > {PublicKey, PrivateKey} = crypto:dh_generate_key([?DH_P, ?DH_G]), > Shared = crypto:dh_compute_key(ClientKey, PrivateKey, [?DH_P, ?DH_G]), > <<_:32, PublicKey2/binary>> = PublicKey. % Needed for my app with the old > API > > New functions: > {PublicKey, PrivateKey} = crypto:generate_key(dh, [?DH_P, ?DH_G]), > Shared = crypto:compute_key(dh, ClientKey, PrivateKey, [?DH_P, ?DH_G]), > <<_:32, PublicKey2/binary>> = PublicKey. > > % ?DH_P size is 132 Bytes > % ?DH_G size is 5 Bytes > > Thanks > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pablo.platt@REDACTED Tue Nov 19 16:33:01 2013 From: pablo.platt@REDACTED (pablo platt) Date: Tue, 19 Nov 2013 17:33:01 +0200 Subject: [erlang-questions] Use new crypto functions In-Reply-To: References: Message-ID: Hi, I had to remove the 32 bits size tag from ?DH_P, ?DH_G too. Now it's working. Thank you. On Tue, Nov 19, 2013 at 4:54 PM, Ingela Andin wrote: > Hi! > > The new API does not want any mpints (binaries with size tags) so if you > hade mpints as input you will have to remove the size tag. If you used > erlang integers there will not be any need to make any changes. > > Regards Ingela Erlang/OTP team - Ericsson AB > > > 2013/11/19 pablo platt > >> Hi, >> >> I'm trying to replace the deprecated crypto functions dh_generate_key/1 >> and dh_compute_key/3 with the new functions generate_key/2 and >> compute_key/3 but my app fails. >> >> The byte_size of the results are different between the old and new API: >> Old: >> PublicKey - 132 Bytes >> PrivateKey - 132 Bytes >> Shared - 128 Bytes >> >> New >> PublicKey - 129 Bytes >> PrivateKey - 129 Bytes >> Shared - 129 Bytes >> >> Shouldn't the functionality and the size of the keys be the same? >> Do I need to change something to make it work? >> >> Code: >> >> Old functions: >> {PublicKey, PrivateKey} = crypto:dh_generate_key([?DH_P, ?DH_G]), >> Shared = crypto:dh_compute_key(ClientKey, PrivateKey, [?DH_P, ?DH_G]), >> <<_:32, PublicKey2/binary>> = PublicKey. % Needed for my app with the old >> API >> >> New functions: >> {PublicKey, PrivateKey} = crypto:generate_key(dh, [?DH_P, ?DH_G]), >> Shared = crypto:compute_key(dh, ClientKey, PrivateKey, [?DH_P, ?DH_G]), >> <<_:32, PublicKey2/binary>> = PublicKey. >> >> % ?DH_P size is 132 Bytes >> % ?DH_G size is 5 Bytes >> >> Thanks >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgolovan@REDACTED Wed Nov 20 19:57:36 2013 From: sgolovan@REDACTED (Sergei Golovan) Date: Wed, 20 Nov 2013 22:57:36 +0400 Subject: [erlang-questions] wxErlang and wxWidgets 3.0 In-Reply-To: References: Message-ID: On Mon, Nov 18, 2013 at 11:52 AM, Sergei Golovan wrote: > > 4) Segfault of dialyzer. dialyzer --wx segfaults immediately after I > click any of the "Add", "Add Dir", or "Add Recursively" button. It > works fine with 2.8. The backtrace in GDB shows that the segfault happens inside wxWidgets library. So, it might be a bug in wxWidgets and not in wxErlang. % gdb -c core /usr/lib/erlang/erts-5.10.3/bin/beam.smp GNU gdb (GDB) 7.6.1 (Debian 7.6.1-1) Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: ... Reading symbols from /usr/lib/erlang/erts-5.10.3/bin/beam.smp...(no debugging symbols found)...done. [New LWP 14549] [New LWP 14521] [New LWP 14555] [New LWP 14525] [New LWP 14542] [New LWP 14527] [New LWP 14528] [New LWP 14572] [New LWP 14526] [New LWP 14538] [New LWP 14529] [New LWP 14544] [New LWP 14540] [New LWP 14539] [New LWP 14531] [New LWP 14537] [New LWP 14541] [New LWP 14530] [New LWP 14545] [New LWP 14546] [New LWP 14543] [New LWP 14532] [New LWP 14536] [New LWP 14535] [New LWP 14534] [New LWP 14533] warning: Could not load shared library symbols for linux-vdso.so.1. Do you need "set solib-search-path" or "set sysroot"? [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by `/usr/lib/erlang/erts-5.10.3/bin/beam.smp -P 1000000 -B -- -root /usr/lib/erlang'. Program terminated with signal 11, Segmentation fault. #0 0x00007f531d4361da in wxItemContainer::AssignNewItemClientData (this=0x7f53080e0c00, pos=0, clientData=0x0, n=0, type=wxClientData_Void) at ../src/common/ctrlsub.cpp:253 253 ../src/common/ctrlsub.cpp: No such file or directory. (gdb) bt #0 0x00007f531d4361da in wxItemContainer::AssignNewItemClientData (this=0x7f53080e0c00, pos=0, clientData=0x0, n=0, type=wxClientData_Void) at ../src/common/ctrlsub.cpp:253 #1 0x00007f531d43629a in wxItemContainer::DoInsertItemsInLoop (this=this@REDACTED=0x7f53080e0c00, items=..., pos=1, pos@REDACTED=0, clientData=clientData@REDACTED=0x0, type=type@REDACTED=wxClientData_Void) at ../src/common/ctrlsub.cpp:142 #2 0x00007f531d3e3084 in wxListBox::DoInsertItems (this=0x7f53080e0990, items=..., pos=0, clientData=0x0, type=wxClientData_Void) at ../src/gtk/listbox.cpp:453 #3 0x00007f531e712a64 in wxItemContainer::Set(wxArrayString const&, void**) () from /usr/lib/erlang/lib/wx-1.1/priv/wxe_driver.so #4 0x00007f531e6d94a1 in WxeApp::wxe_dispatch(wxeCommand&) () from /usr/lib/erlang/lib/wx-1.1/priv/wxe_driver.so #5 0x00007f531e677a3b in WxeApp::dispatch(wxList*, int, int) () from /usr/lib/erlang/lib/wx-1.1/priv/wxe_driver.so #6 0x00007f531e677a97 in WxeApp::dispatch_cmds() () from /usr/lib/erlang/lib/wx-1.1/priv/wxe_driver.so #7 0x00007f531ccd691e in wxAppConsoleBase::CallEventHandler (this=0x7f5308000980, handler=0x7f5308000980, functor=..., event=...) at ../src/common/appbase.cpp:623 #8 0x00007f531ce49a92 in wxEvtHandler::ProcessEventIfMatchesId (entry=..., handler=, event=...) at ../src/common/event.cpp:1384 #9 0x00007f531ce49df6 in wxEvtHandler::SearchDynamicEventTable (this=this@REDACTED=0x7f5308000980, event=...) at ../src/common/event.cpp:1743 #10 0x00007f531ce49e7e in wxEvtHandler::TryHereOnly (this=this@REDACTED=0x7f5308000980, event=...) at ../src/common/event.cpp:1577 #11 0x00007f531ce49f13 in TryBeforeAndHere (event=..., this=this@REDACTED=0x7f5308000980) at ../include/wx/event.h:3671 #12 wxEvtHandler::ProcessEventLocally (this=this@REDACTED=0x7f5308000980, event=...) at ../src/common/event.cpp:1514 #13 0x00007f531ce49f75 in wxEvtHandler::ProcessEvent (this=0x7f5308000980, event=...) at ../src/common/event.cpp:1487 #14 0x00007f531ccd6cf4 in wxAppConsoleBase::ProcessIdle (this=0x7f5308000980) at ../src/common/appbase.cpp:388 #15 0x00007f531d415c43 in wxAppBase::ProcessIdle (this=) at ../src/common/appcmn.cpp:366 #16 0x00007f531d36b92e in wxApp::DoIdle (this=0x7f5308000980) at ../src/gtk/app.cpp:138 #17 0x00007f531d36ba33 in wxapp_idle_callback () at ../src/gtk/app.cpp:107 #18 0x00007f5315c2aea6 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #19 0x00007f5315c2b1f8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #20 0x00007f5315c2b5fa in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #21 0x00007f5317af22e7 in gtk_main () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0 #22 0x00007f531d37e135 in wxGUIEventLoop::DoRun (this=0x7f5308071050) at ../src/gtk/evtloop.cpp:65 #23 0x00007f531cd18c30 in wxEventLoopBase::Run (this=0x7f5308071050) at ../src/common/evtloopcmn.cpp:78 #24 0x00007f531ccd89fd in wxAppConsoleBase::MainLoop (this=0x7f5308000980) at ../src/common/appbase.cpp:334 #25 0x00007f531cd6483d in wxEntry (argc=, argv=) at ../src/common/init.cpp:495 #26 0x00007f531e6775ef in wxe_main_loop(void*) () from /usr/lib/erlang/lib/wx-1.1/priv/wxe_driver.so #27 0x00000000005743c5 in ?? () #28 0x00007f533daa6e0e in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0 #29 0x00007f533d5d40fd in clone () from /lib/x86_64-linux-gnu/libc.so.6 (gdb) Cheers! -- Sergei Golovan From comptekki@REDACTED Wed Nov 20 23:46:23 2013 From: comptekki@REDACTED (Wes James) Date: Wed, 20 Nov 2013 15:46:23 -0700 Subject: [erlang-questions] create release add libraries In-Reply-To: <5287F06E.9040103@ninenines.eu> References: <5287CE62.10705@ninenines.eu> <5287DB4A.6000601@ninenines.eu> <5287F06E.9040103@ninenines.eu> Message-ID: On Sat, Nov 16, 2013 at 3:23 PM, Lo?c Hoguin wrote: > > >> Thanks for your help. With the debugger I found where the app was >> crashing. I added inets to relx.config and now it is working with https >> and wss. With Erlang 16B02 and current cowboy master :) I do have to >> run my app in opera where I used to use chrome. After chrome updated to >> 30.x, secure websockets quit working. >> > > Cool. > > Was it crashing in your code or Cowboy? Cowboy shouldn't be needing inets > anymore. > > I don't have to run the web app in Opera any more. I found that this web app was using an older javascript websocket set up for chrome. It's working fine in chrome now (cowboy master and Erlang 16B02). -wes -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.pennebaker@REDACTED Thu Nov 21 01:06:57 2013 From: andrew.pennebaker@REDACTED (Andrew Pennebaker) Date: Wed, 20 Nov 2013 19:06:57 -0500 Subject: [erlang-questions] Can't run my command line Erlang program In-Reply-To: <52875662.8080402@cs.ntua.gr> References: <20131114083958.GA10608@circlewave.net> <52857232.2020700@cs.ntua.gr> <046ECC8C-A31C-4AF7-B8BC-EB197C1B000F@alumni.caltech.edu> <52875662.8080402@cs.ntua.gr> Message-ID: Thanks! "dialyzer --build_plt --apps erts kernel stdlib" fixes this. My Makefile now looks like: https://github.com/mcandre/mcandre/blob/master/erlang/Makefile ...would be nice if Erlang automatically generated this PLT as post-install. On Sat, Nov 16, 2013 at 6:26 AM, Kostis Sagonas wrote: > On 11/15/2013 10:34 PM, Andrew Pennebaker wrote: > >> Thanks, I might do that! >> >> ...so there's no way to tell dialyzer to just automatically add stdlibs >> to plt? >> > > Dialyzer is agnostic of what stdlib is, whether it contains a module named > string or not, or for that matter whether you want to use the string module > from stdlib or some other module named string in your application. So you > need to tell it what applications to cache in your .dialyzer_plt when you > build it for the first time. > > By the way, the sequence of commands you use below is not the one that I > would use. Instead, I would first build a minimal PLT once: > > dialyzer --build_plt --apps erts kernel stdlib > > and then use this PLT to analyze the modules of my application: > > erlc -Wall +debug_info *.erl > dialyzer *.beam > > You do not need to add your application's modules to the PLT to analyze > them. If at some point you discover that you need more stuff from the OTP > libraries to analyze your application (e.g. the 'random' module), you can > add them incrementally by a command of the form: > > dialyzer --add_to_plt --apps crypto > > Hope it helps, > > Kostis > > On Fri, Nov 15, 2013 at 2:52 AM, Anthony Molinaro >> > wrote: >> >> You can add them to your .plt with something like >> >> # dialyzer --add_to_plt --apps crypto stdlib proper ... >> >> Which should get rid of the warnings. >> >> -Anthony >> >> >> On Nov 14, 2013, at 8:03 PM, Andrew Pennebaker >> > >> >> wrote: >> >> Is there a way to clear the "unknown functions" from dialyzer >>> output? They tend to distract from any warnings I'm trying to find. >>> >>> $ make lint >>> erlc -Wall +debug_info ios7crypt.erl >>> dialyzer *.beam --build_plt --quiet >>> dialyzer *.beam >>> >> > -- Cheers, Andrew Pennebaker www.yellosoft.us -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgolovan@REDACTED Thu Nov 21 10:16:04 2013 From: sgolovan@REDACTED (Sergei Golovan) Date: Thu, 21 Nov 2013 13:16:04 +0400 Subject: [erlang-questions] wxErlang and wxWidgets 3.0 In-Reply-To: References: Message-ID: Hi Dan, On Wed, Nov 20, 2013 at 10:57 PM, Sergei Golovan wrote: > On Mon, Nov 18, 2013 at 11:52 AM, Sergei Golovan wrote: >> >> 4) Segfault of dialyzer. dialyzer --wx segfaults immediately after I >> click any of the "Add", "Add Dir", or "Add Recursively" button. It >> works fine with 2.8. Apparently, wxItemContainer::Set doesn't tolerate NULL clientData anymore. After I removed the clientData argument from Set call the segfault is gone (the code still works with wxWidgets 2.8): ----------------------------------- --- a/lib/wx/c_src/gen/wxe_funcs.cpp +++ b/lib/wx/c_src/gen/wxe_funcs.cpp @@ -15137,7 +15137,7 @@ } bp += (8-((0+ itemsASz) & 7 )) & 7; if(!This) throw wxe_badarg(0); - This->Set(items,(void **) NULL); + This->Set(items); break; } case wxListBox_HitTest: { // wxListBox::HitTest ----------------------------------- Here is a small excerpt from the backtrace with debug symbols enabled: #0 0x00007f7d253e11da in wxItemContainer::AssignNewItemClientData (this=0x7f7cc40e0cc0, pos=0, clientData=0x0, n=0, type=wxClientData_Void) at ../src/common/ctrlsub.cpp:253 #1 0x00007f7d253e129a in wxItemContainer::DoInsertItemsInLoop (this=this@REDACTED=0x7f7cc40e0cc0, items=..., pos=1, pos@REDACTED=0, clientData=clientData@REDACTED=0x0, type=type@REDACTED=wxClientData_Void) at ../src/common/ctrlsub.cpp:142 #2 0x00007f7d2538e084 in wxListBox::DoInsertItems (this=0x7f7cc40e0a50, items=..., pos=0, clientData=0x0, type=wxClientData_Void) at ../src/gtk/listbox.cpp:453 #3 0x00007f7d34bd2a64 in AppendItems (type=wxClientData_Void, clientData=0x0, items=..., this=0x7f7cc40e0cc0) at /usr/include/wx-3.0/wx/ctrlsub.h:113 #4 AppendItems (clientData=0x0, items=..., this=0x7f7cc40e0cc0) at /usr/include/wx-3.0/wx/ctrlsub.h:126 #5 Append (clientData=0x0, items=..., this=0x7f7cc40e0cc0) at /usr/include/wx-3.0/wx/ctrlsub.h:207 #6 wxItemContainer::Set (this=this@REDACTED=0x7f7cc40e0cc0, items=..., clientData=clientData@REDACTED=0x0) at /usr/include/wx-3.0/wx/ctrlsub.h:265 #7 0x00007f7d34b994a1 in WxeApp::wxe_dispatch (this=this@REDACTED=0x7f7cc4000980, Ecmd=...) at gen/wxe_funcs.cpp:15140 Cheers! -- Sergei Golovan From dgud@REDACTED Thu Nov 21 10:52:25 2013 From: dgud@REDACTED (Dan Gudmundsson) Date: Thu, 21 Nov 2013 10:52:25 +0100 Subject: [erlang-questions] wxErlang and wxWidgets 3.0 In-Reply-To: References: Message-ID: Thanks for the debugging and bug fix, it will hopefully be in R16B03. /Dan On Thu, Nov 21, 2013 at 10:16 AM, Sergei Golovan wrote: > Hi Dan, > > On Wed, Nov 20, 2013 at 10:57 PM, Sergei Golovan wrote: > > On Mon, Nov 18, 2013 at 11:52 AM, Sergei Golovan > wrote: > >> > >> 4) Segfault of dialyzer. dialyzer --wx segfaults immediately after I > >> click any of the "Add", "Add Dir", or "Add Recursively" button. It > >> works fine with 2.8. > > Apparently, wxItemContainer::Set doesn't tolerate NULL clientData > anymore. After I removed the clientData argument from Set call the > segfault is gone (the code still works with wxWidgets 2.8): > > ----------------------------------- > --- a/lib/wx/c_src/gen/wxe_funcs.cpp > +++ b/lib/wx/c_src/gen/wxe_funcs.cpp > @@ -15137,7 +15137,7 @@ > } > bp += (8-((0+ itemsASz) & 7 )) & 7; > if(!This) throw wxe_badarg(0); > - This->Set(items,(void **) NULL); > + This->Set(items); > break; > } > case wxListBox_HitTest: { // wxListBox::HitTest > ----------------------------------- > > Here is a small excerpt from the backtrace with debug symbols enabled: > > #0 0x00007f7d253e11da in wxItemContainer::AssignNewItemClientData > (this=0x7f7cc40e0cc0, pos=0, clientData=0x0, n=0, > type=wxClientData_Void) > at ../src/common/ctrlsub.cpp:253 > #1 0x00007f7d253e129a in wxItemContainer::DoInsertItemsInLoop > (this=this@REDACTED=0x7f7cc40e0cc0, items=..., pos=1, pos@REDACTED=0, > clientData=clientData@REDACTED=0x0, > type=type@REDACTED=wxClientData_Void) at ../src/common/ctrlsub.cpp:142 > #2 0x00007f7d2538e084 in wxListBox::DoInsertItems > (this=0x7f7cc40e0a50, items=..., pos=0, clientData=0x0, > type=wxClientData_Void) > at ../src/gtk/listbox.cpp:453 > #3 0x00007f7d34bd2a64 in AppendItems (type=wxClientData_Void, > clientData=0x0, items=..., this=0x7f7cc40e0cc0) at > /usr/include/wx-3.0/wx/ctrlsub.h:113 > #4 AppendItems (clientData=0x0, items=..., this=0x7f7cc40e0cc0) at > /usr/include/wx-3.0/wx/ctrlsub.h:126 > #5 Append (clientData=0x0, items=..., this=0x7f7cc40e0cc0) at > /usr/include/wx-3.0/wx/ctrlsub.h:207 > #6 wxItemContainer::Set (this=this@REDACTED=0x7f7cc40e0cc0, items=..., > clientData=clientData@REDACTED=0x0) at > /usr/include/wx-3.0/wx/ctrlsub.h:265 > #7 0x00007f7d34b994a1 in WxeApp::wxe_dispatch > (this=this@REDACTED=0x7f7cc4000980, Ecmd=...) at gen/wxe_funcs.cpp:15140 > > Cheers! > -- > Sergei Golovan > -------------- next part -------------- An HTML attachment was scrubbed... URL: From letien83@REDACTED Thu Nov 21 15:12:15 2013 From: letien83@REDACTED (Tien Le) Date: Thu, 21 Nov 2013 15:12:15 +0100 Subject: [erlang-questions] Common test 1.7.X gen_server call noproc in init_per_group Message-ID: Hi, Can anyone help me explain the new change of common test 1.7.X? I start my gen_server in init_per_suite. However, when I send a message to it in init_per_group or in the test case I always get {noproc, {gen_server,call, [my_server, ... I even start it before gen_server:call, but it didn't help either. I tried to test with the older common test 1.6.X, and it works fine Thanks! Tien -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Thu Nov 21 16:34:49 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 21 Nov 2013 19:34:49 +0400 Subject: [erlang-questions] Common test 1.7.X gen_server call noproc in init_per_group In-Reply-To: References: Message-ID: Maybe it is because init_per_suite is running in separate process that dies before init_per_group started? -------------- next part -------------- An HTML attachment was scrubbed... URL: From letien83@REDACTED Thu Nov 21 17:23:34 2013 From: letien83@REDACTED (Tien Le) Date: Thu, 21 Nov 2013 17:23:34 +0100 Subject: [erlang-questions] Common test 1.7.X gen_server call noproc in init_per_group In-Reply-To: References: Message-ID: Yes, that's what I thought too. That's why I try to start it again in my init_per_group. My code looks similar like this: init_per_group(_Group, Config) -> case whereis(?SERVER) of undefined -> my_server:start(); _Pid -> ok end, my_server:do(...), Config. I can see some printout that the server is started again, but I still get exit:{noproc, ... execption when I call my_server:do(...) I switch to OTP R15B03 in which it includes Common Test 1.6.X, and it is fine. On Thu, Nov 21, 2013 at 4:34 PM, Max Lapshin wrote: > Maybe it is because init_per_suite is running in separate process that > dies before init_per_group started? > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From desired.mta@REDACTED Thu Nov 21 17:41:18 2013 From: desired.mta@REDACTED (=?UTF-8?Q?Motiejus_Jak=C5=A1tys?=) Date: Thu, 21 Nov 2013 17:41:18 +0100 Subject: [erlang-questions] Common test 1.7.X gen_server call noproc in init_per_group In-Reply-To: References: Message-ID: On Thu, Nov 21, 2013 at 5:23 PM, Tien Le wrote: > Yes, that's what I thought too. That's why I try to start it again in my > init_per_group. My code looks similar like this: > > init_per_group(_Group, Config) -> > case whereis(?SERVER) of > undefined -> > my_server:start(); > _Pid -> > ok > end, > my_server:do(...), > Config. > > I can see some printout that the server is started again, but I still get > exit:{noproc, ... execption when I call my_server:do(...) is my_server:start() a synchronous operation? I.e. are you sure that when it returns, the server is up and running? if you are not sure, try doing a gen_server:call to it right after start, and see if it fixes the situation. > > I switch to OTP R15B03 in which it includes Common Test 1.6.X, and it is > fine. If start is asynchronous, the reason might be different scheduler behavior (which changed quite a bit in R15->R16). Motiejus From letien83@REDACTED Thu Nov 21 19:03:36 2013 From: letien83@REDACTED (Tien Le) Date: Thu, 21 Nov 2013 19:03:36 +0100 Subject: [erlang-questions] Common test 1.7.X gen_server call noproc in init_per_group In-Reply-To: References: Message-ID: Ohh my bad! I found that my_server:start() returns an error. That's why the server can't be started I should have printed the return from start() function. ;P Thanks for your help! On Thu, Nov 21, 2013 at 5:41 PM, Motiejus Jak?tys wrote: > On Thu, Nov 21, 2013 at 5:23 PM, Tien Le wrote: > > Yes, that's what I thought too. That's why I try to start it again in my > > init_per_group. My code looks similar like this: > > > > init_per_group(_Group, Config) -> > > case whereis(?SERVER) of > > undefined -> > > my_server:start(); > > _Pid -> > > ok > > end, > > my_server:do(...), > > Config. > > > > I can see some printout that the server is started again, but I still get > > exit:{noproc, ... execption when I call my_server:do(...) > > is my_server:start() a synchronous operation? I.e. are you sure that > when it returns, the server is up and running? > > if you are not sure, try doing a gen_server:call to it right after > start, and see if it fixes the situation. > > > > > I switch to OTP R15B03 in which it includes Common Test 1.6.X, and it is > > fine. > > If start is asynchronous, the reason might be different scheduler > behavior (which changed quite a bit in R15->R16). > > Motiejus > -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Fri Nov 22 00:57:02 2013 From: comptekki@REDACTED (Wes James) Date: Thu, 21 Nov 2013 16:57:02 -0700 Subject: [erlang-questions] [ANN] Esysman 1.2 Message-ID: I have updated Esysman to 1.2: 1.2 -Update for cowboy 0.9.0 -Add basic centos support -Move to release format https://github.com/comptekki/esysman Thanks, -wes -------------- next part -------------- An HTML attachment was scrubbed... URL: From peerst@REDACTED Fri Nov 22 23:56:45 2013 From: peerst@REDACTED (Peer Stritzinger) Date: Fri, 22 Nov 2013 23:56:45 +0100 Subject: [erlang-questions] compile: making asm and core official References: Message-ID: On 2013-11-18 15:03:34 +0000, Tuncer Ayaz said: > On Mon, Oct 21, 2013 at 8:06 PM, Tuncer Ayaz wrote: >> On Fri, Aug 23, 2013 at 2:13 PM, Tuncer Ayaz wrote: >>> Motivated by a discussion at https://github.com/rebar/rebar/issues/105 >>> and Bjorn-Egil's suggestion, I'd like to ask for opinions on >>> officially supporting 'core' and 'asm' as compile:file/2 options. >>> >>> (1) How likely are you to accept patches which would: >>> >>> * Implement support for compile:file(File, [core]) same as >>> compile:file(File, [asm]). >>> >>> * Officially document 'core' and 'asm' as external names for >>> 'from_asm' and 'from_core'? >>> >>> * Change the existing documentation for 'asm' to not discourage use of >>> the option as much. >>> >>> * Officially document that "erlc foo.core" and "erlc foo.S" have been >>> wired to from_core and from_asm for ages? I find the choices of *.core and *.S unfortunate, since they are used for core dumps and native assembler files on many unixoid systems. I suggest changing these to *.crl and *.srl staying with the *.?rl pattern. Especially before documenting it. Cheers -- Peer >>> >>> (2) Document compile_core/3 and compile_asm/3 >>> >>> Alternatively, one could call compile:compile_asm/3 and >>> compile:compile_core/3, but they're internal functions meant to be >>> used only from erl_compile (used by erlc). This would actually be the >>> most backwards compatible solution if we don't want to require a >>> patched compile.beam. >>> >>> So, what about alternatively or additionally documenting >>> compile_core/3 and compile_asm/3? >> >> ping > > ping From steven.charles.davis@REDACTED Sat Nov 23 02:03:03 2013 From: steven.charles.davis@REDACTED (Steve Davis) Date: Fri, 22 Nov 2013 17:03:03 -0800 (PST) Subject: [erlang-questions] Phased start - bug or misconception? In-Reply-To: <771808E86A57134A85559759DD60290117ABE72F@MCHP01MSX.global-ad.net> References: <771808E86A57134A85559759DD60290117ABE72F@MCHP01MSX.global-ad.net> Message-ID: <3076b44d-9b8c-4d4b-b670-0171a267061f@googlegroups.com> FWIW and being the OP, I thought I'd let you know that my eventual solution was to avoid phased start :-( On Thursday, November 14, 2013 6:50:41 AM UTC-6, Kukosa, Tomas wrote: > > Hi, > > I have the same problem as mentioned in this old (unfortunately unreplied) > message: > http://erlang.org/pipermail/erlang-questions/2010-March/050243.html > > Does anybody have any idea how to solve it? > > Tomas > > _______________________________________________ > erlang-questions mailing list > erlang-q...@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From steven.charles.davis@REDACTED Sat Nov 23 02:59:30 2013 From: steven.charles.davis@REDACTED (Steve Davis) Date: Fri, 22 Nov 2013 17:59:30 -0800 (PST) Subject: [erlang-questions] The hard way to re-invent functions and gen_server... Message-ID: <43d9dd49-113c-4951-90c3-8cd19aa09b65@googlegroups.com> http://stackoverflow.com/questions/4203163/how-do-i-design-a-class-in-python/4203836#4203836 -------------- next part -------------- An HTML attachment was scrubbed... URL: From n.oxyde@REDACTED Sat Nov 23 12:28:36 2013 From: n.oxyde@REDACTED (Anthony Ramine) Date: Sat, 23 Nov 2013 12:28:36 +0100 Subject: [erlang-questions] compile: making asm and core official In-Reply-To: References: Message-ID: <004B6469-C8A1-4AC8-ACD7-064EBD64143A@gmail.com> I disagree but if we change those, we should rather use ".cerl" for ".core". -- Anthony Ramine Le 22 nov. 2013 ? 23:56, Peer Stritzinger a ?crit : > I suggest changing these to *.crl and *.srl staying with the *.?rl pattern. Especially before documenting it. From ulf@REDACTED Sat Nov 23 18:46:54 2013 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 23 Nov 2013 18:46:54 +0100 Subject: [erlang-questions] Phased start - bug or misconception? In-Reply-To: <771808E86A57134A85559759DD60290117ABE72F@MCHP01MSX.global-ad.net> References: <771808E86A57134A85559759DD60290117ABE72F@MCHP01MSX.global-ad.net> Message-ID: One problem there is that you?re starting the applications using application:start(App), which is equivalent to application:start(App, temporary). If you use application:start(App, permanent), a failure in the application start sequence will cause the node to terminate. While this is not in every sense good, at least it leaves your system in a consistent state. :P BR, Ulf W On 14 Nov 2013, at 13:50, Kukosa, Tomas wrote: > Hi, > > I have the same problem as mentioned in this old (unfortunately unreplied) message: > http://erlang.org/pipermail/erlang-questions/2010-March/050243.html > > Does anybody have any idea how to solve it? > > Tomas > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From ok@REDACTED Mon Nov 25 04:16:11 2013 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 25 Nov 2013 16:16:11 +1300 Subject: [erlang-questions] compile: making asm and core official In-Reply-To: References: Message-ID: <46DB1AAA-5E62-4842-AB0D-20A54806662B@cs.otago.ac.nz> On 23/11/2013, at 11:56 AM, Peer Stritzinger wrote: > > I find the choices of *.core and *.S unfortunate, since they are used for core dumps and native assembler files on many unixoid systems. More precisely, the UNIX convention is to use ".s" for assembler, but some POSIX systems (like Mac OS X) ignore alphabetic case when matching file names. I have found the use of .S something of an annoyance on occasion. From sean@REDACTED Mon Nov 25 08:00:03 2013 From: sean@REDACTED (Functional Jobs) Date: Mon, 25 Nov 2013 02:00:03 -0500 Subject: [erlang-questions] New Functional Programming Job Opportunities Message-ID: <5292f57629dd5@functionaljobs.com> Here are some functional programming job opportunities that were posted recently: Software Developer - Functional Programming at Genetec http://functionaljobs.com/jobs/8660-software-developer-functional-programming-at-genetec Cheers, Sean Murphy FunctionalJobs.com From wangjingyi0425@REDACTED Mon Nov 25 08:38:21 2013 From: wangjingyi0425@REDACTED (=?UTF-8?B?546L6Z2W5piT?=) Date: Mon, 25 Nov 2013 15:38:21 +0800 Subject: [erlang-questions] Return [Value] of erlang dict:find fetch Message-ID: Hi, I'm a beginner of erlang and have found some problems in my project. After doing some google I found here and wish someone could help me. I'm using the erlang structure 'dict' for a key-value table in my program, but I found that the return value of dict:fetch and dict:find is actually [Value] or {ok, [Value]} (means I get a list containing the value instead of the original one). However, this is not the problem, the real problem is, this happens only in some situations which I can't find what it is. An example: Eshell V5.8.5 (abort with ^G) 1> A = dict:new(). {dict,0,16,16,8,80,48, {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}, {{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}} 2> A2 = dict:append(key, value, A). {dict,1,16,16,8,80,48, {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}, {{[],[],[],[],[],[],[],[],[], [[key,value]], [],[],[],[],[],[]}}} 3> dict:find(key, A2). {ok,[value]} My erlang environment is R14B04 on ubuntu 12.04. Could any one tell me why the return value of dict:find is not the same as the doc? Best regards, Jingyi Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Mon Nov 25 09:02:38 2013 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 25 Nov 2013 09:02:38 +0100 Subject: [erlang-questions] Return [Value] of erlang dict:find fetch In-Reply-To: References: Message-ID: <1385366558.4787.4.camel@sekic1152.release> These are opinions, not facts. dict:append/3 creates a list of values. Try calling it several times and you will see. If you only want one value use dict:store/3. bengt On Mon, 2013-11-25 at 15:38 +0800, ??? wrote: > Hi, > I'm a beginner of erlang and have found some problems in my project. > After doing some google I found here and wish someone could help me. > I'm using the erlang structure 'dict' for a key-value table in my > program, but I found that the return value of dict:fetch and dict:find > is actually [Value] or {ok, [Value]} (means I get a list containing > the value instead of the original one). However, this is not the > problem, the real problem is, this happens only in some situations > which I can't find what it is. > An example: > Eshell V5.8.5 (abort with ^G) > 1> A = dict:new(). > {dict,0,16,16,8,80,48, > {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}, > {{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}} > 2> A2 = dict:append(key, value, A). > {dict,1,16,16,8,80,48, > {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}, > {{[],[],[],[],[],[],[],[],[], > [[key,value]], > [],[],[],[],[],[]}}} > 3> dict:find(key, A2). > {ok,[value]} > > > My erlang environment is R14B04 on ubuntu 12.04. Could any one tell > me why the return value of dict:find is not the same as the doc? > > > Best regards, > Jingyi Wang > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From omer.kilic@REDACTED Mon Nov 25 12:55:41 2013 From: omer.kilic@REDACTED (Omer Kilic) Date: Mon, 25 Nov 2013 11:55:41 +0000 Subject: [erlang-questions] [ANN] The Erlang Handbook Message-ID: <52933ABD.3010009@erlang-solutions.com> Hi folks, It is with great pleasure that I announce the release of the Erlang Handbook, A CC-licensed concise guide to the language and the runtime to complement already existing documentation and material out there. It is located at [1]. Originally written by Bjarne D?cker and later revised by Robert Virding, the Erlang Handbook is a summary of the language features and the runtime system. It is aimed at people with some programming experience, serving as a quick introduction to the Erlang domain. The current preview can be obtained from [2], if you don't have a LaTeX toolchain setup. If you do, the Makefile should be your friend. You will need the minted package (and pygments) for the syntax highlighting magic should you choose to compile your own. Our goal is to maintain this handbook as a live document so please file corrections and suggestions for improvement about the content using the issue tracker. You may also fork the repository and send a pull request with your suggested fixes and improvements. New revisions of the handbook will be published after major corrections. Comments, PRs and questions welcome! Cheers, Omer. [1] http://opensource.erlang-solutions.com/erlang-handbook/ [2] https://github.com/esl/erlang-handbook/raw/master/output/ErlangHandbook.pdf From erlangsiri@REDACTED Mon Nov 25 15:08:02 2013 From: erlangsiri@REDACTED (Siri Hansen) Date: Mon, 25 Nov 2013 15:08:02 +0100 Subject: [erlang-questions] reltool: sys-level {mod_cond, derived} In-Reply-To: References: Message-ID: Do you mean that reltool knows about the -mode(compile) directive and should be able to figure out the dependencies towards compiler? /siri 2013/10/21 Tuncer Ayaz > On Mon, Apr 15, 2013 at 11:49 AM, Siri Hansen wrote: > > I think this only reflects the application dependencies as they > > actually look > > > > sasl uses tools > > tools uses webtool (cover) and inets > > webtool uses observer > > inets uses mnesia, runtime_tools, ssl, > > observer uses gs, wx, et > > ssl uses crypto and public_key > > ... > > > > Adding {mod_cond,derived} is the way to limit the way reltool > > calculates the application dependencies. > > AFAIU, reltool has the relevant information at runtime and could warn > about missing deps or derive the deps even when {mod_cond,derived} is > set. > > Isn't that the most reasonable behavior? > > Or is there a distinction between hard and soft mod deps? > > > Regards > > /siri > > > > 2013/4/6 Tuncer Ayaz > >> > >> As discussed previously[1] it was decided to make the default > >> rebar reltool.config template safer to use by removing[2] the > >> non-default sys-level mod_cond. > >> > >> While this doesn't produce releases with potentially missing > >> modules, that one-line patch also pulls in many seemingly unused > >> applications resulting in a release that's at least twice as big: > >> > >> With sys-level {mod_cond, derived} (aka non-default settings): > >> $ ls -1 rel/exemplar/lib > >> compiler-4.9.1 > >> crypto-2.3 > >> erts-5.10.1 > >> exemplar > >> hipe-3.10.1 > >> kernel-2.16.1 > >> sasl-2.3.1 > >> stdlib-1.19.1 > >> tools-2.6.10 > >> > >> Without sys-level {mod_cond, derived} (aka default settings): > >> $ g diff > >> diff --git a/rel/reltool.config b/rel/reltool.config > >> index 2dd47be..e65c53c 100644 > >> --- a/rel/reltool.config > >> +++ b/rel/reltool.config > >> @@ -19,7 +19,6 @@ > >> {boot_rel, "exemplar"}, > >> {profile, embedded}, > >> {incl_cond, derived}, > >> - {mod_cond, derived}, > >> {excl_archive_filters, [".*"]}, %% Do not archive built libs > >> {excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)", > >> "^erts.*/(doc|info|include|lib|man|src)"]}, > >> > >> $ ls -1 rel/exemplar/lib > >> asn1-2.0.1 > >> compiler-4.9.1 > >> crypto-2.3 > >> edoc-0.7.12 > >> erts-5.10.1 > >> et-1.4.4.3 > >> exemplar > >> gs-1.5.15.2 > >> hipe-3.10.1 > >> inets-5.9.4 > >> kernel-2.16.1 > >> mnesia-4.8 > >> observer-1.3 > >> public_key-0.18 > >> runtime_tools-1.8.10 > >> sasl-2.3.1 > >> ssl-5.2.1 > >> stdlib-1.19.1 > >> syntax_tools-1.6.11 > >> tools-2.6.10 > >> webtool-0.8.9.2 > >> wx-1.0 > >> xmerl-1.3.3 > >> > >> To reproduce, follow the steps found in > >> https://github.com/rebar/rebar/wiki/Release-handling > >> and make sure to delete the sys-level mod_cond. > >> > >> If you want to keep the sys-level {mod_cond, derived} and use the > >> nodetool escript, remember to add the following line: > >> {app, compiler, [{mod_cond, app}]}, > >> Otherwise reltool might not include[3] some compiler modules which are > >> used due to the `-mode(compile)` directive. As I don't think the > >> nodetool escript has anything to gain by being compiled, I've posted a > >> patch to delete[4] the directive. > >> > >> So, the question is, is this expected reltool behaviour? If so, is > >> this really desired or not possibly including much more than is > >> actually used. Shouldn't the sys-level {incl_cond, derived} make > >> sure only used applications are included (regardless of mod_cond)? > >> > >> [1] > http://erlang.org/pipermail/erlang-questions/2012-December/071135.html > >> [2] https://github.com/rebar/rebar/pull/43 > >> [3] https://github.com/rebar/rebar/issues/64#issuecomment-15998750 > >> [4] https://github.com/rebar/rebar/pull/80 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From james@REDACTED Mon Nov 25 21:55:04 2013 From: james@REDACTED (James Wheare) Date: Mon, 25 Nov 2013 20:55:04 +0000 Subject: [erlang-questions] PKCS-7 signing Message-ID: Hullo, I'm working on implementing Apple's Push Notifications for Websites system and having some trouble signing the "push package" The docs [1] say this: "The signature is a PKCS #7 detached signature of the manifest file. Sign the manifest file with the private key associated with your web push certificate that you obtained while registering with Apple. In PHP, you can do this with the openssl_pkcs7_sign function" So I'm looking for an equivalent to PHP's openssl_pkcs7_sign [2] in erlang. The release notes [3] for the public_key module seem to offer some hope, with "experimental" PKCS-7 support announced in 0.17, but I can't find anything about it in the docs [4] Any advice on solving this? Thanks, - James [1] https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/NotificationProgrammingGuideForWebsites/PushNotifications/PushNotifications.html#//apple_ref/doc/uid/TP40013225-CH3-SW10 [2] http://php.net/manual/en/function.openssl-pkcs7-sign.php [3] http://www.erlang.org/doc/apps/public_key/notes.html [4] http://erlang.org/doc/man/public_key.html From dszoboszlay@REDACTED Mon Nov 25 22:30:54 2013 From: dszoboszlay@REDACTED (=?utf-8?Q?Szoboszlay_D=C3=A1niel?=) Date: Mon, 25 Nov 2013 21:30:54 -0000 Subject: [erlang-questions] PKCS-7 signing In-Reply-To: References: Message-ID: Hi, If it is only a manifest file that (I assume) doesn't change very often I would rather use "openssl smime" to create the signature. I was looking into PKCS-7 signing with Erlang recently, but I could avoid doing it after all. My impression was that there is no direct support for it in OTP, so you'd either have to call the openssl routines via e.g. a port driver or use the existing crypto functions to sign your data and put together a SignedData structure according to RFC 2315 using the ASN.1 application. Yet, I might be wrong. Daniel On Mon, 25 Nov 2013 20:55:04 -0000, James Wheare wrote: > Hullo, > > I'm working on implementing Apple's Push Notifications for Websites > system and having some trouble signing the "push package" > > The docs [1] say this: > > "The signature is a PKCS #7 detached signature of the manifest file. > Sign the manifest file with the private key associated with your web > push certificate that you obtained while registering with Apple. In > PHP, you can do this with the openssl_pkcs7_sign function" > > So I'm looking for an equivalent to PHP's openssl_pkcs7_sign [2] in > erlang. > > The release notes [3] for the public_key module seem to offer some > hope, with "experimental" PKCS-7 support announced in 0.17, but I > can't find anything about it in the docs [4] > > Any advice on solving this? > > Thanks, > - James > > [1] > https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/NotificationProgrammingGuideForWebsites/PushNotifications/PushNotifications.html#//apple_ref/doc/uid/TP40013225-CH3-SW10 > [2] http://php.net/manual/en/function.openssl-pkcs7-sign.php > [3] http://www.erlang.org/doc/apps/public_key/notes.html > [4] http://erlang.org/doc/man/public_key.html > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From virtan@REDACTED Mon Nov 25 22:11:11 2013 From: virtan@REDACTED (virtan) Date: Tue, 26 Nov 2013 00:11:11 +0300 Subject: [erlang-questions] [ANN] Erlang Easy Profiling (eep) provides a way to analyze application performance and call hierarchy Message-ID: <9E9AF7BD-719F-4335-BD7B-CE0591592C59@virtan.com> Hi all. I just want to present to the community my small project which provides a way to analyze performance of your running application and to visualize function call hierarchy (with power of kcachegrind as a GUI tool). It helped me to find some bottlenecks in our application, would be great if it helps someone else. https://github.com/virtan/eep Main features: ? no need to modify sources (doesn't need sources at all) ? no need to stop your running system ? start and stop collecting runtime data at arbitrary time ? profile arbitrary module or whole system ? minimal impact on profiled system performance (unlike fprof) ? very informative visualization of time costs and call stacks (kcachegrind) ? ability to export call graphs in dot or image format ? optional process separation ? based on dbg module and built-in low overhead trace ports Here is an example what you can get using it: https://raw.github.com/virtan/eep/master/doc/sshot1.png Permissive MIT license. -- virtan / virtan@REDACTED / http://www.virtan.com From james@REDACTED Tue Nov 26 02:47:07 2013 From: james@REDACTED (James Wheare) Date: Tue, 26 Nov 2013 01:47:07 +0000 Subject: [erlang-questions] PKCS-7 signing In-Reply-To: References: Message-ID: Unfortunately the manifest is customised with an authentication token for each user, so you can't just reuse a one time signature. Sounds like calling openssl directly might be the best bet for now :/ Thanks On Mon, Nov 25, 2013 at 9:30 PM, Szoboszlay D?niel wrote: > Hi, > > If it is only a manifest file that (I assume) doesn't change very often I > would rather use "openssl smime" to create the signature. > > I was looking into PKCS-7 signing with Erlang recently, but I could avoid > doing it after all. My impression was that there is no direct support for it > in OTP, so you'd either have to call the openssl routines via e.g. a port > driver or use the existing crypto functions to sign your data and put > together a SignedData structure according to RFC 2315 using the ASN.1 > application. Yet, I might be wrong. > > Daniel > > > On Mon, 25 Nov 2013 20:55:04 -0000, James Wheare wrote: > >> Hullo, >> >> I'm working on implementing Apple's Push Notifications for Websites >> system and having some trouble signing the "push package" >> >> The docs [1] say this: >> >> "The signature is a PKCS #7 detached signature of the manifest file. >> Sign the manifest file with the private key associated with your web >> push certificate that you obtained while registering with Apple. In >> PHP, you can do this with the openssl_pkcs7_sign function" >> >> So I'm looking for an equivalent to PHP's openssl_pkcs7_sign [2] in >> erlang. >> >> The release notes [3] for the public_key module seem to offer some >> hope, with "experimental" PKCS-7 support announced in 0.17, but I >> can't find anything about it in the docs [4] >> >> Any advice on solving this? >> >> Thanks, >> - James >> >> [1] >> https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/NotificationProgrammingGuideForWebsites/PushNotifications/PushNotifications.html#//apple_ref/doc/uid/TP40013225-CH3-SW10 >> [2] http://php.net/manual/en/function.openssl-pkcs7-sign.php >> [3] http://www.erlang.org/doc/apps/public_key/notes.html >> [4] http://erlang.org/doc/man/public_key.html >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From techabc@REDACTED Tue Nov 26 09:11:16 2013 From: techabc@REDACTED (techabc) Date: Tue, 26 Nov 2013 16:11:16 +0800 Subject: [erlang-questions] Developing killer / open source apps In-Reply-To: References: Message-ID: sounds nice! go-qml(https://github.com/niemeyer/qml) implement a bridge from golang to QT QUICK, hope erl-qml cames out soon. 2011/8/6 Daniel Goertzen > How about interfacing Erlang to the Qt UI library? > > I don't mean a convential binding like wxErlang or PyQt, but components to > facilitate message passing between Erlang and a Qt port program or NIF > thread running a Qt message loop. > > Qt has relatively recently introduced QML, which is basically a fancy GUI > designer that lets you incorporate javascript. The application development > model is that the GUI is written in QML/javascript, and the underlying > application logic is in C++ (very Web 2.0-ish). Now instead of writing > C++, you have your QML/javascript talk to the "ErQt" object which passes > messages to/from Erlang, and Erlang implements the application logic. > > Conceivably one could create a single Qt port executable, driver, or NIF > library that could run any number of QML/javascript programs. Creating a > GUI for Erlang would involve using the native Qt tools for authoring QML > and javascript, and implementing your comm protocol on both the javascript > and Erlang sides. Your QML/javascript GUI would run on the standard Qt > port exectable...no additional C++ compiling required. > > Now QML is currently only available for mobile devices, but the Qt folks > have stated that they will port it to the desktop and this will become the > preferred way to develop desktop Qt apps. > > This project would likely involve more C++ than Erlang, so I'm not sure > how you feel about that. ;) > > Cheers, > Dan. > > > On Mon, Aug 1, 2011 at 5:53 PM, Nick S wrote: > >> I have just finished implementing a "professional" Erlang server, and >> with time and enthusiasm in hand, I would like to start working on >> something personal. >> I must say, it has been really fun writing apps in OTP and see it >> processing millions of messages without ever crashing...! >> >> Would appreciate some new ideas, that would be useful to community :) >> >> - XMPP, AMQP etc are already in market! >> >> - Any audio/video processing layer? >> >> - Any telecom related...? >> >> - Some standard protocol implementation? >> >> - Something new for next generation...? (Buzz words... cloud computing >> etc..) >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From greim@REDACTED Tue Nov 26 13:01:39 2013 From: greim@REDACTED (greim) Date: Tue, 26 Nov 2013 13:01:39 +0100 Subject: [erlang-questions] Developing killer / open source apps In-Reply-To: References: Message-ID: <52948DA3.5000404@schleibinger.com> Hi Nick, Am 02.08.2011 00:53, schrieb Nick S: > I have just finished implementing a "professional" Erlang server, and > with time and enthusiasm in hand, I would like to start working on > something personal. > I must say, it has been really fun writing apps in OTP and see it > processing millions of messages without ever crashing...! > > Would appreciate some new ideas, that would be useful to community :) > > - XMPP, AMQP etc are already in market! > > - Any audio/video processing layer? > > - Any telecom related...? > > - Some standard protocol implementation? > > - Something new for next generation...? (Buzz words... cloud computing > etc..) > PeerBook = Social media as peer to peer software, encrypted communication with NO central server. Maybe we should call it BeerBook ;-) Markus > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From vances@REDACTED Tue Nov 26 13:16:57 2013 From: vances@REDACTED (Vance Shipley) Date: Tue, 26 Nov 2013 17:46:57 +0530 Subject: [erlang-questions] Developing killer / open source apps In-Reply-To: <52948DA3.5000404@schleibinger.com> References: <52948DA3.5000404@schleibinger.com> Message-ID: DNS with ENUM. On Nov 26, 2013 5:32 PM, "greim" wrote: > Hi Nick, > > Am 02.08.2011 00:53, schrieb Nick S: > >> I have just finished implementing a "professional" Erlang server, and >> with time and enthusiasm in hand, I would like to start working on >> something personal. >> I must say, it has been really fun writing apps in OTP and see it >> processing millions of messages without ever crashing...! >> >> Would appreciate some new ideas, that would be useful to community :) >> >> - XMPP, AMQP etc are already in market! >> >> - Any audio/video processing layer? >> >> - Any telecom related...? >> >> - Some standard protocol implementation? >> >> - Something new for next generation...? (Buzz words... cloud computing >> etc..) >> >> > PeerBook = Social media as peer to peer software, encrypted communication > with NO central server. > > Maybe we should call it BeerBook ;-) > > Markus > > > > > > > >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Tue Nov 26 13:22:06 2013 From: watson.timothy@REDACTED (Tim Watson) Date: Tue, 26 Nov 2013 12:22:06 +0000 Subject: [erlang-questions] Developing killer / open source apps In-Reply-To: <52948DA3.5000404@schleibinger.com> References: <52948DA3.5000404@schleibinger.com> Message-ID: On 26 Nov 2013, at 12:01, greim wrote: > > PeerBook = Social media as peer to peer software, encrypted communication with NO central server. > That would be cool, if done right. -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimo+erlang-questions@REDACTED Tue Nov 26 14:14:21 2013 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Tue, 26 Nov 2013 14:14:21 +0100 Subject: [erlang-questions] [ANN] Erlang Easy Profiling (eep) provides a way to analyze application performance and call hierarchy In-Reply-To: <9E9AF7BD-719F-4335-BD7B-CE0591592C59@virtan.com> References: <9E9AF7BD-719F-4335-BD7B-CE0591592C59@virtan.com> Message-ID: <20131126131421.GB23543@erix.ericsson.se> On Tue, Nov 26, 2013 at 12:11:11AM +0300, virtan wrote: > Hi all. > > I just want to present to the community my small project which provides a way > to analyze performance of your running application and to visualize > function call hierarchy (with power of kcachegrind as a GUI tool). > > It helped me to find some bottlenecks in our application, would be great > if it helps someone else. > > https://github.com/virtan/eep Since EEP in the Erlang world means Erlang Enhancement Proposal or Erlang Enhancement Process, you might consider another name for your project, if that was not intentional... Good name, though. > > Main features: > > ? no need to modify sources (doesn't need sources at all) > ? no need to stop your running system > ? start and stop collecting runtime data at arbitrary time > ? profile arbitrary module or whole system > ? minimal impact on profiled system performance (unlike fprof) > ? very informative visualization of time costs and call stacks (kcachegrind) > ? ability to export call graphs in dot or image format > ? optional process separation > ? based on dbg module and built-in low overhead trace ports > > Here is an example what you can get using it: > https://raw.github.com/virtan/eep/master/doc/sshot1.png > > Permissive MIT license. > > -- > virtan / virtan@REDACTED / http://www.virtan.com > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From mfidelman@REDACTED Tue Nov 26 14:30:56 2013 From: mfidelman@REDACTED (Miles Fidelman) Date: Tue, 26 Nov 2013 08:30:56 -0500 Subject: [erlang-questions] Developing killer / open source apps In-Reply-To: References: <52948DA3.5000404@schleibinger.com> Message-ID: <5294A290.9000807@meetinghouse.net> Tim Watson wrote: > On 26 Nov 2013, at 12:01, greim wrote: >> >> PeerBook = Social media as peer to peer software, encrypted >> communication with NO central server. >> Isn't that called USENET? :-) Miles Fidelman From masklinn@REDACTED Tue Nov 26 14:39:06 2013 From: masklinn@REDACTED (Masklinn) Date: Tue, 26 Nov 2013 14:39:06 +0100 Subject: [erlang-questions] Developing killer / open source apps In-Reply-To: <5294A290.9000807@meetinghouse.net> References: <52948DA3.5000404@schleibinger.com> <5294A290.9000807@meetinghouse.net> Message-ID: <77F4696E-A467-46F0-AFD7-E3F459B6C08E@masklinn.net> On 2013-11-26, at 14:30 , Miles Fidelman wrote: > Tim Watson wrote: >> On 26 Nov 2013, at 12:01, greim wrote: >>> >>> PeerBook = Social media as peer to peer software, encrypted communication with NO central server. >>> > > Isn't that called USENET? :-) It?s true that USENET is decentralised, but it still has servers, and AFAIK most usenet traffic is not encrypted. Sounds more like a darknet, like W.A.S.T.E or Freenet. From pillai.sharmila@REDACTED Tue Nov 26 15:20:10 2013 From: pillai.sharmila@REDACTED (Sharmila Pillai) Date: Tue, 26 Nov 2013 14:20:10 +0000 Subject: [erlang-questions] Fwd: Bug fix for DWR handling in R16B02 In-Reply-To: References: Message-ID: Dear OTP team, I sent this to erlang-patches but doesn't look like it got circulated. Hope this helps someone. regards, Sharmila. ---------- Forwarded message ---------- From: Sharmila Pillai Date: Mon, Nov 25, 2013 at 8:16 PM Subject: Bug fix for DWR handling in R16B02 To: erlang-patches@REDACTED Hi, We were testing our PCRF implementation using the diameter stack and found that DWRs did not have a corresponding DWA. This I found was because the Hop-by-hop identifier and End-to-end identifier in the diameter_header weren't echoed back in a DWA (reference: http://tools.ietf.org/html/rfc3588#section-3) but a new locally generated one was being sent. Patch below fixes the problem. $ diff diameter_watchdog.erl ~/temp/diameter_watchdog.erl 465,468c465,479 < Seq = diameter_session:sequence(Mask), < Hdr = #diameter_header{version = ?DIAMETER_VERSION, < end_to_end_id = Seq, < hop_by_hop_id = Seq}, --- > encode(undefined, Msg, Mask, Dict). > > encode(Req_pkt, Msg, Mask, Dict) -> > Hdr = case Req_pkt of > undefined -> > Seq = diameter_session:sequence(Mask), > #diameter_header{version = ?DIAMETER_VERSION, > end_to_end_id = Seq, > hop_by_hop_id = Seq}; > #diameter_packet{header = #diameter_header{hop_by_hop_id = H2H, > end_to_end_id = E2E}} -> > #diameter_header{version = ?DIAMETER_VERSION, > end_to_end_id = E2E, > hop_by_hop_id = H2H} > end, 551c562 < send(TPid, {send, encode(dwa(Pkt), Mask, Dict0)}), --- > send(TPid, {send, encode(Pkt, dwa(Pkt), Mask, Dict0)}), 795c806,808 < dwa(#diameter_packet{header = H, errors = Es}) -> --- > dwa(#diameter_packet{header = #diameter_header{hop_by_hop_id = H2H, > end_to_end_id = E2E} = H, > errors = Es}) -> best wishes, Sharmila. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mfidelman@REDACTED Tue Nov 26 17:26:40 2013 From: mfidelman@REDACTED (Miles Fidelman) Date: Tue, 26 Nov 2013 11:26:40 -0500 Subject: [erlang-questions] Developing killer / open source apps In-Reply-To: <5294A290.9000807@meetinghouse.net> References: <52948DA3.5000404@schleibinger.com> <5294A290.9000807@meetinghouse.net> Message-ID: <5294CBC0.6050401@meetinghouse.net> Masklinn wrote: > Miles Fidelman wrote: >> Tim Watson wrote: >>> On 26 Nov 2013, at 12:01, greim wrote: >>>> >>>> PeerBook = Social media as peer to peer software, encrypted >>>> communication with NO central server. >>>> >> >> Isn't that called USENET? :-) >> > It?s true that USENET is decentralised, but it still has servers, and > AFAIK most usenet traffic is not encrypted. Sounds more like a darknet, > like W.A.S.T.E or Freenet. Not to be pedantic, but USENET meets "no central server" but not "peer to peer" (unless, of course, each peer is running a server). But yes, Freenet is probably closer in spirit. Having said that - does anybody remember the "Netscape Collaboration Server?" Essentially a collaborative environment built on top of NTTP. (As I recall), it used all the encryption options available w/ NNTP, added a directory service and access controls (cryptographically enforced if I remember correctly). Essentially it made it trivial to set up private, secure newsgroups for work groups. Unfortunately, all traces of it seem to have disappeared after AOL bought Netscape. I keep thinking it would be worth rebuilding. Miles Fidelman From anders.otp@REDACTED Tue Nov 26 17:44:09 2013 From: anders.otp@REDACTED (Anders Svensson) Date: Tue, 26 Nov 2013 17:44:09 +0100 Subject: [erlang-questions] Fwd: Bug fix for DWR handling in R16B02 In-Reply-To: References: Message-ID: Hi Sharmila. Yes, the fault was introduced in R16B02 unfortunately. A fix was pushed to maint/master a few weeks ago: https://github.com/erlang/otp/commit/46a1d278fe063ffd08ae9538bb8a496b813fe661 Anders, Erlang/OTP On Tue, Nov 26, 2013 at 3:20 PM, Sharmila Pillai wrote: > Dear OTP team, > I sent this to erlang-patches but doesn't look like it got circulated. Hope > this helps someone. > > regards, > Sharmila. > > ---------- Forwarded message ---------- > From: Sharmila Pillai > Date: Mon, Nov 25, 2013 at 8:16 PM > Subject: Bug fix for DWR handling in R16B02 > To: erlang-patches@REDACTED > > > Hi, > > We were testing our PCRF implementation using the diameter stack and found > that DWRs did not have a corresponding DWA. > This I found was because the Hop-by-hop identifier and End-to-end identifier > in the diameter_header weren't echoed back in a DWA (reference: > http://tools.ietf.org/html/rfc3588#section-3) but a new locally generated > one was being sent. Patch below fixes the problem. > > > $ diff diameter_watchdog.erl ~/temp/diameter_watchdog.erl > 465,468c465,479 > < Seq = diameter_session:sequence(Mask), > < Hdr = #diameter_header{version = ?DIAMETER_VERSION, > < end_to_end_id = Seq, > < hop_by_hop_id = Seq}, > --- >> encode(undefined, Msg, Mask, Dict). >> >> encode(Req_pkt, Msg, Mask, Dict) -> >> Hdr = case Req_pkt of >> undefined -> >> Seq = diameter_session:sequence(Mask), >> #diameter_header{version = ?DIAMETER_VERSION, >> end_to_end_id = Seq, >> hop_by_hop_id = Seq}; >> #diameter_packet{header = #diameter_header{hop_by_hop_id = >> H2H, >> end_to_end_id = >> E2E}} -> >> #diameter_header{version = ?DIAMETER_VERSION, >> end_to_end_id = E2E, >> hop_by_hop_id = H2H} >> end, > 551c562 > < send(TPid, {send, encode(dwa(Pkt), Mask, Dict0)}), > --- >> send(TPid, {send, encode(Pkt, dwa(Pkt), Mask, Dict0)}), > 795c806,808 > < dwa(#diameter_packet{header = H, errors = Es}) -> > --- >> dwa(#diameter_packet{header = #diameter_header{hop_by_hop_id = H2H, >> end_to_end_id = E2E} = H, >> errors = Es}) -> > > > best wishes, > Sharmila. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From greim@REDACTED Tue Nov 26 18:50:48 2013 From: greim@REDACTED (greim) Date: Tue, 26 Nov 2013 18:50:48 +0100 Subject: [erlang-questions] Developing killer / open source apps In-Reply-To: <5294CBC0.6050401@meetinghouse.net> References: <52948DA3.5000404@schleibinger.com> <5294A290.9000807@meetinghouse.net> <5294CBC0.6050401@meetinghouse.net> Message-ID: <5294DF78.4030606@schleibinger.com> Am 26.11.2013 17:26, schrieb Miles Fidelman: > Masklinn wrote: >> Miles Fidelman wrote: >>> Tim Watson wrote: >>>> On 26 Nov 2013, at 12:01, greim wrote: >>>>> >>>>> PeerBook = Social media as peer to peer software, encrypted >>>>> communication with NO central server. >>>>> >>> >>> Isn't that called USENET? :-) >>> >> It?s true that USENET is decentralised, but it still has servers, and >> AFAIK most usenet traffic is not encrypted. Sounds more like a darknet, >> like W.A.S.T.E or Freenet. > > Not to be pedantic, but USENET meets "no central server" but not "peer > to peer" (unless, of course, each peer is running a server). But yes, > Freenet is probably closer in spirit. > > Having said that - does anybody remember the "Netscape Collaboration > Server?" Essentially a collaborative environment built on top of NTTP. > (As I recall), it used all the encryption options available w/ NNTP, > added a directory service and access controls (cryptographically > enforced if I remember correctly). Essentially it made it trivial to set > up private, secure newsgroups for work groups. Unfortunately, all traces > of it seem to have disappeared after AOL bought Netscape. I keep > thinking it would be worth rebuilding. At the Univ. Paderborn, Germany, they had developed a framework: http://p2pframework.com/?lang=en The framework source should be published "soon", whenever it is. And there is a system called Tribler. Any experience with it? I heard that the German Telekom is sponsoring such developments, but i can't remember where and how. Markus Greim > > Miles Fidelman > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From akonsu@REDACTED Tue Nov 26 20:09:19 2013 From: akonsu@REDACTED (akonsu) Date: Tue, 26 Nov 2013 14:09:19 -0500 Subject: [erlang-questions] what is overlay? Message-ID: Hello, could someone please explain what a rebar/reltool overlay is and how I can use them? I tried searching on the web but found no comprehensible information about it... thanks konstantin -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Tue Nov 26 20:29:31 2013 From: comptekki@REDACTED (Wes James) Date: Tue, 26 Nov 2013 12:29:31 -0700 Subject: [erlang-questions] [ANN] Esysman 1.2 In-Reply-To: References: Message-ID: On Mon, Nov 25, 2013 at 11:00 PM, Andreas Stenius wrote: > 2013/11/22 Wes James > >> I have updated Esysman to 1.2: >> > > Having a short introduction as to what Esysman is (at a glance) would be > nice > for those not familiar with your project (me included). > > Cheers > Sorry about that. ESysMan is a systems manager. You set up a web service (cowboy) and talk to it with a browser via websockets. The console is a web page that has your rooms that you click on a room name to view a particular room then in each room you can run commands on the systems in that room (the layout for the rooms is similar to the actual layout of the room). You can run the commands on individuall workstations or on the whole room of workstations. Some commands that can be run are wol, restart, shutdown, copy (for copying scripts or installer files to the workstations), run scripts or applications that have been copied, ping, freeze/thaw/get status for deepfreeze software. At the top of the console you can see how many systems are up in each room and a total for all rooms. I also have a panel for alerts that indicate which systems have the same user logged in more than once (students aren't supposed to share accounts ;) ), and so forth. If you have any more questions, let me know. -wes -------------- next part -------------- An HTML attachment was scrubbed... URL: From fly@REDACTED Tue Nov 26 20:43:09 2013 From: fly@REDACTED (Fred Youhanaie) Date: Tue, 26 Nov 2013 19:43:09 +0000 Subject: [erlang-questions] module_info and code switch Message-ID: <5294F9CD.1050608@anydata.co.uk> Hi I'm playing with a simple piece of code where I switch versions via erl shell. Curiously I noticed that as soon as I load a new version of the module, module_info/1 returns the attribute of the currently loaded version rather than the version for the running process! Is this intentional? Code and sample session is at the bottom. Thanks Fred Here's the code: -module(loopie). -compile([export_all]). start() -> start(5000). start(T) -> register(loopie, spawn(?MODULE, loop, [T])). loop(T) -> receive switch -> io:format("switched~n"), loopie:loop(T); ANY -> io:format("received unexpected message >~p<.~n", [ANY]), loop(T) after T -> io:format("v1 ~p.~n", [module_info(attributes)]), loop(T) end. Here's a sample session: 1. initially loopie prints v1 and vsn every 5 seconds. 2. on the source "v1" is changed to "v2" and module is compiled and loaded 3. loopie is now printing v1 but with the new vsn 4. switch message is sent 5. loopie is now printing v2 and the new vsn $ erl Erlang R16B02 (erts-5.10.3) [source] [async-threads:10] [hipe] [kernel-poll:false] Eshell V5.10.3 (abort with ^G) 1> l(loopie). {module,loopie} 2> loopie:start(). true v1 [{vsn,[102112148784636006663528886950745967476]}]. v1 [{vsn,[102112148784636006663528886950745967476]}]. 3> l(loopie). {module,loopie} v1 [{vsn,[337256366447556252629333013282189761649]}]. v1 [{vsn,[337256366447556252629333013282189761649]}]. v1 [{vsn,[337256366447556252629333013282189761649]}]. 4> loopie!switch. switched switch v2 [{vsn,[337256366447556252629333013282189761649]}]. v2 [{vsn,[337256366447556252629333013282189761649]}]. 5> From pierrefenoll@REDACTED Tue Nov 26 23:08:18 2013 From: pierrefenoll@REDACTED (Pierre Fenoll) Date: Tue, 26 Nov 2013 22:08:18 +0000 Subject: [erlang-questions] [ANN] Esysman 1.2 In-Reply-To: References: Message-ID: Killer Erlang FOSS? Implementations of most communication protocols. Code that shows where Erlang can be awesome, with awe-inspiring tech (P2P, chat, streaming, clustering, BTC, ?) all scalable and highly available. And if those things already are created somewhere, a way to find them. Cheers, -- Pierre Fenoll On 26 November 2013 19:29, Wes James wrote: > > > > On Mon, Nov 25, 2013 at 11:00 PM, Andreas Stenius < > andreas.stenius@REDACTED> wrote: > >> 2013/11/22 Wes James >> >>> I have updated Esysman to 1.2: >>> >> >> Having a short introduction as to what Esysman is (at a glance) would be >> nice >> for those not familiar with your project (me included). >> >> Cheers >> > > Sorry about that. > > ESysMan is a systems manager. You set up a web service (cowboy) and talk > to it with a browser via websockets. The console is a web page that has > your rooms that you click on a room name to view a particular room then in > each room you can run commands on the systems in that room (the layout for > the rooms is similar to the actual layout of the room). You can run the > commands on individuall workstations or on the whole room of workstations. > Some commands that can be run are wol, restart, shutdown, copy (for copying > scripts or installer files to the workstations), run scripts or > applications that have been copied, ping, freeze/thaw/get status for > deepfreeze software. At the top of the console you can see how many > systems are up in each room and a total for all rooms. I also have a panel > for alerts that indicate which systems have the same user logged in more > than once (students aren't supposed to share accounts ;) ), and so forth. > > If you have any more questions, let me know. > > -wes > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From marouene.lakhdhar@REDACTED Tue Nov 26 22:18:02 2013 From: marouene.lakhdhar@REDACTED (Marouene Lakhdhar) Date: Wed, 27 Nov 2013 00:18:02 +0300 Subject: [erlang-questions] os:cmd/1 performance issue Message-ID: Hi, I'm facing a performance issue with os:cmd/1. it takes about 5 secs to return the result however if i execute the commande with cmd.exe, the reuslt will be immediately displayed. I'm using erl5.10.3 under windows 7. Could you please help me how to avoid the extra time when usung os:cmd/1? Thanks, Marouene. -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Tue Nov 26 23:56:47 2013 From: comptekki@REDACTED (Wes James) Date: Tue, 26 Nov 2013 15:56:47 -0700 Subject: [erlang-questions] os:cmd/1 performance issue In-Reply-To: References: Message-ID: On Tue, Nov 26, 2013 at 2:18 PM, Marouene Lakhdhar < marouene.lakhdhar@REDACTED> wrote: > Hi, > > I'm facing a performance issue with os:cmd/1. it takes about 5 secs to > return the result however if i execute the commande with cmd.exe, the > reuslt will be immediately displayed. > > I'm using erl5.10.3 under windows 7. > > Could you please help me how to avoid the extra time when usung os:cmd/1? > > Thanks, > Marouene. > > I just brought up a machine with ESysMan, coped over an any.cmd with "echo hello>hello.txt" and executed the any.cmd file and it created a file hello.txt pretty much right after I executed it. I do it like this: https://github.com/comptekki/esysman/blob/master/src/ecom.erl Just a simple call to os:cmd(...) I also put C:\Program Files\erl5.9.3.1\erts-5.9.3.1\bin at beginning of the System Variables, Path variable. It's hard to tell why yours is slow with no context of how you are using it. -wes -------------- next part -------------- An HTML attachment was scrubbed... URL: From pierrefenoll@REDACTED Wed Nov 27 00:02:41 2013 From: pierrefenoll@REDACTED (Pierre Fenoll) Date: Tue, 26 Nov 2013 23:02:41 +0000 Subject: [erlang-questions] [ANN] Esysman 1.2 In-Reply-To: References: Message-ID: On 26 November 2013 22:08, Pierre Fenoll wrote: > Killer Erlang FOSS? > > Implementations of most communication protocols. > Code that shows where Erlang can be awesome, with awe-inspiring tech (P2P, > chat, streaming, clustering, BTC, ?) all scalable and highly available. > And if those things already are created somewhere, a way to find them. > Wrong post! Sorry about that. Cheers, -- Pierre Fenoll -------------- next part -------------- An HTML attachment was scrubbed... URL: From pierrefenoll@REDACTED Wed Nov 27 00:04:13 2013 From: pierrefenoll@REDACTED (Pierre Fenoll) Date: Tue, 26 Nov 2013 23:04:13 +0000 Subject: [erlang-questions] Developing killer / open source apps In-Reply-To: <5294DF78.4030606@schleibinger.com> References: <52948DA3.5000404@schleibinger.com> <5294A290.9000807@meetinghouse.net> <5294CBC0.6050401@meetinghouse.net> <5294DF78.4030606@schleibinger.com> Message-ID: Killer Erlang FOSS? Implementations of most communication protocols. Code that shows where Erlang can be awesome, with awe-inspiring tech (P2P, chat, streaming, clustering, BTC, ?) all scalable and highly available. (Erlang The Movie II was pretty good at that!) And if those things already are created somewhere, a way to find them. Cheers, -- Pierre Fenoll On 26 November 2013 17:50, greim wrote: > Am 26.11.2013 17:26, schrieb Miles Fidelman: > > Masklinn wrote: >> >>> Miles Fidelman wrote: >>> >>>> Tim Watson wrote: >>>> >>>>> On 26 Nov 2013, at 12:01, greim wrote: >>>>> >>>>>> >>>>>> PeerBook = Social media as peer to peer software, encrypted >>>>>> communication with NO central server. >>>>>> >>>>>> >>>> Isn't that called USENET? :-) >>>> >>>> It?s true that USENET is decentralised, but it still has servers, and >>> AFAIK most usenet traffic is not encrypted. Sounds more like a darknet, >>> like W.A.S.T.E or Freenet. >>> >> >> Not to be pedantic, but USENET meets "no central server" but not "peer >> to peer" (unless, of course, each peer is running a server). But yes, >> Freenet is probably closer in spirit. >> >> Having said that - does anybody remember the "Netscape Collaboration >> Server?" Essentially a collaborative environment built on top of NTTP. >> (As I recall), it used all the encryption options available w/ NNTP, >> added a directory service and access controls (cryptographically >> enforced if I remember correctly). Essentially it made it trivial to set >> up private, secure newsgroups for work groups. Unfortunately, all traces >> of it seem to have disappeared after AOL bought Netscape. I keep >> thinking it would be worth rebuilding. >> > > > At the Univ. Paderborn, Germany, they had developed a framework: > > http://p2pframework.com/?lang=en > > The framework source should be published "soon", whenever it is. > > And there is a system called Tribler. Any experience with it? > > I heard that the German Telekom is sponsoring such developments, but i > can't remember where and how. > > Markus Greim > > > > > > >> Miles Fidelman >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dszoboszlay@REDACTED Wed Nov 27 00:06:22 2013 From: dszoboszlay@REDACTED (=?utf-8?Q?Szoboszlay_D=C3=A1niel?=) Date: Tue, 26 Nov 2013 23:06:22 -0000 Subject: [erlang-questions] module_info and code switch In-Reply-To: <5294F9CD.1050608@anydata.co.uk> References: <5294F9CD.1050608@anydata.co.uk> Message-ID: Hi, If you compile the module with the 'E' option you can see the actual code generated for module_info/0,1: module_info() -> erlang:get_module_info(loopie). module_info(X) -> erlang:get_module_info(loopie, X). This means the compiler doesn't implement the function by hard coding the results, but via caling a BIF instead. And the BIF always uses the current version of the module. Which, I personally think, is OK and consistent with the rest of OTP: if you would e.g. print the result of code:get_object_code(?MODULE) it would also reflect the current version. However, I think this behaviour of module_info is not documented properly. The "compiler will hard code the results in the module" would be a valid mental model too, especially since erlang:get_module_info/1,2 functions aren't documented either. So I'd raise a bug report on the documentation. BR, Daniel On Tue, 26 Nov 2013 19:43:09 -0000, Fred Youhanaie wrote: > Hi > > I'm playing with a simple piece of code where I switch versions via erl > shell. > > Curiously I noticed that as soon as I load a new version of the module, > module_info/1 returns the attribute of the currently loaded version > rather than the version for the running process! > > Is this intentional? > > Code and sample session is at the bottom. > > Thanks > > Fred > > Here's the code: > > -module(loopie). > -compile([export_all]). > start() -> > start(5000). > start(T) -> > register(loopie, spawn(?MODULE, loop, [T])). > loop(T) -> > receive > switch -> > io:format("switched~n"), > loopie:loop(T); > ANY -> > io:format("received unexpected message >~p<.~n", [ANY]), > loop(T) > after T -> > io:format("v1 ~p.~n", [module_info(attributes)]), > loop(T) > end. > > Here's a sample session: > > 1. initially loopie prints v1 and vsn every 5 seconds. > 2. on the source "v1" is changed to "v2" and module is compiled andloaded > 3. loopie is now printing v1 but with the new vsn > 4. switch message is sent > 5. loopie is now printing v2 and the new vsn > > $ erl > Erlang R16B02 (erts-5.10.3) [source] [async-threads:10] [hipe] > [kernel-poll:false] > > Eshell V5.10.3 (abort with ^G) > 1> l(loopie). > {module,loopie} > 2> loopie:start(). > true > v1 [{vsn,[102112148784636006663528886950745967476]}]. > v1 [{vsn,[102112148784636006663528886950745967476]}]. > 3> l(loopie). > {module,loopie} > v1 [{vsn,[337256366447556252629333013282189761649]}]. > v1 [{vsn,[337256366447556252629333013282189761649]}]. > v1 [{vsn,[337256366447556252629333013282189761649]}]. > 4> loopie!switch. > switched > switch > v2 [{vsn,[337256366447556252629333013282189761649]}]. > v2 [{vsn,[337256366447556252629333013282189761649]}]. > 5> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From ahe.sanath@REDACTED Wed Nov 27 02:28:38 2013 From: ahe.sanath@REDACTED (Sanath Prasanna) Date: Wed, 27 Nov 2013 06:58:38 +0530 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 Message-ID: Hi all, when running following sample in ERL shell, I got wrong value. What is the reason for this? 2452.45*100. = 245244.99999999997 It should be 245245.0 or 245245 Then all the calculations became wrong in my program. Are there any idea regarding above? Br, Sanath -------------- next part -------------- An HTML attachment was scrubbed... URL: From mangalaman93@REDACTED Wed Nov 27 02:34:23 2013 From: mangalaman93@REDACTED (aman mangal) Date: Wed, 27 Nov 2013 07:04:23 +0530 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 In-Reply-To: References: Message-ID: Hi, I guess it is because of floating point arithmetic not specific to erlang. see this http://www.erlang.org/faq/problems.html#id56586 Aman Mangal 4th year Undergraduate Student Department of Computer Science & Engineering IIT Bombay www.cse.iitb.ac.in/~amanmangal On Wed, Nov 27, 2013 at 6:58 AM, Sanath Prasanna wrote: > Hi all, > when running following sample in ERL shell, I got wrong value. What is the > reason for this? > > 2452.45*100. = 245244.99999999997 > > It should be 245245.0 or 245245 > > > Then all the calculations became wrong in my program. > Are there any idea regarding above? > > Br, > Sanath > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dch@REDACTED Wed Nov 27 02:35:35 2013 From: dch@REDACTED (Dave Cottlehuber) Date: Wed, 27 Nov 2013 02:35:35 +0100 Subject: [erlang-questions] Maths Problem -> 2452.45*100. =?utf-8?Q?=3D_?=245244.99999999997 In-Reply-To: References: Message-ID: On 27. November 2013 at 02:33:05, Sanath Prasanna (ahe.sanath@REDACTED) wrote: > > Hi all, > when running following sample in ERL shell, I got wrong value. > What is the > reason for this? > > 2452.45*100. = 245244.99999999997 > > It should be 245245.0 or 245245 Hi Sanath, Unfortunately not, welcome to Computing :-), the shell is right. > Then all the calculations became wrong in my program. > Are there any idea regarding above? > > Br, > Sanath The best explanation I?ve found is here: ? ? http://floating-point-gui.de/ For an in-depth explanation, read? ? ??http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html A+ Dave From ahe.sanath@REDACTED Wed Nov 27 03:01:12 2013 From: ahe.sanath@REDACTED (Sanath Prasanna) Date: Wed, 27 Nov 2013 07:31:12 +0530 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 In-Reply-To: References: Message-ID: I accepted your comment. But generally we expected full value. I did same in another scripting language like php. It is given correct result. Thats why I asked this question. 245245 On Wed, Nov 27, 2013 at 7:05 AM, Dave Cottlehuber wrote: > On 27. November 2013 at 02:33:05, Sanath Prasanna (ahe.sanath@REDACTED) > wrote: > > > > Hi all, > > when running following sample in ERL shell, I got wrong value. > > What is the > > reason for this? > > > > 2452.45*100. = 245244.99999999997 > > > > It should be 245245.0 or 245245 > > Hi Sanath, > > Unfortunately not, welcome to Computing :-), the shell is right. > > > Then all the calculations became wrong in my program. > > Are there any idea regarding above? > > > > Br, > > Sanath > > The best explanation I?ve found is here: > > http://floating-point-gui.de/ > > For an in-depth explanation, read > > http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html > > A+ > Dave > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Wed Nov 27 03:42:40 2013 From: bob@REDACTED (Bob Ippolito) Date: Tue, 26 Nov 2013 18:42:40 -0800 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 In-Reply-To: References: Message-ID: PHP's echo is rounding the result, losing some precision in the process. Erlang, Python, Ruby, Haskell, JavaScript, etc. print floating point numbers in the shell without loss of precision. On Tue, Nov 26, 2013 at 6:01 PM, Sanath Prasanna wrote: > I accepted your comment. But generally we expected full value. I did same > in another scripting language like php. It is given correct result. Thats > why I asked this question. > $a=2452.45*100; > echo $a; > exit; > ?> > 245245 > > > > > > > On Wed, Nov 27, 2013 at 7:05 AM, Dave Cottlehuber wrote: > >> On 27. November 2013 at 02:33:05, Sanath Prasanna (ahe.sanath@REDACTED) >> wrote: >> > >> > Hi all, >> > when running following sample in ERL shell, I got wrong value. >> > What is the >> > reason for this? >> > >> > 2452.45*100. = 245244.99999999997 >> > >> > It should be 245245.0 or 245245 >> >> Hi Sanath, >> >> Unfortunately not, welcome to Computing :-), the shell is right. >> >> > Then all the calculations became wrong in my program. >> > Are there any idea regarding above? >> > >> > Br, >> > Sanath >> >> The best explanation I?ve found is here: >> >> http://floating-point-gui.de/ >> >> For an in-depth explanation, read >> >> http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html >> >> A+ >> Dave >> >> >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Wed Nov 27 04:20:06 2013 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 27 Nov 2013 16:20:06 +1300 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 In-Reply-To: References: Message-ID: <05DE93E5-2C54-454C-B915-55E543D770D5@cs.otago.ac.nz> On 27/11/2013, at 2:28 PM, Sanath Prasanna wrote: > Hi all, > when running following sample in ERL shell, I got wrong value. What is the reason for this? > > 2452.45*100. = 245244.99999999997 > > It should be 245245.0 or 245245 > What do you mean "should"? Some programming languages lie to you about the number they give you. Ruby for one. You have to probe a little deeper. m% irb >> 2452.45*100 => 245245.0 >> 2452.45*100 - 245245.0 => -2.91038304567337e-11 So Ruby _actually_ calculated the *same* answer as Erlang, but showed you a different number. SWI Prolog calculated the same number as Erlang. m% swipl ?- X is 2452.45*100. X = 245244.99999999997. Gambit Scheme calculated the same number as Erlang. m% gsi Gambit v4.6.0 > (* 2452.45 100) 245244.99999999997 R calculates the same number as Erlang, but like Ruby, rounds the number before displaying it: m% R > x <- 2452.45 * 100 > x [1] 245245 > x - 245245 [1] -2.910383e-11 Javascript calculates the same number as Erlang. m% /Scratch/js-1.6.20070208/js js> 2452.45*100 245244.99999999997 I think we're beginning to see a pattern. m% cat >foo.c #include int main(void) { printf("%.12f\n", 2452.45*100); return 0; } m% cc foo.c m% a.out 245244.999999999971 It looks very much as though Erlang calculates exactly the answer that it "should" calculate. Remember, this is IEEE double-precision *binary* floating- point arithmetic. 100 can be represented exactly in that arithmetic, but 2452.45 *cannot*. From a C program, when you convert 2452.45 to an IEEE double, what you get is 2452.44999999999981810106. There _is_ an IEEE standard for decimal floating point arithmetic, and recent IBM z/Series and Power computers offer high speed hardware support for it, and there _is_ at least a draft of a standard for decimal floating point in C, which IBM's XLC supports, GCC supports (see http://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html), but clang doesn't. From ok@REDACTED Wed Nov 27 04:28:36 2013 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 27 Nov 2013 16:28:36 +1300 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 In-Reply-To: References: Message-ID: <1F4633C4-1202-4848-92A7-4351B90055FA@cs.otago.ac.nz> On 27/11/2013, at 3:01 PM, Sanath Prasanna wrote: > I accepted your comment. But generally we expected full value. I did same in another scripting language like php. It is given correct result. Wrong. It *calculated* the same number as Erlang did, but then it *displayed* a different number, a rounded version. m% cat >foo.php m% php foo.php 245245 -2.9103830456734E-11 We see from this that while the number *displays as* 245245, it is not *equal to* 245245. As I said, PHP computed *exactly* the same answer as Erlang. Who is this "we" who "expect full value"? This is floating-point arithmetic, not rational arithmetic. (Our 2nd year students are taught this stuff, but it doesn't really take. In 3rd year they have an exercise they have to do where they start to really understand that floating point arithmetic is *not* arithmetic on the mathematical real numbers, but a different mathematical system which sort of approximates the algebra of the reals. They learn that adding up an array of numbers from left to right generally gives you a different answer from adding up from right to left, for example.) Numbers in IEEE floating point arithmetic are precise, but are bounded in their precision, and arithmetic operations on them (including conversion between decimal and binary) have to round their answers to something that is representable. There's a rounding in the conversion of 2452.45 to binary, and then the multiplication incurs another rounding. From michael.eugene.turner@REDACTED Wed Nov 27 05:35:20 2013 From: michael.eugene.turner@REDACTED (Michael Turner) Date: Wed, 27 Nov 2013 13:35:20 +0900 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 In-Reply-To: <1F4633C4-1202-4848-92A7-4351B90055FA@cs.otago.ac.nz> References: <1F4633C4-1202-4848-92A7-4351B90055FA@cs.otago.ac.nz> Message-ID: Gee, now might be a good time to bore everyone with a war story: a startup I once worked for independently /pre/-invented the Pentium Floating Point Bug, against my strenuous protests. How could this happen, I wondered, as I was losing the battle for IEEE-standard purity? Maybe, I thought, it's because we're a small company that can't afford to hire experts to ratify my opinion? We were using Weitek FPU adder and multiplier chips in our hardware, and I implemented floating point division the way they said to do it - the right way. Tried to, that is. I got overruled. Not too many years later, for the Pentium design, Intel acquired Weitek's IP. Then they introduced very similar mistakes in floating point arithmetic, through no fault of Weitek. Ours, at least, could have been patched by sending customers a new ROM to socket. Intel's errors went onto a single chip. What I learned about IEEE floating point arithmetic is that if you try to clean up floating point "errors" one way, you just squeeze the errors out some place else. What I learned about people is that Size Doesn't Matter. The proximate provocation in both cases: somebody didn't like how the number printed. I first saw "errors" like when I was in high school, programming in Dartmouth BASIC. I was told, "floating point is like that - if it weren't that, it would be something worse." So I was prepared. But lots of people now graduate with C.S. degrees who aren't prepared. Regards, Michael Turner Executive Director Project Persephone K-1 bldg 3F 7-2-6 Nishishinjuku Shinjuku-ku Tokyo 160-0023 Tel: +81 (3) 6890-1140 Fax: +81 (3) 6890-1158 Mobile: +81 (90) 5203-8682 turner@REDACTED http://www.projectpersephone.org/ "Love does not consist in gazing at each other, but in looking outward together in the same direction." -- Antoine de Saint-Exup?ry On Wed, Nov 27, 2013 at 12:28 PM, Richard A. O'Keefe wrote: > > On 27/11/2013, at 3:01 PM, Sanath Prasanna wrote: > >> I accepted your comment. But generally we expected full value. I did same in another scripting language like php. It is given correct result. > > Wrong. It *calculated* the same number as Erlang did, > but then it *displayed* a different number, a rounded version. > > m% cat >foo.php > $a = 2452.45*100; > echo $a; echo "\n"; > $a = $a - 245245.0; > echo $a; echo "\n"; > exit; > ?> > > m% php foo.php > 245245 > -2.9103830456734E-11 > > We see from this that while the number *displays as* > 245245, it is not *equal to* 245245. > > As I said, PHP computed *exactly* the same answer as Erlang. > Who is this "we" who "expect full value"? > This is floating-point arithmetic, not rational arithmetic. > > (Our 2nd year students are taught this stuff, but it doesn't > really take. In 3rd year they have an exercise they have to > do where they start to really understand that floating point > arithmetic is *not* arithmetic on the mathematical real > numbers, but a different mathematical system which sort of > approximates the algebra of the reals. They learn that > adding up an array of numbers from left to right generally > gives you a different answer from adding up from right to > left, for example.) > > Numbers in IEEE floating point arithmetic are precise, > but are bounded in their precision, and arithmetic operations > on them (including conversion between decimal and binary) > have to round their answers to something that is representable. > There's a rounding in the conversion of 2452.45 to binary, > and then the multiplication incurs another rounding. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From jay@REDACTED Wed Nov 27 06:28:39 2013 From: jay@REDACTED (Jay Nelson) Date: Tue, 26 Nov 2013 21:28:39 -0800 Subject: [erlang-questions] process per task or not ? Message-ID: <77D4EFBF-9827-44F2-8DEF-A7A18BA41626@duomark.com> Check https://github.com/duomark/dk_cxy for concurrency limiting utilities. cxy_ctl module provides a cap on the number of concurrent processes and when it is exceeded you have the choice of refusing to execute, or executing the request inline without spawning as a form of back pressure on demand. The concurrency limits are configured declaratively on initialization, using a concurrent ets table to manage the count and a ring buffer of historical execution times for spawned processes. jay From iqbaltalaat@REDACTED Wed Nov 27 06:52:49 2013 From: iqbaltalaat@REDACTED (I-T) Date: Wed, 27 Nov 2013 10:52:49 +0500 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 In-Reply-To: References: <1F4633C4-1202-4848-92A7-4351B90055FA@cs.otago.ac.nz> Message-ID: You might want to try:- https://github.com/tim/erlang-decimal Run Iqbal-Bhatti:ebin afrobeard$ erl Erlang R13B03 (erts-5.7.4) [source] [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false] Eshell V5.7.4 (abort with ^G) 1> decimal:multiply("2452.45", "100"). {0,24524500,-2} 2> Best Regards, On 27 November 2013 09:35, Michael Turner wrote: > Gee, now might be a good time to bore everyone with a war story: a > startup I once worked for independently /pre/-invented the Pentium > Floating Point Bug, against my strenuous protests. How could this > happen, I wondered, as I was losing the battle for IEEE-standard > purity? Maybe, I thought, it's because we're a small company that > can't afford to hire experts to ratify my opinion? > > We were using Weitek FPU adder and multiplier chips in our hardware, > and I implemented floating point division the way they said to do it - > the right way. Tried to, that is. I got overruled. > > Not too many years later, for the Pentium design, Intel acquired > Weitek's IP. Then they introduced very similar mistakes in floating > point arithmetic, through no fault of Weitek. Ours, at least, could > have been patched by sending customers a new ROM to socket. Intel's > errors went onto a single chip. > > What I learned about IEEE floating point arithmetic is that if you try > to clean up floating point "errors" one way, you just squeeze the > errors out some place else. > > What I learned about people is that Size Doesn't Matter. > > The proximate provocation in both cases: somebody didn't like how the > number printed. I first saw "errors" like when I was in high school, > programming in Dartmouth BASIC. I was told, "floating point is like > that - if it weren't that, it would be something worse." So I was > prepared. But lots of people now graduate with C.S. degrees who aren't > prepared. > > > Regards, > Michael Turner > Executive Director > Project Persephone > K-1 bldg 3F > 7-2-6 Nishishinjuku > Shinjuku-ku Tokyo 160-0023 > Tel: +81 (3) 6890-1140 > Fax: +81 (3) 6890-1158 > Mobile: +81 (90) 5203-8682 > turner@REDACTED > http://www.projectpersephone.org/ > > "Love does not consist in gazing at each other, but in looking outward > together in the same direction." -- Antoine de Saint-Exup?ry > > > On Wed, Nov 27, 2013 at 12:28 PM, Richard A. O'Keefe > wrote: > > > > On 27/11/2013, at 3:01 PM, Sanath Prasanna wrote: > > > >> I accepted your comment. But generally we expected full value. I did > same in another scripting language like php. It is given correct result. > > > > Wrong. It *calculated* the same number as Erlang did, > > but then it *displayed* a different number, a rounded version. > > > > m% cat >foo.php > > > $a = 2452.45*100; > > echo $a; echo "\n"; > > $a = $a - 245245.0; > > echo $a; echo "\n"; > > exit; > > ?> > > > > m% php foo.php > > 245245 > > -2.9103830456734E-11 > > > > We see from this that while the number *displays as* > > 245245, it is not *equal to* 245245. > > > > As I said, PHP computed *exactly* the same answer as Erlang. > > Who is this "we" who "expect full value"? > > This is floating-point arithmetic, not rational arithmetic. > > > > (Our 2nd year students are taught this stuff, but it doesn't > > really take. In 3rd year they have an exercise they have to > > do where they start to really understand that floating point > > arithmetic is *not* arithmetic on the mathematical real > > numbers, but a different mathematical system which sort of > > approximates the algebra of the reals. They learn that > > adding up an array of numbers from left to right generally > > gives you a different answer from adding up from right to > > left, for example.) > > > > Numbers in IEEE floating point arithmetic are precise, > > but are bounded in their precision, and arithmetic operations > > on them (including conversion between decimal and binary) > > have to round their answers to something that is representable. > > There's a rounding in the conversion of 2452.45 to binary, > > and then the multiplication incurs another rounding. > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Iqbal Talaat Bhatti "If we did all the things we are capable of doing, we would literally astound ourselves." - Thomas Edison -------------- next part -------------- An HTML attachment was scrubbed... URL: From ingela.andin@REDACTED Wed Nov 27 08:57:49 2013 From: ingela.andin@REDACTED (Ingela Andin) Date: Wed, 27 Nov 2013 08:57:49 +0100 Subject: [erlang-questions] PKCS-7 signing In-Reply-To: References: Message-ID: HI! Actually there is some support for PKCS-7 in public_key, it is not so well announce as it is consider some what experimental and just tested on a very basic level. But public key can decode/encode a basic PKCS-7.pem file. You should be able to manipulate a PKCS-7 structure in Erlang resign it with public_key functions and be happy. We recently added support for SCEP (Simple Certificate Enrolment Protocol). PKSCS-7 is a spec that can be extended so you might need some additional own ASN-1 handling! Regards Ingela Erlang/OTP-team Ericsson AB 2013/11/25 Szoboszlay D?niel > Hi, > > If it is only a manifest file that (I assume) doesn't change very often I > would rather use "openssl smime" to create the signature. > > I was looking into PKCS-7 signing with Erlang recently, but I could avoid > doing it after all. My impression was that there is no direct support for > it in OTP, so you'd either have to call the openssl routines via e.g. a > port driver or use the existing crypto functions to sign your data and put > together a SignedData structure according to RFC 2315 using the ASN.1 > application. Yet, I might be wrong. > > Daniel > > > On Mon, 25 Nov 2013 20:55:04 -0000, James Wheare wrote: > > Hullo, >> >> I'm working on implementing Apple's Push Notifications for Websites >> system and having some trouble signing the "push package" >> >> The docs [1] say this: >> >> "The signature is a PKCS #7 detached signature of the manifest file. >> Sign the manifest file with the private key associated with your web >> push certificate that you obtained while registering with Apple. In >> PHP, you can do this with the openssl_pkcs7_sign function" >> >> So I'm looking for an equivalent to PHP's openssl_pkcs7_sign [2] in >> erlang. >> >> The release notes [3] for the public_key module seem to offer some >> hope, with "experimental" PKCS-7 support announced in 0.17, but I >> can't find anything about it in the docs [4] >> >> Any advice on solving this? >> >> Thanks, >> - James >> >> [1] https://developer.apple.com/library/mac/documentation/ >> NetworkingInternet/Conceptual/NotificationProgrammingGuideFo >> rWebsites/PushNotifications/PushNotifications.html#// >> apple_ref/doc/uid/TP40013225-CH3-SW10 >> [2] http://php.net/manual/en/function.openssl-pkcs7-sign.php >> [3] http://www.erlang.org/doc/apps/public_key/notes.html >> [4] http://erlang.org/doc/man/public_key.html >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fly@REDACTED Wed Nov 27 10:07:44 2013 From: fly@REDACTED (Fred Youhanaie) Date: Wed, 27 Nov 2013 09:07:44 +0000 Subject: [erlang-questions] module_info and code switch In-Reply-To: References: <5294F9CD.1050608@anydata.co.uk> Message-ID: <5295B660.6000309@anydata.co.uk> On 26/11/13 21:02, Andreas Stenius wrote: > 2013/11/26 Fred Youhanaie > >> [...] >> Curiously I noticed that as soon as I load a new version of the module, >> module_info/1 returns the attribute of the currently loaded version rather >> than the version for the running process! >> >> Is this intentional? >> >> > Yes. > > I see that you call the local `module_info/1` function, but the > implementation of that in your module is simply to forward the call to > `erlang:get_module_info/2`, so it doesn't matter if you call it on your old > or new version of the code, it will give the same result in both cases. > Which will be that of the active version of the module, according to [1]. > > Cheers. > > [1] > https://github.com/erlang/otp/blob/maint/erts/emulator/beam/beam_load.c#L5251 > Hi, Thanks for the explanation. So, this means that "-Vsn" is not reliable for identifying (introspection) the version of the code executing a function :-( Cheers f. From fly@REDACTED Wed Nov 27 10:07:55 2013 From: fly@REDACTED (Fred Youhanaie) Date: Wed, 27 Nov 2013 09:07:55 +0000 Subject: [erlang-questions] module_info and code switch In-Reply-To: References: <5294F9CD.1050608@anydata.co.uk> Message-ID: <5295B66B.2020203@anydata.co.uk> On 26/11/13 23:06, Szoboszlay D?niel wrote: > ... > However, I think this behaviour of module_info is not documented properly. The > "compiler will hard code the results in the module" would be a valid mental > model too, especially since erlang:get_module_info/1,2 functions aren't > documented either. So I'd raise a bug report on the documentation. Thanks. After some more searching I came across this thread from 5 years ago: http://erlang.org/pipermail/erlang-questions/2008-October/038848.html I couldn't see if a bug report was raised or not. I'll have a go at that. Cheers f. From tony@REDACTED Wed Nov 27 10:08:39 2013 From: tony@REDACTED (Tony Rogvall) Date: Wed, 27 Nov 2013 10:08:39 +0100 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 In-Reply-To: References: <1F4633C4-1202-4848-92A7-4351B90055FA@cs.otago.ac.nz> Message-ID: Wow. Always nice with war stories from the dusty past :-) Does your story imply that the "Maths Problem" can be calculated differently still using the standard IEEE representation ? Regards /Tony On 27 nov 2013, at 05:35, Michael Turner wrote: > Gee, now might be a good time to bore everyone with a war story: a > startup I once worked for independently /pre/-invented the Pentium > Floating Point Bug, against my strenuous protests. How could this > happen, I wondered, as I was losing the battle for IEEE-standard > purity? Maybe, I thought, it's because we're a small company that > can't afford to hire experts to ratify my opinion? > > We were using Weitek FPU adder and multiplier chips in our hardware, > and I implemented floating point division the way they said to do it - > the right way. Tried to, that is. I got overruled. > > Not too many years later, for the Pentium design, Intel acquired > Weitek's IP. Then they introduced very similar mistakes in floating > point arithmetic, through no fault of Weitek. Ours, at least, could > have been patched by sending customers a new ROM to socket. Intel's > errors went onto a single chip. > > What I learned about IEEE floating point arithmetic is that if you try > to clean up floating point "errors" one way, you just squeeze the > errors out some place else. > > What I learned about people is that Size Doesn't Matter. > > The proximate provocation in both cases: somebody didn't like how the > number printed. I first saw "errors" like when I was in high school, > programming in Dartmouth BASIC. I was told, "floating point is like > that - if it weren't that, it would be something worse." So I was > prepared. But lots of people now graduate with C.S. degrees who aren't > prepared. > > > Regards, > Michael Turner > Executive Director > Project Persephone > K-1 bldg 3F > 7-2-6 Nishishinjuku > Shinjuku-ku Tokyo 160-0023 > Tel: +81 (3) 6890-1140 > Fax: +81 (3) 6890-1158 > Mobile: +81 (90) 5203-8682 > turner@REDACTED > http://www.projectpersephone.org/ > > "Love does not consist in gazing at each other, but in looking outward > together in the same direction." -- Antoine de Saint-Exup?ry > > > On Wed, Nov 27, 2013 at 12:28 PM, Richard A. O'Keefe wrote: >> >> On 27/11/2013, at 3:01 PM, Sanath Prasanna wrote: >> >>> I accepted your comment. But generally we expected full value. I did same in another scripting language like php. It is given correct result. >> >> Wrong. It *calculated* the same number as Erlang did, >> but then it *displayed* a different number, a rounded version. >> >> m% cat >foo.php >> > $a = 2452.45*100; >> echo $a; echo "\n"; >> $a = $a - 245245.0; >> echo $a; echo "\n"; >> exit; >> ?> >> >> m% php foo.php >> 245245 >> -2.9103830456734E-11 >> >> We see from this that while the number *displays as* >> 245245, it is not *equal to* 245245. >> >> As I said, PHP computed *exactly* the same answer as Erlang. >> Who is this "we" who "expect full value"? >> This is floating-point arithmetic, not rational arithmetic. >> >> (Our 2nd year students are taught this stuff, but it doesn't >> really take. In 3rd year they have an exercise they have to >> do where they start to really understand that floating point >> arithmetic is *not* arithmetic on the mathematical real >> numbers, but a different mathematical system which sort of >> approximates the algebra of the reals. They learn that >> adding up an array of numbers from left to right generally >> gives you a different answer from adding up from right to >> left, for example.) >> >> Numbers in IEEE floating point arithmetic are precise, >> but are bounded in their precision, and arithmetic operations >> on them (including conversion between decimal and binary) >> have to round their answers to something that is representable. >> There's a rounding in the conversion of 2452.45 to binary, >> and then the multiplication incurs another rounding. >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony@REDACTED Wed Nov 27 10:13:44 2013 From: tony@REDACTED (Tony Rogvall) Date: Wed, 27 Nov 2013 10:13:44 +0100 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 In-Reply-To: References: <1F4633C4-1202-4848-92A7-4351B90055FA@cs.otago.ac.nz> Message-ID: Or a bit faster ? Scale everything by a factor of 100 (or what ever suits the problem) and use fix point calculations. 245245 * 10000 = 2452450000 We just need to eat or drink something that make us see the dots. :-) /Tony On 27 nov 2013, at 06:52, I-T wrote: > You might want to try:- > > https://github.com/tim/erlang-decimal > > Run > > Iqbal-Bhatti:ebin afrobeard$ erl > Erlang R13B03 (erts-5.7.4) [source] [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false] > > Eshell V5.7.4 (abort with ^G) > 1> decimal:multiply("2452.45", "100"). > {0,24524500,-2} > 2> > > Best Regards, > > > On 27 November 2013 09:35, Michael Turner wrote: > Gee, now might be a good time to bore everyone with a war story: a > startup I once worked for independently /pre/-invented the Pentium > Floating Point Bug, against my strenuous protests. How could this > happen, I wondered, as I was losing the battle for IEEE-standard > purity? Maybe, I thought, it's because we're a small company that > can't afford to hire experts to ratify my opinion? > > We were using Weitek FPU adder and multiplier chips in our hardware, > and I implemented floating point division the way they said to do it - > the right way. Tried to, that is. I got overruled. > > Not too many years later, for the Pentium design, Intel acquired > Weitek's IP. Then they introduced very similar mistakes in floating > point arithmetic, through no fault of Weitek. Ours, at least, could > have been patched by sending customers a new ROM to socket. Intel's > errors went onto a single chip. > > What I learned about IEEE floating point arithmetic is that if you try > to clean up floating point "errors" one way, you just squeeze the > errors out some place else. > > What I learned about people is that Size Doesn't Matter. > > The proximate provocation in both cases: somebody didn't like how the > number printed. I first saw "errors" like when I was in high school, > programming in Dartmouth BASIC. I was told, "floating point is like > that - if it weren't that, it would be something worse." So I was > prepared. But lots of people now graduate with C.S. degrees who aren't > prepared. > > > Regards, > Michael Turner > Executive Director > Project Persephone > K-1 bldg 3F > 7-2-6 Nishishinjuku > Shinjuku-ku Tokyo 160-0023 > Tel: +81 (3) 6890-1140 > Fax: +81 (3) 6890-1158 > Mobile: +81 (90) 5203-8682 > turner@REDACTED > http://www.projectpersephone.org/ > > "Love does not consist in gazing at each other, but in looking outward > together in the same direction." -- Antoine de Saint-Exup?ry > > > On Wed, Nov 27, 2013 at 12:28 PM, Richard A. O'Keefe wrote: > > > > On 27/11/2013, at 3:01 PM, Sanath Prasanna wrote: > > > >> I accepted your comment. But generally we expected full value. I did same in another scripting language like php. It is given correct result. > > > > Wrong. It *calculated* the same number as Erlang did, > > but then it *displayed* a different number, a rounded version. > > > > m% cat >foo.php > > > $a = 2452.45*100; > > echo $a; echo "\n"; > > $a = $a - 245245.0; > > echo $a; echo "\n"; > > exit; > > ?> > > > > m% php foo.php > > 245245 > > -2.9103830456734E-11 > > > > We see from this that while the number *displays as* > > 245245, it is not *equal to* 245245. > > > > As I said, PHP computed *exactly* the same answer as Erlang. > > Who is this "we" who "expect full value"? > > This is floating-point arithmetic, not rational arithmetic. > > > > (Our 2nd year students are taught this stuff, but it doesn't > > really take. In 3rd year they have an exercise they have to > > do where they start to really understand that floating point > > arithmetic is *not* arithmetic on the mathematical real > > numbers, but a different mathematical system which sort of > > approximates the algebra of the reals. They learn that > > adding up an array of numbers from left to right generally > > gives you a different answer from adding up from right to > > left, for example.) > > > > Numbers in IEEE floating point arithmetic are precise, > > but are bounded in their precision, and arithmetic operations > > on them (including conversion between decimal and binary) > > have to round their answers to something that is representable. > > There's a rounding in the conversion of 2452.45 to binary, > > and then the multiplication incurs another rounding. > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > -- > Iqbal Talaat Bhatti > > "If we did all the things we are capable of doing, we would literally astound ourselves." - Thomas Edison > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Wed Nov 27 11:27:19 2013 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Wed, 27 Nov 2013 11:27:19 +0100 Subject: [erlang-questions] what is overlay? In-Reply-To: References: Message-ID: Overlays allow you to do work on the release after it has been created: * create directories * copy files into the release * instantiate templates with parameters (M4 macros, reinvented) It is usually used to make a software package complete with configuration files, directories, ... and so on. On Tue, Nov 26, 2013 at 8:09 PM, akonsu wrote: > Hello, > > could someone please explain what a rebar/reltool overlay is and how I can > use them? I tried searching on the web but found no comprehensible > information about it... > > thanks > konstantin > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- J. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Wed Nov 27 12:09:03 2013 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Wed, 27 Nov 2013 13:09:03 +0200 Subject: [erlang-questions] what is overlay? In-Reply-To: References: Message-ID: <0DF84FED-4FC2-4134-B3FE-03D29A3046D3@gmail.com> Hello, I was following this post during my overlay journey. http://cartesianfaith.com/2011/09/08/overlay-variables-and-rebar/ - Dmitry On Nov 26, 2013, at 9:09 PM, akonsu wrote: > Hello, > > could someone please explain what a rebar/reltool overlay is and how I can use them? I tried searching on the web but found no comprehensible information about it... > > thanks > konstantin > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From small@REDACTED Wed Nov 27 13:48:53 2013 From: small@REDACTED (Des Small) Date: Wed, 27 Nov 2013 13:48:53 +0100 (CET) Subject: [erlang-questions] net_adm:names vs. erlang:nodes Message-ID: Hi, I have been having some problems with getting Erlang nodes to see each other on a complex network. I start all node with long names and raw numerical IP addresses, since I also can't rely on DNS to do the right thing. I have three nodes: my local node ("local"); a "control" node; and a "streamer" node that sends data over a fast network link. Now, "control" can't see "streamer" using their specified IP addresses: control> net_adm:ping('streamer'). returns 'pang', and that's reasonable because traceroute(1) *also* can't find a path to the IP address used for 'streamer'. But IP traffic the other way works fine and 'streamer' *can* net_adm:ping('control') and get 'pong', and after that repeating the net_adm:ping('streamer') from 'control' *does* work. So we have the folling interaction: """ control1>net_adm:ping('streamer'). pang streamer1>net_adm:ping('control'). pong control2>net_adm:ping('streamer'). pong """ (All hostname atoms above are really of the form @.) It took quite a while to realise that manually pinging from 'streamer' to 'control' would set the network up correctly; both are visible from 'local' and I was pinging them from there successfully without getting a link from 'control' to 'streamer'. Continuing, we discover that erlang:names on 'control' *doesn't* have a port for 'streamer'. control3> names(). {ok, [{'control',34285}] but net_adm:nodes *does* see it. control4> net_adm:nodes(). ['streamer@REDACTED'] So, I am mostly asking after the fact how I should have known this, and how to ask erlang itself what route it is actually using between 'control' and 'streamer'? I'd cheefully settle for a hint as to which part of the FM I should be R'ing! (I am not currently asking whether our network topology is particularly optimal, although I am of course open to opinions.) Cheers, Des -- Des Small, Scientific Programmer, JIVE Contact details on http://www.jive.nl/~small From andra.dinu@REDACTED Wed Nov 27 15:21:53 2013 From: andra.dinu@REDACTED (Andra Dinu) Date: Wed, 27 Nov 2013 15:21:53 +0100 (CET) Subject: [erlang-questions] Erlang Factory SF Bay Area 2014 - Call for talks closes on 11 December Message-ID: <2065328407.70269.1385562113322.JavaMail.zimbra@erlang-solutions.com> The Erlang Factory will be back to San Francisco on 3-7 March 2014. This will be a great opportunity to share your work and experience with an eager audience. We are looking for talks on how Erlang/OTP is used in real-world scenarios but also on tricks, tools and applications which increase productivity or enable developers to write better code. As always, talks directed at new users or at those interested in adopting Erlang in their technology stack are welcome. Submit your talk here: https://docs.google.com/spreadsheet/viewform?formkey=dEdqTC0xc0RCbjBDM2wxaEM1QUVVckE6MA Event website: https://www.erlang-factory.com/conference/SFBay2014 If you have any questions or need more information, please e-mail us at conferences@REDACTED Thanks, Andra -- Andra Dinu Community & Social ERLANG SOLUTIONS LTD New Loom House 101 Back Church Lane London, E1 1LU United Kingdom Tel +44(0)2076550344 Mob +44(0)7983484387 www.erlang-solutions.com From matwey.kornilov@REDACTED Wed Nov 27 13:46:58 2013 From: matwey.kornilov@REDACTED (Matwey V. Kornilov) Date: Wed, 27 Nov 2013 16:46:58 +0400 Subject: [erlang-questions] compile time Message-ID: Hi, erlc puts compile date and time into CInf chunk of the resulting .beam file. Is there a way to disable this behavior? Putting compile time into code file leads to production of different .beam files for the same .erl source. From mail@REDACTED Wed Nov 27 14:37:46 2013 From: mail@REDACTED (Alexander Alexeev) Date: Wed, 27 Nov 2013 17:37:46 +0400 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 In-Reply-To: References: <1F4633C4-1202-4848-92A7-4351B90055FA@cs.otago.ac.nz> Message-ID: <20131127173746.3f4d81eb@portege> Unfortunately, decimal does not solves all problems. For example: http://pastexen.com/code.php?file=zt4viJXw1I.txt I wonder, does Erlang has a Data.Ratio equivalent from Haskell? > You might want to try:- > > https://github.com/tim/erlang-decimal > > Run > > Iqbal-Bhatti:ebin afrobeard$ erl > Erlang R13B03 (erts-5.7.4) [source] [smp:4:4] [rq:4] [async-threads:0] > [kernel-poll:false] > > Eshell V5.7.4 (abort with ^G) > 1> decimal:multiply("2452.45", "100"). > {0,24524500,-2} > 2> > > Best Regards, > > > On 27 November 2013 09:35, Michael Turner > wrote: > > > Gee, now might be a good time to bore everyone with a war story: a > > startup I once worked for independently /pre/-invented the Pentium > > Floating Point Bug, against my strenuous protests. How could this > > happen, I wondered, as I was losing the battle for IEEE-standard > > purity? Maybe, I thought, it's because we're a small company that > > can't afford to hire experts to ratify my opinion? > > > > We were using Weitek FPU adder and multiplier chips in our hardware, > > and I implemented floating point division the way they said to do > > it - the right way. Tried to, that is. I got overruled. > > > > Not too many years later, for the Pentium design, Intel acquired > > Weitek's IP. Then they introduced very similar mistakes in floating > > point arithmetic, through no fault of Weitek. Ours, at least, could > > have been patched by sending customers a new ROM to socket. Intel's > > errors went onto a single chip. > > > > What I learned about IEEE floating point arithmetic is that if you > > try to clean up floating point "errors" one way, you just squeeze > > the errors out some place else. > > > > What I learned about people is that Size Doesn't Matter. > > > > The proximate provocation in both cases: somebody didn't like how > > the number printed. I first saw "errors" like when I was in high > > school, programming in Dartmouth BASIC. I was told, "floating point > > is like that - if it weren't that, it would be something worse." So > > I was prepared. But lots of people now graduate with C.S. degrees > > who aren't prepared. > > > > > > Regards, > > Michael Turner > > Executive Director > > Project Persephone > > K-1 bldg 3F > > 7-2-6 Nishishinjuku > > Shinjuku-ku Tokyo 160-0023 > > Tel: +81 (3) 6890-1140 > > Fax: +81 (3) 6890-1158 > > Mobile: +81 (90) 5203-8682 > > turner@REDACTED > > http://www.projectpersephone.org/ > > > > "Love does not consist in gazing at each other, but in looking > > outward together in the same direction." -- Antoine de Saint-Exup?ry > > > > > > On Wed, Nov 27, 2013 at 12:28 PM, Richard A. O'Keefe > > wrote: > > > > > > On 27/11/2013, at 3:01 PM, Sanath Prasanna wrote: > > > > > >> I accepted your comment. But generally we expected full value. I > > >> did > > same in another scripting language like php. It is given correct > > result. > > > > > > Wrong. It *calculated* the same number as Erlang did, > > > but then it *displayed* a different number, a rounded version. > > > > > > m% cat >foo.php > > > > > $a = 2452.45*100; > > > echo $a; echo "\n"; > > > $a = $a - 245245.0; > > > echo $a; echo "\n"; > > > exit; > > > ?> > > > > > > m% php foo.php > > > 245245 > > > -2.9103830456734E-11 > > > > > > We see from this that while the number *displays as* > > > 245245, it is not *equal to* 245245. > > > > > > As I said, PHP computed *exactly* the same answer as Erlang. > > > Who is this "we" who "expect full value"? > > > This is floating-point arithmetic, not rational arithmetic. > > > > > > (Our 2nd year students are taught this stuff, but it doesn't > > > really take. In 3rd year they have an exercise they have to > > > do where they start to really understand that floating point > > > arithmetic is *not* arithmetic on the mathematical real > > > numbers, but a different mathematical system which sort of > > > approximates the algebra of the reals. They learn that > > > adding up an array of numbers from left to right generally > > > gives you a different answer from adding up from right to > > > left, for example.) > > > > > > Numbers in IEEE floating point arithmetic are precise, > > > but are bounded in their precision, and arithmetic operations > > > on them (including conversion between decimal and binary) > > > have to round their answers to something that is representable. > > > There's a rounding in the conversion of 2452.45 to binary, > > > and then the multiplication incurs another rounding. > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > Iqbal Talaat Bhatti > > "If we did all the things we are capable of doing, we would literally > astound ourselves." - Thomas Edison -- Best regards, Alexander Alexeev http://eax.me/ From n.oxyde@REDACTED Wed Nov 27 16:55:05 2013 From: n.oxyde@REDACTED (Anthony Ramine) Date: Wed, 27 Nov 2013 16:55:05 +0100 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 In-Reply-To: <20131127173746.3f4d81eb@portege> References: <1F4633C4-1202-4848-92A7-4351B90055FA@cs.otago.ac.nz> <20131127173746.3f4d81eb@portege> Message-ID: <975B0F5A-0D64-4681-BCE8-7FF563176882@gmail.com> This looks like a bug in decimal though, this time. -- Anthony Ramine Le 27 nov. 2013 ? 14:37, Alexander Alexeev a ?crit : > Unfortunately, decimal does not solves all problems. From n.oxyde@REDACTED Wed Nov 27 16:57:41 2013 From: n.oxyde@REDACTED (Anthony Ramine) Date: Wed, 27 Nov 2013 16:57:41 +0100 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 In-Reply-To: <975B0F5A-0D64-4681-BCE8-7FF563176882@gmail.com> References: <1F4633C4-1202-4848-92A7-4351B90055FA@cs.otago.ac.nz> <20131127173746.3f4d81eb@portege> <975B0F5A-0D64-4681-BCE8-7FF563176882@gmail.com> Message-ID: Ah nevermind, didn?t see the divisions. -- Anthony Ramine Le 27 nov. 2013 ? 16:55, Anthony Ramine a ?crit : > This looks like a bug in decimal though, this time. > > -- > Anthony Ramine > > Le 27 nov. 2013 ? 14:37, Alexander Alexeev a ?crit : > >> Unfortunately, decimal does not solves all problems. > From bsvancara@REDACTED Wed Nov 27 17:13:22 2013 From: bsvancara@REDACTED (Bohuslav Svancara) Date: Wed, 27 Nov 2013 17:13:22 +0100 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 In-Reply-To: <975B0F5A-0D64-4681-BCE8-7FF563176882@gmail.com> References: <1F4633C4-1202-4848-92A7-4351B90055FA@cs.otago.ac.nz> <20131127173746.3f4d81eb@portege> <975B0F5A-0D64-4681-BCE8-7FF563176882@gmail.com> Message-ID: >>Unfortunately, decimal does not solves all problems. I do not want to be sarcastic, but it is really hard to divide 100 dollars between three guys, give them all the same amount (100/3) and then say "Sorry, I need my money back". Do you think you will have 100 dollars then? You need to decide what precision is right for you (specifically when you ared dividing), how to correctly round and so on. There is a whole mathematics about it. You need to determine needed precision. Sometimes the value 3.14 is good, but sometimes the value 3,14159265358979323846 is not good enough... Decimals do solve problems if you know needed precision. In financials you need to calculate millions and billions with a precision to cents. And - for example - for US Debt ( http://www.usdebtclock.org/ ) you need 16 digits (trillions) if you want to be accurate to cents right now. :-) Imagine to express US Debt in Japanese Yen :-) Regards, Bob 2013/11/27 Anthony Ramine > This looks like a bug in decimal though, this time. > > -- > Anthony Ramine > > Le 27 nov. 2013 ? 14:37, Alexander Alexeev a ?crit : > > > Unfortunately, decimal does not solves all problems. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From heinz@REDACTED Wed Nov 27 20:09:57 2013 From: heinz@REDACTED (Heinz Nikolaus Gies) Date: Wed, 27 Nov 2013 20:09:57 +0100 Subject: [erlang-questions] Developing killer / open source apps In-Reply-To: References: Message-ID: > - Something new for next generation...? (Buzz words... cloud computing etc..) I would like to toss in Project-FiFo[1] here nearly all Erlang cloud management framework. [1] http://project-fifo.net Cheers, Heinz -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 842 bytes Desc: Message signed with OpenPGP using GPGMail URL: From mail@REDACTED Wed Nov 27 19:02:13 2013 From: mail@REDACTED (Alexander Alexeev) Date: Wed, 27 Nov 2013 22:02:13 +0400 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 In-Reply-To: References: <1F4633C4-1202-4848-92A7-4351B90055FA@cs.otago.ac.nz> <20131127173746.3f4d81eb@portege> <975B0F5A-0D64-4681-BCE8-7FF563176882@gmail.com> Message-ID: <20131127220213.055ad381@portege> Here is a real world example. We are calculating a commission: 28 x 85 x 312 x 5 / 0.85 In this case decimal gives you a rounding error +/- 0.01 USD. With _any_ chosen precision. But if you are using something like Data.Ratio you'll get: 28 x 85 x 312 x 5 / 0.85 = 28 x 85 x 312 x 5 x 85 / 100 = exactly 4368000 USD See the difference? > >>Unfortunately, decimal does not solves all problems. > > I do not want to be sarcastic, but it is really hard to divide 100 > dollars between three guys, > give them all the same amount (100/3) and then say "Sorry, I need my > money back". > Do you think you will have 100 dollars then? > > You need to decide what precision is right for you (specifically when > you ared dividing), how to correctly round and so on. There is a whole > mathematics about it. > > You need to determine needed precision. > Sometimes the value 3.14 is good, but sometimes the value > 3,14159265358979323846 is not good enough... > > Decimals do solve problems if you know needed precision. > > In financials you need to calculate millions and billions with a > precision to cents. > > And - for example - for US Debt ( http://www.usdebtclock.org/ ) you > need 16 digits (trillions) if you want to be accurate to cents right > now. :-) Imagine to express US Debt in Japanese Yen :-) > > Regards, > Bob > > > > > 2013/11/27 Anthony Ramine > > > This looks like a bug in decimal though, this time. > > > > -- > > Anthony Ramine > > > > Le 27 nov. 2013 ? 14:37, Alexander Alexeev a ?crit : > > > > > Unfortunately, decimal does not solves all problems. > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > -- Best regards, Alexander Alexeev http://eax.me/ From virtan@REDACTED Wed Nov 27 19:56:20 2013 From: virtan@REDACTED (virtan) Date: Wed, 27 Nov 2013 21:56:20 +0300 Subject: [erlang-questions] Matching binaries and shadowed variables Message-ID: <700808F8-9504-4885-8E58-05D36E4CC1F0@virtan.com> Does anybody know why there is a such thing as shadowed variables in Erlang? What was the reason to prevent typical "matching" approach for closures? It is even more unclear in matching binaries: 1> A = <<"hello">>, ASize = size(A), lists:map( fun (<>) when A1 == A -> match; (_) -> nomatch end, [<<"hello world">>, <<"nohello">>]). [match,nomatch] 2> You can't use A instead of A1 (it creates new variable, shadowing outer A), but should use ASize inside the pattern (otherwise you'll get unbound error during compilation). -- virtan / virtan@REDACTED / http://www.virtan.com From iqbaltalaat@REDACTED Wed Nov 27 21:22:18 2013 From: iqbaltalaat@REDACTED (I-T) Date: Thu, 28 Nov 2013 01:22:18 +0500 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 In-Reply-To: <20131127220213.055ad381@portege> References: <1F4633C4-1202-4848-92A7-4351B90055FA@cs.otago.ac.nz> <20131127173746.3f4d81eb@portege> <975B0F5A-0D64-4681-BCE8-7FF563176882@gmail.com> <20131127220213.055ad381@portege> Message-ID: In Python:- >>> 28 * 85 * 312 * 5 * (85.0 / 100) 3155880.0 In Erlang:- 16> 28 * 85 * 312 * 5 * 85 / 100. 3155880.0 In Erlang (via rational Numbers): https://github.com/sdanzan/erlang-tools 15> rationals:mul(rationals:mul(rationals:mul(rationals:mul({28,1},{85,1}), {312,1}), {5,1}), {85,100}). {3155880,1} On 27 November 2013 23:02, Alexander Alexeev wrote: > Here is a real world example. We are calculating a commission: > > 28 x 85 x 312 x 5 / 0.85 > > In this case decimal gives you a rounding error +/- 0.01 USD. With > _any_ chosen precision. But if you are using something like Data.Ratio > you'll get: > > 28 x 85 x 312 x 5 / 0.85 = > 28 x 85 x 312 x 5 x 85 / 100 = > exactly 4368000 USD > > See the difference? > > > >>Unfortunately, decimal does not solves all problems. > > > > I do not want to be sarcastic, but it is really hard to divide 100 > > dollars between three guys, > > give them all the same amount (100/3) and then say "Sorry, I need my > > money back". > > Do you think you will have 100 dollars then? > > > > You need to decide what precision is right for you (specifically when > > you ared dividing), how to correctly round and so on. There is a whole > > mathematics about it. > > > > You need to determine needed precision. > > Sometimes the value 3.14 is good, but sometimes the value > > 3,14159265358979323846 is not good enough... > > > > Decimals do solve problems if you know needed precision. > > > > In financials you need to calculate millions and billions with a > > precision to cents. > > > > And - for example - for US Debt ( http://www.usdebtclock.org/ ) you > > need 16 digits (trillions) if you want to be accurate to cents right > > now. :-) Imagine to express US Debt in Japanese Yen :-) > > > > Regards, > > Bob > > > > > > > > > > 2013/11/27 Anthony Ramine > > > > > This looks like a bug in decimal though, this time. > > > > > > -- > > > Anthony Ramine > > > > > > Le 27 nov. 2013 ? 14:37, Alexander Alexeev a ?crit : > > > > > > > Unfortunately, decimal does not solves all problems. > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > Best regards, > Alexander Alexeev > http://eax.me/ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Iqbal Talaat Bhatti "If we did all the things we are capable of doing, we would literally astound ourselves." - Thomas Edison -------------- next part -------------- An HTML attachment was scrubbed... URL: From aggelgian@REDACTED Wed Nov 27 22:25:55 2013 From: aggelgian@REDACTED (Aggelos Giantsios) Date: Wed, 27 Nov 2013 23:25:55 +0200 Subject: [erlang-questions] compile time In-Reply-To: References: Message-ID: Why is that a problem? If you use beam_lib:cmp/2 to compare the files that are otherwise the same, the result will be ok meaning that they are equal for Erlang. Anyhow, you can also use beam_lib:strip/1 on an existing beam file to remove the compile info chunk. Aggelos On Wed, Nov 27, 2013 at 2:46 PM, Matwey V. Kornilov < matwey.kornilov@REDACTED> wrote: > Hi, > > erlc puts compile date and time into CInf chunk of the resulting .beam > file. Is there a way to disable this behavior? Putting compile time into > code file leads to production of different .beam files for the same .erl > source. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dszoboszlay@REDACTED Wed Nov 27 23:37:20 2013 From: dszoboszlay@REDACTED (=?utf-8?Q?Szoboszlay_D=C3=A1niel?=) Date: Wed, 27 Nov 2013 22:37:20 -0000 Subject: [erlang-questions] net_adm:names vs. erlang:nodes In-Reply-To: References: Message-ID: Hi, Regarding: > control3> names(). > {ok, [{'control',34285}] > control4> net_adm:nodes(). > ['streamer@REDACTED'] I assume they meant to be net_adm:names() and nodes(). The former returns the name and server port of all nodes on the current host, regardless whether they are connected to control, while the latter returns nodes that are connected to control regardless whether they are on the same or a remote host. Regarding the one-way connectivity issues: I think your problem is caused by the algorithm Erlang uses to avoid duplicated connections between nodes. When two nodes attempt to connect to each other simultaneously, there's a race condition. We don't want two connections between them (e.g. one initiated by control to streamer and one from streamer to control). The decision is that the lesser wins (by comparing the node names): the connection attempt of the greater node is refused by the lesser. When local connects to both control and streamer, these two nodes will both attempt to connect automatically to form a fully connected mash. And according to the above described scenario control will refuse the incoming connection attempt of streamer believing that streamer will accept its own attempt[1]. However, due to your network layout, initiating a TCP connection in that direction is impossible, so the request will eventually time out and the two nodes remain disconnected. When you issue net_adm:ping('control') on streamer you force a new connection attempt. This one is however not mutual, so it will succeed. I had a very similar situation with some server nodes (let's say s1, s2, s3) and a debug node called d with a firewall between them. d could connect to the server hosts, but not the other way around. When I pinged s1 from d they connected, but d didn't connect to s2 or s3 automatically. (And btw. those servers flooded the logs with reports from failed connection attempts to d). The workaround is that I renamed my debug node to z, so it's name is now larger than the servers'. It's quite a hackish solution, but if one-way firewalls cause problems in your network you might try creatively renaming your nodes (streamer -> accelerated_streamer? control -> streamer_control?). BR, Daniel [1] In fact, I think control will not even try to connect. It's sure it would loose the race, so why bother? On Wed, 27 Nov 2013 12:48:53 -0000, Des Small wrote: > Hi, > > I have been having some problems with getting Erlang nodes to see each > other on a complex network. I start all node with long names and raw > numerical IP addresses, since I also can't rely on DNS to do the right > thing. > > I have three nodes: my local node ("local"); a "control" node; and a > "streamer" node that sends data over a fast network link. > > Now, "control" can't see "streamer" using their specified IP addresses: > > control> net_adm:ping('streamer'). > > returns 'pang', and that's reasonable because traceroute(1) *also* can't > find a path to the IP address used for 'streamer'. But IP traffic the > other way works fine and 'streamer' *can* net_adm:ping('control') and > get 'pong', and after that repeating the net_adm:ping('streamer') from > 'control' *does* work. > > So we have the folling interaction: > > """ > control1>net_adm:ping('streamer'). > pang > streamer1>net_adm:ping('control'). > pong > control2>net_adm:ping('streamer'). > pong > """ > (All hostname atoms above are really of the form @.) > > It took quite a while to realise that manually pinging from 'streamer' > to 'control' would set the network up correctly; both are visible from > 'local' and I was pinging them from there successfully without getting a > link from 'control' to 'streamer'. > > Continuing, we discover that erlang:names on 'control' *doesn't* have a > port for 'streamer'. > > control3> names(). > {ok, [{'control',34285}] > > but net_adm:nodes *does* see it. > > control4> net_adm:nodes(). > ['streamer@REDACTED'] > > So, I am mostly asking after the fact how I should have known this, and > how to ask erlang itself what route it is actually using between > 'control' and 'streamer'? I'd cheefully settle for a hint as to which > part of the FM I should be R'ing! > > (I am not currently asking whether our network topology is particularly > optimal, although I am of course open to opinions.) > > Cheers, > > Des From bsvancara@REDACTED Thu Nov 28 00:07:11 2013 From: bsvancara@REDACTED (Bohuslav Svancara) Date: Thu, 28 Nov 2013 00:07:11 +0100 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 In-Reply-To: <20131127220213.055ad381@portege> References: <1F4633C4-1202-4848-92A7-4351B90055FA@cs.otago.ac.nz> <20131127173746.3f4d81eb@portege> <975B0F5A-0D64-4681-BCE8-7FF563176882@gmail.com> <20131127220213.055ad381@portege> Message-ID: It must be some misunderstanding. This is my result in Erlang: 28 * 85 * 312 * 5 / 0.85. 4.368e6 or 28 * 85 * 312 * 5 / (85 / 100). 4.368e6 or 28 * 85 * 312 * 5 / (85 * 0.01). 4.368e6 or using "decimal": decimal:divide( decimal:multiply(28,decimal:multiply(85,decimal:multiply(312,5))), decimal:divide(85,100) ). {0,43680,2} or decimal:divide( decimal:multiply(28,decimal:multiply(85,decimal:multiply(312,5))), decimal:multiply(85,0.01) ). {0,4368,3} No problem anywhere. Correct? Bob 2013/11/27 Alexander Alexeev > Here is a real world example. We are calculating a commission: > > 28 x 85 x 312 x 5 / 0.85 > > In this case decimal gives you a rounding error +/- 0.01 USD. With > _any_ chosen precision. But if you are using something like Data.Ratio > you'll get: > > 28 x 85 x 312 x 5 / 0.85 = > 28 x 85 x 312 x 5 x 85 / 100 = > exactly 4368000 USD > > See the difference? > > > >>Unfortunately, decimal does not solves all problems. > > > > I do not want to be sarcastic, but it is really hard to divide 100 > > dollars between three guys, > > give them all the same amount (100/3) and then say "Sorry, I need my > > money back". > > Do you think you will have 100 dollars then? > > > > You need to decide what precision is right for you (specifically when > > you ared dividing), how to correctly round and so on. There is a whole > > mathematics about it. > > > > You need to determine needed precision. > > Sometimes the value 3.14 is good, but sometimes the value > > 3,14159265358979323846 is not good enough... > > > > Decimals do solve problems if you know needed precision. > > > > In financials you need to calculate millions and billions with a > > precision to cents. > > > > And - for example - for US Debt ( http://www.usdebtclock.org/ ) you > > need 16 digits (trillions) if you want to be accurate to cents right > > now. :-) Imagine to express US Debt in Japanese Yen :-) > > > > Regards, > > Bob > > > > > > > > > > 2013/11/27 Anthony Ramine > > > > > This looks like a bug in decimal though, this time. > > > > > > -- > > > Anthony Ramine > > > > > > Le 27 nov. 2013 ? 14:37, Alexander Alexeev a ?crit : > > > > > > > Unfortunately, decimal does not solves all problems. > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > Best regards, > Alexander Alexeev > http://eax.me/ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay.s.doane@REDACTED Thu Nov 28 00:23:07 2013 From: jay.s.doane@REDACTED (Jay Doane) Date: Wed, 27 Nov 2013 15:23:07 -0800 Subject: [erlang-questions] run_erl logfiles and cron Message-ID: Hi, As an expedient, when the host is booted, I'm starting an erlang project with cron using something similar to the following in a crontab: @reboot ~/my_proj/rel/my_proj/bin/my_proj start where my_proj is built using "rebar compile generate". While this *does* actually start the erlang project, the "run_erl" logfiles it generates differ from those that are generated when the project is started from the command line using the same command; *each log entry is suffixed with a (node@REDACTED)1> prompt.* For example, here's a snippet of log started via cron (weird suffixes highlighted in red) Eshell V5.9.2 (abort with ^G) (my_proj@REDACTED)1> =INFO REPORT==== 27-Nov-2013::19:41:54 === Registering 0 remote connections on node ' my_proj@REDACTED'( my_proj@REDACTED)1> =INFO REPORT==== 27-Nov-2013::19:41:54 === Node 'my_proj@REDACTED' connected with 0 users( my_proj@REDACTED)1> And the same snippet later when started from bash: Eshell V5.9.2 (abort with ^G) (my_proj@REDACTED)1> =INFO REPORT==== 27-Nov-2013::19:56:42 === Registering 0 remote connections on node ' my_proj@REDACTED' =INFO REPORT==== 27-Nov-2013::19:56:42 === Node 'my_proj@REDACTED' connected with 0 users Can anyone give me any clues as to why this might be happening, and especially suggestions on how to stop it? Thanks, Jay -------------- next part -------------- An HTML attachment was scrubbed... URL: From peerst@REDACTED Thu Nov 28 00:28:58 2013 From: peerst@REDACTED (Peer Stritzinger) Date: Thu, 28 Nov 2013 00:28:58 +0100 Subject: [erlang-questions] compile: making asm and core official References: <46DB1AAA-5E62-4842-AB0D-20A54806662B@cs.otago.ac.nz> Message-ID: On 2013-11-25 03:16:11 +0000, Richard A. O'Keefe said: > On 23/11/2013, at 11:56 AM, Peer Stritzinger wrote: >> >> I find the choices of *.core and *.S unfortunate, since they are used >> for core dumps and native assembler files on many unixoid systems. > > More precisely, the UNIX convention is to use ".s" for assembler, > but some POSIX systems (like Mac OS X) ignore alphabetic case when > matching file names. I have found the use of .S something of an > annoyance on occasion. The uppercase ".S" extension is to my knowledge used for assembler that need C preprocessing. I checked with GNU make and BSD make: both run the C preprocessor on files with ".S" extension to create a file withe ".s" extension. Of course on case insensitive filesystems this wont work. Cheers -- Peer From peerst@REDACTED Thu Nov 28 00:33:49 2013 From: peerst@REDACTED (Peer Stritzinger) Date: Thu, 28 Nov 2013 00:33:49 +0100 Subject: [erlang-questions] compile: making asm and core official References: <004B6469-C8A1-4AC8-ACD7-064EBD64143A@gmail.com> Message-ID: On 2013-11-23 11:28:36 +0000, Anthony Ramine said: > I disagree but if we change those, we should rather use ".cerl" for ".core". I actually don't care much what they are, as long as they don't collide with widely used extensions for other stuff and (minimum requirement is to avoid the extensions used by the implicit rules of BSD and GNU make). Also they shouldn't be too confusing which in my opinion makes ".cerl" a bad coice. Why not use ".ecore" and ". srl" or ".easm" or whatever colour the bikeshed should have as long as its black. Cheers -- Peer From dszoboszlay@REDACTED Thu Nov 28 01:29:26 2013 From: dszoboszlay@REDACTED (=?utf-8?Q?Szoboszlay_D=C3=A1niel?=) Date: Thu, 28 Nov 2013 00:29:26 -0000 Subject: [erlang-questions] run_erl logfiles and cron In-Reply-To: References: Message-ID: Hi, That's because cron doesn't allocate a pseudo tty for your program, so your node starts up with the old shell. (Hopefully some Linux guru will know how to fix it, but I have no idea.) BR, Daniel On Wed, 27 Nov 2013 23:23:07 -0000, Jay Doane wrote: > Hi, > > As an expedient, when the host is booted, I'm starting an erlang project > with cron using something similar to the following in a crontab: > > @reboot ~/my_proj/rel/my_proj/bin/my_proj start > > where my_proj is built using "rebar compile generate". > > While this *does* actually start the erlang project, the "run_erl" > logfiles it generates differ from those that are generated when the > project is started from the command line using the same >command; each > log entry is suffixed with a (node@REDACTED)1> prompt. > > For example, here's a snippet of log started via cron (weird suffixes > highlighted in red) > > Eshell V5.9.2 (abort with ^G) > (my_proj@REDACTED)1> > =INFO REPORT==== 27-Nov-2013::19:41:54 === > Registering 0 remote connections on node > 'my_proj@REDACTED'(my_proj@REDACTED)1> > =INFO REPORT==== 27-Nov-2013::19:41:54 === > Node 'my_proj@REDACTED' connected with 0 > users(my_proj@REDACTED)1> > > And the same snippet later when started from bash: > > Eshell V5.9.2 (abort with ^G) > (my_proj@REDACTED)1> > =INFO REPORT==== 27-Nov-2013::19:56:42 === > Registering 0 remote connections on node > 'my_proj@REDACTED' > =INFO REPORT==== 27-Nov-2013::19:56:42 === > Node 'my_proj@REDACTED' connected with 0 > users > > Can anyone give me any clues as to why this might be happening, and > especially suggestions on how to stop it? > > Thanks, > Jay -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Thu Nov 28 02:57:06 2013 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 28 Nov 2013 14:57:06 +1300 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 In-Reply-To: <20131127173746.3f4d81eb@portege> References: <1F4633C4-1202-4848-92A7-4351B90055FA@cs.otago.ac.nz> <20131127173746.3f4d81eb@portege> Message-ID: <7676BF84-974C-4D1A-ADE8-74BE7D1B175E@cs.otago.ac.nz> On 28/11/2013, at 2:37 AM, Alexander Alexeev wrote: > Unfortunately, decimal does not solves all problems. For example: > > http://pastexen.com/code.php?file=zt4viJXw1I.txt Smalltalk has a ScaledDecimal class. If the implementations could only agree to follow what the standard says, or if for that matter the standard were sufficiently coherent to _be_ followed -- referring to non-existent material in another standard does not help -- it might be a very good thing. My reading of that standard is that a ScaledDecimal is an arbitrary precision integer M and a scale S representing the precise number M*10^(-S). Addition, subtraction, multiplication, and comparison are _no_ problem, but division is, and that's what your link above is all about. No finite-precision representation of numbers can handle division perfectly, even when it has unbounded range. (Question for people using data bases with Erlang: do you know what the SQL standard says about division of NUMERIC values? Does your SQL implementation do that?) > I wonder, does Erlang has a Data.Ratio equivalent from Haskell? Not as a built in type. It's not that hard to make something using {Num,Den} pairs, tedious rather than difficult, and not usable with ordinary mathematical operations. Since Erlang's close relatives Lisp and Scheme have ratios, and since some even closer Prolog relatives have ratios (thanks, Jan, for ratios in SWI Prolog), ratios would _fit_ into Erlang quite nicely. It has been argued for years that Erlang applications wouldn't benefit from them sufficiently to justify the cost of implementing them. From ok@REDACTED Thu Nov 28 03:23:17 2013 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 28 Nov 2013 15:23:17 +1300 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 In-Reply-To: <20131127220213.055ad381@portege> References: <1F4633C4-1202-4848-92A7-4351B90055FA@cs.otago.ac.nz> <20131127173746.3f4d81eb@portege> <975B0F5A-0D64-4681-BCE8-7FF563176882@gmail.com> <20131127220213.055ad381@portege> Message-ID: On 28/11/2013, at 7:02 AM, Alexander Alexeev wrote: > Here is a real world example. We are calculating a commission: > > 28 x 85 x 312 x 5 / 0.85 In VisualAge Smalltalk, open a Workspace, type 28 * 84 * 312 * 5 / 0.85s2 and then click on the spectacles icon. The answer 4368000 is inserted and selected. 0.85s2 is a ScaledDecimal representing an exact decimal fraction with 2 digits after the decimal point. On the IBM mainframes, this was aimed at exploiting z/Series decimal fixed point instructions, and the representation in VA/ST is 18 bytes. One byte holds a precision (number of digits). One byte holds a scale (number of digits after the decimal point). The remaining 16 bytes hold 2 packed decimal digits per byte, with one of those "digits" being a sign, so the maximum precision is 31 and the maximum scale is 255. > > In this case decimal gives you a rounding error +/- 0.01 USD. With > _any_ chosen precision. As we just saw, that's not true. It might be true of decimal floats, but it's not true of NUMERIC(3,2) arithmetic in this case. Other Smalltalks do not have the same hard limit on the magnitude of ScaledDecimal numbers, but they have their own quirks. There's more than one way to specify decimal arithmetic for a computer and some of them are better than others. From jay@REDACTED Thu Nov 28 04:35:18 2013 From: jay@REDACTED (Jay Doane) Date: Wed, 27 Nov 2013 19:35:18 -0800 Subject: [erlang-questions] run_erl logfiles and cron In-Reply-To: References: Message-ID: Daniel, Great clue! A search for "pseudo tty cron" led me to this link: https://www.linuxquestions.org/questions/linux-server-73/running-process-from-cron-with-ptty-588635/, and an eventual solution like this: @reboot screen -d -m ~/my_proj/rel/my_proj/bin/my_proj start Thanks, Jay On Wed, Nov 27, 2013 at 4:29 PM, Szoboszlay D?niel wrote: > Hi, > > That's because cron doesn't allocate a pseudo tty for your program, so > your node starts up with the old shell. (Hopefully some Linux guru will > know how to fix it, but I have no idea.) > > BR, > Daniel > > On Wed, 27 Nov 2013 23:23:07 -0000, Jay Doane > wrote: > > Hi, > > As an expedient, when the host is booted, I'm starting an erlang project > with cron using something similar to the following in a crontab: > > @reboot ~/my_proj/rel/my_proj/bin/my_proj start > > where my_proj is built using "rebar compile generate". > > While this *does* actually start the erlang project, the "run_erl" > logfiles it generates differ from those that are generated when the project > is started from the command line using the same command; *each log entry > is suffixed with a (node@REDACTED)1> prompt.* > > For example, here's a snippet of log started via cron (weird suffixes > highlighted in red) > > Eshell V5.9.2 (abort with ^G) > (my_proj@REDACTED)1> > =INFO REPORT==== 27-Nov-2013::19:41:54 === > Registering 0 remote connections on node ' > my_proj@REDACTED'( > my_proj@REDACTED)1> > =INFO REPORT==== 27-Nov-2013::19:41:54 === > Node 'my_proj@REDACTED' connected with 0 users > (my_proj@REDACTED)1> > > And the same snippet later when started from bash: > > Eshell V5.9.2 (abort with ^G) > (my_proj@REDACTED)1> > =INFO REPORT==== 27-Nov-2013::19:56:42 === > Registering 0 remote connections on node ' > my_proj@REDACTED' > =INFO REPORT==== 27-Nov-2013::19:56:42 === > Node 'my_proj@REDACTED' connected with 0 users > > Can anyone give me any clues as to why this might be happening, and > especially suggestions on how to stop it? > > Thanks, > Jay > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Thu Nov 28 07:52:37 2013 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Thu, 28 Nov 2013 08:52:37 +0200 Subject: [erlang-questions] run_erl logfiles and cron In-Reply-To: References: Message-ID: <6CC40293-943C-4253-81C6-B0455AA7647D@gmail.com> Just curious, why are you using cron to start application after reboot? There is a nice service utility that is capable to restart all background applications. Best Regards, Dmitry >-|-|-*> > On 28.11.2013, at 5.35, Jay Doane wrote: > > Daniel, > > Great clue! A search for "pseudo tty cron" led me to this link: https://www.linuxquestions.org/questions/linux-server-73/running-process-from-cron-with-ptty-588635/, and an eventual solution like this: > > @reboot screen -d -m ~/my_proj/rel/my_proj/bin/my_proj start > > Thanks, > Jay > > >> On Wed, Nov 27, 2013 at 4:29 PM, Szoboszlay D?niel wrote: >> Hi, >> >> That's because cron doesn't allocate a pseudo tty for your program, so your node starts up with the old shell. (Hopefully some Linux guru will know how to fix it, but I have no idea.) >> >> BR, >> Daniel >> >> On Wed, 27 Nov 2013 23:23:07 -0000, Jay Doane wrote: >> >> Hi, >> >> As an expedient, when the host is booted, I'm starting an erlang project with cron using something similar to the following in a crontab: >> >> @reboot ~/my_proj/rel/my_proj/bin/my_proj start >> >> where my_proj is built using "rebar compile generate". >> >> While this *does* actually start the erlang project, the "run_erl" logfiles it generates differ from those that are generated when the project is started from the command line using the same command; each log entry is suffixed with a (node@REDACTED)1> prompt. >> >> For example, here's a snippet of log started via cron (weird suffixes highlighted in red) >> >> Eshell V5.9.2 (abort with ^G) >> (my_proj@REDACTED)1> >> =INFO REPORT==== 27-Nov-2013::19:41:54 === >> Registering 0 remote connections on node 'my_proj@REDACTED'(my_proj@REDACTED)1> >> =INFO REPORT==== 27-Nov-2013::19:41:54 === >> Node 'my_proj@REDACTED' connected with 0 users(my_proj@REDACTED)1> >> >> And the same snippet later when started from bash: >> >> Eshell V5.9.2 (abort with ^G) >> (my_proj@REDACTED)1> >> =INFO REPORT==== 27-Nov-2013::19:56:42 === >> Registering 0 remote connections on node 'my_proj@REDACTED' >> =INFO REPORT==== 27-Nov-2013::19:56:42 === >> Node 'my_proj@REDACTED' connected with 0 users >> >> Can anyone give me any clues as to why this might be happening, and especially suggestions on how to stop it? >> >> Thanks, >> Jay >> >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From matwey.kornilov@REDACTED Thu Nov 28 09:06:38 2013 From: matwey.kornilov@REDACTED (Matwey V. Kornilov) Date: Thu, 28 Nov 2013 12:06:38 +0400 Subject: [erlang-questions] compile time In-Reply-To: References: Message-ID: 2013/11/28 Aggelos Giantsios : > Why is that a problem? > If you use beam_lib:cmp/2 to compare the files that are otherwise the same, > the result will be ok meaning that they are equal for Erlang. The problem is that I am using cmp and getting something like the following. It is from rpm build service, and this test must be common for all binary files and it doesn't know what inside the beam. That is the problem. [ 39s] /usr/lib/erlang/lib/meck-0.7.2/ebin/meck.beam differs ( Erlang BEAM file) [ 39s] --- /tmp/tmp.iR7IQpEoPU 2013-10-01 16:12:09.590793188 +0000 [ 39s] +++ /tmp/tmp.0U2oEYv9tS 2013-10-01 16:12:09.606793188 +0000 [ 39s] @@ -916,8 +916,8 @@ [ 39s] 00003930 69 6e 66 6f 68 02 64 00 01 69 6b 00 07 69 6e 63 |infoh.d..ik..inc| [ 39s] 00003940 6c 75 64 65 6a 68 02 64 00 07 76 65 72 73 69 6f |ludejh.d..versio| [ 39s] 00003950 6e 6b 00 05 34 2e 39 2e 33 68 02 64 00 04 74 69 |nk..4.9.3h.d..ti| [ 39s] -00003960 6d 65 68 06 62 00 00 07 dd 61 09 61 19 61 11 61 |meh.b....a.a.a.a| [ 39s] -00003970 32 61 32 68 02 64 00 06 73 6f 75 72 63 65 6b 00 |2a2h.d..sourcek.| [ 39s] +00003960 6d 65 68 06 62 00 00 07 dd 61 0a 61 01 61 10 61 |meh.b....a.a.a.a| [ 39s] +00003970 0c 61 04 68 02 64 00 06 73 6f 75 72 63 65 6b 00 |.a.h.d..sourcek.| [ 39s] 00003980 4a 2f 68 6f 6d 65 2f 61 62 75 69 6c 64 2f 72 70 |J/home/abuild/rp| [ 39s] 00003990 6d 62 75 69 6c 64 2f 42 55 49 4c 44 2f 6d 65 63 |mbuild/BUILD/mec| [ 39s] 000039a0 6b 2d 30 2e 37 2e 32 2b 67 69 74 2e 31 33 36 35 |k-0.7.2+git.1365| > Anyhow, you can also use beam_lib:strip/1 on an existing beam file to remove > the compile info chunk. Yes, this may be a solution. -- With best regards, Matwey V. Kornilov http://0x2207.blogspot.com xmpp:0x2207@REDACTED From rvirding@REDACTED Thu Nov 28 11:06:29 2013 From: rvirding@REDACTED (Robert Virding) Date: Thu, 28 Nov 2013 11:06:29 +0100 Subject: [erlang-questions] Return [Value] of erlang dict:find fetch In-Reply-To: <1385366558.4787.4.camel@sekic1152.release> References: <1385366558.4787.4.camel@sekic1152.release> Message-ID: No, they are facts. :-) The documentation of dict:append says: "This function appends a new Value to the current list of values associated with Key." So it manages a list of values. Robert On 25 November 2013 09:02, Bengt Kleberg wrote: > These are opinions, not facts. > > dict:append/3 creates a list of values. Try calling it several times and > you will see. > If you only want one value use dict:store/3. > > > bengt > > On Mon, 2013-11-25 at 15:38 +0800, ??? wrote: > > Hi, > > I'm a beginner of erlang and have found some problems in my project. > > After doing some google I found here and wish someone could help me. > > I'm using the erlang structure 'dict' for a key-value table in my > > program, but I found that the return value of dict:fetch and dict:find > > is actually [Value] or {ok, [Value]} (means I get a list containing > > the value instead of the original one). However, this is not the > > problem, the real problem is, this happens only in some situations > > which I can't find what it is. > > An example: > > Eshell V5.8.5 (abort with ^G) > > 1> A = dict:new(). > > {dict,0,16,16,8,80,48, > > {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}, > > {{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}} > > 2> A2 = dict:append(key, value, A). > > {dict,1,16,16,8,80,48, > > {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}, > > {{[],[],[],[],[],[],[],[],[], > > [[key,value]], > > [],[],[],[],[],[]}}} > > 3> dict:find(key, A2). > > {ok,[value]} > > > > > > My erlang environment is R14B04 on ubuntu 12.04. Could any one tell > > me why the return value of dict:find is not the same as the doc? > > > > > > Best regards, > > Jingyi Wang > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Thu Nov 28 11:15:37 2013 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 28 Nov 2013 11:15:37 +0100 Subject: [erlang-questions] Return [Value] of erlang dict:find fetch In-Reply-To: References: <1385366558.4787.4.camel@sekic1152.release> Message-ID: <1385633737.4838.15.camel@sekic1152.release> These are opinions, not facts. It is better to err on the side of caution. Some readers of Erlang-questions are _very_ sensitive to not separating facts from opinions. Presumably they have only ever seen a part of the Internet where this http://xkcd.com/386/ makes no sense. bengt On Thu, 2013-11-28 at 11:06 +0100, Robert Virding wrote: > No, they are facts. :-) The documentation of dict:append says: > > "This function appends a new Value to the current list of values > associated with Key." > > > So it manages a list of values. > > > Robert > > > > On 25 November 2013 09:02, Bengt Kleberg > wrote: > These are opinions, not facts. > > dict:append/3 creates a list of values. Try calling it several > times and > you will see. > If you only want one value use dict:store/3. > > > bengt > > On Mon, 2013-11-25 at 15:38 +0800, ??? wrote: > > Hi, > > I'm a beginner of erlang and have found some problems in my > project. > > After doing some google I found here and wish someone could > help me. > > I'm using the erlang structure 'dict' for a key-value > table in my > > program, but I found that the return value of dict:fetch and > dict:find > > is actually [Value] or {ok, [Value]} (means I get a list > containing > > the value instead of the original one). However, this is not > the > > problem, the real problem is, this happens only in some > situations > > which I can't find what it is. > > An example: > > Eshell V5.8.5 (abort with ^G) > > 1> A = dict:new(). > > {dict,0,16,16,8,80,48, > > {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}, > > {{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}} > > 2> A2 = dict:append(key, value, A). > > {dict,1,16,16,8,80,48, > > {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}, > > {{[],[],[],[],[],[],[],[],[], > > [[key,value]], > > [],[],[],[],[],[]}}} > > 3> dict:find(key, A2). > > {ok,[value]} > > > > > > My erlang environment is R14B04 on ubuntu 12.04. Could > any one tell > > me why the return value of dict:find is not the same as the > doc? > > > > > > Best regards, > > Jingyi Wang > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > From jay@REDACTED Fri Nov 29 07:23:12 2013 From: jay@REDACTED (Jay Doane) Date: Thu, 28 Nov 2013 22:23:12 -0800 Subject: [erlang-questions] run_erl logfiles and cron In-Reply-To: <6CC40293-943C-4253-81C6-B0455AA7647D@gmail.com> References: <6CC40293-943C-4253-81C6-B0455AA7647D@gmail.com> Message-ID: I'm using cron because I didn't want to write an init script for my project, but I'm certainly open to a better solution. Please feel free to enlighten me. Thanks, Jay On Wed, Nov 27, 2013 at 10:52 PM, Dmitry Kolesnikov wrote: > Just curious, why are you using cron to start application after reboot? > There is a nice service utility that is capable to restart all background > applications. > > Best Regards, > Dmitry >-|-|-*> > > > On 28.11.2013, at 5.35, Jay Doane wrote: > > Daniel, > > Great clue! A search for "pseudo tty cron" led me to this link: > https://www.linuxquestions.org/questions/linux-server-73/running-process-from-cron-with-ptty-588635/, > and an eventual solution like this: > > @reboot screen -d -m ~/my_proj/rel/my_proj/bin/my_proj start > > Thanks, > Jay > > > On Wed, Nov 27, 2013 at 4:29 PM, Szoboszlay D?niel wrote: > >> Hi, >> >> That's because cron doesn't allocate a pseudo tty for your program, so >> your node starts up with the old shell. (Hopefully some Linux guru will >> know how to fix it, but I have no idea.) >> >> BR, >> Daniel >> >> On Wed, 27 Nov 2013 23:23:07 -0000, Jay Doane >> wrote: >> >> Hi, >> >> As an expedient, when the host is booted, I'm starting an erlang project >> with cron using something similar to the following in a crontab: >> >> @reboot ~/my_proj/rel/my_proj/bin/my_proj start >> >> where my_proj is built using "rebar compile generate". >> >> While this *does* actually start the erlang project, the "run_erl" >> logfiles it generates differ from those that are generated when the project >> is started from the command line using the same command; *each log entry >> is suffixed with a (node@REDACTED)1> prompt.* >> >> For example, here's a snippet of log started via cron (weird suffixes >> highlighted in red) >> >> Eshell V5.9.2 (abort with ^G) >> (my_proj@REDACTED)1> >> =INFO REPORT==== 27-Nov-2013::19:41:54 === >> Registering 0 remote connections on node ' >> my_proj@REDACTED'( >> my_proj@REDACTED)1> >> =INFO REPORT==== 27-Nov-2013::19:41:54 === >> Node 'my_proj@REDACTED' connected with 0 >> users(my_proj@REDACTED)1> >> >> And the same snippet later when started from bash: >> >> Eshell V5.9.2 (abort with ^G) >> (my_proj@REDACTED)1> >> =INFO REPORT==== 27-Nov-2013::19:56:42 === >> Registering 0 remote connections on node ' >> my_proj@REDACTED' >> =INFO REPORT==== 27-Nov-2013::19:56:42 === >> Node 'my_proj@REDACTED' connected with 0 >> users >> >> Can anyone give me any clues as to why this might be happening, and >> especially suggestions on how to stop it? >> >> Thanks, >> Jay >> >> >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Fri Nov 29 10:59:04 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 29 Nov 2013 13:59:04 +0400 Subject: [erlang-questions] myproto development status (erlang as an SQL server) Message-ID: Hi. Some time ago Manuel has released myproto library: https://github.com/altenwald/myproto This is an implementation of mysql server protocol. Why does it matter? We are speaking a lot about web and about http services, but all modern languages and frameworks like PHP or Ruby on Rails have excelent SQL connectors and ORM on top of them, but horrible HTTP clients. No, really! HTTP is a too young thing to start support it seriously. SQL is more mature, so it is much easier to retrieve data into modern Rails app via SQL than via some REST request. I know only one software that uses this approach: it is Shinx search engine that has refused from it's private protocol and now uses only mysql protocol. It is a good idea, because you don't need to support clients anymore: every language in the world has mysql adapter. Myproto library implements this server protocol and also makes some sql parsing. Of course, I understand that writing full SQL parser will take ages, so let's say that it focuses on most trivial requests. I had to make some fixes to myproto (including trivial fixes like buffering tcp flow, because there are no messages in tcp =), so right now Ruby on Rails 3.2 can connect to erlyvideo and request stream list, opened sessions and their history, etc. My fork is https://github.com/flussonic/myproto but I hope that Manuel will accept it. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Fri Nov 29 11:11:15 2013 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Fri, 29 Nov 2013 12:11:15 +0200 Subject: [erlang-questions] run_erl logfiles and cron In-Reply-To: References: <6CC40293-943C-4253-81C6-B0455AA7647D@gmail.com> Message-ID: This is a beauty of using rebar to generate "release" for you along with necessary scripts It also generate a script "almost" usable as init.d script. I am building following init.d wrapper for my apps /etc/init.d/myapp #!/bin/bash export HOME=/root /usr/local/myapp/bin/myapp \$1 - Dmitry On Nov 29, 2013, at 8:23 AM, Jay Doane wrote: > I'm using cron because I didn't want to write an init script for my project, but I'm certainly open to a better solution. > > Please feel free to enlighten me. > > Thanks, > Jay > > > On Wed, Nov 27, 2013 at 10:52 PM, Dmitry Kolesnikov wrote: > Just curious, why are you using cron to start application after reboot? There is a nice service utility that is capable to restart all background applications. > > Best Regards, > Dmitry >-|-|-*> > > > On 28.11.2013, at 5.35, Jay Doane wrote: > >> Daniel, >> >> Great clue! A search for "pseudo tty cron" led me to this link: https://www.linuxquestions.org/questions/linux-server-73/running-process-from-cron-with-ptty-588635/, and an eventual solution like this: >> >> @reboot screen -d -m ~/my_proj/rel/my_proj/bin/my_proj start >> >> Thanks, >> Jay >> >> >> On Wed, Nov 27, 2013 at 4:29 PM, Szoboszlay D?niel wrote: >> Hi, >> >> That's because cron doesn't allocate a pseudo tty for your program, so your node starts up with the old shell. (Hopefully some Linux guru will know how to fix it, but I have no idea.) >> >> BR, >> Daniel >> >> On Wed, 27 Nov 2013 23:23:07 -0000, Jay Doane wrote: >> >> Hi, >> >> As an expedient, when the host is booted, I'm starting an erlang project with cron using something similar to the following in a crontab: >> >> @reboot ~/my_proj/rel/my_proj/bin/my_proj start >> >> where my_proj is built using "rebar compile generate". >> >> While this *does* actually start the erlang project, the "run_erl" logfiles it generates differ from those that are generated when the project is started from the command line using the same command; each log entry is suffixed with a (node@REDACTED)1> prompt. >> >> For example, here's a snippet of log started via cron (weird suffixes highlighted in red) >> >> Eshell V5.9.2 (abort with ^G) >> (my_proj@REDACTED)1> >> =INFO REPORT==== 27-Nov-2013::19:41:54 === >> Registering 0 remote connections on node 'my_proj@REDACTED'(my_proj@REDACTED)1> >> =INFO REPORT==== 27-Nov-2013::19:41:54 === >> Node 'my_proj@REDACTED' connected with 0 users(my_proj@REDACTED)1> >> >> And the same snippet later when started from bash: >> >> Eshell V5.9.2 (abort with ^G) >> (my_proj@REDACTED)1> >> =INFO REPORT==== 27-Nov-2013::19:56:42 === >> Registering 0 remote connections on node 'my_proj@REDACTED' >> =INFO REPORT==== 27-Nov-2013::19:56:42 === >> Node 'my_proj@REDACTED' connected with 0 users >> >> Can anyone give me any clues as to why this might be happening, and especially suggestions on how to stop it? >> >> Thanks, >> Jay >> >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan@REDACTED Fri Nov 29 12:37:22 2013 From: ivan@REDACTED (Ivan Uemlianin) Date: Fri, 29 Nov 2013 11:37:22 +0000 Subject: [erlang-questions] Matching binaries and shadowed variables In-Reply-To: <700808F8-9504-4885-8E58-05D36E4CC1F0@virtan.com> References: <700808F8-9504-4885-8E58-05D36E4CC1F0@virtan.com> Message-ID: <52987C72.7020605@llaisdy.com> You can match A like this: > A = <<"hello">>. > ASize = size(A). > lists:map(fun (<>) -> match; > (_) -> nomatch end, > [<<"hello world">>, <<"nohello">>]). > [match,match] Ivan (Sorry if someone else has replied to this) On 27/11/2013 18:56, virtan wrote: > Does anybody know why there is a such thing as shadowed variables in Erlang? > What was the reason to prevent typical "matching" approach for closures? > > It is even more unclear in matching binaries: > > 1> A = <<"hello">>, ASize = size(A), > lists:map( > fun (<>) when A1 == A -> match; > (_) -> nomatch end, > [<<"hello world">>, <<"nohello">>]). > [match,nomatch] > 2> > > You can't use A instead of A1 (it creates new variable, shadowing outer A), > but should use ASize inside the pattern (otherwise you'll get unbound error during compilation). > -- ============================================================ Ivan A. Uemlianin PhD Llaisdy Speech Technology Research and Development ivan@REDACTED www.llaisdy.com llaisdy.wordpress.com github.com/llaisdy www.linkedin.com/in/ivanuemlianin festina lente ============================================================ From n.oxyde@REDACTED Fri Nov 29 12:54:27 2013 From: n.oxyde@REDACTED (Anthony Ramine) Date: Fri, 29 Nov 2013 12:54:27 +0100 Subject: [erlang-questions] Matching binaries and shadowed variables In-Reply-To: <52987C72.7020605@llaisdy.com> References: <700808F8-9504-4885-8E58-05D36E4CC1F0@virtan.com> <52987C72.7020605@llaisdy.com> Message-ID: No, the A in the function clause is fresh and shadows the previous A. > lists:map(fun (<>) -> match; (_) -> nomatch end, [<<"foobar">>]). [match] And if it did not shadow the previous A binding, the closure would return nomatch for <<"nohello">> because it does not begin with hello. -- Anthony Ramine Le 29 nov. 2013 ? 12:37, Ivan Uemlianin a ?crit : > You can match A like this: > > > A = <<"hello">>. > > ASize = size(A). > > lists:map(fun (<>) -> match; > > (_) -> nomatch end, > > [<<"hello world">>, <<"nohello">>]). > > [match,match] > > Ivan > > (Sorry if someone else has replied to this) > > > On 27/11/2013 18:56, virtan wrote: >> Does anybody know why there is a such thing as shadowed variables in Erlang? >> What was the reason to prevent typical "matching" approach for closures? >> >> It is even more unclear in matching binaries: >> >> 1> A = <<"hello">>, ASize = size(A), >> lists:map( >> fun (<>) when A1 == A -> match; >> (_) -> nomatch end, >> [<<"hello world">>, <<"nohello">>]). >> [match,nomatch] >> 2> >> >> You can't use A instead of A1 (it creates new variable, shadowing outer A), >> but should use ASize inside the pattern (otherwise you'll get unbound error during compilation). >> > > -- > ============================================================ > Ivan A. Uemlianin PhD > Llaisdy > Speech Technology Research and Development > > ivan@REDACTED > www.llaisdy.com > llaisdy.wordpress.com > github.com/llaisdy > www.linkedin.com/in/ivanuemlianin > > festina lente > ============================================================ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From ivan@REDACTED Fri Nov 29 13:10:31 2013 From: ivan@REDACTED (Ivan Uemlianin) Date: Fri, 29 Nov 2013 12:10:31 +0000 Subject: [erlang-questions] Matching binaries and shadowed variables In-Reply-To: References: <700808F8-9504-4885-8E58-05D36E4CC1F0@virtan.com> <52987C72.7020605@llaisdy.com> Message-ID: <52988437.9060701@llaisdy.com> ah yes my mistake. On 29/11/2013 11:54, Anthony Ramine wrote: > No, the A in the function clause is fresh and shadows the previous A. > >> lists:map(fun (<>) -> match; (_) -> nomatch end, [<<"foobar">>]). > [match] > > And if it did not shadow the previous A binding, the closure would return nomatch for <<"nohello">> because it does not begin with hello. > -- ============================================================ Ivan A. Uemlianin PhD Llaisdy Speech Technology Research and Development ivan@REDACTED www.llaisdy.com llaisdy.wordpress.com github.com/llaisdy www.linkedin.com/in/ivanuemlianin festina lente ============================================================ From vychodil.hynek@REDACTED Sat Nov 30 17:51:20 2013 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Sat, 30 Nov 2013 17:51:20 +0100 Subject: [erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997 In-Reply-To: <05DE93E5-2C54-454C-B915-55E543D770D5@cs.otago.ac.nz> References: <05DE93E5-2C54-454C-B915-55E543D770D5@cs.otago.ac.nz> Message-ID: Just to stack up some more languages: $ perl -E'say 2452.45*100' 245245 $ perl -E'say 2452.45*100 - 245245' -2.91038304567337e-11 ocaml # let a = 2452.45 *. 100.0;; val a : float = 245244.999999999971 But dc computes precise $ dc <<<"20k2452.45 100*245245-p" 0 $ dc <<<"20k28 85*312*5*0.85/p" 4368000.00000000000000000000 H. On Wed, Nov 27, 2013 at 4:20 AM, Richard A. O'Keefe wrote: > > On 27/11/2013, at 2:28 PM, Sanath Prasanna wrote: > > > Hi all, > > when running following sample in ERL shell, I got wrong value. What is > the reason for this? > > > > 2452.45*100. = 245244.99999999997 > > > > It should be 245245.0 or 245245 > > > > What do you mean "should"? > Some programming languages lie to you about the number they give you. > Ruby for one. > You have to probe a little deeper. > > m% irb > >> 2452.45*100 > => 245245.0 > >> 2452.45*100 - 245245.0 > => -2.91038304567337e-11 > > So Ruby _actually_ calculated the *same* answer as Erlang, > but showed you a different number. > > SWI Prolog calculated the same number as Erlang. > > m% swipl > ?- X is 2452.45*100. > X = 245244.99999999997. > > Gambit Scheme calculated the same number as Erlang. > > m% gsi > Gambit v4.6.0 > > (* 2452.45 100) > 245244.99999999997 > > R calculates the same number as Erlang, but like Ruby, > rounds the number before displaying it: > > m% R > > x <- 2452.45 * 100 > > x > [1] 245245 > > x - 245245 > [1] -2.910383e-11 > > Javascript calculates the same number as Erlang. > > m% /Scratch/js-1.6.20070208/js > js> 2452.45*100 > 245244.99999999997 > > I think we're beginning to see a pattern. > > m% cat >foo.c > #include > > int main(void) { > printf("%.12f\n", 2452.45*100); > return 0; > } > > m% cc foo.c > m% a.out > 245244.999999999971 > > It looks very much as though Erlang calculates exactly the > answer that it "should" calculate. > > Remember, this is IEEE double-precision *binary* floating- > point arithmetic. 100 can be represented exactly in that > arithmetic, but 2452.45 *cannot*. From a C program, when > you convert 2452.45 to an IEEE double, what you get is > 2452.44999999999981810106. > > There _is_ an IEEE standard for decimal floating point > arithmetic, and recent IBM z/Series and Power computers > offer high speed hardware support for it, and there _is_ > at least a draft of a standard for decimal floating point > in C, which IBM's XLC supports, GCC supports (see > http://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html), > but clang doesn't. > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: