From cean.ebengt@REDACTED Sat Dec 1 10:51:40 2018 From: cean.ebengt@REDACTED (bengt) Date: Sat, 1 Dec 2018 10:51:40 +0100 Subject: [erlang-questions] Looking for Erlang v21 https:get() options Message-ID: Greetings, I have a test case, originally for Erlang v20, where I do httpc:request(get, {"http://[::1]:8888/apath ", []}, [], [{ipv6_host_with_brackets, true}]). (it is to verify that Cowboy has started correctly by looking at the contents of the returned Body). After upgrading to v21 this test case fails. DNS can not find [::0], there is no attempt to request/4 to localhost. I am on Ubuntu 18.10 if that can be a cause of problems. Remove the option {ipv6_host_with_brackets, true} and DNS is no longer involved and the request is done. But then Cowboy complains: The host header is invalid. (RFC7230 5.4) and in the reply there is no Body. The missing Body was what prompted me to add the option in the first place (v20). Is there a new, v21, option that I have missed that would allow this(*) to work? If not, and if the v20 behaviour is not possible anymore, perhaps a new option: {ipv6_host_with_brackets_in_http_header, true} can be introduced? It would only add the brackets to IPv6 addresses in HTTP headers, while allowing httpc to remove them for other (DNS) usage. Best Wishes, bengt (*) Erlang v21, https:get/4, Cowboy, [::0] -------------- next part -------------- An HTML attachment was scrubbed... URL: From by@REDACTED Sun Dec 2 17:57:51 2018 From: by@REDACTED (by) Date: Mon, 3 Dec 2018 00:57:51 +0800 Subject: [erlang-questions] Erlang Text Editor Searching In-Reply-To: References: <02F824CD-1B7B-443A-A775-EDB8D7D4DE66@meetlost.com> <55d4e75162f97a131703b22a496371d3@smtp.hushmail.com> Message-ID: Hello, Good news. Based on below link, I configured my Emacs to a state which can do auto-completion and simple error/warning checking, it just works. https://www.lambdacat.com/post-modern-emacs-setup-for-erlang/ Just put here for newbies like me get into Erlang/Emacs world more smoothly. I used Erlang/OTP 19 and distel+company-distel to do the auto-completion configuration. During this process, I do realized that the key is to pick a text editor, then, live with it. I am lucky that Emacs smiled upon me. Best Regards, Yao > ? 2018?11?27??22:13?by ??? > > Thanks a lot for all your suggestions. > > After considering these ideas, I decide to learn Emacs with extensions for Erlang at first, since Emacs is not easy to get started, I am not sure whether Emacs will be my final choice. > > I wrote some front-end projects with VS Code, I must say, as a text editor, VS Code is just wonderful for front-end developers out-of-the-box. > The Erlang extension for VS Code is also very easy to use. > Actually, in my view, as a project, the default behavior is very important. Users should take very simple/stupid steps to get into the project, the advanced feature or customization should be another topic. VS Code is a good example, I download it, open project folder, then write the code(front-end); or, I install the Erlang extension, then write the Erlang code. > > And yes, I know Emacs is very flexible, but the Emacs world is just not easy to get into. > I used vi before, and am happy about it for simple file editing, but never tried vim with advanced plugins. > > Use Erlang as an another example, I am attracted by the world view of Erlang: observe the world, and write program based on the observation. > This is simple, and I get started without too much pain. And I know Erlang is hard in some sense, but this is another topic. > > I think I will use Emacs and VS Code at the same time. If I have time and configured Emacs to a handy state, It will be choice. > > Best Regards, > Yao >>>> Hello, >>>> >>>> I am new to Erlang, and trying to find a modern text editor for it. >>>> >>>> I build Erlang from source, and I can use the basic Erlang Mode happily. >>>> But seems the basic erlang-mode with emacs does not contain some *key* features would be needed as a modern text editor, like auto-complete. >>>> Actually, as a text editor, I think I just need the auto completion of library/custom modules and functions, other advanced features is not needed for now. >>>> >>>> Which text editor do you use in daily life? >>>> I really want to get me into emacs world but found not quite easy, a suggestion about emacs extensions would be very helpful. >>>> >>>> By the way, I tried Visual Studio Code with the Erlang extension, it works amazing. >>>> >>>> Best Regards, >>>> Yao >>>> _______________________________________________ >>>> 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 > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From yevhenii.kurtov@REDACTED Mon Dec 3 08:25:17 2018 From: yevhenii.kurtov@REDACTED (Yevhenii Kurtov) Date: Mon, 3 Dec 2018 08:25:17 +0100 Subject: [erlang-questions] Mnesia is stuck in mnesia_controller:rec_tabs Message-ID: Morning people, My application is suddenly stopped to load. Observer tells me that it's being stuck here https://github.com/erlang/otp/blob/master/lib/mnesia/src/mnesia_controller.erl#L277 while loading >5Gb file in disc_copies mode. I didn't change anything related to mnesia interactions which is why this is weird. Also it doesn't even try to load anything - table is of size of 0. Table load is performed through mnesia:force_load_table. Can anyone please suggest what is wrong? Have a great week! -------------- next part -------------- An HTML attachment was scrubbed... URL: From dangud@REDACTED Mon Dec 3 08:46:19 2018 From: dangud@REDACTED (Dan Gudmundsson) Date: Mon, 3 Dec 2018 08:46:19 +0100 Subject: [erlang-questions] Mnesia is stuck in mnesia_controller:rec_tabs In-Reply-To: References: Message-ID: That is user process waiting for completion, more interesting is what is the mnesia processes doing and what is their state, mnesia_controller? What are the other nodes doing? mnesia:info() on the other nodes may give some clues on processes holding locks and so. On Mon, Dec 3, 2018 at 8:30 AM Yevhenii Kurtov wrote: > Morning people, > > My application is suddenly stopped to load. Observer tells me that it's > being stuck here > https://github.com/erlang/otp/blob/master/lib/mnesia/src/mnesia_controller.erl#L277 > while loading >5Gb file in disc_copies mode. > I didn't change anything related to mnesia interactions which is why this > is weird. Also it doesn't even try to load anything - table is of size of 0. > > Table load is performed through mnesia:force_load_table. > > Can anyone please suggest what is wrong? > > Have a great week! > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yevhenii.kurtov@REDACTED Mon Dec 3 11:03:47 2018 From: yevhenii.kurtov@REDACTED (Yevhenii Kurtov) Date: Mon, 3 Dec 2018 11:03:47 +0100 Subject: [erlang-questions] Mnesia is stuck in mnesia_controller:rec_tabs In-Reply-To: References: Message-ID: mnesia_controller stack trace is gen_server:loop/6 (gen_server.erl:368) proc_lib:init_p_do_apply/3 (proc_lib.erl:247) It's state is {state,<0.338.0>,true,[],[], {0,nil}, [],[], {0,nil}, undefined,[],[],#Ref<0.0.4.1852>,false} No logged events and status is Running. mnesia_locker is in the mnesia_locker.loop/1 on mnesia_locker.erl:159, it's state is {state,<0.338.0>} mnesia_monitor stack trace is same as in mnesia_controller and {state,<0.338.0>,[],[],true,[],undefined,[],[]} mnesia_tm state is {state,{0,nil},{0,nil},<0.338.0>,[],[],[]} I will try to check mnesia.info now On Mon, Dec 3, 2018 at 8:46 AM Dan Gudmundsson wrote: > That is user process waiting for completion, more interesting is what is > the mnesia processes doing and what is their state, > mnesia_controller? > What are the other nodes doing? > > mnesia:info() on the other nodes may give some clues on processes holding > locks and so. > > On Mon, Dec 3, 2018 at 8:30 AM Yevhenii Kurtov > wrote: > >> Morning people, >> >> My application is suddenly stopped to load. Observer tells me that it's >> being stuck here >> https://github.com/erlang/otp/blob/master/lib/mnesia/src/mnesia_controller.erl#L277 >> while loading >5Gb file in disc_copies mode. >> I didn't change anything related to mnesia interactions which is why this >> is weird. Also it doesn't even try to load anything - table is of size of 0. >> >> Table load is performed through mnesia:force_load_table. >> >> Can anyone please suggest what is wrong? >> >> Have a great week! >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yevhenii.kurtov@REDACTED Mon Dec 3 11:10:15 2018 From: yevhenii.kurtov@REDACTED (Yevhenii Kurtov) Date: Mon, 3 Dec 2018 11:10:15 +0100 Subject: [erlang-questions] Mnesia is stuck in mnesia_controller:rec_tabs In-Reply-To: References: Message-ID: Removing schema.DAT and restarting application seems to do the trick. Seems that schema was changed. Any options to get around that? On Mon, Dec 3, 2018 at 11:03 AM Yevhenii Kurtov wrote: > mnesia_controller stack trace is > > gen_server:loop/6 (gen_server.erl:368) > proc_lib:init_p_do_apply/3 (proc_lib.erl:247) > > It's state is > > {state,<0.338.0>,true,[],[], > {0,nil}, > [],[], > {0,nil}, > undefined,[],[],#Ref<0.0.4.1852>,false} > > > No logged events and status is Running. > > mnesia_locker is in the mnesia_locker.loop/1 on mnesia_locker.erl:159, > it's state is {state,<0.338.0>} > mnesia_monitor stack trace is same as in mnesia_controller and > {state,<0.338.0>,[],[],true,[],undefined,[],[]} > mnesia_tm state is {state,{0,nil},{0,nil},<0.338.0>,[],[],[]} > > I will try to check mnesia.info now > > > > On Mon, Dec 3, 2018 at 8:46 AM Dan Gudmundsson wrote: > >> That is user process waiting for completion, more interesting is what is >> the mnesia processes doing and what is their state, >> mnesia_controller? >> What are the other nodes doing? >> >> mnesia:info() on the other nodes may give some clues on processes holding >> locks and so. >> >> On Mon, Dec 3, 2018 at 8:30 AM Yevhenii Kurtov >> wrote: >> >>> Morning people, >>> >>> My application is suddenly stopped to load. Observer tells me that it's >>> being stuck here >>> https://github.com/erlang/otp/blob/master/lib/mnesia/src/mnesia_controller.erl#L277 >>> while loading >5Gb file in disc_copies mode. >>> I didn't change anything related to mnesia interactions which is why >>> this is weird. Also it doesn't even try to load anything - table is of size >>> of 0. >>> >>> Table load is performed through mnesia:force_load_table. >>> >>> Can anyone please suggest what is wrong? >>> >>> Have a great week! >>> _______________________________________________ >>> 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 Mon Dec 3 12:55:12 2018 From: ahe.sanath@REDACTED (Sanath Prasanna) Date: Mon, 3 Dec 2018 17:25:12 +0530 Subject: [erlang-questions] Enable strict-ssl in mochiweb Message-ID: Hi all, Pls let me know "How to enable strict-ssl in mochiweb ?" Br, Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From tommy.mattsson@REDACTED Mon Dec 3 14:30:43 2018 From: tommy.mattsson@REDACTED (Mattsson, Tommy) Date: Mon, 3 Dec 2018 13:30:43 +0000 Subject: [erlang-questions] Erlang ssh shell question In-Reply-To: <205d030c-ae15-131a-8072-0c493ca284e0@ericsson.com> References: <69b28448-29a5-208a-2737-a5bd02109ec6@ericsson.com> , <205d030c-ae15-131a-8072-0c493ca284e0@ericsson.com> Message-ID: Hi Hans! I've started to look into this. I did a trace using redbug and as far as I can tell I don't end up in the section with the comment "The F communicates via standard io:write/read." but rather end up in the section with the comment "%% Exec called and the shell is the default shell (= Erlang shell).". This was assuming that the I/O not coming back for the exec case is a bug. My redbug output: % 14:10:33 <22297.5495.0>({ssh_client_channel,init,1}) % ssh_cli:handle_ssh_msg({ssh_cm,<22297.4959.0>, {exec,1,false, "sshtest:sshIO()."}}, {state,undefined,undefined,undefined,undefined,undefined, {shell,start,[]}, undefined}) Which means, as far as I can tell, that no I/O is given back (there is no I/O handling from what I can see in the function ssh_clki:exec_in_erlang_default_shell/1. Thanks for any help I can get ?? Best regards, Tommy Mattsson ________________________________ From: Hans Nilsson R Sent: Tuesday, November 6, 2018 10:43 AM To: Mattsson, Tommy; Per Hedeland Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Erlang ssh shell question Hi Tommy and Hi Per too :) Sorry for my sloppy reading of your first mail, but now I think I understand you. To start an Erlang server executing "shell" or "exec" commands you just start a normal server (= daemon): Erlang/OTP 21 [erts-10.1.1] [source-3094642] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] 2> ssh:daemon(1236, [{system_dir,"XXX"}]). % (will get ~/.ssh as user_dir where ~ is the home of the user that started erl) and elsewhere in a bash: ~$ ssh -p 1236 localhost Eshell V10.1.1 (abort with ^G) 1> io:write(hej). hejok 2> exit(). ~$ or, for "exec": ~$ ssh -p 1236 localhost 1+2. 3 ~$ etc. Now as I understand, you want to do I/O in the command and expect: ~$ ssh -p 1236 localhost 'io:write(hejsan).' hejsan ~$ but you get: ~$ ssh -p 1236 localhost 'io:write(hejsan).' ok ~$ and hejsan is written in the shell of the server started above. You could start your own exec command interpreter with the option 'exec' to the server: (See http://erlang.org/doc/man/ssh.html#type-exec_daemon_option but NOTE: ERROR in that one..... should be {exec, {direct, 'exec_fun/1'() | 'exec_fun/2'() | 'exec_fun/3'()} } ) Example: 9> ssh:daemon(1237, [{system_dir,"XXX"}, {exec, {direct, fun(Cmd) -> {ok, {got,Cmd}} end }}]). and from a separate bash shell: ~$ ssh -p 1237 localhost 'io:write(hejsan).' {got,"io:write(hejsan)."}~$ This gives a clue on what to do: "Just" write something executing the command grabbing the output and return it in that {direct,fun(Cmd)...} as a string... Now I think that not returning I/O from an exec command is a bug. However I can't look into that now and probably not on this side of christmas. IF you should like to dig into this, the central function is ssh_cli:handle_ssh_msg/2 line 114. The clause with the head: handle_ssh_msg({ssh_cm, ConnectionHandler, {exec, ChannelId, WantReply, Cmd}}, S0) -> There are comments in that code which could give you some clues. There is also a comment with "The F communicates via standard io:write/read.". That makes me belive that I accidently changed some functionality when I restructured this part. I will look into that too, but not now. I hope you got some ideas, and just ask if you wonder about something. And Pull Requests are welcome! /Hans On 11/6/18 9:24 AM, Mattsson, Tommy wrote: > Hi Per and Hans, > > Thank you both for your replies! ?? > Per is correct, I want to execute "ssh " from a regular shell (bash, etc.) and have it connect to the Erlang SSH shell that I started on and give me output like there was "echo test1", "echo test2" in a bash script. > > > I will look into if I can make use of the exec functionality for the Erlang SSH server. I looked at it earlier but it seemed to me that its intended use was for an Erlang SSH client connecting to an Erlang SSH server so I dismissed that as an option. > > If all else fails I could look into the ssh_cli option and see if I can have an Erlang SSH shell handle I/O differently than the default. > > > Best regards, > > Tommy > > ________________________________ > From: Per Hedeland > Sent: Friday, November 2, 2018 11:30:33 AM > To: Hans Nilsson R; Mattsson, Tommy > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Erlang ssh shell question > > Hi Tommy! (and Hans:-) > > Hans, I *think* you are misunderstanding Tommy's question. More > speculation below, since I haven't actually verified how ssh(3) > works... When using e.g. the OpenSSH client, > > $ ssh > > makes a "shell" request per > https://tools.ietf.org/html/rfc4254#section-6.5 , while > > $ ssh > > makes an "exec" request. I think Tommy is happy with how "shell" works, > but you seem to be changing it to a pretty boring implementation.:-) And > I think Tommy's question is about "exec" not associating 'standard_io' > with the SSH channel - thus if you use "exec" to call a function that > prints something, the output is lost. > > I'm not sure there is anything "wrong" with that though - for an SSH > server running "directly" on *nix, it is obvious that "exec" should > associate stdio with the SSH channel, since is *nix shell command, > and it's pretty fundamental that you want any output (and exit code) > that it produces. But for the Erlang/OTP SSH server, is > (apparently) an Erlang function call, and sending only what the call > returns (in text form) back through the channel is not unreasonable per > se. > > But maybe there could be an option to ssh:daemon() to make it do the > same thing with 'standard_io' for "exec" as it does for "shell" - I > can't see one in the man page. And I can't think of a way that the > called function could set it up. But I assume that it's possible to > do-it-all yourself via the 'ssh_cli' option. > > --Per > > On 2018-11-02 10:37, Hans Nilsson R wrote: >> Hi, >> >> Try >> >> 5> ssh:daemon(1234, [{system_dir,...}, {shell,fun(Usr,Hst) -> spawn(fun() -> io:format("Hello ~p ~p~n",[Usr,Hst]), L1 = io:get_line("&& "), io:format("Got ~p~n", [L1]) end) end}]). >> {ok,<0.110.0>} >> 6> >> >> Sorry for the one-liner. The fun() a bit edited, I hope I got it right: >> >> fun(Usr,Hst) -> >> spawn(fun() -> >> io:format("Hello ~p ~p~n",[Usr,Hst]), >> L1 = io:get_line("&& "), >> io:format("Got ~p~n", [L1]) >> end) >> end >> >> >> Note the option shell and the spawn, it is essential. >> You don't need the subsystem option. The user_dir option defaults to the $HOME/.ssh of the user that started erl. >> >> Now in bash: >> >> ~$ ssh -p 1234 localhost >> Hello "USERNAME" {{127,0,0,1},60088} >> && some command >> Got "some command\n" >> Connection to localhost closed. >> ~$ >> >> Hope this helps. >> /Hans >> >> >> >> On 11/2/18 10:05 AM, Mattsson, Tommy wrote: >>> Hi, >>> >>> First time writer here on the erlang questions list :) >>> >>> >>> I am wondering if anyone knows about how the erlang ssh handles I/O? More details can be found below. >>> >>> >>> Erlang version: 21.0 >>> >>> >>> >>> Start of SSH server on testing (Windows) machine: >>> >>> application:ensure_all_started(ssh), >>> Options = [{system_dir, filename:join(SSHPath, "daemon")}, {user_dir, ?DIR}, {subsystems, [ssh_sftpd:subsystem_spec([{cwd, SSHPath}])]}], >>> >>> ssh:daemon(?ipaddr, ?port, Options]). >>> >>> Test module: >>> -module(sshtest). >>> sshIO() -> >>> io:format("test1~n"), >>> io:format("test2\n"), >>> test3. >>> >>> >>> Test run from my own machine: >>>> ssh $IPADDR 'sshtest:sshIO().' >>> test3 >>> >>> >>> For some reason any io:format/io:fwrite does not travel back over the SSH connection. If I connect to some Linux machine that already has a (non-erlang) SSH server running and I try to run some random bash script then any echo I have in the script will travel back over the SSH connection. >>> >>> A test I did with a bash script towards a Linux server, >>> Bash script (~/test.sh): >>> >>> echo "test1" >>> >>> echo "test2" >>> >>> echo "test3" >>> >>> >>> Test run from my own machine: >>>> ssh $IPADDR ./test.sh >>> >>> test1 >>> >>> test2 >>> >>> test3 >>> >>> This is how I'd like it to work. >>> >>> >>> I have been googling and reading the documentation for the ssh and related modules to no avail in regards to finding a solution to this problem. >>> >>> Other than this I/O problem the ssh connection works perfectly for me = > >>> >>> Hopefully someone here on the list has some insight into how this works. >>> >>> Thankful for any help I can get :) >>> Best regards, >>> >>> Tommy >>> >>> >>> >>> >>> >>> >>> _______________________________________________ >>> 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 Michael.K.Schmidt@REDACTED Tue Dec 4 19:44:09 2018 From: Michael.K.Schmidt@REDACTED (Michael Schmidt) Date: Tue, 4 Dec 2018 18:44:09 +0000 Subject: [erlang-questions] Compile Question Message-ID: I have been chasing a compile error: ** (CompileError) elixir_compiler_1: function '__MODULE__'/1+17: An implementation limit was reached. Try reducing the complexity of this function. Instruction: {move,{x,0},{y,1555}} (stdlib) lists.erl:1338: :lists.foreach/2 lib/absinthe/phase/schema/compile.ex:51: Absinthe.Phase.Schema.Compile.run/2 lib/absinthe/pipeline.ex:283: Absinthe.Pipeline.run_phase/3 lib/absinthe/schema.ex:214: Absinthe.Schema.__after_compile__/2 (stdlib) lists.erl:1263: :lists.foldl/3 (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6 (elixir) lib/kernel/parallel_compiler.ex:206: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6 I realize this is an Elixir / Absinthe issue, but my question is this: How is lists:foreach() able to trigger this? https://github.com/erlang/otp/blob/master/lib/stdlib/src/lists.erl#L1332 Poking around, there is indeed a list of 776 items that generates 2 function defs each, which gives us a final AST list of approx 1552. I assume this is related to the {y,1555} in Error. Can lists:each() not handle lists longer than 1024? What am I missing? Thanks! Mike -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Tue Dec 4 20:06:09 2018 From: mononcqc@REDACTED (Fred Hebert) Date: Tue, 4 Dec 2018 14:06:09 -0500 Subject: [erlang-questions] Compile Question In-Reply-To: References: Message-ID: On Tue, Dec 4, 2018 at 1:44 PM Michael Schmidt < Michael.K.Schmidt@REDACTED> wrote: > I have been chasing a compile error: > > ** (CompileError) elixir_compiler_1: function '__MODULE__'/1+17: > > An implementation limit was reached. > > Try reducing the complexity of this function. > > > > Instruction: {move,{x,0},{y,1555}} > > ... > > Poking around, there is indeed a list of 776 items that generates 2 > function defs each, which gives us a final AST list of approx 1552. I > assume this is related to the {y,1555} in Error. > > > > Can lists:each() not handle lists longer than 1024? What am I missing? > > > > The limit is on the number of funs that can be exported by a single function. Each function gets an id like `#Fun` where the second integer (9) is a counter of the number of anonymous functions/closures within a single function. You probably overflow that counter. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michal@REDACTED Tue Dec 4 20:14:05 2018 From: michal@REDACTED (=?utf-8?Q?Micha=C5=82_Muska=C5=82a?=) Date: Tue, 4 Dec 2018 20:14:05 +0100 Subject: [erlang-questions] Compile Question In-Reply-To: References: Message-ID: The issue seems to be that the compile-time function created by the module is huge and tries to allocate a compile-time list with 1555 elements. The lists:foreach call is probably misleading - that's just somewhere on the compiler stack. The good thing is that it's probably just a matter of refactoring ?macros in the Absinthe.Phase.Schema.Compile module. It shouldn't need to build such huge lists (I've reviewed the module briefly). Micha?. On 4 Dec 2018, 19:44 +0100, Michael Schmidt , wrote: > I have been chasing a compile error: > ** (CompileError) elixir_compiler_1: function '__MODULE__'/1+17: > ? An implementation limit was reached. > ? Try reducing the complexity of this function. > > ? Instruction: {move,{x,0},{y,1555}} > > ??? (stdlib) lists.erl:1338: :lists.foreach/2 > ??? lib/absinthe/phase/schema/compile.ex:51: Absinthe.Phase.Schema.Compile.run/2 > ??? lib/absinthe/pipeline.ex:283: Absinthe.Pipeline.run_phase/3 > ??? lib/absinthe/schema.ex:214: Absinthe.Schema.__after_compile__/2 > ??? (stdlib) lists.erl:1263: :lists.foldl/3 > ??? (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6 > ??? (elixir) lib/kernel/parallel_compiler.ex:206: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6 > > I realize this is an Elixir / Absinthe issue, but my question is this:? How is lists:foreach() able to trigger this? > https://github.com/erlang/otp/blob/master/lib/stdlib/src/lists.erl#L1332 > > Poking around, there is indeed a list of 776 items that generates 2 function defs each, which gives us a final AST list of approx 1552.? I assume this is related to the {y,1555} in Error. > > Can lists:each() not handle lists longer than 1024?? What am I missing? > > Thanks! > Mike > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From Michael.K.Schmidt@REDACTED Tue Dec 4 20:18:47 2018 From: Michael.K.Schmidt@REDACTED (Michael Schmidt) Date: Tue, 4 Dec 2018 19:18:47 +0000 Subject: [erlang-questions] Compile Question In-Reply-To: References: Message-ID: Thanks! I think you might be onto something. We use a lot of funs in our resolve functions. Is the limit per-function? Or per-function-head? From: Fred Hebert [mailto:mononcqc@REDACTED] Sent: Tuesday, December 4, 2018 1:06 PM To: Michael Schmidt Cc: Erlang Subject: Re: [erlang-questions] Compile Question [External email: Use caution with links and attachments] ________________________________ On Tue, Dec 4, 2018 at 1:44 PM Michael Schmidt > wrote: I have been chasing a compile error: ** (CompileError) elixir_compiler_1: function '__MODULE__'/1+17: An implementation limit was reached. Try reducing the complexity of this function. Instruction: {move,{x,0},{y,1555}} ... Poking around, there is indeed a list of 776 items that generates 2 function defs each, which gives us a final AST list of approx 1552. I assume this is related to the {y,1555} in Error. Can lists:each() not handle lists longer than 1024? What am I missing? The limit is on the number of funs that can be exported by a single function. Each function gets an id like `#Fun` where the second integer (9) is a counter of the number of anonymous functions/closures within a single function. You probably overflow that counter. ______________________________________________________________________ This email has been scanned by the Symantec Email Security.cloud service. ______________________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From Michael.K.Schmidt@REDACTED Tue Dec 4 20:24:11 2018 From: Michael.K.Schmidt@REDACTED (Michael Schmidt) Date: Tue, 4 Dec 2018 19:24:11 +0000 Subject: [erlang-questions] Compile Question In-Reply-To: References: Message-ID: Thanks! That makes sense that the issue is not the lists:foreach(), but a layer deeper I am open on how to address this?I need to test Fred?s hypothesis real quick. In the mean time, this is as deep as I got: def build_types(types) do IO.puts "build_types #{types |> length() |> inspect}" for type <- types do if !type.definition, do: raise(""" No definition set! #{inspect(type)} """) ast = Macro.escape(type, unquote: true) quote do def __absinthe_type__(unquote(type.identifier)) do unquote(ast) end def __absinthe_type__(unquote(type.name)) do unquote(ast) end end end |> Enum.concat([ quote do def __absinthe_type__(_type) do nil end end ]) end The types list is 776 long. If I comment out the 2 ?def __absinthe_type()? clauses the issue does not occur, so I assume this is the list referenced in the error message. From: Micha? Muska?a [mailto:michal@REDACTED] Sent: Tuesday, December 4, 2018 1:14 PM To: erlang-questions@REDACTED; Michael Schmidt Subject: Re: [erlang-questions] Compile Question [External email: Use caution with links and attachments] ________________________________ The issue seems to be that the compile-time function created by the module is huge and tries to allocate a compile-time list with 1555 elements. The lists:foreach call is probably misleading - that's just somewhere on the compiler stack. The good thing is that it's probably just a matter of refactoring macros in the Absinthe.Phase.Schema.Compile module. It shouldn't need to build such huge lists (I've reviewed the module briefly). Micha?. On 4 Dec 2018, 19:44 +0100, Michael Schmidt >, wrote: I have been chasing a compile error: ** (CompileError) elixir_compiler_1: function '__MODULE__'/1+17: An implementation limit was reached. Try reducing the complexity of this function. Instruction: {move,{x,0},{y,1555}} (stdlib) lists.erl:1338: :lists.foreach/2 lib/absinthe/phase/schema/compile.ex:51: Absinthe.Phase.Schema.Compile.run/2 lib/absinthe/pipeline.ex:283: Absinthe.Pipeline.run_phase/3 lib/absinthe/schema.ex:214: Absinthe.Schema.__after_compile__/2 (stdlib) lists.erl:1263: :lists.foldl/3 (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6 (elixir) lib/kernel/parallel_compiler.ex:206: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6 I realize this is an Elixir / Absinthe issue, but my question is this: How is lists:foreach() able to trigger this? https://github.com/erlang/otp/blob/master/lib/stdlib/src/lists.erl#L1332 Poking around, there is indeed a list of 776 items that generates 2 function defs each, which gives us a final AST list of approx 1552. I assume this is related to the {y,1555} in Error. Can lists:each() not handle lists longer than 1024? What am I missing? Thanks! Mike _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions ______________________________________________________________________ This email has been scanned by the Symantec Email Security.cloud service. ______________________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From Michael.K.Schmidt@REDACTED Tue Dec 4 20:38:48 2018 From: Michael.K.Schmidt@REDACTED (Michael Schmidt) Date: Tue, 4 Dec 2018 19:38:48 +0000 Subject: [erlang-questions] Compile Question In-Reply-To: References: Message-ID: Just to close the loop, this was the fix: https://github.com/absinthe-graphql/absinthe/pull/645 Thanks again Micha? and Fred for the help From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Michael Schmidt Sent: Tuesday, December 4, 2018 1:24 PM To: Micha? Muska?a ; erlang-questions@REDACTED Subject: Re: [erlang-questions] Compile Question [External email: Use caution with links and attachments] ________________________________ Thanks! That makes sense that the issue is not the lists:foreach(), but a layer deeper I am open on how to address this?I need to test Fred?s hypothesis real quick. In the mean time, this is as deep as I got: def build_types(types) do IO.puts "build_types #{types |> length() |> inspect}" for type <- types do if !type.definition, do: raise(""" No definition set! #{inspect(type)} """) ast = Macro.escape(type, unquote: true) quote do def __absinthe_type__(unquote(type.identifier)) do unquote(ast) end def __absinthe_type__(unquote(type.name)) do unquote(ast) end end end |> Enum.concat([ quote do def __absinthe_type__(_type) do nil end end ]) end The types list is 776 long. If I comment out the 2 ?def __absinthe_type()? clauses the issue does not occur, so I assume this is the list referenced in the error message. From: Micha? Muska?a [mailto:michal@REDACTED] Sent: Tuesday, December 4, 2018 1:14 PM To: erlang-questions@REDACTED; Michael Schmidt > Subject: Re: [erlang-questions] Compile Question [External email: Use caution with links and attachments] ________________________________ The issue seems to be that the compile-time function created by the module is huge and tries to allocate a compile-time list with 1555 elements. The lists:foreach call is probably misleading - that's just somewhere on the compiler stack. The good thing is that it's probably just a matter of refactoring macros in the Absinthe.Phase.Schema.Compile module. It shouldn't need to build such huge lists (I've reviewed the module briefly). Micha?. On 4 Dec 2018, 19:44 +0100, Michael Schmidt >, wrote: I have been chasing a compile error: ** (CompileError) elixir_compiler_1: function '__MODULE__'/1+17: An implementation limit was reached. Try reducing the complexity of this function. Instruction: {move,{x,0},{y,1555}} (stdlib) lists.erl:1338: :lists.foreach/2 lib/absinthe/phase/schema/compile.ex:51: Absinthe.Phase.Schema.Compile.run/2 lib/absinthe/pipeline.ex:283: Absinthe.Pipeline.run_phase/3 lib/absinthe/schema.ex:214: Absinthe.Schema.__after_compile__/2 (stdlib) lists.erl:1263: :lists.foldl/3 (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6 (elixir) lib/kernel/parallel_compiler.ex:206: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6 I realize this is an Elixir / Absinthe issue, but my question is this: How is lists:foreach() able to trigger this? https://github.com/erlang/otp/blob/master/lib/stdlib/src/lists.erl#L1332 Poking around, there is indeed a list of 776 items that generates 2 function defs each, which gives us a final AST list of approx 1552. I assume this is related to the {y,1555} in Error. Can lists:each() not handle lists longer than 1024? What am I missing? Thanks! Mike _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions ______________________________________________________________________ This email has been scanned by the Symantec Email Security.cloud service. ______________________________________________________________________ ______________________________________________________________________ This email has been scanned by the Symantec Email Security.cloud service. ______________________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From bchesneau@REDACTED Wed Dec 5 14:02:22 2018 From: bchesneau@REDACTED (Benoit Chesneau) Date: Wed, 5 Dec 2018 14:02:22 +0100 Subject: [erlang-questions] [ANN] just released erlang-rocksdb 0.26.0, a binding of rocksdb embedded K/V database Message-ID: I just released erlang-rocksdb 0.26.0, a binding of rocksdb an embedded K/V database from Facebook for Erlang based applications. This version is using cmake for the build and allows you to customize your installation by reusing the libraries installed on your system: https://gitlab.com/barrel-db/erlang-rocksdb/tags/0.26.0 also available on hex.pm : https://hex.pm/packages/rocksdb Enjoy! Beno?t -------------- next part -------------- An HTML attachment was scrubbed... URL: From bchesneau@REDACTED Wed Dec 5 14:32:53 2018 From: bchesneau@REDACTED (Benoit Chesneau) Date: Wed, 5 Dec 2018 14:32:53 +0100 Subject: [erlang-questions] [ANN] erlang-rocksdb 0.25.0 is released In-Reply-To: References: Message-ID: On Fri, Nov 23, 2018 at 11:27 AM Caragea Silviu wrote: > Hello, > > Do you have any benchmarks agains https://github.com/leo-project/erocksdb > ? > > Silviu > Sorry somehow the messages was lost in the backlog. In term of speed erlang-rocksdb used to be a little faster at the time I started the project but I didn't do any change. The main internal diff between both is that erlang-rocksdb is using dirty nifs to schedule calls to the rocksdb database while the binding from the leo project is using its own pool of threads. The erlang-rocksdb project is also more features packed to offer more control in the way you want to handle your data but also backpressure and other related topics. It aims to provide a complete programmable database toolkit for erlang apps, something I want since a long time. Beno?t > > On Wed, Nov 21, 2018 at 3:03 PM Benoit Chesneau > wrote: > >> I just released a new version of erlang-rocksdb 0.25.0 a binding of >> rocksdb for Erlang. This version support latest version of rocksdb >> (0.17.2) and brings many new features allowing more control of the >> database: >> >> https://gitlab.com/barrel-db/erlang-rocksdb/tags/0.25.0 >> >> Package is also available on hex.pm: https://hex.pm/packages/rocksdb >> >> Documentation is on the wiki: >> https://gitlab.com/barrel-db/erlang-rocksdb/wikis/home >> >> >> Any feedback is welcome :) >> >> Enjoy! >> >> Beno?t >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From marc@REDACTED Wed Dec 5 17:33:14 2018 From: marc@REDACTED (Marc Worrell) Date: Wed, 5 Dec 2018 17:33:14 +0100 Subject: [erlang-questions] Eleveldb / Snappy on macOS 10.13 Message-ID: Hi, I am trying to compile eleveldb on macOS 10.13 and running into compile errors. Anybody got a fork or an idea which magic CXXFLAGS might do the trick? Thanks! Marc gmake[1]: Entering directory '/Users/marc/tmp/eleveldb/eleveldb/c_src/snappy-1.0.4' /bin/sh ./libtool --tag=CXX --mode=compile c++ -DHAVE_CONFIG_H -I. -Wall -O3 -fPIC -mmacosx-version-min=10.8 -MT snappy.lo -MD -MP -MF .deps/snappy.Tpo -c -o snappy.lo snappy.cc libtool: compile: c++ -DHAVE_CONFIG_H -I. -Wall -O3 -fPIC -mmacosx-version-min=10.8 -MT snappy.lo -MD -MP -MF .deps/snappy.Tpo -c snappy.cc -fno-common -DPIC -o snappy.o warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found] In file included from snappy.cc:29: ./snappy.h:43:10: fatal error: 'string' file not found #include ^~~~~~~~ 1 warning and 1 error generated. Makefile:417: recipe for target 'snappy.lo' failed -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew@REDACTED Wed Dec 5 19:32:42 2018 From: andrew@REDACTED (Andrew Thompson) Date: Wed, 5 Dec 2018 13:32:42 -0500 Subject: [erlang-questions] [ANN] erlang-rocksdb 0.25.0 is released In-Reply-To: References: Message-ID: <20181205183241.GG1783@thecloud.hijacked.us> On Wed, Dec 05, 2018 at 02:32:53PM +0100, Benoit Chesneau wrote: > The erlang-rocksdb project is also more features packed to offer more > control in the way you want to handle your data but also backpressure and > other related topics. It aims to provide a complete programmable database > toolkit for erlang apps, something I want since a long time. I'd like to echo the above. It's *extremely* useful to have a (fairly) complete wrapper for some of the cooler features rocksdb has. I've been using it for the last couple months and Benoit has been very helpful troubleshooting bugs, merging changes I proposed and adding features I needed. Also, the bitset merge operator is awesome. Andrew From silviu.cpp@REDACTED Thu Dec 6 15:38:56 2018 From: silviu.cpp@REDACTED (Caragea Silviu) Date: Thu, 6 Dec 2018 16:38:56 +0200 Subject: [erlang-questions] rebar3 and restricted shell Message-ID: Hello guys, I have an erlang release (via rebar3) where I enabled in vm.args the restricted shell using : +Bi -stdlib restricted_shell my_module This works nice but there is one problem: When doing myapp remote_console the same vm.args is applied including the above settings which makes impossible to exit from remote_console shell. The old rebar2 only applies few settings from vm.args like cookie, name (mostly the one used to be able to connect) to the node. So there this was not the problem. Do you have any suggestion ? Silviu -------------- next part -------------- An HTML attachment was scrubbed... URL: From kruskakli@REDACTED Thu Dec 6 15:53:12 2018 From: kruskakli@REDACTED (Torbjorn Tornkvist) Date: Thu, 6 Dec 2018 15:53:12 +0100 Subject: [erlang-questions] [ANN] edbg Message-ID: <27181115-d7f7-cdd8-a901-4d8ca37361cb@gmail.com> Hi, edbg - A TTY interface to the Erlang debugger and trace functionality. ? https://github.com/etnt/edbg Debugger part: Useful if you, for example, work from home but still want to debug your code at your work desktop, or if you simply don't like the standard debugger GUI. Note that lots of the debugger functionality is already supported by the standard OTP int.erl module. What the edbg debugger brings is basically the tty based attached mode and the possibility to make use of interactively defined conditional break points. Tracing part: The edbg tracing functionality is (hopefully) a somewhat more novel approach compared to existing trace tools. The idea is to avoid being drowned in trace output. Instead you'll get a call-graph where you can choose what arguments to inspect. Study the examples to get an idea of how it works: https://github.com/etnt/edbg#trace-examples Cheers, Tobbe (edbg is a bit hackish but has been quite stable for some time now...) From t@REDACTED Thu Dec 6 15:56:01 2018 From: t@REDACTED (Tristan Sloughter) Date: Thu, 06 Dec 2018 07:56:01 -0700 Subject: [erlang-questions] rebar3 and restricted shell In-Reply-To: References: Message-ID: <1544108161.3157029.1600965152.6EED6D0E@webmail.messagingengine.com> Hey Silviu, yea, this is a known pain that we haven't decided on the best solution for yet. I think it is going to be to just require a second vm.args if you want anything in it beyond what you mentioned was in the rebar2 one for remote console.. not sure. The issue is it isn't always only cookie and name that are needed to use a remote console, I think this first came up with net_ticktime. As there became more options people want kept we moved to a blacklist from a whitelist for vm.args. The change needed would be in relx, not rebar3, and is either to have the restricted shell argument removed when in extended_script when it removes name/sname, support for providing a separate remote console vm.args so we don't have to do any filtering at all, or templating of vm.args somehow to specify which are for remote console and which are for normal runs. Tristan On Thu, Dec 6, 2018, at 07:38, Caragea Silviu wrote: > Hello guys, > > I have an erlang release (via rebar3) where I enabled in vm.args the > restricted shell using :> +Bi -stdlib restricted_shell my_module > > This works nice but there is one problem: > > When doing myapp remote_console the same vm.args is applied > including the above settings which makes impossible to exit from > remote_console shell.> > The old rebar2 only applies few settings from vm.args like cookie, > name (mostly the one used to be able to connect) to the node. So there > this was not the problem.> > Do you have any suggestion ? > > Silviu > _________________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank.muller.erl@REDACTED Fri Dec 7 05:21:31 2018 From: frank.muller.erl@REDACTED (Frank Muller) Date: Fri, 7 Dec 2018 05:21:31 +0100 Subject: [erlang-questions] Passing data between Erlang and C port while preserving padding and alignment? Message-ID: Hi guys Let assume the following C structure (I have a bunch of them, all different): struct foo { int32 i32; char c; int64 i64; char * p; float f; char * str[16]; }; When it gets compiled, GCC will add some padding to align data types (i.e self-alignment). More info at: http://www.catb.org/esr/structure-packing/ On the Erlang side, it is very easy to generate a binary which matches this C structure field by field. But it won?t work because of the padding :-/ Question: how can I derive the GCC's padding, and automatically add it to my Erlang binary? I am open to any generic/flexible solutions even if I have to auto-generate these C structures (i.e meta-programming). Thank you. /Frank -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Fri Dec 7 09:17:59 2018 From: vances@REDACTED (Vance Shipley) Date: Fri, 7 Dec 2018 13:47:59 +0530 Subject: [erlang-questions] Passing data between Erlang and C port while preserving padding and alignment? In-Reply-To: References: Message-ID: On Fri, Dec 7, 2018 at 9:51 AM Frank Muller wrote: > Question: how can I derive the GCC's padding, and automatically add it to my Erlang binary? Frank, I used to write linked-in drivers for embedded systems which provided C library APIs. Back in those days I was building for 32 & 64 bit, x86 & SPARC. I used GNU autotools to figure out the target environment and generate macros in my Erlang header files. It all worked quite smoothly in the end. I'd be happy to send you an example project if you think it'd helpful. To your specific question I think the autoconf macro AC_CHECK_ALIGNOF does what you want: https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Generic-Compiler-Characteristics.html -- -Vance From frank.muller.erl@REDACTED Fri Dec 7 09:49:19 2018 From: frank.muller.erl@REDACTED (Frank Muller) Date: Fri, 7 Dec 2018 09:49:19 +0100 Subject: [erlang-questions] Passing data between Erlang and C port while preserving padding and alignment? In-Reply-To: References: Message-ID: Hello Vance Fantastic!!! It would be great if you can share some code. I?m totally lost with this tricky problem and no one was able to help me. Thanks in advance... /Frank > On Fri, Dec 7, 2018 at 9:51 AM Frank Muller > wrote: > > Question: how can I derive the GCC's padding, and automatically add it > to my Erlang binary? > > Frank, > > I used to write linked-in drivers for embedded systems which provided > C library APIs. Back in those days I was building for 32 & 64 bit, x86 > & SPARC. I used GNU autotools to figure out the target environment and > generate macros in my Erlang header files. It all worked quite > smoothly in the end. I'd be happy to send you an example project if > you think it'd helpful. > > To your specific question I think the autoconf macro AC_CHECK_ALIGNOF > does what you want: > > https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Generic-Compiler-Characteristics.html > > -- > -Vance > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dszoboszlay@REDACTED Fri Dec 7 12:34:52 2018 From: dszoboszlay@REDACTED (=?UTF-8?Q?D=C3=A1niel_Szoboszlay?=) Date: Fri, 7 Dec 2018 12:34:52 +0100 Subject: [erlang-questions] Temporarily violating record type constraints annoys dialyzer In-Reply-To: References: Message-ID: Hi, I'm a bit late to this party, but I have a suggestion I haven't seen coming up in the thread. So maybe it could be still useful for you or someone else: Consider moving type specs out from your record definition completely! Use a custom type instead: -record(widget, {id, name, size}). -type widget() :: #widget{id :: binary(), name :: binary(), size :: binary()}. This way you can explicitly tell in the function specs whether you're dealing with a properly typed widget() or not. You may even define a different type for the parser, and have Dialyzer check against that: -type partially_parsed_widget() :: #widget{id :: binary()|undefined, name :: binary()|undefined, size :: binary()|undefined}. -spec parse_widget(proplists:proplist()) -> widget(). -spec parse_widget(proplists:proplist(), partially_parsed_widget()) -> widget(). There are lots of cases when you want to use a record's structure with different type constraints than the "usual" use of that record. Generating property based tests and negative tests were already mentioned. But using records in match specifications is also very common. And in case of some simple records you may also use tuples that are not meant to be a record, but look like one (consider someone defining -record(error, {err_no :: integer(), msg :: string()}). for example). An additional benefit of separating record definitions from type specs is that Dialyzer would actually generate much more useful error messages on type violations. With types in records you may get something like this: foo.erl:10: Function test/0 has no local return foo.erl:11: Record construction #foo{bar::0} violates the declared type of field bar::pos_integer() The problem is that the "has no local return" error is poisonous: it will propagate to all other functions calling foo:test/0, and from there to their callers etc. You'll get a ton of error messages and it will be very hard to figure out the root cause. On the other hand when using a separate foo() type the error message would become: foo.erl:7: Invalid type specification for function foo:test/0. The success typing is () -> #foo{bar::0} This error will not propagate and will be easy to debug. Just my two cents. Cheers, Daniel On Mon, 12 Nov 2018 at 11:58 Roger Lipscombe wrote: > I've got a record defined as follows (e.g., and very simplified): > > -record widget { > id :: binary(), > name :: binary(), > size :: integer() > }. > > I parse that from (e.g.) a proplist: > > parse_widget(Props) -> > parse_widget(Props, #widget{}). > > parse_widget([{name, Name} | Rest], Acc) -> > parse_widget(Rest, Acc#widget { name = Name }); > % etc. > > Dialyzer isn't happy that my fields are initially set to 'undefined', > even though this only occurs during the parsing step, and isn't a big > deal. > > What can I do to deal with this? Either re-structuring my code or > persuading dialyzer that it's OK would both be acceptable. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andras.boroska@REDACTED Fri Dec 7 15:04:23 2018 From: andras.boroska@REDACTED (=?UTF-8?Q?Boroska_Andr=C3=A1s?=) Date: Fri, 7 Dec 2018 15:04:23 +0100 Subject: [erlang-questions] Temporarily violating record type constraints annoys dialyzer In-Reply-To: References: Message-ID: Hi, When defining records the way Daniel suggests dialyzer seems to find problems with record field constraints better. I find it helpful and changed our record definitions everywhere. On the other hand when 'warn_untyped_record' compiler option is turned on, it warns us that "record foo has field(s) without type information". (OTP-21.1.3) Shall I open a bug report/feature request on dialyzer? Andras -------------- next part -------------- An HTML attachment was scrubbed... URL: From andras.boroska@REDACTED Fri Dec 7 15:06:56 2018 From: andras.boroska@REDACTED (=?UTF-8?Q?Boroska_Andr=C3=A1s?=) Date: Fri, 7 Dec 2018 15:06:56 +0100 Subject: [erlang-questions] Temporarily violating record type constraints annoys dialyzer In-Reply-To: References: Message-ID: Sorry, I meant bug report on the _compiler_ (not on dialyzer). On Fri, Dec 7, 2018 at 3:04 PM Boroska Andr?s wrote: > Hi, > > When defining records the way Daniel suggests dialyzer seems to find > problems with record field constraints better. I find it helpful and > changed our record definitions everywhere. > > On the other hand when 'warn_untyped_record' compiler option is turned on, > it warns us that "record foo has field(s) without type information". > (OTP-21.1.3) Shall I open a bug report/feature request on dialyzer? > > Andras > -------------- next part -------------- An HTML attachment was scrubbed... URL: From otp@REDACTED Fri Dec 7 15:29:15 2018 From: otp@REDACTED (Erlang/OTP) Date: Fri, 7 Dec 2018 15:29:15 +0100 Subject: [erlang-questions] Patch Package OTP 20.3.8.15 Released Message-ID: <20181207142915.GA4423@erix.ericsson.se> Patch Package: OTP 20.3.8.15 Git Tag: OTP-20.3.8.15 Date: 2018-12-07 Trouble Report Id: OTP-15470 Seq num: ERIERL-278 System: OTP Release: 20 Application: asn1-5.0.5.2 Predecessor: OTP 20.3.8.14 Check out the git tag OTP-20.3.8.15, and build a full OTP system including documentation. Apply one or more applications from this build as patches to your installation using the 'otp_patch_apply' tool. For information on install requirements, see descriptions for each application version below. --------------------------------------------------------------------- --- asn1-5.0.5.2 ---------------------------------------------------- --------------------------------------------------------------------- The asn1-5.0.5.2 application can be applied independently of other applications on a full OTP 20 installation. --- Fixed Bugs and Malfunctions --- OTP-15470 Application(s): asn1 Related Id(s): ERIERL-278 Handle erroneous length during decode (BER only) without crashing. Full runtime dependencies of asn1-5.0.5.2: erts-7.0, kernel-3.0, stdlib-2.0 --------------------------------------------------------------------- --------------------------------------------------------------------- --------------------------------------------------------------------- From kostis@REDACTED Fri Dec 7 15:39:18 2018 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 7 Dec 2018 15:39:18 +0100 Subject: [erlang-questions] Temporarily violating record type constraints annoys dialyzer In-Reply-To: References: Message-ID: <45f5d45c-a5a6-9801-d45e-13e47e6967c9@cs.ntua.gr> On 12/7/18 3:06 PM, Boroska Andr?s wrote: > Sorry, I meant bug report on the _compiler_ (not on dialyzer). > > On Fri, Dec 7, 2018 at 3:04 PM Boroska Andr?s > wrote: > > Hi, > > When defining records the way Daniel suggests dialyzer seems to find > problems with record field constraints better. I find it helpful and > changed our record definitions everywhere. > > On the other hand when 'warn_untyped_record' compiler option is > turned on, it warns us that "record foo has field(s) without type > information". (OTP-21.1.3) Shall I open a bug report/feature request > on dialyzer? If, for whatever reason, you find that having records without types works better for your setting / code base, what's the reason why you also set the `warn_untyped_record' compiler option? It's off by default, isn't it? (And its name explicitly suggests that it warns when you have record definitions without types, doesn't it?) Kostis From dszoboszlay@REDACTED Fri Dec 7 16:05:10 2018 From: dszoboszlay@REDACTED (=?UTF-8?Q?D=C3=A1niel_Szoboszlay?=) Date: Fri, 7 Dec 2018 16:05:10 +0100 Subject: [erlang-questions] Temporarily violating record type constraints annoys dialyzer In-Reply-To: <45f5d45c-a5a6-9801-d45e-13e47e6967c9@cs.ntua.gr> References: <45f5d45c-a5a6-9801-d45e-13e47e6967c9@cs.ntua.gr> Message-ID: I agree that the warn_untyped_record warning does exactly what its name suggests. However, when working with records without types, a different warning would be useful, something that could be called maybe warn_untyped_record_in_type and what would give you a warning when a -type or -spec declaration contains a record without type specification for all of its fields. For example: -record(foo, {a :: integer(), b}). -type a() :: #foo{b :: boolean()}. % this is OK, both fields of #foo have a type -type b() :: #foo{}. % this is wrong, #foo.b has no explicit type Daniel On Fri, 7 Dec 2018 at 15:39 Kostis Sagonas wrote: > On 12/7/18 3:06 PM, Boroska Andr?s wrote: > > Sorry, I meant bug report on the _compiler_ (not on dialyzer). > > > > On Fri, Dec 7, 2018 at 3:04 PM Boroska Andr?s > > wrote: > > > > Hi, > > > > When defining records the way Daniel suggests dialyzer seems to find > > problems with record field constraints better. I find it helpful and > > changed our record definitions everywhere. > > > > On the other hand when 'warn_untyped_record' compiler option is > > turned on, it warns us that "record foo has field(s) without type > > information". (OTP-21.1.3) Shall I open a bug report/feature request > > on dialyzer? > > If, for whatever reason, you find that having records without types > works better for your setting / code base, what's the reason why you > also set the `warn_untyped_record' compiler option? > > It's off by default, isn't it? (And its name explicitly suggests that > it warns when you have record definitions without types, doesn't it?) > > Kostis > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikpelinux@REDACTED Fri Dec 7 18:30:34 2018 From: mikpelinux@REDACTED (Mikael Pettersson) Date: Fri, 7 Dec 2018 18:30:34 +0100 Subject: [erlang-questions] Passing data between Erlang and C port while preserving padding and alignment? In-Reply-To: References: Message-ID: You'll need to use C's offsetof() and sizeof() to discover (a) any internal padding between end of a previous field and the start of a new field, basically offsetof(struct, f2) - (offsetof(struct, f1) + sizeof(struct.f1)) gives that internal padding, and (2) any trailing padding, given by sizeof(struct) - (offsetof(struct, lastField) + sizeof(struct.lastField)). Beware that the contents of padding is unspecified, so might not be all-bits-zero. You'll need to derive these values via the C compiler. In theory you could derive them in pure Erlang given the types involved, but that'd require not only a C type parser but also a complete description of the machine's C ABI. I would't go that way. On Fri, Dec 7, 2018 at 9:49 AM Frank Muller wrote: > > Hello Vance > > Fantastic!!! > > It would be great if you can share some code. > I?m totally lost with this tricky problem and no one was able to help me. > > Thanks in advance... > > /Frank >> >> On Fri, Dec 7, 2018 at 9:51 AM Frank Muller wrote: >> > Question: how can I derive the GCC's padding, and automatically add it to my Erlang binary? >> >> Frank, >> >> I used to write linked-in drivers for embedded systems which provided >> C library APIs. Back in those days I was building for 32 & 64 bit, x86 >> & SPARC. I used GNU autotools to figure out the target environment and >> generate macros in my Erlang header files. It all worked quite >> smoothly in the end. I'd be happy to send you an example project if >> you think it'd helpful. >> >> To your specific question I think the autoconf macro AC_CHECK_ALIGNOF >> does what you want: >> https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Generic-Compiler-Characteristics.html >> >> -- >> -Vance > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From frank.muller.erl@REDACTED Fri Dec 7 19:02:34 2018 From: frank.muller.erl@REDACTED (Frank Muller) Date: Fri, 7 Dec 2018 19:02:34 +0100 Subject: [erlang-questions] Passing data between Erlang and C port while preserving padding and alignment? In-Reply-To: References: Message-ID: Thanks Mikael. Any others thoughts ? /Frank You'll need to use C's offsetof() and sizeof() to discover (a) any > internal padding between end of a previous field and the start of a > new field, basically offsetof(struct, f2) - (offsetof(struct, f1) + > sizeof(struct.f1)) gives that internal padding, and (2) any trailing > padding, given by sizeof(struct) - (offsetof(struct, lastField) + > sizeof(struct.lastField)). Beware that the contents of padding is > unspecified, so might not be all-bits-zero. > > You'll need to derive these values via the C compiler. In theory you > could derive them in pure Erlang given the types involved, but that'd > require not only a C type parser but also a complete description of > the machine's C ABI. I would't go that way. > On Fri, Dec 7, 2018 at 9:49 AM Frank Muller > wrote: > > > > Hello Vance > > > > Fantastic!!! > > > > It would be great if you can share some code. > > I?m totally lost with this tricky problem and no one was able to help me. > > > > Thanks in advance... > > > > /Frank > >> > >> On Fri, Dec 7, 2018 at 9:51 AM Frank Muller > wrote: > >> > Question: how can I derive the GCC's padding, and automatically add > it to my Erlang binary? > >> > >> Frank, > >> > >> I used to write linked-in drivers for embedded systems which provided > >> C library APIs. Back in those days I was building for 32 & 64 bit, x86 > >> & SPARC. I used GNU autotools to figure out the target environment and > >> generate macros in my Erlang header files. It all worked quite > >> smoothly in the end. I'd be happy to send you an example project if > >> you think it'd helpful. > >> > >> To your specific question I think the autoconf macro AC_CHECK_ALIGNOF > >> does what you want: > >> > https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Generic-Compiler-Characteristics.html > >> > >> -- > >> -Vance > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From roger@REDACTED Fri Dec 7 22:02:58 2018 From: roger@REDACTED (Roger Lipscombe) Date: Fri, 7 Dec 2018 21:02:58 +0000 Subject: [erlang-questions] Passing data between Erlang and C port while preserving padding and alignment? In-Reply-To: References: Message-ID: On Fri, 7 Dec 2018 at 18:02, Frank Muller wrote: > Thanks Mikael. > Any others thoughts ? > I'm assuming that you've considered serializing and deserializing the data to an unpadded (or defined padding) format, but that you've presumably discounted it for performance reasons? Just putting it out there in case someone's facing a similar issue, but has different constraints. We once used XDR for this (with some kind of IDL-to-C converter, if I recall correctly). Some brief googling suggests that XDR is not dead yet. Cheers, Roger. -------------- next part -------------- An HTML attachment was scrubbed... URL: From roger@REDACTED Fri Dec 7 22:05:29 2018 From: roger@REDACTED (Roger Lipscombe) Date: Fri, 7 Dec 2018 21:05:29 +0000 Subject: [erlang-questions] Relationship of SSL processes? Message-ID: Is there any documentation for which processes are involved in the SSL connection/handshaking mechanism in OTP 21.x? I ask because my verify_fun seems to be called from a different process than the one that calls ssl:ssl_accept/2, which makes it hard to correlate the two. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Fri Dec 7 22:17:07 2018 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 7 Dec 2018 22:17:07 +0100 Subject: [erlang-questions] Temporarily violating record type constraints annoys dialyzer In-Reply-To: References: <45f5d45c-a5a6-9801-d45e-13e47e6967c9@cs.ntua.gr> Message-ID: <107051f6-f5b9-f6d9-ecdb-7f911bff8cf9@cs.ntua.gr> On 12/07/2018 04:05 PM, D?niel Szoboszlay wrote: > I agree that the warn_untyped_record warning does exactly what its name > suggests. > > However, when working with records without types, a different warning > would be useful, something that could be called maybe > warn_untyped_record_in_type?and what would give you a warning when a > -type or -spec declaration contains a record without type specification > for all of its fields. Please feel free to provide a pull request that implements this. (Or whatever else you think should be appropriate for the approach to typing -- and at the same time not typing -- records you advocate.) Kostis From solvip@REDACTED Sat Dec 8 00:11:34 2018 From: solvip@REDACTED (=?utf-8?Q?S=C3=B6lvi_P=C3=A1ll_=C3=81sgeirsson?=) Date: Fri, 7 Dec 2018 23:11:34 +0000 Subject: [erlang-questions] Passing data between Erlang and C port while preserving padding and alignment? In-Reply-To: References: Message-ID: Can you use #pragma pack on the C structs? You can then easily deconstruct them in a binary match Regards S?lvi Sent from my iPhone > On 7 Dec 2018, at 21:02, Roger Lipscombe wrote: > >> On Fri, 7 Dec 2018 at 18:02, Frank Muller wrote: >> Thanks Mikael. >> Any others thoughts ? > > I'm assuming that you've considered serializing and deserializing the data to an unpadded (or defined padding) format, but that you've presumably discounted it for performance reasons? > > Just putting it out there in case someone's facing a similar issue, but has different constraints. > > We once used XDR for this (with some kind of IDL-to-C converter, if I recall correctly). Some brief googling suggests that XDR is not dead yet. > > Cheers, > Roger. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Sat Dec 8 06:20:11 2018 From: vances@REDACTED (Vance Shipley) Date: Sat, 8 Dec 2018 10:50:11 +0530 Subject: [erlang-questions] Twenty years ago today Message-ID: A very big thank you to the OTP team for 20 years of sharing their great work! http://web.archive.org/web/19991009002753/www.erlang.se/onlinenews/ErlangOTPos.shtml -- -Vance From ajityagaty@REDACTED Sat Dec 8 01:17:52 2018 From: ajityagaty@REDACTED (Ajit Yagaty) Date: Fri, 7 Dec 2018 16:17:52 -0800 Subject: [erlang-questions] Starting Erlang distribution programmatically Message-ID: Hello All, Currently, one can start an Erlang node in distributed mode by passing in the ?proto_dist? parameter on the command line. Could anyone please let me know if there is a way to start the distribution on a non-distributed Erlang node (in any one of inet_tcp/inet6_tcp/inet_tls/inet6_tls modes) programmatically? In the code ( https://github.com/erlang/otp/blob/master/lib/kernel/src/net_kernel.erl#L1487), there seems to be a reliance on the presence of the command line argument ?proto_dist?. If not passed, proto_dist always defaults to inet_tcp. If there is a way to start the distribution programmatically, then the logic that decides what proto_dist value to pass can be moved from the init script (when the application is run as a service) into an Erlang module. This would also help in not having to re-write this code snippet for all the different platforms (Linux/Windows/OSX) that one would want to support. Any tips on this will be very helpful. But if there is no support to start the distribution programmatically, then would it make sense to add that support? Best regards, Ajit -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Sat Dec 8 16:31:00 2018 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Sat, 8 Dec 2018 16:31:00 +0100 Subject: [erlang-questions] Passing data between Erlang and C port while preserving padding and alignment? In-Reply-To: References: Message-ID: There is also an attribute, packed, which can be useful here: https://gcc.gnu.org/onlinedocs/gcc-4.0.4/gcc/Type-Attributes.html http://www.catb.org/esr/structure-packing/ If you are not too concerned about the efficiency, I would just pack the struct and send it over the wire. The problem with this on a modern CPU: * While it packs tighter in your L1D cache, and this gives a speedup. * It requires more instructions on-CPU to get alignment back in order. * If multiple CPU threads access the data, you will end up bouncing between the L1D caches of the cores, and this is usually bad. With alignment, this can be avoided. My attack on the problem would be to pack first, then start measuring and see how much more I can get out of a solution as suggested by Mikael in this thread. On Sat, Dec 8, 2018 at 12:11 AM S?lvi P?ll ?sgeirsson wrote: > Can you use #pragma pack on the C structs? > You can then easily deconstruct them in a binary match > > Regards > S?lvi > > Sent from my iPhone > > On 7 Dec 2018, at 21:02, Roger Lipscombe wrote: > > On Fri, 7 Dec 2018 at 18:02, Frank Muller > wrote: > >> Thanks Mikael. >> Any others thoughts ? >> > > I'm assuming that you've considered serializing and deserializing the data > to an unpadded (or defined padding) format, but that you've presumably > discounted it for performance reasons? > > Just putting it out there in case someone's facing a similar issue, but > has different constraints. > > We once used XDR for this (with some kind of IDL-to-C converter, if I > recall correctly). Some brief googling suggests that XDR is not dead yet. > > Cheers, > Roger. > > _______________________________________________ > 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 > -- J. -------------- next part -------------- An HTML attachment was scrubbed... URL: From meishiang@REDACTED Sat Dec 8 17:06:06 2018 From: meishiang@REDACTED (Mei Shiang Cheah) Date: Sun, 9 Dec 2018 00:06:06 +0800 Subject: [erlang-questions] How to handle high frequency inserts table in clustered mnesia? Message-ID: Hi all, I have an application that is currently running on a cluster. There are tables that are writing very frequently and at some point the message_queue_len of mnesia_tm will get large. The application seems to be stuck whenever this happens. My question is, how would tables with high write frequencies be handled, and how does having clustered nodes, affects this? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank.muller.erl@REDACTED Sat Dec 8 23:30:47 2018 From: frank.muller.erl@REDACTED (Frank Muller) Date: Sat, 8 Dec 2018 23:30:47 +0100 Subject: [erlang-questions] Passing data between Erlang and C port while preserving padding and alignment? In-Reply-To: References: Message-ID: Hello Jesper, My binaries are an infinite stream of at least ~7500B each (include lot of floats). Packing the associated C struct will negatively affect the performances I?m afraid. This is why I would like to align every field to its natural alignement if possible. /Frank There is also an attribute, packed, which can be useful here: > > https://gcc.gnu.org/onlinedocs/gcc-4.0.4/gcc/Type-Attributes.html > http://www.catb.org/esr/structure-packing/ > > If you are not too concerned about the efficiency, I would just pack the > struct and send it over the wire. The problem with this on a modern CPU: > > * While it packs tighter in your L1D cache, and this gives a speedup. > * It requires more instructions on-CPU to get alignment back in order. > * If multiple CPU threads access the data, you will end up bouncing > between the L1D caches of the cores, and this is usually bad. With > alignment, this can be avoided. > > My attack on the problem would be to pack first, then start measuring and > see how much more I can get out of a solution as suggested by Mikael in > this thread. > > On Sat, Dec 8, 2018 at 12:11 AM S?lvi P?ll ?sgeirsson > wrote: > >> Can you use #pragma pack on the C structs? >> You can then easily deconstruct them in a binary match >> >> Regards >> S?lvi >> >> Sent from my iPhone >> >> On 7 Dec 2018, at 21:02, Roger Lipscombe wrote: >> >> On Fri, 7 Dec 2018 at 18:02, Frank Muller >> wrote: >> >>> Thanks Mikael. >>> Any others thoughts ? >>> >> >> I'm assuming that you've considered serializing and deserializing the >> data to an unpadded (or defined padding) format, but that you've presumably >> discounted it for performance reasons? >> >> Just putting it out there in case someone's facing a similar issue, but >> has different constraints. >> >> We once used XDR for this (with some kind of IDL-to-C converter, if I >> recall correctly). Some brief googling suggests that XDR is not dead yet. >> >> Cheers, >> Roger. >> >> _______________________________________________ >> 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 >> > > > -- > J. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From raoknz@REDACTED Sun Dec 9 12:46:51 2018 From: raoknz@REDACTED (Richard O'Keefe) Date: Mon, 10 Dec 2018 00:46:51 +1300 Subject: [erlang-questions] Passing data between Erlang and C port while preserving padding and alignment? In-Reply-To: References: Message-ID: The alignment/padding in a C struct depends on the hardware, the ABI, the compiler, and the options that were given to the compiler at build time. In the past I ran into serious problems trying to exchange binary data between C programs running on the same machine that were compiled by different compilers. (I have three C compilers on my el-cheapo Linux box, and could easily add a fourth if I wanted, all free. The last time I tried the fifth free compiler, it did not work, but I live in hope.) Me, I'd use an existing C compiler to do the parsing, such as GCC-XML or CastXML, extract the struct declaration from that, and generate both C and Erlang code for pickling and unpickling. (Or if you are fluent in SML, you could give the ckit library a go. There are also C lexers/parsers/verifiers in OCaml.) More likely, I'd just invent a little tabular DSL for describing the structs I wanted to communicate between C and Erlang, and generate the C declaration and other code and the Erlang code from that, to save having to learn yet another tool. On Fri, 7 Dec 2018 at 17:21, Frank Muller wrote: > Hi guys > > Let assume the following C structure (I have a bunch of them, all > different): > > struct foo { > int32 i32; > char c; > int64 i64; > char * p; > float f; > char * str[16]; > }; > > When it gets compiled, GCC will add some padding to align data types (i.e > self-alignment). More info at: > > http://www.catb.org/esr/structure-packing/ > > On the Erlang side, it is very easy to generate a binary which matches > this C structure field by field. > But it won?t work because of the padding :-/ > > Question: how can I derive the GCC's padding, and automatically add it to > my Erlang binary? > > I am open to any generic/flexible solutions even if I have to > auto-generate these C structures (i.e meta-programming). > > Thank you. > /Frank > _______________________________________________ > 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 Sun Dec 9 18:49:53 2018 From: max.lapshin@REDACTED (Max Lapshin) Date: Sun, 9 Dec 2018 20:49:53 +0300 Subject: [erlang-questions] Eleveldb / Snappy on macOS 10.13 In-Reply-To: References: Message-ID: 1) try `xcode-select --install 2) try clang++ -------------- next part -------------- An HTML attachment was scrubbed... URL: From dszoboszlay@REDACTED Mon Dec 10 00:32:49 2018 From: dszoboszlay@REDACTED (=?UTF-8?Q?D=C3=A1niel_Szoboszlay?=) Date: Mon, 10 Dec 2018 00:32:49 +0100 Subject: [erlang-questions] Starting Erlang distribution programmatically In-Reply-To: References: Message-ID: I don't know about a way to change the distribution module programmatically. You can however list multiple modules, as long as their select/1 callback can properly sort out which module to use towards which node (may work in IPv4 vs IPv6 cases, wont work with plain vs tls connections). An easy workaround may be to implement your custom distribution module, a proxy, that takes from some app env setting or similar the name of a real distribution module. Than you can simply proxy all API calls towards that module. BR, Daniel On Sat, 8 Dec 2018, 08:34 Ajit Yagaty, wrote: > Hello All, > > Currently, one can start an Erlang node in distributed mode by passing in > the ?proto_dist? parameter on the command line. Could anyone please let me > know if there is a way to start the distribution on a non-distributed > Erlang node (in any one of inet_tcp/inet6_tcp/inet_tls/inet6_tls modes) > programmatically? > > > In the code ( > https://github.com/erlang/otp/blob/master/lib/kernel/src/net_kernel.erl#L1487), > there seems to be a reliance on the presence of the command line argument > ?proto_dist?. If not passed, proto_dist always defaults to inet_tcp. > > > If there is a way to start the distribution programmatically, then the > logic that decides what proto_dist value to pass can be moved from the init > script (when the application is run as a service) into an Erlang module. > This would also help in not having to re-write this code snippet for all > the different platforms (Linux/Windows/OSX) that one would want to support. > > > Any tips on this will be very helpful. > > > But if there is no support to start the distribution programmatically, > then would it make sense to add that support? > > > Best regards, > > Ajit > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fchschneider@REDACTED Mon Dec 10 08:30:38 2018 From: fchschneider@REDACTED (Frans Schneider) Date: Mon, 10 Dec 2018 08:30:38 +0100 Subject: [erlang-questions] PropER generator for list of records with a sequence number Message-ID: <9451072b-29b9-575c-7ee2-e01a3f5fea2a@gmail.com> Hi list, In PropER, I am looking for a way to generate records with one field being a sequence number which is incremented for each instance. -record(cache_change, {sequence_number :: sequence_number(), ... data_value :: term()). Every cache entry is supposed to have a new sequence number which is normally generated by the application, but I now want PropER to generate the sequence numbers to test drive the cache in isolation. How does one create a custom generator for this? Another, related question, is how to start an unregistered process (the cache) in PropER and use its pid? Normally, the caches are started from a simple-one-for-one supervisor. The cache should be restarted for every test run. PropER documentation and examples always show registered processes and not unregistered processes. Thanks, Frans From torben.lehoff@REDACTED Mon Dec 10 08:59:17 2018 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Mon, 10 Dec 2018 08:59:17 +0100 Subject: [erlang-questions] PropER generator for list of records with a sequence number In-Reply-To: <9451072b-29b9-575c-7ee2-e01a3f5fea2a@gmail.com> References: <9451072b-29b9-575c-7ee2-e01a3f5fea2a@gmail.com> Message-ID: Hi Frans, This will most likely run you into some problems with shrinking. You would have to generate the next sequence number from the previous one, but then no shrinking can be done since that would leave a gap in the sequence numbers. But maybe there is another way to do this that I can't think of right now. Cheers, Torben On Mon, 10 Dec 2018 at 08:30, Frans Schneider wrote: > Hi list, > > In PropER, I am looking for a way to generate records with one field > being a sequence number which is incremented for each instance. > > -record(cache_change, {sequence_number :: sequence_number(), > ... > data_value :: term()). > > Every cache entry is supposed to have a new sequence number which is > normally generated by the application, but I now want PropER to generate > the sequence numbers to test drive the cache in isolation. > > How does one create a custom generator for this? > > Another, related question, is how to start an unregistered process (the > cache) in PropER and use its pid? Normally, the caches are started from > a simple-one-for-one supervisor. The cache should be restarted for every > test run. PropER documentation and examples always show registered > processes and not unregistered processes. > > Thanks, > > Frans > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- http://www.linkedin.com/in/torbenhoffmann @LeHoff -------------- next part -------------- An HTML attachment was scrubbed... URL: From marc@REDACTED Mon Dec 10 10:37:12 2018 From: marc@REDACTED (Marc Worrell) Date: Mon, 10 Dec 2018 10:37:12 +0100 Subject: [erlang-questions] Eleveldb / Snappy on macOS 10.13 In-Reply-To: References: Message-ID: <6B3839EA-9EB3-4FBF-9E1B-9B3B7C63D6F7@worrell.nl> Hi Max, I have ?fixed? the issue by completely removing my current Xcode install and re-installing it from scratch. (Including all the optional extra packages for command line an what-not). Apparently something in my Xcode install was broken, and it came up with this less thank helpful error. Cheers, Marc > On 9 Dec 2018, at 18:49, Max Lapshin wrote: > > 1) try `xcode-select --install > > 2) try clang++ From paulperegud@REDACTED Mon Dec 10 11:27:35 2018 From: paulperegud@REDACTED (Paul Peregud) Date: Mon, 10 Dec 2018 10:27:35 +0000 Subject: [erlang-questions] PropER generator for list of records with a sequence number In-Reply-To: References: <9451072b-29b9-575c-7ee2-e01a3f5fea2a@gmail.com> Message-ID: Possible solution - move id assignment out of the generator into a thin wrapper around SUT. On Mon, Dec 10, 2018 at 7:59 AM Torben Hoffmann wrote: > Hi Frans, > > This will most likely run you into some problems with shrinking. > You would have to generate the next sequence number from the previous one, > but then no shrinking can be done since that would leave a gap in the > sequence numbers. > But maybe there is another way to do this that I can't think of right now. > > Cheers, > Torben > > On Mon, 10 Dec 2018 at 08:30, Frans Schneider > wrote: > >> Hi list, >> >> In PropER, I am looking for a way to generate records with one field >> being a sequence number which is incremented for each instance. >> >> -record(cache_change, {sequence_number :: sequence_number(), >> ... >> data_value :: term()). >> >> Every cache entry is supposed to have a new sequence number which is >> normally generated by the application, but I now want PropER to generate >> the sequence numbers to test drive the cache in isolation. >> >> How does one create a custom generator for this? >> >> Another, related question, is how to start an unregistered process (the >> cache) in PropER and use its pid? Normally, the caches are started from >> a simple-one-for-one supervisor. The cache should be restarted for every >> test run. PropER documentation and examples always show registered >> processes and not unregistered processes. >> >> Thanks, >> >> Frans >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > -- > http://www.linkedin.com/in/torbenhoffmann > @LeHoff > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Best regards, Paul Peregud +48602112091 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Mon Dec 10 12:18:37 2018 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Mon, 10 Dec 2018 12:18:37 +0100 Subject: [erlang-questions] PropER generator for list of records with a sequence number In-Reply-To: <9451072b-29b9-575c-7ee2-e01a3f5fea2a@gmail.com> References: <9451072b-29b9-575c-7ee2-e01a3f5fea2a@gmail.com> Message-ID: On Mon, Dec 10, 2018 at 8:30 AM Frans Schneider wrote: > Hi list, > > In PropER, I am looking for a way to generate records with one field > being a sequence number which is incremented for each instance. > > This is somewhat haphazard, you have been warned! Some questions/initial guesses: * If you run 100 proper tests, do you want the cache to be restarted 100 times, or just once? The former does not provide any kind of isolation between runs, which is usually not what you want to do. * Use `erlang:unique_integer` to provide a unique integer for each run, and feed it into the cache? * It isn't entirely clear what a run means to you, and what property you are trying to epoch-test. * If you have any kind of relations between commands toward your cache, you can look at stateful testing. * By "not entirely clear" I mean that the lifetime needs of your SUT and your test generator isn't really known to us. Some observations: * Observation: the seqno is "time". Time should often be injected. * Create your cache so you can start it with a given seqno. Feed this into the cache by injecting it as a parameter when you start it. * Your cache run can then assume that seqno. * If you go for a stateful test, you can then write properties which verifies the cache handles its seqno correctly, for all possible starting seqno. * Write a test where there is only a single key. Focus on the seqno since that is highly likely to contain an error. Once you have this, extend your model with multiple keys, but keep it low: 2 to 5 keys should be more than enough to capture almost all kinds of errors in the system. In a stateless model, the best you can do is generating random integers as sequence numbers and verify the cache does the right thing given its current state. Say it should ignore updates if a sequence number is too low. Then if we start with a large integer in the sequence, then most runs will just reject the input, as it should. In a stateful model, you can track the state of the cache and then generate sequence_numbers with the property they are monotonically increasing, which will make the system test the "real code". A stateful model would also fault-inject once in a while to test the case where the sequence number is too low. One big advantage of the stateful model is precision: when failure occurs, it knows the command sequence which made the failure occur, so it can often point to the culprit by shrinking. A stateless model needs to search more to find the problem. The disadvantage is that a stateful model requires more work to implement and get right. Personally, I'd just go with a stateful model immediately. Add a way to query your cache for its current contents. Then you can write your update commands such that they update, then query the cache state. This makes postconditions/invariants easy to write for the system. Start with a single command and work from there. As you add commands, you will start to find the problems in the SUT. I.e., the first goal should be to initialize the cache and then ask how large it is or something such. This should always be 0. Then stop the cache again. Next model could track if you updated a single key in the cache or not. So the size is either 0 or 1, depending on when that call happens. You can slowly extend the model from this simple initial idea until you cover everything. IF you want to go with a stateless model, generate a random list of operations to run against the cache. Run these against the cache and against a different local model you have. Then run an observation against both and fail if they don't agree. This provides isolation from run to run (your 100 test cases might run 10 cache operations each, roughly). However, many operations will not have effect, and the observations will be weaker than a stateful model, so you would have to do more runs before you hit a problem. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fchschneider@REDACTED Mon Dec 10 13:03:39 2018 From: fchschneider@REDACTED (Frans Schneider) Date: Mon, 10 Dec 2018 13:03:39 +0100 Subject: [erlang-questions] PropER generator for list of records with a sequence number In-Reply-To: References: <9451072b-29b9-575c-7ee2-e01a3f5fea2a@gmail.com> Message-ID: <934db7d8-95bb-6f8d-1784-76978af4cb7f@gmail.com> Thanks guys for the suggestions. I guess I'll have to add some extra code for starting and stopping the cache and generating the cache changes that PropER can use. I don't want to make changes to the application's code base to facilitate testing because that would give to much clutter. I'll also go for the stateful approach as suggested. PropER is great, but it takes some time to get used to it... Frans On 12/10/18 12:18 PM, Jesper Louis Andersen wrote: > On Mon, Dec 10, 2018 at 8:30 AM Frans Schneider > wrote: > > Hi list, > > In PropER, I am looking for a way to generate records with one field > being a sequence number which is incremented for each instance. > > > This is somewhat haphazard, you have been warned! > > Some questions/initial guesses: > > * If you run 100 proper tests, do you want the cache to be restarted 100 > times, or just once? The former does not provide any kind of isolation > between runs, which is usually not what you want to do. > * Use `erlang:unique_integer` to provide a unique integer for each run, > and feed it into the cache? > * It isn't entirely clear what a run means to you, and what property you > are trying to epoch-test. > * If you have any kind of relations between commands toward your cache, > you can look at stateful testing. > * By "not entirely clear" I mean that the lifetime needs of your SUT and > your test generator isn't really known to us. > > Some observations: > > * Observation: the seqno is "time". Time should often be injected. > * Create your cache so you can start it with a given seqno. Feed this > into the cache by injecting it as a parameter when you start it. > * Your cache run can then assume that seqno. > * If you go for a stateful test, you can then write properties which > verifies the cache handles its seqno correctly, for all possible > starting seqno. > * Write a test where there is only a single key. Focus on the seqno > since that is highly likely to contain an error. Once you have this, > extend your model with multiple keys, but keep it low: 2 to 5 keys > should be more than enough to capture almost all kinds of errors in the > system. > > In a stateless model, the best you can do is generating random integers > as sequence numbers and verify the cache does the right thing given its > current state. Say it should ignore updates if a sequence number is too > low. Then if we start with a large integer in the sequence, then most > runs will just reject the input, as it should. In a stateful model, you > can track the state of the cache and then generate sequence_numbers with > the property they are monotonically increasing, which will make the > system test the "real code". A stateful model would also fault-inject > once in a while to test the case where the sequence number is too low. > > One big advantage of the stateful model is precision: when failure > occurs, it knows the command sequence which made the failure occur, so > it can often point to the culprit by shrinking. A stateless model needs > to search more to find the problem. The disadvantage is that a stateful > model requires more work to implement and get right. > > Personally, I'd just go with a stateful model immediately. Add a way to > query your cache for its current contents. Then you can write your > update commands such that they update, then query the cache state. This > makes postconditions/invariants easy to write for the system. Start with > a single command and work from there. As you add commands, you will > start to find the problems in the SUT. I.e., the first goal should be to > initialize the cache and then ask how large it is or something such. > This should always be 0. Then stop the cache again. Next model could > track if you updated a single key in the cache or not. So the size is > either 0 or 1, depending on when that call happens. You can slowly > extend the model from this simple initial idea until you cover everything. > > IF you want to go with a stateless model, generate a random list of > operations to run against the cache. Run these against the cache and > against a different local model you have. Then run an observation > against both and fail if they don't agree. This provides isolation from > run to run (your 100 test cases might run 10 cache operations each, > roughly). However, many operations will not have effect, and the > observations will be weaker than a stateful model, so you would have to > do more runs before you hit a problem. > From denis.kirichenko@REDACTED Mon Dec 10 13:00:16 2018 From: denis.kirichenko@REDACTED (Denis Kirichenko) Date: Mon, 10 Dec 2018 16:00:16 +0400 Subject: [erlang-questions] Standard allocator memory leak Message-ID: <61074f77-9163-68ad-d9c0-b15c3bfea196@gmail.com> Hello. Does anybody can help me to debug std_alloc memory leak. Our production elixir/erlang application now leak for about 200MB a day. Recon shows that it is because of std_alloc. But standard allocator contains a lot of different types of data, and I don't know how to start debugging this problem. Any ideas? Any ways to inspect the erlang vm? > recon_alloc:memory(allocated_types). [{binary_alloc,173309952}, ?{driver_alloc,2392064}, ?{eheap_alloc,256114688}, ?{ets_alloc,155713536}, ?{fix_alloc,7897088}, ?{ll_alloc,35913728}, ?{sl_alloc,294912}, ?{std_alloc,1883799552}, %<<< 1.8G ?{temp_alloc,1179648}] > erlang:memory(). [{total,2098938448}, ?{processes,99837664}, ?{processes_used,99355784}, ?{system,1999100784}, %<<< 1.9G ?{atom,842689}, ?{atom_used,828419}, ?{binary,41062080}, ?{code,15612969}, ?{ets,88859304}] From lukas@REDACTED Mon Dec 10 13:37:21 2018 From: lukas@REDACTED (Lukas Larsson) Date: Mon, 10 Dec 2018 13:37:21 +0100 Subject: [erlang-questions] Standard allocator memory leak In-Reply-To: <61074f77-9163-68ad-d9c0-b15c3bfea196@gmail.com> References: <61074f77-9163-68ad-d9c0-b15c3bfea196@gmail.com> Message-ID: Hello! On Mon, Dec 10, 2018 at 1:20 PM Denis Kirichenko wrote: > Hello. Does anybody can help me to debug std_alloc memory leak. Our > production elixir/erlang application now leak for about 200MB a day. > Recon shows that it is because of std_alloc. But standard allocator > contains a lot of different types of data, and I don't know how to start > debugging this problem. Any ideas? Any ways to inspect the erlang vm? > > You can use the instrument module to get more information, http://erlang.org/doc/man/instrument.html Note that this module had a major overhaul in OTP-21. Lukas -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerhard@REDACTED Mon Dec 10 13:44:15 2018 From: gerhard@REDACTED (Gerhard Lazu) Date: Mon, 10 Dec 2018 12:44:15 +0000 Subject: [erlang-questions] Standard allocator memory leak In-Reply-To: <61074f77-9163-68ad-d9c0-b15c3bfea196@gmail.com> References: <61074f77-9163-68ad-d9c0-b15c3bfea196@gmail.com> Message-ID: Some resources that helped team RabbitMQ with a similar question: * Grafana BEAM Memory Allocators Dashboard * How can we increase multiblock carrier utilization for binary_alloc? * Help us determine better Erlang VM memory management configuration defaults for RabbitMQ * Use more optimal default memory allocators where available (Erlang 20.2.3 or later) OTP PR #2046 caught my attention (thanks @essen!) - less helpful, but something worth keeping an eye on. Hope this helps, Gerhard. On Mon, Dec 10, 2018 at 12:20 PM Denis Kirichenko < denis.kirichenko@REDACTED> wrote: > Hello. Does anybody can help me to debug std_alloc memory leak. Our > production elixir/erlang application now leak for about 200MB a day. > Recon shows that it is because of std_alloc. But standard allocator > contains a lot of different types of data, and I don't know how to start > debugging this problem. Any ideas? Any ways to inspect the erlang vm? > > > recon_alloc:memory(allocated_types). > [{binary_alloc,173309952}, > {driver_alloc,2392064}, > {eheap_alloc,256114688}, > {ets_alloc,155713536}, > {fix_alloc,7897088}, > {ll_alloc,35913728}, > {sl_alloc,294912}, > {std_alloc,1883799552}, %<<< 1.8G > {temp_alloc,1179648}] > > > erlang:memory(). > [{total,2098938448}, > {processes,99837664}, > {processes_used,99355784}, > {system,1999100784}, %<<< 1.9G > {atom,842689}, > {atom_used,828419}, > {binary,41062080}, > {code,15612969}, > {ets,88859304}] > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank.muller.erl@REDACTED Mon Dec 10 15:12:20 2018 From: frank.muller.erl@REDACTED (Frank Muller) Date: Mon, 10 Dec 2018 15:12:20 +0100 Subject: [erlang-questions] C++ NIF skeleton Message-ID: Hi guys, I?m looking for a ?C++ NIF skeleton? from a toy project. Any pointer I can look at? Thanks in advance. /Frank -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmytro.lytovchenko@REDACTED Mon Dec 10 15:23:10 2018 From: dmytro.lytovchenko@REDACTED (Dmytro Lytovchenko) Date: Mon, 10 Dec 2018 14:23:10 +0000 Subject: [erlang-questions] C++ NIF skeleton In-Reply-To: References: Message-ID: It is dangerous territory to go alone Please, take this http://beam-wisdoms.clau.se/en/latest/interfacing.html#native-libraries On Mon, 10 Dec 2018 at 14:12, Frank Muller wrote: > Hi guys, > > I?m looking for a ?C++ NIF skeleton? from a toy project. Any pointer I can > look at? > > Thanks in advance. > > /Frank > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank.muller.erl@REDACTED Mon Dec 10 18:50:00 2018 From: frank.muller.erl@REDACTED (Frank Muller) Date: Mon, 10 Dec 2018 18:50:00 +0100 Subject: [erlang-questions] C++ NIF skeleton In-Reply-To: References: Message-ID: Thanks a lot Dmytro. It is dangerous territory to go alone > Please, take this > http://beam-wisdoms.clau.se/en/latest/interfacing.html#native-libraries > > On Mon, 10 Dec 2018 at 14:12, Frank Muller > wrote: > >> Hi guys, >> >> I?m looking for a ?C++ NIF skeleton? from a toy project. Any pointer I >> can look at? >> >> Thanks in advance. >> >> /Frank >> > _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Mon Dec 10 22:29:04 2018 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Mon, 10 Dec 2018 22:29:04 +0100 Subject: [erlang-questions] PropER generator for list of records with a sequence number In-Reply-To: <934db7d8-95bb-6f8d-1784-76978af4cb7f@gmail.com> References: <9451072b-29b9-575c-7ee2-e01a3f5fea2a@gmail.com> <934db7d8-95bb-6f8d-1784-76978af4cb7f@gmail.com> Message-ID: On Mon, Dec 10, 2018 at 1:03 PM Frans Schneider wrote: > I don't want to make changes to the application's code base to > facilitate testing > because that would give to much clutter. > I'd beg you reconsider this stance. In my experience, adding tooling around an application in order to query its internal state in a well-defined way is often beneficial when there is a bug and you need to introspect the code in question. Debugging is often helped by having a canonical way to inspect and analyze the application. Also, if you need to run through hoops before you can test your code, chances are you are looking at the wrong API, so it should at least be entertained a better one might exist. In linear logic, there are two kinds of choice called "additive conjunction" and "additive disjunction". One type, conjunction, is controlled by either the PropER model or by the caller into the application/SUT. The other kind of choice, disjunction, is made by the application/SUT internally when it executes. Additive disjunctions are hard because they make the model unable to predict what will happen. So it has to guard against all types of outcome from the SUT/application, and this makes the models quite weak. The Wikipedia page has a nice example with a vendoring machine interpretation of the model[0], but the idea of a linear dialogue between a buyer and a vendoring machine is exactly mapped into an API user and the process behind the API, implementing it. One important point about PropER testing is that you must try to shift as much choice to be controlled by the model. This often requires an API where one can inject parameters from the outside to control the setup of certain states. You can always have a sane default which initializes if not overriden, and this is what I've often done. Important examples are that randomness and time must be controlled from the outside in some way. Otherwise, the system tend to become impossible to test. And it also hides important details to the user of the API to boot. [0] https://en.wikipedia.org/wiki/Linear_logic -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Tue Dec 11 05:49:19 2018 From: mononcqc@REDACTED (Fred Hebert) Date: Mon, 10 Dec 2018 23:49:19 -0500 Subject: [erlang-questions] PropER generator for list of records with a sequence number In-Reply-To: References: <9451072b-29b9-575c-7ee2-e01a3f5fea2a@gmail.com> <934db7d8-95bb-6f8d-1784-76978af4cb7f@gmail.com> Message-ID: On Mon, Dec 10, 2018 at 4:29 PM Jesper Louis Andersen < jesper.louis.andersen@REDACTED> wrote: > > One important point about PropER testing is that you must try to shift as > much choice to be controlled by the model. This often requires an API where > one can inject parameters from the outside to control the setup of certain > states. You can always have a sane default which initializes if not > overriden, and this is what I've often done. Important examples are that > randomness and time must be controlled from the outside in some way. > Otherwise, the system tend to become impossible to test. And it also hides > important details to the user of the API to boot. > One of the tips I recommend on propertesting.com is to use shim modules. If the API is not amenable to good control, the generator of the model at least has to be. So you might have a single call to "add_item(Id, Name, ...)" but various reactions according to whether the item exists or not. The shim module will act as a wrapper where you can instead expose calls like "add_existing_item(...)", "add_unknown_item(...)", or "add_malformed_item(...)". The generator, preconditions, next_state, and postconditions callback can then build their expectations based on the type of operation even though the underlying system handles calls by itself. It also makes it easier to make calls synchronous or asynchronous as long as the underlying system exposes them. It also helps to do things like change a successful return value that you want to store in the state from {ok, Pid} to just Pid, and then pass it back to the next generated call such that it won't clash with the opaque placeholders the framework uses. this does require the system under test to have at least some level of control given to build this higher-level test-only abstraction, but it helps make things simpler. The one case I can think of where you may want to adapt your system is when it comes to timeout handling. Ensuring some calls timeout while succeeding or failing is rather difficult and may not always work with a shim, especially in async interfaces. For those, having a way to configure or override timers might be necessary. But I would also like to violently agree with the notion that the model has to drive the test, which implies that you can, without looking at the system (aside from opaque types like generated IDs that you store in placeholders), create a full predictable execution with useful invariants to check. This can quickly become tricky when you have some non-deterministic results (N/M requests might be dropped), so you have to be careful. -------------- next part -------------- An HTML attachment was scrubbed... URL: From getonga2018@REDACTED Tue Dec 11 10:25:12 2018 From: getonga2018@REDACTED (=?UTF-8?B?MTjlubTmoqbphpI=?=) Date: Tue, 11 Dec 2018 17:25:12 +0800 Subject: [erlang-questions] Is the monitor/2 function is much efficient in erlang 21? Message-ID: I recently test the sbroker in erlang 21, but the skip_down_match test is always failed, I check out the code and make a prototype of the code: ``` -module(a). -export([start/0]). start() -> Pid = spawn(fun() -> t() end), register(t_name, Pid), spawn(fun() -> t1() end), timer:sleep(1000). t1() -> {_, _MRef} = spawn_monitor(fun() -> Pid = whereis(t_name), Pid ! {pid, self()}, exit(normal) end). t() -> receive {pid, Pid} -> Ref = monitor(process, Pid), case demonitor(Ref, [flush, info]) of true -> io:format("result is true"); false -> io:format("result is false") end end. ``` I run it like this: ``` $ /usr/local/otp_src_21.1.4/bin/erlc a.erl $ /usr/local/otp_src_21.1.4/bin/erl -s a start -s init stop -noinput result is true $ rm a.beam $ /usr/local/otp_src_20.3.8.15/bin/erlc a.erl $ /usr/local/otp_src_20.3.8.15/bin/erl -s a start -s init stop -noinput result is false ``` The same code, in erlang 21, the output is `result is true`, but in erlang 20, the output is `result is false`, that is why the test fail. I just wonder why the same code but different version, why the result is different? Is the behaviour changed with the monitor/2 function? -------------- next part -------------- An HTML attachment was scrubbed... URL: From sverker@REDACTED Tue Dec 11 12:26:43 2018 From: sverker@REDACTED (Sverker Eriksson) Date: Tue, 11 Dec 2018 12:26:43 +0100 Subject: [erlang-questions] Is the monitor/2 function is much efficient in erlang 21? In-Reply-To: References: Message-ID: <1544527602.10784.16.camel@erlang.org> On tis, 2018-12-11 at 17:25 +0800, 18??? wrote: > I recently test the sbroker in erlang 21, but the?skip_down_match test is > always failed, I check out the code and make a prototype of the code: > ``` > -module(a). > > -export([start/0]). > > start() -> > ? ? Pid = spawn(fun() -> t() end), > ? ? register(t_name, Pid), > ? ? spawn(fun() -> t1() end), > ? ? timer:sleep(1000). > > t1() -> > ? ? {_, _MRef} = spawn_monitor(fun() -> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Pid = whereis(t_name), > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Pid ! {pid, self()}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?exit(normal) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?end). > t() -> > ? ? receive > ? ? ? ? {pid, Pid} -> > ? ? ? ? ? ? Ref = monitor(process, Pid), > ? ? ? ? ? ? case demonitor(Ref, [flush, info]) of > ? ? ? ? ? ? ? ? true -> > ? ? ? ? ? ? ? ? ? ? io:format("result is true"); > ? ? ? ? ? ? ? ? false -> > ? ? ? ? ? ? ? ? ? ? io:format("result is false") > ? ? ? ? ? ? end > ? ? end. > Yes the behavior has changed in 21, but both behaviors are correct and you are not guaranteed to always get the same behavior in any OTP version. The program contains a race condition. At the time demonitor(Ref, [flush,info]) is called you don't know if the monitored process is still alive or not. If it's still alive, the monitor will be remove and demonitor returns true. If it's not alive, no monitor exists (a 'DOWN' message/signal has instead been sent which will be removed by the 'flush' option) and demonitor will return false. /Sverker -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Tue Dec 11 14:21:18 2018 From: erlang@REDACTED (Stefan Marr) Date: Tue, 11 Dec 2018 13:21:18 +0000 Subject: [erlang-questions] Call for Extended Abstracts: MoreVMs'19 Message-ID: <8B47DDE2-3BF5-4E91-8890-DF3D47DD8FFA@stefan-marr.de> ============================================================================ Call for Extended Abstracts: MoreVMs'19 3rd Workshop on Modern Language Runtimes, and Ecosystems Co-located with '19 April 1st or 2nd, 2019, Genova, Italy https://2019.programming-conference.org/track/MoreVMs-2019 ============================================================================ Following two previous successful editions, the MoreVMs'19 workshop aims to bring together industrial and academic programmers to discuss the design, implementation, and usage of modern languages and runtimes. This includes aspects such as reuse of language runtimes, modular implementation, language design and compilation strategies. By bringing together both researchers and practitioners, the workshop aims to enable a diverse discussion on how languages and runtimes are currently being utilized, and where they need to improve further. Relevant topics include, but are definitely not limited to, the following: - Extensible VM design (compiler- or interpreter-based VMs) - Reusable components (e.g. interpreters, garbage collectors, ...) - Static and dynamic compilation techniques - Techniques for targeting high-level languages such as JavaScript - Interoperability between languages - Tooling support (e.g. debugging, profiling, etc.) - Programming language development environments - Case studies of existing language implementation approaches - Language implementation challenges and trade-offs - Surveys and usage reports to understand usage in the wild - Ideas for more predictable performance - Ideas for how VMs could take advantage of new hardware features - Ideas for how we should build languages in the future Workshop Format and Submissions ------------------------------- We welcome presentation proposals in the form of extended abstracts (1 to 2 pages long) discussing experiences, work-in-progress, as well as future visions, from either an academic or industrial perspective. The extended abstracts, and if the speakers wish, their slides, will be published on the workshop's web site. Alternatively, the abstracts can be published as part of the companion of '19 in the ACM DL. Publication in the ACM DL is conditional on the acceptance by the program committee. Please note that MoreVMs'19 is organized as an academic workshop, and as such, speakers will be required to register for the workshop. Author Instructions ------------------- Submissions should use the ACM Conference 'acmart' Format with the 'sigconf' option and with a font size of 9 point and the font family Libertine/Biolinum. All submissions should be in PDF format. If you use LaTeX or Word, please use the provided ACM acmart templates. Otherwise, please follow the ACM author instructions. If you are formatting your paper using Word, you may wish to use the provided Word template that supports this font size. Please include page numbers in your submission for review using the LaTeX command '\settopmatter{printfolios=true}' (see examples in template). Please also ensure that your submission is legible when printed on a black and white printer. In particular, please check that colors remain distinct and font sizes are legible. Submission Site: https://easychair.org/conferences/?conf=morevms19 Important Dates --------------- Extended abstract submissions: 2019-01-11 Author notification: 2019-02-10 Camera Ready: 2019-02-22 Workshop: 2019-04-01 or 2019-04-02 All deadlines are Anywhere on Earth (AoE), i.e. GMT/UTC-12:00 hour. Program Committee ----------------- Nicolas B. Pierron, Mozilla, France Walter Binder, University of Lugano, Switzerland Eduard-Mihai Burtescu, Lyken Software Solutions Vyacheslav Egorov, Google, Denmark Tony Hosking, Australian National University / Data61, Australia Christoph Kirsch, University of Salzburg, Austria Lun Liu, University of California at Los Angeles, USA Fabio Niephaus, Hasso Plattner Institute, Germany Lu?s Pina, George Mason University, USA Manuel Rigger, Johannes Kepler University Linz, Austria Jennifer B. Sartor, Ghent University, Belgium Andy Wingo, Igalia, S.L., France Organizers ---------- Edd Barrett, King's College London, UK Stefan Marr, University of Kent, UK Adam Welc, Uber Technologies, USA -- Stefan Marr School of Computing, University of Kent http://stefan-marr.de/research/ From henrik.x.nord@REDACTED Tue Dec 11 15:09:11 2018 From: henrik.x.nord@REDACTED (Henrik Nord X) Date: Tue, 11 Dec 2018 14:09:11 +0000 Subject: [erlang-questions] Patch Package OTP 21.2 Released Message-ID: <1544537351.3583.25.camel@ericsson.com> Erlang/OTP 21.2 is the second service release for the 21st major release with, improvements as well as a few features! Highlights: SSH: * Public key methods: ssh-ed25519 and ssh-ed448 added. Requires OpenSSL 1.1.1 or later as cryptolib under the OTP application SSL: * ssl now uses active n internally to boost performance. Old active once behaviour can be restored by setting a application variable. ERTS, Kernel: * New counters and atomics modules supplies access to highly efficient operations on mutable fixed word sized variables. * New module persistent_term!. Lookups are in constant time! No copying the terms! * New pollset made to handle sockets that use {active, true} or {active, N}. Polled by a normal scheduler! * No more ONESHOT mechanism overhead on fds! Only on Linux and BSD For a full list of details see: http://erlang.org/download/otp_src_21.2.readme Pre built versions for Windows can be fetched here: http://erlang.org/download/otp_win32_21.2.exe http://erlang.org/download/otp_win64_21.2.exe Online documentation can be browsed here: http://erlang.org/documentation/doc-10.2/doc The Erlang/OTP source can also be found at GitHub on the official Erlang repository, Here:? https://github.com/erlang/otp/releases/tag/OTP-21.2 Please report any new issues via Erlang/OTPs public issue tracker https://bugs.erlang.org We want to thank all of those who sent us patches, suggestions and bug reports! Thank you! The Erlang/OTP Team at Ericsson From bchesneau@REDACTED Tue Dec 11 21:19:52 2018 From: bchesneau@REDACTED (Benoit Chesneau) Date: Tue, 11 Dec 2018 21:19:52 +0100 Subject: [erlang-questions] C++ NIF skeleton In-Reply-To: References: Message-ID: On Mon, Dec 10, 2018 at 3:12 PM Frank Muller wrote: > Hi guys, > > I?m looking for a ?C++ NIF skeleton? from a toy project. Any pointer I can > look at? > > Thanks in advance. > > /Frank > > You can look at https://github.com/goertzenator/nifpp to make some quick and "dirty". Just for my curiosity but what are you trying to do? - benoit -------------- next part -------------- An HTML attachment was scrubbed... URL: From soverdor@REDACTED Wed Dec 12 00:54:52 2018 From: soverdor@REDACTED (Sam Overdorf) Date: Tue, 11 Dec 2018 15:54:52 -0800 Subject: [erlang-questions] otp 21.2 Message-ID: This version does not load my ".erlang" file when I run "escript". If I run "erl" it gets loaded as expected. Thanks, Sam Overdorf soverdor@REDACTED From dgud@REDACTED Wed Dec 12 07:35:38 2018 From: dgud@REDACTED (Dan Gudmundsson) Date: Wed, 12 Dec 2018 07:35:38 +0100 Subject: [erlang-questions] otp 21.2 In-Reply-To: References: Message-ID: Loading .erlang have intentionally been removed from escript, as noted in the release notes for 21.0. You can load it manually from your escripts if want, see c:erlangrc/1 On Wed, Dec 12, 2018 at 12:46 AM Sam Overdorf wrote: > This version does not load my ".erlang" file when I run "escript". > If I run "erl" it gets loaded as expected. > Thanks, > Sam Overdorf > soverdor@REDACTED > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenneth@REDACTED Wed Dec 12 07:44:32 2018 From: kenneth@REDACTED (Kenneth Lundin) Date: Wed, 12 Dec 2018 07:44:32 +0100 Subject: [erlang-questions] otp 21.2 In-Reply-To: References: Message-ID: Den ons 12 dec. 2018 00:47 skrev Sam Overdorf : > This version does not load my ".erlang" file when I run "escript". > If I run "erl" it gets loaded as expected. > This is a change made on purpose, and introduced in 21.0. In the README for OTP-21.0 we have: --- Improvements and New Features --- OTP-14439 Application(s): compiler, dialyzer, erts, stdlib *** POTENTIAL INCOMPATIBILITY *** Changed the default behaviour of .erlang loading: .erlang is no longer loaded from the current directory. c:erlangrc(PathList) can be used to search and load an .erlang file from user specified directories. escript, erlc, dialyzer and typer no longer load an .erlang at all. /Kenneth Erlang/OTP, Ericsson > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Wed Dec 12 11:24:35 2018 From: bob@REDACTED (Bob Cowdery) Date: Wed, 12 Dec 2018 10:24:35 +0000 Subject: [erlang-questions] Maps and binaries Message-ID: <4544a9ce-ea3e-592d-fac4-db60a7c6bff3@bobcowdery.plus.com> Hi, Its a long time since using Erlang so just getting back in. I know that there is always better ways to do things so is there a better patten matching way than this straight forward step-wise method. I have output from a UDP request put through jstone:decode which ends up like so: #{<<"outputs">> => ????? [#{<<"api">> => <<"MME">>,<<"channels">> => 2,<<"direction">> => 1, ???????? <<"index">> => 5,<<"name">> => <<"Microsoft Sound Mapper - Output">>}, ?????? #{<<"api">> => <<"MME">>,<<"channels">> => 8,<<"direction">> => 1, ???????? <<"index">> => 6,<<"name">> => <<"Speakers (Realtek High Definiti">>}, ... ???? #{<<"api">> => <<>>,<<"channels">> => 0,<<"direction">> => 0, ???????? <<"index">> => 0,<<"name">> => <<>>}]} I want to extract the second member api and name. ??? Map = jsone:decode(Resp), ??? List = maps:get(<<"outputs">>, Map), ??? Element = lists:nth(2, List), ??? Api = my_binary_to_list(maps:get(<<"api">>, Element)), ??? Dev = my_binary_to_list(maps:get(<<"name">>, Element)), ??? io:format("~p, ~p~n", [Api, Dev]). my_binary_to_list(<>) -> ??? [H|my_binary_to_list(T)]; my_binary_to_list(<<>>) -> []. prints: "MME", "Speakers (Realtek High Definiti" Thanks in advance, Bob From essen@REDACTED Wed Dec 12 11:29:50 2018 From: essen@REDACTED (=?UTF-8?Q?Lo=c3=afc_Hoguin?=) Date: Wed, 12 Dec 2018 11:29:50 +0100 Subject: [erlang-questions] Maps and binaries In-Reply-To: <4544a9ce-ea3e-592d-fac4-db60a7c6bff3@bobcowdery.plus.com> References: <4544a9ce-ea3e-592d-fac4-db60a7c6bff3@bobcowdery.plus.com> Message-ID: <807d7df9-5338-af6e-3a13-45634fe414e9@ninenines.eu> Just match directly and let io:format convert for you: #{<<"outputs">> := [_, #{ <<"api">> := Api, <<"name">> := Dev }|_]} = jsone:decode(Resp), io:format("\"~s\", \"~s\"~n", [Api, Dev]). Or ~ts if it can have Unicode characters. On 12/12/18 11:24 AM, Bob Cowdery wrote: > Hi, > > Its a long time since using Erlang so just getting back in. I know that > there is always better ways to do things so is there a better patten > matching way than this straight forward step-wise method. > I have output from a UDP request put through jstone:decode which ends up > like so: > #{<<"outputs">> => > ????? [#{<<"api">> => <<"MME">>,<<"channels">> => 2,<<"direction">> => 1, > ???????? <<"index">> => 5,<<"name">> => <<"Microsoft Sound Mapper - > Output">>}, > ?????? #{<<"api">> => <<"MME">>,<<"channels">> => 8,<<"direction">> => 1, > ???????? <<"index">> => 6,<<"name">> => <<"Speakers (Realtek High > Definiti">>}, > ... > ???? #{<<"api">> => <<>>,<<"channels">> => 0,<<"direction">> => 0, > ???????? <<"index">> => 0,<<"name">> => <<>>}]} > I want to extract the second member api and name. > > ??? Map = jsone:decode(Resp), > ??? List = maps:get(<<"outputs">>, Map), > ??? Element = lists:nth(2, List), > ??? Api = my_binary_to_list(maps:get(<<"api">>, Element)), > ??? Dev = my_binary_to_list(maps:get(<<"name">>, Element)), > ??? io:format("~p, ~p~n", [Api, Dev]). > > my_binary_to_list(<>) -> > ??? [H|my_binary_to_list(T)]; > my_binary_to_list(<<>>) -> []. > > prints: > > "MME", "Speakers (Realtek High Definiti" > > Thanks in advance, Bob > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Lo?c Hoguin https://ninenines.eu From hugo@REDACTED Wed Dec 12 11:37:52 2018 From: hugo@REDACTED (Hugo Mills) Date: Wed, 12 Dec 2018 10:37:52 +0000 Subject: [erlang-questions] Maps and binaries In-Reply-To: <4544a9ce-ea3e-592d-fac4-db60a7c6bff3@bobcowdery.plus.com> References: <4544a9ce-ea3e-592d-fac4-db60a7c6bff3@bobcowdery.plus.com> Message-ID: <20181212103752.GF10099@carfax.org.uk> Hi, Bob, On Wed, Dec 12, 2018 at 10:24:35AM +0000, Bob Cowdery wrote: > Its a long time since using Erlang so just getting back in. I know > that there is always better ways to do things so is there a better > patten matching way than this straight forward step-wise method. > I have output from a UDP request put through jstone:decode which > ends up like so: > #{<<"outputs">> => > ????? [#{<<"api">> => <<"MME">>,<<"channels">> => 2,<<"direction">> => 1, > ???????? <<"index">> => 5,<<"name">> => <<"Microsoft Sound Mapper - > Output">>}, > ?????? #{<<"api">> => <<"MME">>,<<"channels">> => 8,<<"direction">> => 1, > ???????? <<"index">> => 6,<<"name">> => <<"Speakers (Realtek High > Definiti">>}, > ... > ???? #{<<"api">> => <<>>,<<"channels">> => 0,<<"direction">> => 0, > ???????? <<"index">> => 0,<<"name">> => <<>>}]} > I want to extract the second member api and name. > > ??? Map = jsone:decode(Resp), > ??? List = maps:get(<<"outputs">>, Map), > ??? Element = lists:nth(2, List), > ??? Api = my_binary_to_list(maps:get(<<"api">>, Element)), > ??? Dev = my_binary_to_list(maps:get(<<"name">>, Element)), > ??? io:format("~p, ~p~n", [Api, Dev]). This seems perfectly reasonable as it is. However, you can pattern-match maps this way: #{<<"outputs">> := List} = Map and if you know that it's always going to be the second entry in the list, you can pattern-match that with this: [_, Element | _] = List Note that with the map pattern, the key must always be either a literal or a bound variable. Also note the required use of :=, which is the "mandatory key" syntax, as opposed to =>, which is "optional key". You can match multiple key/value pairs in a map in a single pattern. > my_binary_to_list(<>) -> > ??? [H|my_binary_to_list(T)]; > my_binary_to_list(<<>>) -> []. Why not just use binary_to_list/1 in the erlang module? Hugo. > prints: > > "MME", "Speakers (Realtek High Definiti" > > Thanks in advance, Bob > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Hugo Mills | Doughnut furs ache me, Omar Dorlin hugo@REDACTED carfax.org.uk | http://carfax.org.uk/ | PGP: E2AB1DE4 | Steve Bell -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From bob@REDACTED Wed Dec 12 15:58:54 2018 From: bob@REDACTED (Bob Cowdery) Date: Wed, 12 Dec 2018 14:58:54 +0000 Subject: [erlang-questions] Maps and binaries In-Reply-To: <20181212103752.GF10099@carfax.org.uk> References: <4544a9ce-ea3e-592d-fac4-db60a7c6bff3@bobcowdery.plus.com> <20181212103752.GF10099@carfax.org.uk> Message-ID: <2967afce-b65c-64e3-08e7-249976666388@bobcowdery.plus.com> Hi Hugo Thanks, all good points. This is test code just sorting out how to do things. I have a problem with encoding now. This is my map: msg(set_audio_route) -> #{<<"cmd">> => <<"set_audio_route">>, <<"params">> => []}; to which I add parameters and encode. PMsg = maps:put(<<"params">>, [1, "LOCAL", 1, Api, Dev, "BOTH"], msg(set_audio_route)), FullMsg = jsone:encode(PMsg), This encodes to: SetRoute - <<"{\"cmd\":\"set_audio_route\",\"params\":[1,[76,79,67,65,76],1,[77,77,69],[83,112,101,97,107,101,114,115,32,40,82,101,97,108,116,101,107,32,72,105,103,104,32,68,101,102,105,110,105,116,105],[66,79,84,72]]}">> The problem is my C lib when I decode the Json is expecting strings in the list and it gets lists. I'm doing this in a few languages at the moment so can't change the C for one language when its working for others. Is there a way around this? Bob) On 12/12/2018 10:37, Hugo Mills wrote: > Hi, Bob, > > On Wed, Dec 12, 2018 at 10:24:35AM +0000, Bob Cowdery wrote: >> Its a long time since using Erlang so just getting back in. I know >> that there is always better ways to do things so is there a better >> patten matching way than this straight forward step-wise method. >> I have output from a UDP request put through jstone:decode which >> ends up like so: >> #{<<"outputs">> => >> ????? [#{<<"api">> => <<"MME">>,<<"channels">> => 2,<<"direction">> => 1, >> ???????? <<"index">> => 5,<<"name">> => <<"Microsoft Sound Mapper - >> Output">>}, >> ?????? #{<<"api">> => <<"MME">>,<<"channels">> => 8,<<"direction">> => 1, >> ???????? <<"index">> => 6,<<"name">> => <<"Speakers (Realtek High >> Definiti">>}, >> ... >> ???? #{<<"api">> => <<>>,<<"channels">> => 0,<<"direction">> => 0, >> ???????? <<"index">> => 0,<<"name">> => <<>>}]} >> I want to extract the second member api and name. >> >> ??? Map = jsone:decode(Resp), >> ??? List = maps:get(<<"outputs">>, Map), >> ??? Element = lists:nth(2, List), >> ??? Api = my_binary_to_list(maps:get(<<"api">>, Element)), >> ??? Dev = my_binary_to_list(maps:get(<<"name">>, Element)), >> ??? io:format("~p, ~p~n", [Api, Dev]). > This seems perfectly reasonable as it is. However, you can > pattern-match maps this way: > > #{<<"outputs">> := List} = Map > > and if you know that it's always going to be the second entry in the > list, you can pattern-match that with this: > > [_, Element | _] = List > > Note that with the map pattern, the key must always be either a > literal or a bound variable. Also note the required use of :=, which > is the "mandatory key" syntax, as opposed to =>, which is "optional > key". You can match multiple key/value pairs in a map in a single > pattern. > >> my_binary_to_list(<>) -> >> ??? [H|my_binary_to_list(T)]; >> my_binary_to_list(<<>>) -> []. > Why not just use binary_to_list/1 in the erlang module? > > Hugo. > >> prints: >> >> "MME", "Speakers (Realtek High Definiti" >> >> Thanks in advance, Bob >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From hugo@REDACTED Wed Dec 12 16:06:34 2018 From: hugo@REDACTED (Hugo Mills) Date: Wed, 12 Dec 2018 15:06:34 +0000 Subject: [erlang-questions] Maps and binaries In-Reply-To: <2967afce-b65c-64e3-08e7-249976666388@bobcowdery.plus.com> References: <4544a9ce-ea3e-592d-fac4-db60a7c6bff3@bobcowdery.plus.com> <20181212103752.GF10099@carfax.org.uk> <2967afce-b65c-64e3-08e7-249976666388@bobcowdery.plus.com> Message-ID: <20181212150634.GH10099@carfax.org.uk> On Wed, Dec 12, 2018 at 02:58:54PM +0000, Bob Cowdery wrote: > Hi Hugo > > Thanks, all good points. This is test code just sorting out how to > do things. I have a problem with encoding now. > > This is my map: > > msg(set_audio_route) -> #{<<"cmd">> => <<"set_audio_route">>, > <<"params">> => []}; > > to which I add parameters and encode. > PMsg = maps:put(<<"params">>, [1, "LOCAL", 1, Api, Dev, "BOTH"], > msg(set_audio_route)), > FullMsg = jsone:encode(PMsg), > > This encodes to: > > SetRoute - <<"{\"cmd\":\"set_audio_route\",\"params\":[1,[76,79,67,65,76],1,[77,77,69],[83,112,101,97,107,101,114,115,32,40,82,101,97,108,116,101,107,32,72,105,103,104,32,68,101,102,105,110,105,116,105],[66,79,84,72]]}">> I don't know the jsone library, but it looks like it's encoding binaries to strings, and lists to lists (whether the lists are intended to be strings or not). This kind of makes sense, given the way erlang represents strings, in that it gives the encoder a concrete statement of what to encode as a string and what as a list. Does it do the right thing if you write <<"LOCAL">> and <<"BOTH">>, and you don't convert Api and Dev to a list? Hugo. > The problem is my C lib when I decode the Json is expecting strings > in the list and it gets lists. I'm doing this in a few languages at > the moment so can't change the C for one language when its working > for others. Is there a way around this? > > Bob) > > On 12/12/2018 10:37, Hugo Mills wrote: > > Hi, Bob, > > > >On Wed, Dec 12, 2018 at 10:24:35AM +0000, Bob Cowdery wrote: > >>Its a long time since using Erlang so just getting back in. I know > >>that there is always better ways to do things so is there a better > >>patten matching way than this straight forward step-wise method. > >>I have output from a UDP request put through jstone:decode which > >>ends up like so: > >>#{<<"outputs">> => > >> ????? [#{<<"api">> => <<"MME">>,<<"channels">> => 2,<<"direction">> => 1, > >> ???????? <<"index">> => 5,<<"name">> => <<"Microsoft Sound Mapper - > >>Output">>}, > >> ?????? #{<<"api">> => <<"MME">>,<<"channels">> => 8,<<"direction">> => 1, > >> ???????? <<"index">> => 6,<<"name">> => <<"Speakers (Realtek High > >>Definiti">>}, > >>... > >> ???? #{<<"api">> => <<>>,<<"channels">> => 0,<<"direction">> => 0, > >> ???????? <<"index">> => 0,<<"name">> => <<>>}]} > >>I want to extract the second member api and name. > >> > >> ??? Map = jsone:decode(Resp), > >> ??? List = maps:get(<<"outputs">>, Map), > >> ??? Element = lists:nth(2, List), > >> ??? Api = my_binary_to_list(maps:get(<<"api">>, Element)), > >> ??? Dev = my_binary_to_list(maps:get(<<"name">>, Element)), > >> ??? io:format("~p, ~p~n", [Api, Dev]). > > This seems perfectly reasonable as it is. However, you can > >pattern-match maps this way: > > > > #{<<"outputs">> := List} = Map > > > >and if you know that it's always going to be the second entry in the > >list, you can pattern-match that with this: > > > > [_, Element | _] = List > > > > Note that with the map pattern, the key must always be either a > >literal or a bound variable. Also note the required use of :=, which > >is the "mandatory key" syntax, as opposed to =>, which is "optional > >key". You can match multiple key/value pairs in a map in a single > >pattern. > > > >>my_binary_to_list(<>) -> > >> ??? [H|my_binary_to_list(T)]; > >>my_binary_to_list(<<>>) -> []. > > Why not just use binary_to_list/1 in the erlang module? > > > > Hugo. > > > >>prints: > >> > >>"MME", "Speakers (Realtek High Definiti" > >> > >>Thanks in advance, Bob > >>_______________________________________________ > >>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 -- Hugo Mills | Every time you make a typo, the errorists win. hugo@REDACTED carfax.org.uk | http://carfax.org.uk/ | PGP: E2AB1DE4 | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From bob@REDACTED Wed Dec 12 16:34:01 2018 From: bob@REDACTED (Bob Cowdery) Date: Wed, 12 Dec 2018 15:34:01 +0000 Subject: [erlang-questions] Maps and binaries In-Reply-To: <20181212150634.GH10099@carfax.org.uk> References: <4544a9ce-ea3e-592d-fac4-db60a7c6bff3@bobcowdery.plus.com> <20181212103752.GF10099@carfax.org.uk> <2967afce-b65c-64e3-08e7-249976666388@bobcowdery.plus.com> <20181212150634.GH10099@carfax.org.uk> Message-ID: <8f76a2bb-2fcd-dd82-3b93-caf12d013829@bobcowdery.plus.com> Yes it does, thank you. I tried a few things around that theme but didn't do it quite right. On 12/12/2018 15:06, Hugo Mills wrote: > On Wed, Dec 12, 2018 at 02:58:54PM +0000, Bob Cowdery wrote: >> Hi Hugo >> >> Thanks, all good points. This is test code just sorting out how to >> do things. I have a problem with encoding now. >> >> This is my map: >> >> msg(set_audio_route) -> #{<<"cmd">> => <<"set_audio_route">>, >> <<"params">> => []}; >> >> to which I add parameters and encode. >> PMsg = maps:put(<<"params">>, [1, "LOCAL", 1, Api, Dev, "BOTH"], >> msg(set_audio_route)), >> FullMsg = jsone:encode(PMsg), >> >> This encodes to: >> >> SetRoute - <<"{\"cmd\":\"set_audio_route\",\"params\":[1,[76,79,67,65,76],1,[77,77,69],[83,112,101,97,107,101,114,115,32,40,82,101,97,108,116,101,107,32,72,105,103,104,32,68,101,102,105,110,105,116,105],[66,79,84,72]]}">> > I don't know the jsone library, but it looks like it's encoding > binaries to strings, and lists to lists (whether the lists are > intended to be strings or not). This kind of makes sense, given the > way erlang represents strings, in that it gives the encoder a concrete > statement of what to encode as a string and what as a list. > > Does it do the right thing if you write <<"LOCAL">> and <<"BOTH">>, > and you don't convert Api and Dev to a list? > > Hugo. > >> The problem is my C lib when I decode the Json is expecting strings >> in the list and it gets lists. I'm doing this in a few languages at >> the moment so can't change the C for one language when its working >> for others. Is there a way around this? >> >> Bob) >> >> On 12/12/2018 10:37, Hugo Mills wrote: >>> Hi, Bob, >>> >>> On Wed, Dec 12, 2018 at 10:24:35AM +0000, Bob Cowdery wrote: >>>> Its a long time since using Erlang so just getting back in. I know >>>> that there is always better ways to do things so is there a better >>>> patten matching way than this straight forward step-wise method. >>>> I have output from a UDP request put through jstone:decode which >>>> ends up like so: >>>> #{<<"outputs">> => >>>> ????? [#{<<"api">> => <<"MME">>,<<"channels">> => 2,<<"direction">> => 1, >>>> ???????? <<"index">> => 5,<<"name">> => <<"Microsoft Sound Mapper - >>>> Output">>}, >>>> ?????? #{<<"api">> => <<"MME">>,<<"channels">> => 8,<<"direction">> => 1, >>>> ???????? <<"index">> => 6,<<"name">> => <<"Speakers (Realtek High >>>> Definiti">>}, >>>> ... >>>> ???? #{<<"api">> => <<>>,<<"channels">> => 0,<<"direction">> => 0, >>>> ???????? <<"index">> => 0,<<"name">> => <<>>}]} >>>> I want to extract the second member api and name. >>>> >>>> ??? Map = jsone:decode(Resp), >>>> ??? List = maps:get(<<"outputs">>, Map), >>>> ??? Element = lists:nth(2, List), >>>> ??? Api = my_binary_to_list(maps:get(<<"api">>, Element)), >>>> ??? Dev = my_binary_to_list(maps:get(<<"name">>, Element)), >>>> ??? io:format("~p, ~p~n", [Api, Dev]). >>> This seems perfectly reasonable as it is. However, you can >>> pattern-match maps this way: >>> >>> #{<<"outputs">> := List} = Map >>> >>> and if you know that it's always going to be the second entry in the >>> list, you can pattern-match that with this: >>> >>> [_, Element | _] = List >>> >>> Note that with the map pattern, the key must always be either a >>> literal or a bound variable. Also note the required use of :=, which >>> is the "mandatory key" syntax, as opposed to =>, which is "optional >>> key". You can match multiple key/value pairs in a map in a single >>> pattern. >>> >>>> my_binary_to_list(<>) -> >>>> ??? [H|my_binary_to_list(T)]; >>>> my_binary_to_list(<<>>) -> []. >>> Why not just use binary_to_list/1 in the erlang module? >>> >>> Hugo. >>> >>>> prints: >>>> >>>> "MME", "Speakers (Realtek High Definiti" >>>> >>>> Thanks in advance, Bob >>>> _______________________________________________ >>>> 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 steve@REDACTED Wed Dec 12 16:40:53 2018 From: steve@REDACTED (Steve Strong) Date: Wed, 12 Dec 2018 15:40:53 +0000 Subject: [erlang-questions] cowboy_static / file:sendfile Message-ID: Hi, I?m seeing a potential issue with file:sendfile if the client shuts down the connection. My setup is a cowboy server with a simple cowboy_static endpoint, and a rate-limited curl as the client - if I start the curl download and then ctrl-c curl before it completes, cowboy sits hung inside the call to sendfile. I inspected the cowboy process as follows: (file_encoder@REDACTED)83> P = processes(). [<0.0.0>,<0.1.0>,<0.2.0>,<0.3.0>,<0.4.0>,<0.5.0>,<0.8.0>, <0.40.0>,<0.42.0>,<0.44.0>,<0.45.0>,<0.47.0>,<0.48.0>, <0.50.0>,<0.51.0>,<0.52.0>,<0.53.0>,<0.54.0>,<0.55.0>, <0.56.0>,<0.57.0>,<0.58.0>,<0.59.0>,<0.60.0>,<0.61.0>, <0.62.0>,<0.63.0>,<0.64.0>,<0.65.0>|?] %% Run curl and ctrl-c in a separate window? (file_encoder@REDACTED)84> erlang:process_info(hd(processes() -- P), [current_function, messages]). [{current_function,{prim_inet,sendfile_1,4}}, {messages,[{'EXIT',<0.1798.0>,normal}, {tcp_closed,#Port<0.266>}, {inet_reply,#Port<0.266>,{error,closed}}]}] This process looks doomed to live forever - it is stuck in prim_inet:sendfile_1 on the following receive: receive {sendfile, S, {ok, SentLow, SentHigh}} -> {ok, SentLow bor (SentHigh bsl 32)}; {sendfile, S, {error, Reason}} -> {error, Reason}; {'EXIT', S, _Reason} -> {error, closed} end The port that it had opened, 0.266, has closed so there will never be an exit message: (file_encoder@REDACTED)89> erlang:ports(). [#Port<0.0>,#Port<0.2>,#Port<0.4>,#Port<0.5>,#Port<0.6>, #Port<0.8>,#Port<0.10>,#Port<0.11>,#Port<0.12>,#Port<0.13>, #Port<0.14>,#Port<0.15>,#Port<0.16>,#Port<0.254>, #Port<0.255>,#Port<0.256>,#Port<0.257>,#Port<0.258>, #Port<0.259>,#Port<0.260>,#Port<0.261>,#Port<0.262>, #Port<0.263>,#Port<0.264>] I?m guessing the process wasn?t linked with the port, or it would have received the exit message and all would have been well. Unsure if this is a cowboy or prim_inet bug, or indeed if I?ve done something wrong. Any ideas? Cheers, Steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Wed Dec 12 16:52:09 2018 From: essen@REDACTED (=?UTF-8?Q?Lo=c3=afc_Hoguin?=) Date: Wed, 12 Dec 2018 16:52:09 +0100 Subject: [erlang-questions] cowboy_static / file:sendfile In-Reply-To: References: Message-ID: Hello, This might have been fixed in OTP-21.2: OTP-15461 Application(s): erts Related Id(s): ERL-784 Fixed bug in file:sendfile when the send operation failed. For sockets in active modes it could cause emulator crash or a hanging call. For sockets with {active,false} an unexpected {inet_reply, _, _} message could be sent to the calling process. The bug exists since OTP-21.0. On 12/12/18 4:40 PM, Steve Strong wrote: > Hi, > > I?m seeing a potential issue with file:sendfile if the client shuts down > the connection. ?My setup is a cowboy server with a simple cowboy_static > endpoint, and a rate-limited curl as the client - if I start the curl > download and then ctrl-c curl before it completes, cowboy sits hung > inside the call to sendfile. > > I inspected the cowboy process as follows: > > (file_encoder@REDACTED )83> P = processes(). > [<0.0.0>,<0.1.0>,<0.2.0>,<0.3.0>,<0.4.0>,<0.5.0>,<0.8.0>, > ?<0.40.0>,<0.42.0>,<0.44.0>,<0.45.0>,<0.47.0>,<0.48.0>, > ?<0.50.0>,<0.51.0>,<0.52.0>,<0.53.0>,<0.54.0>,<0.55.0>, > ?<0.56.0>,<0.57.0>,<0.58.0>,<0.59.0>,<0.60.0>,<0.61.0>, > ?<0.62.0>,<0.63.0>,<0.64.0>,<0.65.0>|?] > > %% Run curl and ctrl-c in a separate window? > > (file_encoder@REDACTED )84> > erlang:process_info(hd(processes() -- P), [current_function, messages]). > [{current_function,{prim_inet,sendfile_1,4}}, > ?{messages,[{'EXIT',<0.1798.0>,normal}, > ? ? ? ? ? ? {tcp_closed,#Port<0.266>}, > ? ? ? ? ? ? {inet_reply,#Port<0.266>,{error,closed}}]}] > > > This process looks doomed to live forever - it is stuck in > prim_inet:sendfile_1 on the following receive: > > ? ? ? receive > ? ? ? ? {sendfile, S, {ok, SentLow, SentHigh}} -> > ? ? ? ? ? {ok, SentLow bor (SentHigh bsl 32)}; > ? ? ? ? {sendfile, S, {error, Reason}} -> > ? ? ? ? ? {error, Reason}; > ? ? ? ? {'EXIT', S, _Reason} -> > ? ? ? ? ? {error, closed} > ? ? ? end > > The port that it had opened, 0.266, has closed so there will never be an > exit message: > > (file_encoder@REDACTED )89> erlang:ports(). > [#Port<0.0>,#Port<0.2>,#Port<0.4>,#Port<0.5>,#Port<0.6>, > ?#Port<0.8>,#Port<0.10>,#Port<0.11>,#Port<0.12>,#Port<0.13>, > ?#Port<0.14>,#Port<0.15>,#Port<0.16>,#Port<0.254>, > ?#Port<0.255>,#Port<0.256>,#Port<0.257>,#Port<0.258>, > ?#Port<0.259>,#Port<0.260>,#Port<0.261>,#Port<0.262>, > ?#Port<0.263>,#Port<0.264>] > > I?m guessing the process wasn?t linked with the port, or it would have > received the exit message and all would have been well. ?Unsure if this > is a cowboy or prim_inet bug, or indeed if I?ve done something wrong. > ?Any ideas? > > Cheers, > > Steve > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Lo?c Hoguin https://ninenines.eu From soverdor@REDACTED Thu Dec 13 00:15:48 2018 From: soverdor@REDACTED (Sam Overdorf) Date: Wed, 12 Dec 2018 15:15:48 -0800 Subject: [erlang-questions] otp 21.2 In-Reply-To: References: Message-ID: "erl" still has the behavior of loading the ".erlangrc". Shouldn't it have the same behavior as escript to be consistent? Thanks, Sam On Tue, Dec 11, 2018 at 10:44 PM Kenneth Lundin wrote: > > > > Den ons 12 dec. 2018 00:47 skrev Sam Overdorf : >> >> This version does not load my ".erlang" file when I run "escript". >> If I run "erl" it gets loaded as expected. > > > This is a change made on purpose, and introduced in 21.0. > > In the README for OTP-21.0 we have: > > --- Improvements and New Features --- > > OTP-14439 Application(s): compiler, dialyzer, erts, stdlib > > *** POTENTIAL INCOMPATIBILITY *** > > Changed the default behaviour of .erlang loading: > .erlang is no longer loaded from the current directory. > c:erlangrc(PathList) can be used to search and load an > .erlang file from user specified directories. > > escript, erlc, dialyzer and typer no longer load an > .erlang at all. > > /Kenneth Erlang/OTP, Ericsson >> >> From raoknz@REDACTED Thu Dec 13 00:15:49 2018 From: raoknz@REDACTED (Richard O'Keefe) Date: Thu, 13 Dec 2018 12:15:49 +1300 Subject: [erlang-questions] otp 21.2 In-Reply-To: References: Message-ID: The .erlang file is a customisation file for "erl". It's just like the way a .gdbinit file will be read if you run a C program under GDB. On Thu, 13 Dec 2018 at 12:08, Sam Overdorf wrote: > "erl" still has the behavior of loading the ".erlangrc". Shouldn't it > have the same behavior as escript to be consistent? > > Thanks, > Sam > > > > > > > On Tue, Dec 11, 2018 at 10:44 PM Kenneth Lundin > wrote: > > > > > > > > Den ons 12 dec. 2018 00:47 skrev Sam Overdorf : > >> > >> This version does not load my ".erlang" file when I run "escript". > >> If I run "erl" it gets loaded as expected. > > > > > > This is a change made on purpose, and introduced in 21.0. > > > > In the README for OTP-21.0 we have: > > > > --- Improvements and New Features --- > > > > OTP-14439 Application(s): compiler, dialyzer, erts, stdlib > > > > *** POTENTIAL INCOMPATIBILITY *** > > > > Changed the default behaviour of .erlang loading: > > .erlang is no longer loaded from the current directory. > > c:erlangrc(PathList) can be used to search and load an > > .erlang file from user specified directories. > > > > escript, erlc, dialyzer and typer no longer load an > > .erlang at all. > > > > /Kenneth Erlang/OTP, Ericsson > >> > >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From soverdor@REDACTED Thu Dec 13 00:30:27 2018 From: soverdor@REDACTED (Sam Overdorf) Date: Wed, 12 Dec 2018 15:30:27 -0800 Subject: [erlang-questions] otp 21.2 In-Reply-To: References: Message-ID: I believe you missed the point that they "erl" and "escript" should have the same behavior. Sam On Wed, Dec 12, 2018 at 3:16 PM Richard O'Keefe wrote: > > The .erlang file is a customisation file for "erl". > It's just like the way a .gdbinit file will be read > if you run a C program under GDB. > > > On Thu, 13 Dec 2018 at 12:08, Sam Overdorf wrote: >> >> "erl" still has the behavior of loading the ".erlangrc". Shouldn't it >> have the same behavior as escript to be consistent? >> >> Thanks, >> Sam >> >> >> >> >> >> >> On Tue, Dec 11, 2018 at 10:44 PM Kenneth Lundin wrote: >> > >> > >> > >> > Den ons 12 dec. 2018 00:47 skrev Sam Overdorf : >> >> >> >> This version does not load my ".erlang" file when I run "escript". >> >> If I run "erl" it gets loaded as expected. >> > >> > >> > This is a change made on purpose, and introduced in 21.0. >> > >> > In the README for OTP-21.0 we have: >> > >> > --- Improvements and New Features --- >> > >> > OTP-14439 Application(s): compiler, dialyzer, erts, stdlib >> > >> > *** POTENTIAL INCOMPATIBILITY *** >> > >> > Changed the default behaviour of .erlang loading: >> > .erlang is no longer loaded from the current directory. >> > c:erlangrc(PathList) can be used to search and load an >> > .erlang file from user specified directories. >> > >> > escript, erlc, dialyzer and typer no longer load an >> > .erlang at all. >> > >> > /Kenneth Erlang/OTP, Ericsson >> >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From 2QdxY4RzWzUUiLuE@REDACTED Thu Dec 13 01:23:47 2018 From: 2QdxY4RzWzUUiLuE@REDACTED (Dan Sommers) Date: Wed, 12 Dec 2018 18:23:47 -0600 Subject: [erlang-questions] otp 21.2 In-Reply-To: References: Message-ID: <45a41641-81c2-50c5-d62f-59535e687c2e@potatochowder.com> On 12/12/18 5:30 PM, Sam Overdorf wrote: > I believe you missed the point that they "erl" and "escript" should > have the same behavior. I don't know the exact reason for the change, but if your escript depends on your .erlang file, then you can't share it with anyone. In fact, if your escript even just loads your .erlang file, then you can't share it with anyone. I believe that the correct behaviour for escript is *not* to read a .erlang file, unless directed to do so explicitly. Dan From frank.muller.erl@REDACTED Thu Dec 13 08:07:03 2018 From: frank.muller.erl@REDACTED (Frank Muller) Date: Thu, 13 Dec 2018 08:07:03 +0100 Subject: [erlang-questions] Connect to an old Erlang node Message-ID: Hi guys Can I disable this behaviour when connecting to an old node with no support for UTF8 atoms? (client@REDACTED)1> =ERROR REPORT==== 17-Nov-2017::00:32:12 === ** server@REDACTED: Connection attempt from node server@REDACTED rejected since it cannot handle ["UTF8_ATOMS"].** I?m not using UTF8 at all and just want to be able to connect. Is there a flag to disable this? Thank you. /Frank -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Thu Dec 13 10:05:48 2018 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 13 Dec 2018 12:05:48 +0300 Subject: [erlang-questions] small post about ordered_set and partially-bound keys Message-ID: Erlang ets with ordered_set mode has very cool feature: partially bound tuple primary key that allows to use ets as a good old binary tree. I haven't found any good explanations of how to use, so have written some draft of post: https://medium.com/@max.lapshin/how-we-adopted-partial-ordered-set-in-erlang-782f773349f4 Would be glad for any feedback. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lukas@REDACTED Thu Dec 13 11:01:44 2018 From: lukas@REDACTED (Lukas Larsson) Date: Thu, 13 Dec 2018 11:01:44 +0100 Subject: [erlang-questions] Connect to an old Erlang node In-Reply-To: References: Message-ID: On Thu, Dec 13, 2018 at 8:07 AM Frank Muller wrote: > Hi guys > > Can I disable this behaviour when connecting to an old node with no support > for UTF8 atoms? > > (client@REDACTED)1> > > =ERROR REPORT==== 17-Nov-2017::00:32:12 === > > ** server@REDACTED: Connection attempt from node server@REDACTED rejected since it > cannot handle ["UTF8_ATOMS"].** > > > I?m not using UTF8 at all and just want to be able to connect. > > > Is there a flag to disable this? > No. The support to talk using latin1 atoms has been removed from the VM on newer versions of Erlang. > > Thank you. > > /Frank > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas.schultz@REDACTED Thu Dec 13 12:25:26 2018 From: andreas.schultz@REDACTED (Andreas Schultz) Date: Thu, 13 Dec 2018 12:25:26 +0100 Subject: [erlang-questions] small post about ordered_set and partially-bound keys In-Reply-To: References: Message-ID: Max Lapshin schrieb am Do., 13. Dez. 2018 um 10:06 Uhr: > Erlang ets with ordered_set mode has very cool feature: partially bound > tuple primary key that allows to use ets as a good old binary tree. > > I haven't found any good explanations of how to use, so have written some > draft of post: > > https://medium.com/@max.lapshin/how-we-adopted-partial-ordered-set-in-erlang-782f773349f4 > You don't need to play tricks with ets:fun2ms/1. It is mostly a helper so that you don't have to think to much about the structure of a match spec yourself. But, you can still construct the same spec manually. So, instead of: ets:fun2ms(fun (#segment{utc={_,_,_}} = Segment) -> true end) You can simply use: [{#segment{utc = {'_','_','_'}, _ = '_'}, [], [true]}] Or to use your sample: match_spec_hour(Name, Hour, true) -> [{#segment{utc = {Name,Hour,'_'}, _ = '_'}, [], [true]}]; match_spec_hour(Name, Hour, segment) -> [{#segment{utc = {Name,Hour,'_'}, _ = '_'}, [], ['$_']}]. Regards Andreas > > Would be glad for any feedback. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- -- Dipl.-Inform. Andreas Schultz ----------------------- enabling your networks ---------------------- Travelping GmbH Phone: +49-391-81 90 99 0 Roentgenstr. 13 Fax: +49-391-81 90 99 299 39108 Magdeburg Email: info@REDACTED GERMANY Web: http://www.travelping.com Company Registration: Amtsgericht Stendal Reg No.: HRB 10578 Geschaeftsfuehrer: Holger Winkelmann VAT ID No.: DE236673780 --------------------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From vans_163@REDACTED Thu Dec 13 15:23:13 2018 From: vans_163@REDACTED (Vans S) Date: Thu, 13 Dec 2018 14:23:13 +0000 (UTC) Subject: [erlang-questions] open_port + spawn and closing the spawned application when port closes References: <211674047.4069757.1544710993659.ref@mail.yahoo.com> Message-ID: <211674047.4069757.1544710993659@mail.yahoo.com> I recall there was a way to do this by basho but wondering if there are new alternatives recently. Basically the example is a simple one, open_port({spawn, "curl -L "http://releases.ubuntu.com/18.04.1.0/ubuntu-18.04.1.0-live-server-amd64.iso?" --progress-bar -o /dev/null"}) now kill the process, close the port, or kill the emulator.? The curl process keeps running.? I believe it was when the port closes, stdin/stdout closes for the process, and the work around was to wrap the process in a bash script that would detect stdin/out closed, and terminate the process it wrapped. Any thoughts on this, or perhaps help finding that bash script again? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Thu Dec 13 19:03:02 2018 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 13 Dec 2018 19:03:02 +0100 Subject: [erlang-questions] mnesia_leveled - experimental new Mnesia backend plugin Message-ID: At Aeternity, we've been using the rocksdb plugin for Mnesia for some time, but apart from porting problems to Windows, we're a bit annoyed at the long compile times. So we started testing an alternative: leveled [2] is primarily intended as a replacement for LevelDb as a Riak backend, but the mnesia plugin API is sufficiently narrow that it might work there too. Leveled has the nice property that it's (almost) entirely written in Erlang, so it should be a lot easier to get running on different platforms. The `mnesia_leveled` [3] plugin is still experimental, but if you want to play around with it and perhaps contribute, it will be much appreciated. Note: the mnesia_leveled test suite will currently fail on vanilla OTP, but does pass with a patch that is currently pending in a pull request [4]. The failure is only relevant if you intend to use indexing plugins (though of course, why wouldn't you want to?). BR, Ulf W [1] https://github.com/aeternity/mnesia_rocksdb [2] https://github.com/martinsumner/leveled [3] https://github.com/aeternity/mnesia_leveled [4] https://github.com/erlang/otp/pull/1695 -------------- next part -------------- An HTML attachment was scrubbed... URL: From steve@REDACTED Thu Dec 13 19:10:39 2018 From: steve@REDACTED (Steve Strong) Date: Thu, 13 Dec 2018 18:10:39 +0000 Subject: [erlang-questions] cowboy_static / file:sendfile In-Reply-To: References: Message-ID: Yes, 21.2 appears to have solved it - thanks! > On 12 Dec 2018, at 15:52, Lo?c Hoguin wrote: > > Hello, > > This might have been fixed in OTP-21.2: > > OTP-15461 Application(s): erts > Related Id(s): ERL-784 > > Fixed bug in file:sendfile when the send operation > failed. For sockets in active modes it could cause > emulator crash or a hanging call. For sockets with > {active,false} an unexpected {inet_reply, _, _} message > could be sent to the calling process. The bug exists > since OTP-21.0. > > On 12/12/18 4:40 PM, Steve Strong wrote: >> Hi, >> I?m seeing a potential issue with file:sendfile if the client shuts down the connection. My setup is a cowboy server with a simple cowboy_static endpoint, and a rate-limited curl as the client - if I start the curl download and then ctrl-c curl before it completes, cowboy sits hung inside the call to sendfile. >> I inspected the cowboy process as follows: >> (file_encoder@REDACTED )83> P = processes(). >> [<0.0.0>,<0.1.0>,<0.2.0>,<0.3.0>,<0.4.0>,<0.5.0>,<0.8.0>, >> <0.40.0>,<0.42.0>,<0.44.0>,<0.45.0>,<0.47.0>,<0.48.0>, >> <0.50.0>,<0.51.0>,<0.52.0>,<0.53.0>,<0.54.0>,<0.55.0>, >> <0.56.0>,<0.57.0>,<0.58.0>,<0.59.0>,<0.60.0>,<0.61.0>, >> <0.62.0>,<0.63.0>,<0.64.0>,<0.65.0>|?] >> %% Run curl and ctrl-c in a separate window? >> (file_encoder@REDACTED )84> erlang:process_info(hd(processes() -- P), [current_function, messages]). >> [{current_function,{prim_inet,sendfile_1,4}}, >> {messages,[{'EXIT',<0.1798.0>,normal}, >> {tcp_closed,#Port<0.266>}, >> {inet_reply,#Port<0.266>,{error,closed}}]}] >> This process looks doomed to live forever - it is stuck in prim_inet:sendfile_1 on the following receive: >> receive >> {sendfile, S, {ok, SentLow, SentHigh}} -> >> {ok, SentLow bor (SentHigh bsl 32)}; >> {sendfile, S, {error, Reason}} -> >> {error, Reason}; >> {'EXIT', S, _Reason} -> >> {error, closed} >> end >> The port that it had opened, 0.266, has closed so there will never be an exit message: >> (file_encoder@REDACTED )89> erlang:ports(). >> [#Port<0.0>,#Port<0.2>,#Port<0.4>,#Port<0.5>,#Port<0.6>, >> #Port<0.8>,#Port<0.10>,#Port<0.11>,#Port<0.12>,#Port<0.13>, >> #Port<0.14>,#Port<0.15>,#Port<0.16>,#Port<0.254>, >> #Port<0.255>,#Port<0.256>,#Port<0.257>,#Port<0.258>, >> #Port<0.259>,#Port<0.260>,#Port<0.261>,#Port<0.262>, >> #Port<0.263>,#Port<0.264>] >> I?m guessing the process wasn?t linked with the port, or it would have received the exit message and all would have been well. Unsure if this is a cowboy or prim_inet bug, or indeed if I?ve done something wrong. Any ideas? >> Cheers, >> Steve >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > -- > Lo?c Hoguin > https://ninenines.eu From kostis@REDACTED Fri Dec 14 16:36:39 2018 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 14 Dec 2018 16:36:39 +0100 Subject: [erlang-questions] Big band playing Message-ID: <601e4ab3-532c-06fe-5e2b-c7b283475b2a@cs.ntua.gr> We have been playing with CutEr (https://github.com/aggelgian/cuter), a Concolic unit testing tool for Erlang, and discovered the following bug in the implementation of bitwise and (band/2) operator: Erlang/OTP 21 [erts-10.2] [source-2bf2b70] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [sharing-preserving] Eshell V10.2 (abort with ^G) 1> (-1299341865233935136534120785510400) band (-1). -1299341865233953583278194495062016 which is the wrong result, of course. Most likely, it has existed forever. Kostis From ebegumisa@REDACTED Fri Dec 14 16:52:59 2018 From: ebegumisa@REDACTED (Edmond Begumisa) Date: Sat, 15 Dec 2018 01:52:59 +1000 Subject: [erlang-questions] Patch Package OTP 21.2 Released In-Reply-To: <1544537351.3583.25.camel@ericsson.com> References: <1544537351.3583.25.camel@ericsson.com> Message-ID: On Wed, 12 Dec 2018 00:09:11 +1000, Henrik Nord X wrote: > Erlang/OTP 21.2 is the second service release for the 21st major > release with, improvements as well as a few features! > > Highlights: > > SSH: > > * Public key methods: ssh-ed25519 and ssh-ed448 added. Requires OpenSSL > 1.1.1 or later as cryptolib under the OTP application > > SSL: > > * ssl now uses active n internally to boost performance. Old active > once behaviour can be restored by setting a application variable. > > ERTS, Kernel: > > * New counters and atomics modules supplies access to highly efficient > operations on mutable fixed word sized variables. > > * New module persistent_term!. Lookups are in constant time! No copying > the terms! > WOW! This persistent_term module is very interesting [1], and already see many places in both my private and work codebase where it will be a godsend. However, I fear that there is going to be a lot of abuse. The temptation to use this as a global shared memory quick-and-dirty alternative to more elaborate better thought through designs is going to be too irresistible to many. The downside to many projects these days using rebar3 and the resulting deep dependencies, is that it's increasingly more difficult to avoid abuse instigated by others being introduced into your system (as we're seeing with quick-and-dirty NIFs). I foresee many projects looking at those warnings in the persistent_term docs and thinking "I've weighed it, and I think my project is 'special' enough to call put/1 and erase/1 a little more frequently than the documentation suggests, or have more entries than is recommended, and I have my reasons for not using ETS instead". With deep dependencies pulled down from github, this kind of thinking gets compounded and infectious. I wish there was a way of providing protections against that sort of thing. I can't think of one. Other than that, bravo! This is a very useful feature. [1] My immediate thought is a replacement for runtime re-compiled and re-loaded configuration modules which make use the ERTS constant pool -- I've been using these a lot. persistent_term would solve the lingering purge process-killing problem that the hot-loading approach to config suffers from. > * New pollset made to handle sockets that use {active, true} or > {active, N}. Polled by a normal scheduler! > > * No more ONESHOT mechanism overhead on fds! Only on Linux and BSD > > For a full list of details see: > http://erlang.org/download/otp_src_21.2.readme > > Pre built versions for Windows can be fetched here: > http://erlang.org/download/otp_win32_21.2.exe > http://erlang.org/download/otp_win64_21.2.exe > > Online documentation can be browsed here: > http://erlang.org/documentation/doc-10.2/doc > > The Erlang/OTP source can also be found at GitHub on the official > Erlang repository, Here: > https://github.com/erlang/otp/releases/tag/OTP-21.2 > > Please report any new issues via Erlang/OTPs public issue tracker > https://bugs.erlang.org > > We want to thank all of those who sent us patches, suggestions and bug > reports! > > Thank you! > > The Erlang/OTP Team at Ericsson > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Using Opera's mail client: http://www.opera.com/mail/ From eric.pailleau@REDACTED Sat Dec 15 19:09:14 2018 From: eric.pailleau@REDACTED (PAILLEAU Eric) Date: Sat, 15 Dec 2018 19:09:14 +0100 Subject: [erlang-questions] [ANN] geas 2.4.0 (Erlang 21.2) Message-ID: Hi Geas 2.4.0 has been released ! Geas is a tool detecting the runnable official Erlang release window for your project. Geas will tell you also : - what are the offending functions in the beam/source files that reduce the available window. - if some beam files are compiled native. - the installed patches and recommend patches that should be installed depending your code. Geas is available as a module, erlang.mk and rebar 2/3 plugins. Changelog : - Update for Erlang 21.2 detection and database - geas and geas_rebar3 plugin are now both available on hex.pm https://github.com/crownedgrouse/geas https://github.com/crownedgrouse/geas/releases/tag/2.4.0 Cheers ! Eric From mikpelinux@REDACTED Sat Dec 15 19:30:11 2018 From: mikpelinux@REDACTED (Mikael Pettersson) Date: Sat, 15 Dec 2018 19:30:11 +0100 Subject: [erlang-questions] Big band playing In-Reply-To: <601e4ab3-532c-06fe-5e2b-c7b283475b2a@cs.ntua.gr> References: <601e4ab3-532c-06fe-5e2b-c7b283475b2a@cs.ntua.gr> Message-ID: On Fri, Dec 14, 2018 at 4:32 PM Kostis Sagonas wrote: > > We have been playing with CutEr (https://github.com/aggelgian/cuter), a > Concolic unit testing tool for Erlang, and discovered the following bug > in the implementation of bitwise and (band/2) operator: > > Erlang/OTP 21 [erts-10.2] [source-2bf2b70] [64-bit] [smp:8:8] > [ds:8:8:10] [async-threads:1] [hipe] [sharing-preserving] > > Eshell V10.2 (abort with ^G) > 1> (-1299341865233935136534120785510400) band (-1). > -1299341865233953583278194495062016 > > > which is the wrong result, of course. > > Most likely, it has existed forever. Looks like an old bug, I was able to reproduce it with every release back to R16B03 (R15B03 wouldn't build due to perl errors). It's a single-bit error where the least significant bit of the most significant word (in the bignum representation) gets set. The call chain in big.c is big_band() -> I_band() -> I_btrail() -> D_add(), that D_add() gets 1 as initial carry, and that's what's setting the bit incorrectly. I might look a little further, but this needs the eyes of someone more familiar with the bignum code. /Mikael From kostis@REDACTED Sat Dec 15 20:23:19 2018 From: kostis@REDACTED (Kostis Sagonas) Date: Sat, 15 Dec 2018 20:23:19 +0100 Subject: [erlang-questions] Big band playing In-Reply-To: References: <601e4ab3-532c-06fe-5e2b-c7b283475b2a@cs.ntua.gr> Message-ID: <7d090675-e9ef-013e-db41-9e386f51b79f@cs.ntua.gr> On 12/15/18 7:30 PM, Mikael Pettersson wrote: > On Fri, Dec 14, 2018 at 4:32 PM Kostis Sagonas wrote: >> We have been playing with CutEr (https://github.com/aggelgian/cuter), a >> Concolic unit testing tool for Erlang, and discovered the following bug >> in the implementation of bitwise and (band/2) operator: >> >> Erlang/OTP 21 [erts-10.2] [source-2bf2b70] [64-bit] [smp:8:8] >> [ds:8:8:10] [async-threads:1] [hipe] [sharing-preserving] >> >> Eshell V10.2 (abort with ^G) >> 1> (-1299341865233935136534120785510400) band (-1). >> -1299341865233953583278194495062016 >> >> >> which is the wrong result, of course. >> >> Most likely, it has existed forever. > Looks like an old bug, I was able to reproduce it with every release > back to R16B03 (R15B03 wouldn't build due to perl errors). I was able to reproduce this on an old R12 version that I still have around: Erlang (BEAM) emulator version 5.6.5 [source] [64-bit] [smp:64] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.5 (abort with ^G) 1> (-1299341865233935136534120785510400) band (-1). -1299341865233953583278194495062016 I would not be surprised if this bug existed even before Erlang/OTP became open source. Kostis From soverdor@REDACTED Sun Dec 16 00:51:18 2018 From: soverdor@REDACTED (Sam Overdorf) Date: Sat, 15 Dec 2018 15:51:18 -0800 Subject: [erlang-questions] otp 21.2 In-Reply-To: <45a41641-81c2-50c5-d62f-59535e687c2e@potatochowder.com> References: <45a41641-81c2-50c5-d62f-59535e687c2e@potatochowder.com> Message-ID: This kind of defeats the purpose of an ".rc" file. The unix world uses them to set default behavior for scripts and programs. Now I have to remember to add "c:erlangrc()" to each of my programs. If I forget to do this then OOPs things don't work correctly. Sam On Wed, Dec 12, 2018 at 9:01 PM Dan Sommers <2QdxY4RzWzUUiLuE@REDACTED> wrote: > > On 12/12/18 5:30 PM, Sam Overdorf wrote: > > I believe you missed the point that they "erl" and "escript" should > > have the same behavior. > > I don't know the exact reason for the change, but if your escript > depends on your .erlang file, then you can't share it with anyone. > > In fact, if your escript even just loads your .erlang file, then > you can't share it with anyone. > > I believe that the correct behaviour for escript is *not* to read > a .erlang file, unless directed to do so explicitly. > > Dan > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From andrew@REDACTED Sun Dec 16 01:30:03 2018 From: andrew@REDACTED (Andrew Thompson) Date: Sat, 15 Dec 2018 19:30:03 -0500 Subject: [erlang-questions] otp 21.2 In-Reply-To: References: <45a41641-81c2-50c5-d62f-59535e687c2e@potatochowder.com> Message-ID: <20181216003003.GH1783@thecloud.hijacked.us> On Sat, Dec 15, 2018 at 03:51:18PM -0800, Sam Overdorf wrote: > This kind of defeats the purpose of an ".rc" file. > The unix world uses them to set default behavior for scripts and programs. > Now I have to remember to add "c:erlangrc()" to each of my programs. > If I forget to do this then OOPs things don't work correctly. This is like expecting bash shell scripts to source your ~/.bashrc. .bashrc is only sourced for interactive shells, not non-interactive shells, like the one invoked by the shebang line in a shell script. Arguably you're relying on incorrect behaviour in escript and you should adjust your usage accordingly. Andrew From mjtruog@REDACTED Sun Dec 16 07:44:13 2018 From: mjtruog@REDACTED (Michael Truog) Date: Sat, 15 Dec 2018 22:44:13 -0800 Subject: [erlang-questions] Avoiding Problems In-Reply-To: References: <1544537351.3583.25.camel@ericsson.com> Message-ID: On 12/14/18 7:52 AM, Edmond Begumisa wrote: > > WOW! This persistent_term module is very interesting [1], and already > see many places in both my private and work codebase where it will be > a godsend. > > However, I fear that there is going to be a lot of abuse. > > The temptation to use this as a global shared memory quick-and-dirty > alternative to more elaborate better thought through designs is going > to be too irresistible to many. The downside to many projects these > days using rebar3 and the resulting deep dependencies, is that it's > increasingly more difficult to avoid abuse instigated by others being > introduced into your system (as we're seeing with quick-and-dirty NIFs). > > I foresee many projects looking at those warnings in the > persistent_term docs and thinking "I've weighed it, and I think my > project is 'special' enough to call put/1 and erase/1 a little more > frequently than the documentation suggests, or have more entries than > is recommended, and I have my reasons for not using ETS instead". With > deep dependencies pulled down from github, this kind of thinking gets > compounded and infectious. > > I wish there was a way of providing protections against that sort of > thing. I can't think of one. For avoiding NIFs/port-drivers and other problems that relate to security, I created https://github.com/okeuday/pest .? PEST is a static analysis tool that looks for function calls it knows are problematic in Erlang source code and provides information about where the problems occur.? You could also use the PEST source code to identify other function calls that should be avoided if you are concerned about persistent_term. Best Regards, Michael From n.oxyde@REDACTED Sun Dec 16 17:21:17 2018 From: n.oxyde@REDACTED (Anthony Ramine) Date: Sun, 16 Dec 2018 17:21:17 +0100 Subject: [erlang-questions] Patch Package OTP 21.2 Released In-Reply-To: References: <1544537351.3583.25.camel@ericsson.com> Message-ID: <00EDBA90-5CD3-4711-B157-ED5974C6A4CB@gmail.com> Are you saying you don't do due diligence and just pull dependencies in your project without reviewing them? > Le 14 d?c. 2018 ? 16:52, Edmond Begumisa a ?crit : > > I foresee many projects looking at those warnings in the persistent_term docs and thinking "I've weighed it, and I think my project is 'special' enough to call put/1 and erase/1 a little more frequently than the documentation suggests, or have more entries than is recommended, and I have my reasons for not using ETS instead". With deep dependencies pulled down from github, this kind of thinking gets compounded and infectious. From mikpelinux@REDACTED Sun Dec 16 19:08:34 2018 From: mikpelinux@REDACTED (Mikael Pettersson) Date: Sun, 16 Dec 2018 19:08:34 +0100 Subject: [erlang-questions] Big band playing In-Reply-To: <7d090675-e9ef-013e-db41-9e386f51b79f@cs.ntua.gr> References: <601e4ab3-532c-06fe-5e2b-c7b283475b2a@cs.ntua.gr> <7d090675-e9ef-013e-db41-9e386f51b79f@cs.ntua.gr> Message-ID: On Sat, Dec 15, 2018 at 8:19 PM Kostis Sagonas wrote: > > On 12/15/18 7:30 PM, Mikael Pettersson wrote: > > On Fri, Dec 14, 2018 at 4:32 PM Kostis Sagonas wrote: > >> We have been playing with CutEr (https://github.com/aggelgian/cuter), a > >> Concolic unit testing tool for Erlang, and discovered the following bug > >> in the implementation of bitwise and (band/2) operator: > >> > >> Erlang/OTP 21 [erts-10.2] [source-2bf2b70] [64-bit] [smp:8:8] > >> [ds:8:8:10] [async-threads:1] [hipe] [sharing-preserving] > >> > >> Eshell V10.2 (abort with ^G) > >> 1> (-1299341865233935136534120785510400) band (-1). > >> -1299341865233953583278194495062016 > >> > >> > >> which is the wrong result, of course. > >> > >> Most likely, it has existed forever. > > Looks like an old bug, I was able to reproduce it with every release > > back to R16B03 (R15B03 wouldn't build due to perl errors). > > I was able to reproduce this on an old R12 version that I still have around: > > Erlang (BEAM) emulator version 5.6.5 [source] [64-bit] [smp:64] > [async-threads:0] [hipe] [kernel-poll:false] > > Eshell V5.6.5 (abort with ^G) > 1> (-1299341865233935136534120785510400) band (-1). > -1299341865233953583278194495062016 > > > I would not be surprised if this bug existed even before Erlang/OTP > became open source. I did some more debugging, but wasn't able to pin-point the error (I have two suspects, but the big.c code is non-obvious so it's difficult to tell). Anyway, I opened https://bugs.erlang.org/browse/ERL-804 for this issue, linking back to your original post here. /Mikael From ebegumisa@REDACTED Sun Dec 16 20:26:14 2018 From: ebegumisa@REDACTED (Edmond Begumisa) Date: Mon, 17 Dec 2018 05:26:14 +1000 Subject: [erlang-questions] Avoiding Problems In-Reply-To: References: <1544537351.3583.25.camel@ericsson.com> Message-ID: On Sun, 16 Dec 2018 16:44:13 +1000, Michael Truog wrote: > On 12/14/18 7:52 AM, Edmond Begumisa wrote: >> >> WOW! This persistent_term module is very interesting [1], and already >> see many places in both my private and work codebase where it will be a >> godsend. >> >> However, I fear that there is going to be a lot of abuse. >> >> The temptation to use this as a global shared memory quick-and-dirty >> alternative to more elaborate better thought through designs is going >> to be too irresistible to many. The downside to many projects these >> days using rebar3 and the resulting deep dependencies, is that it's >> increasingly more difficult to avoid abuse instigated by others being >> introduced into your system (as we're seeing with quick-and-dirty NIFs). >> >> I foresee many projects looking at those warnings in the >> persistent_term docs and thinking "I've weighed it, and I think my >> project is 'special' enough to call put/1 and erase/1 a little more >> frequently than the documentation suggests, or have more entries than >> is recommended, and I have my reasons for not using ETS instead". With >> deep dependencies pulled down from github, this kind of thinking gets >> compounded and infectious. >> >> I wish there was a way of providing protections against that sort of >> thing. I can't think of one. > > For avoiding NIFs/port-drivers and other problems that relate to > security, I created https://github.com/okeuday/pest . PEST is a static > analysis tool that looks for function calls it knows are problematic in > Erlang source code and provides information about where the problems > occur. You could also use the PEST source code to identify other > function calls that should be avoided if you are concerned about > persistent_term. > > Best Regards, > Michael > This is very helpful tool. You might want to drop the "security" in the description because it could be used as part of general code review. Thanks for this. I'm going to start using it. I was thinking of something along the lines of persistent_term internally doing some sort of tracking at runtime and warning when it's being called in such a way that would degrade performance. And perhaps the NIF API too. Neither seem practical though. - Edmond - -- Using Opera's mail client: http://www.opera.com/mail/ From ebegumisa@REDACTED Sun Dec 16 20:44:22 2018 From: ebegumisa@REDACTED (Edmond Begumisa) Date: Mon, 17 Dec 2018 05:44:22 +1000 Subject: [erlang-questions] Patch Package OTP 21.2 Released In-Reply-To: <00EDBA90-5CD3-4711-B157-ED5974C6A4CB@gmail.com> References: <1544537351.3583.25.camel@ericsson.com> <00EDBA90-5CD3-4711-B157-ED5974C6A4CB@gmail.com> Message-ID: On Mon, 17 Dec 2018 02:21:17 +1000, Anthony Ramine wrote: > Are you saying you don't do due diligence and just pull dependencies in > your project without reviewing them? > Certainly not. I'm saying that when you've reviewed both your rebar3 direct dependencies and their deep dependencies right down to the leaves (every .erl file for every git URL in all the rebar.config files), it becomes increasingly more difficult to perform this review task when you upgrade your direct dependencies and they introduce new indirect dependencies and/or when you introduce new direct dependencies. As both the width and depth grows, at some point, it becomes impractical as anyone who's used Node.js with npm/yarn can attest (half the time you've no idea what all those js files NPM has pulled down are doing). The route Anthony Ramine suggests I think is more practical. A tool that points you to which parts of which dependencies you need to take (another) look at. - Edmond - >> Le 14 d?c. 2018 ? 16:52, Edmond Begumisa >> a ?crit : >> >> I foresee many projects looking at those warnings in the >> persistent_term docs and thinking "I've weighed it, and I think my >> project is 'special' enough to call put/1 and erase/1 a little more >> frequently than the documentation suggests, or have more entries than >> is recommended, and I have my reasons for not using ETS instead". With >> deep dependencies pulled down from github, this kind of thinking gets >> compounded and infectious. > -- Using Opera's mail client: http://www.opera.com/mail/ From ebegumisa@REDACTED Sun Dec 16 20:53:44 2018 From: ebegumisa@REDACTED (Edmond Begumisa) Date: Mon, 17 Dec 2018 05:53:44 +1000 Subject: [erlang-questions] Patch Package OTP 21.2 Released In-Reply-To: References: <1544537351.3583.25.camel@ericsson.com> <00EDBA90-5CD3-4711-B157-ED5974C6A4CB@gmail.com> Message-ID: On Mon, 17 Dec 2018 05:44:22 +1000, Edmond Begumisa wrote: > On Mon, 17 Dec 2018 02:21:17 +1000, Anthony Ramine > wrote: > >> Are you saying you don't do due diligence and just pull dependencies in >> your project without reviewing them? >> > > Certainly not. > > I'm saying that when you've reviewed both your rebar3 direct > dependencies and their deep dependencies right down to the leaves (every > .erl file for every git URL in all the rebar.config files), it becomes > increasingly more difficult to perform this review task when you upgrade > your direct dependencies and they introduce new indirect dependencies > and/or when you introduce new direct dependencies. As both the width and > depth grows, at some point, it becomes impractical as anyone who's used > Node.js with npm/yarn can attest (half the time you've no idea what all > those js files NPM has pulled down are doing). > > The route Anthony Ramine suggests I think is more practical. Correction: The route Michael Truog suggests! > A tool that points you to which parts of which dependencies you need to > take (another) look at. > > - Edmond - > >>> Le 14 d?c. 2018 ? 16:52, Edmond Begumisa >>> a ?crit : >>> >>> I foresee many projects looking at those warnings in the >>> persistent_term docs and thinking "I've weighed it, and I think my >>> project is 'special' enough to call put/1 and erase/1 a little more >>> frequently than the documentation suggests, or have more entries than >>> is recommended, and I have my reasons for not using ETS instead". With >>> deep dependencies pulled down from github, this kind of thinking gets >>> compounded and infectious. >> > > -- Using Opera's mail client: http://www.opera.com/mail/ From frank.muller.erl@REDACTED Mon Dec 17 08:46:36 2018 From: frank.muller.erl@REDACTED (Frank Muller) Date: Mon, 17 Dec 2018 08:46:36 +0100 Subject: [erlang-questions] =?utf-8?q?Any_Erlang_=E2=80=9Chierarchical_tim?= =?utf-8?b?aW5nIHdoZWVs4oCdIGxpYnJhcnk/?= Message-ID: Hi there I am looking for any Erlang implementation of a ?hierarchical timing wheel? with disk persistency (if possible)? I need to handle a very large number of timers (around 10 million events) in my app. Each timer will trigger an associated MFA event. I?ve one special case: some events can be triggered after a long period of time (ex. 2 years). The rest of the timers can be considered short (in minutes, hours or days at max). That?s why ?hierarchical timing wheel? can solve this special case. Any help/idea/link appreciated. Thank you /Frank -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlsson.richard@REDACTED Mon Dec 17 11:23:06 2018 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Mon, 17 Dec 2018 11:23:06 +0100 Subject: [erlang-questions] Big band playing In-Reply-To: References: <601e4ab3-532c-06fe-5e2b-c7b283475b2a@cs.ntua.gr> <7d090675-e9ef-013e-db41-9e386f51b79f@cs.ntua.gr> Message-ID: These days (since version 6, 2014), the GNU Multiple Precision Library ( https://gmplib.org/) is available under LGPL v3, which is compatible with the Apache 2.0 license that Erlang is using (since OTP 18, 2015). Perhaps it would be a good idea to start using the heavily optimized GMP code now instead of Erlang's own bignum implementation. At least, to make it a build time option. /Richard Den s?n 16 dec. 2018 kl 19:08 skrev Mikael Pettersson : > On Sat, Dec 15, 2018 at 8:19 PM Kostis Sagonas wrote: > > > > On 12/15/18 7:30 PM, Mikael Pettersson wrote: > > > On Fri, Dec 14, 2018 at 4:32 PM Kostis Sagonas > wrote: > > >> We have been playing with CutEr (https://github.com/aggelgian/cuter), > a > > >> Concolic unit testing tool for Erlang, and discovered the following > bug > > >> in the implementation of bitwise and (band/2) operator: > > >> > > >> Erlang/OTP 21 [erts-10.2] [source-2bf2b70] [64-bit] [smp:8:8] > > >> [ds:8:8:10] [async-threads:1] [hipe] [sharing-preserving] > > >> > > >> Eshell V10.2 (abort with ^G) > > >> 1> (-1299341865233935136534120785510400) band (-1). > > >> -1299341865233953583278194495062016 > > >> > > >> > > >> which is the wrong result, of course. > > >> > > >> Most likely, it has existed forever. > > > Looks like an old bug, I was able to reproduce it with every release > > > back to R16B03 (R15B03 wouldn't build due to perl errors). > > > > I was able to reproduce this on an old R12 version that I still have > around: > > > > Erlang (BEAM) emulator version 5.6.5 [source] [64-bit] [smp:64] > > [async-threads:0] [hipe] [kernel-poll:false] > > > > Eshell V5.6.5 (abort with ^G) > > 1> (-1299341865233935136534120785510400) band (-1). > > -1299341865233953583278194495062016 > > > > > > I would not be surprised if this bug existed even before Erlang/OTP > > became open source. > > I did some more debugging, but wasn't able to pin-point the error (I > have two suspects, but the big.c code is non-obvious so it's difficult > to tell). > Anyway, I opened https://bugs.erlang.org/browse/ERL-804 for this > issue, linking back to your original post here. > > /Mikael > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Mon Dec 17 13:04:15 2018 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Mon, 17 Dec 2018 13:04:15 +0100 Subject: [erlang-questions] Patch Package OTP 21.2 Released In-Reply-To: References: <1544537351.3583.25.camel@ericsson.com> Message-ID: On Fri, Dec 14, 2018 at 4:52 PM Edmond Begumisa wrote: > > However, I fear that there is going to be a lot of abuse. > > I'm guessing there is going to be a lot of abuse as well. But I don't think that is different from using a large list where a map would do for instance. So lots of code has performance problems, uses excessive amounts of memory or otherwise slows down your system. As for the discussion on reading through your dependencies: There is a security aspect and a performance aspect. Both are important. Currently I think the best tool wrt. security is to have libraries define capabilities on what they do, and then verify those capabilities with a crash in the system. See e.g., OpenBSDs pledge(2) system call. Once a process pledges itself to a subset of all syscalls, it will be terminated if it ever calls one of the illegal targets. But as for the slowness, the best bet is to run benchmarks on your system and profile the code base extensively. People tend to make innocuously looking changes to a system---only for it to have catastrophic consequences on your software. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ajityagaty@REDACTED Mon Dec 17 18:55:05 2018 From: ajityagaty@REDACTED (Ajit Yagaty) Date: Mon, 17 Dec 2018 09:55:05 -0800 Subject: [erlang-questions] Starting Erlang distribution programmatically In-Reply-To: References: Message-ID: Hello Daniel, Apologies for the delay in response. Thanks for responding to my question! I'll try to see if I can get to work with the proxy workaround that you've suggested for now. But I do think that it would be nice to enable the distribution in the required mode programmatically. I'll see if I can put out a patch. Best regards, Ajit On Sun, Dec 9, 2018 at 3:33 PM D?niel Szoboszlay wrote: > I don't know about a way to change the distribution module > programmatically. You can however list multiple modules, as long as their > select/1 callback can properly sort out which module to use towards which > node (may work in IPv4 vs IPv6 cases, wont work with plain vs tls > connections). > > An easy workaround may be to implement your custom distribution module, a > proxy, that takes from some app env setting or similar the name of a real > distribution module. Than you can simply proxy all API calls towards that > module. > > BR, > Daniel > > On Sat, 8 Dec 2018, 08:34 Ajit Yagaty, wrote: > >> Hello All, >> >> Currently, one can start an Erlang node in distributed mode by passing in >> the ?proto_dist? parameter on the command line. Could anyone please let me >> know if there is a way to start the distribution on a non-distributed >> Erlang node (in any one of inet_tcp/inet6_tcp/inet_tls/inet6_tls modes) >> programmatically? >> >> >> In the code ( >> https://github.com/erlang/otp/blob/master/lib/kernel/src/net_kernel.erl#L1487), >> there seems to be a reliance on the presence of the command line argument >> ?proto_dist?. If not passed, proto_dist always defaults to inet_tcp. >> >> >> If there is a way to start the distribution programmatically, then the >> logic that decides what proto_dist value to pass can be moved from the init >> script (when the application is run as a service) into an Erlang module. >> This would also help in not having to re-write this code snippet for all >> the different platforms (Linux/Windows/OSX) that one would want to support. >> >> >> Any tips on this will be very helpful. >> >> >> But if there is no support to start the distribution programmatically, >> then would it make sense to add that support? >> >> >> Best regards, >> >> Ajit >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vans_163@REDACTED Tue Dec 18 00:46:05 2018 From: vans_163@REDACTED (Vans S) Date: Mon, 17 Dec 2018 23:46:05 +0000 (UTC) Subject: [erlang-questions] erlang cpu topology +sct woes References: <339701440.6370495.1545090365130.ref@mail.yahoo.com> Message-ID: <339701440.6370495.1545090365130@mail.yahoo.com> I am trying to set the topology appropriately for this particular condition. I have a dual processor system, and I want to run BEAM on processor 1 (numa node 1), with both physical and hyperthreading threads. The system topo looks like,? PROC0 0-9, PROC1 10-19, PROC0-THREAD0 20-29, PROC1-THREAD1 30-39. No matter how I try to set the topo it does not work and erlang fails to start with the error that its invalid. +sct L10-19T30-39C10-19,30-39P1N1 This should be the topology I am guessing? 10 logical cores, 10 threads, using 20 cores, on physical processor 1, numa node 1. But it gives the error "bad cpu topology 'L10-19T30-39C10-19,30-39P1N1': invalid identifier range" -------------- next part -------------- An HTML attachment was scrubbed... URL: From t6sn7gt@REDACTED Tue Dec 18 02:04:30 2018 From: t6sn7gt@REDACTED (Donald Steven) Date: Mon, 17 Dec 2018 20:04:30 -0500 Subject: [erlang-questions] binary_to_integer badarg Message-ID: <136398d8-4c5b-fb35-af4b-7a539bcd519f@aim.com> Hi all, A newbie question (I've tried for hours to figure this out, but failed): I want to read a single character from a file, and have it return the integer representation of the character.? I've used: file:open(Fname, [read, raw, binary]) to open the file and file:read(Fd,1) to retrieve a character. This works fine and I'll get back, for example <<"%">>, which is_binary tells me is a binary.? I've tried binary_to_integer(<<"%">>) but I get a badarg error. Your help would be greatly appreciated.? Thanks. Don From vans_163@REDACTED Tue Dec 18 02:36:16 2018 From: vans_163@REDACTED (Vans S) Date: Tue, 18 Dec 2018 01:36:16 +0000 (UTC) Subject: [erlang-questions] 300k HTTP GET RPS on Erlang 21.2, benchmarking per scheduler polling References: <477143608.6439372.1545096976895.ref@mail.yahoo.com> Message-ID: <477143608.6439372.1545096976895@mail.yahoo.com> If anyone is interested here is the writeup??https://elixirforum.com/t/300k-requests-per-second-webserver-in-elixir-otp21-2-10-cores/18823. tl;dr;?About 22% of time the scheduler spent in poll. to serve 30k~ HTTP Get requests. I think its a little much still? -------------- next part -------------- An HTML attachment was scrubbed... URL: From 2QdxY4RzWzUUiLuE@REDACTED Tue Dec 18 03:15:32 2018 From: 2QdxY4RzWzUUiLuE@REDACTED (Dan Sommers) Date: Mon, 17 Dec 2018 20:15:32 -0600 Subject: [erlang-questions] binary_to_integer badarg In-Reply-To: <136398d8-4c5b-fb35-af4b-7a539bcd519f@aim.com> References: <136398d8-4c5b-fb35-af4b-7a539bcd519f@aim.com> Message-ID: <8e06700d-03a5-06a1-f8d7-8401e13177b6@potatochowder.com> On 12/17/18 7:04 PM, Donald Steven wrote: > This works fine and I'll get back, for example <<"%">>, which is_binary > tells me is a binary.? I've tried binary_to_integer(<<"%">>) but I get a > badarg error. This does what you want, but there may be better ways (I'm an Erlang newbie, too): <> = Binary, Integer. Dan From t6sn7gt@REDACTED Tue Dec 18 04:25:24 2018 From: t6sn7gt@REDACTED (Donald Steven) Date: Mon, 17 Dec 2018 22:25:24 -0500 Subject: [erlang-questions] Fwd: Re: binary_to_integer badarg In-Reply-To: <71c19ea9-593d-d842-4bc7-f1aa34c4d9a7@potatochowder.com> References: <71c19ea9-593d-d842-4bc7-f1aa34c4d9a7@potatochowder.com> Message-ID: <56508268-da1d-234b-ccdc-65d2224b031b@aim.com> An HTML attachment was scrubbed... URL: From frank.muller.erl@REDACTED Tue Dec 18 06:16:20 2018 From: frank.muller.erl@REDACTED (Frank Muller) Date: Tue, 18 Dec 2018 06:16:20 +0100 Subject: [erlang-questions] =?utf-8?q?Any_Erlang_=E2=80=9Chierarchical_tim?= =?utf-8?b?aW5nIHdoZWVs4oCdIGxpYnJhcnk/?= In-Reply-To: References: Message-ID: Really, no library out there? /Frank Hi there > > I am looking for any Erlang implementation of a ?hierarchical timing > wheel? with disk persistency (if possible)? > > I need to handle a very large number of timers (around 10 million events) > in my app. Each timer will trigger an associated MFA event. > > I?ve one special case: some events can be triggered after a long period of > time (ex. 2 years). The rest of the timers can be considered short (in > minutes, hours or days at max). That?s why ?hierarchical timing wheel? > can solve this special case. > > Any help/idea/link appreciated. > > Thank you > /Frank > -------------- next part -------------- An HTML attachment was scrubbed... URL: From torben.lehoff@REDACTED Tue Dec 18 07:22:14 2018 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Tue, 18 Dec 2018 07:22:14 +0100 Subject: [erlang-questions] =?utf-8?q?Any_Erlang_=E2=80=9Chierarchical_tim?= =?utf-8?b?aW5nIHdoZWVs4oCdIGxpYnJhcnk/?= In-Reply-To: References: Message-ID: This is the nearest I can think of: https://github.com/fra/ecron/blob/master/README.md Cheers, Torben On Tue, 18 Dec 2018 at 06:17, Frank Muller wrote: > Really, no library out there? > > /Frank > > Hi there >> >> I am looking for any Erlang implementation of a ?hierarchical timing >> wheel? with disk persistency (if possible)? >> >> I need to handle a very large number of timers (around 10 million events) >> in my app. Each timer will trigger an associated MFA event. >> >> I?ve one special case: some events can be triggered after a long period >> of time (ex. 2 years). The rest of the timers can be considered short (in >> minutes, hours or days at max). That?s why ?hierarchical timing wheel? >> can solve this special case. >> >> Any help/idea/link appreciated. >> >> Thank you >> /Frank >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- https://www.linkedin.com/in/torbenhoffmann/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From lukas@REDACTED Tue Dec 18 08:32:07 2018 From: lukas@REDACTED (Lukas Larsson) Date: Tue, 18 Dec 2018 08:32:07 +0100 Subject: [erlang-questions] 300k HTTP GET RPS on Erlang 21.2, benchmarking per scheduler polling In-Reply-To: <477143608.6439372.1545096976895@mail.yahoo.com> References: <477143608.6439372.1545096976895.ref@mail.yahoo.com> <477143608.6439372.1545096976895@mail.yahoo.com> Message-ID: Hello, On Tue, Dec 18, 2018 at 2:36 AM Vans S wrote: > If anyone is interested here is the writeup > https://elixirforum.com/t/300k-requests-per-second-webserver-in-elixir-otp21-2-10-cores/18823 > . > > tl;dr; About 22% of time the scheduler spent in poll. to serve 30k~ HTTP > Get requests. I think its a little much still? > Firstly, it is not poll that you spend 22% in, it is PORT, i.e. the work done by gen_tcp to call writev/read. Polling shows up in the state CHECK_IO. The optimizations introduced in 21.2 were mainly done to reduce the time spent doing polling. Secondly, I'd say it is too little. As you saw in the edit that you made, if your remove/optimize the Erlang parts you will get higher a throughput rate as the system can spend more time doing port work. What you are seeing as OTHER is most likely the system spinning looking for work to do. You can get more states if you are interested in digging deeper by passing --with-microstate-accounting=extra to configure. The inet_driver (the port driver that is used for TCP/UDP/SCTP) is not perfect, but almost 2 decades have been spent improving it, so there are very few low hanging fruits left. Lukas -------------- next part -------------- An HTML attachment was scrubbed... URL: From lukas@REDACTED Tue Dec 18 08:39:40 2018 From: lukas@REDACTED (Lukas Larsson) Date: Tue, 18 Dec 2018 08:39:40 +0100 Subject: [erlang-questions] binary_to_integer badarg In-Reply-To: <136398d8-4c5b-fb35-af4b-7a539bcd519f@aim.com> References: <136398d8-4c5b-fb35-af4b-7a539bcd519f@aim.com> Message-ID: On Tue, Dec 18, 2018 at 2:04 AM Donald Steven wrote: > Hi all, > > A newbie question (I've tried for hours to figure this out, but failed): > > I want to read a single character from a file, and have it return the > integer representation of the character. I've used: > > file:open(Fname, [read, raw, binary]) to open the file and > file:read(Fd,1) to retrieve a character. > > This works fine and I'll get back, for example <<"%">>, which is_binary > tells me is a binary. I've tried binary_to_integer(<<"%">>) but I get a > badarg error. > binary_to_integer converts the binary text representation of an integer to an integer, i.e. binary_to_integer(<<"123">>) -> 123. To get the integer value of a binary you can either use pattern matching as Dan suggestest: > <> = Binary, Integer. > or you can use binary:decode_unsigned(<<"%">>) -> 37. Lukas -------------- next part -------------- An HTML attachment was scrubbed... URL: From t6sn7gt@REDACTED Tue Dec 18 12:40:14 2018 From: t6sn7gt@REDACTED (Donald Steven) Date: Tue, 18 Dec 2018 06:40:14 -0500 Subject: [erlang-questions] binary_to_integer badarg In-Reply-To: References: <136398d8-4c5b-fb35-af4b-7a539bcd519f@aim.com> Message-ID: An HTML attachment was scrubbed... URL: From vans_163@REDACTED Tue Dec 18 13:33:52 2018 From: vans_163@REDACTED (Vans S) Date: Tue, 18 Dec 2018 12:33:52 +0000 (UTC) Subject: [erlang-questions] =?utf-8?q?Any_Erlang_=E2=80=9Chierarchical_tim?= =?utf-8?b?aW5nIHdoZWVs4oCdIGxpYnJhcnk/?= In-Reply-To: References: Message-ID: <1981010432.6624170.1545136432232@mail.yahoo.com> Why dont you write your own, since this is a special use case anyways that has a ton of implementations, there is no way youl find an implemenation that will fully satisfy you. Its quite simple too,?Hashed and Hierarchical Timing Wheels, scheme #2 here will be VERY performant on erlang.? an ordered_set mnesia table, using dirty_next to get the first element each 1-10ms to check if a timer is ready to pop. Then spawn a new process and pass the event for handling to it. | | | | Hashed and Hierarchical Timing Wheels Hashed and Hierarchical Timing Wheels: Data Structures for the Efficient Implementation of a Timing Facility | | | On Tuesday, December 18, 2018, 1:22:44 a.m. EST, Torben Hoffmann wrote: This is the nearest I can think of: https://github.com/fra/ecron/blob/master/README.md Cheers, Torben On Tue, 18 Dec 2018 at 06:17, Frank Muller wrote: Really, no library out there? /Frank Hi there? I am looking for any Erlang implementation of a ?hierarchical timing wheel? with disk persistency (if possible)? I need to handle a very large number of timers (around 10 million events) in my app. Each timer will trigger an associated MFA event.? I?ve one special case: some events can be triggered after a long period of time (ex. 2 years). The rest of the timers can be considered short (in minutes, hours or days at max). That?s why ?hierarchical timing wheel? can solve this special case. Any help/idea/link appreciated. Thank you/Frank _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -- https://www.linkedin.com/in/torbenhoffmann/ _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From vans_163@REDACTED Tue Dec 18 15:34:01 2018 From: vans_163@REDACTED (Vans S) Date: Tue, 18 Dec 2018 14:34:01 +0000 (UTC) Subject: [erlang-questions] 300k HTTP GET RPS on Erlang 21.2, benchmarking per scheduler polling In-Reply-To: References: <477143608.6439372.1545096976895.ref@mail.yahoo.com> <477143608.6439372.1545096976895@mail.yahoo.com> Message-ID: <1522630353.6731828.1545143641036@mail.yahoo.com> I think OTHER is something to do with Ports / polling, because I just removed the inet_drv and wrote a simple c nif to do TCP networking, and the throughput doubled. I did not get around to recompiling erlang with microstate accounting but without inet driver using an unoptimized nonblocking tcp nif I got the msacc report to look like ?scheduler( 1)? ? 0.68%? ? 0.00%? ?89.85%? ? 3.46%? ? 6.01%? ? 0.00%? ? 0.00%?scheduler( 2)? ? 0.66%? ? 0.01%? ?90.43%? ? 3.40%? ? 5.50%? ? 0.00%? ? 0.00% Using 2 schedulers because 10 physical cores generating load now just barely fully saturated.? now 90% of the time is spent in emulator, 6% is other, I am guessing 6% other is the NIF calls to the socket calls? The throughput was 250k for 2 physical cores.? If all scales linearly that is 1.25m RPS for simple GET hello world benchmark. The NIF is PoC?https://gist.github.com/vans163/d96fcc7c89d0cf25c819c5fb77769e81?ofcourse its only useful in the case there is constant data on socket, otherwise this PoC will break if there is idle connections that keep getting polled.? This opens the possibility though to using something like DPDK. On Tuesday, December 18, 2018, 2:32:21 a.m. EST, Lukas Larsson wrote: Hello, On Tue, Dec 18, 2018 at 2:36 AM Vans S wrote: If anyone is interested here is the writeup??https://elixirforum.com/t/300k-requests-per-second-webserver-in-elixir-otp21-2-10-cores/18823. tl;dr;?About 22% of time the scheduler spent in poll. to serve 30k~ HTTP Get requests. I think its a little much still? Firstly, it is not poll that you spend 22% in, it is PORT, i.e. the work done by gen_tcp to call writev/read. Polling shows up in the state CHECK_IO. The optimizations introduced in 21.2 were mainly done to reduce the time spent doing polling. Secondly, I'd say it is too little. As you saw in the edit that you made, if your remove/optimize the Erlang parts you will get higher a throughput rate as the system can spend more time doing port work. What you are seeing as OTHER is most likely the system spinning looking for work to do. You can get more states if you are interested in digging deeper by passing --with-microstate-accounting=extra to configure. The inet_driver (the port driver that is used for TCP/UDP/SCTP) is not perfect, but almost 2 decades have been spent improving it, so there are very few low hanging fruits left. Lukas -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank.muller.erl@REDACTED Tue Dec 18 16:01:41 2018 From: frank.muller.erl@REDACTED (Frank Muller) Date: Tue, 18 Dec 2018 16:01:41 +0100 Subject: [erlang-questions] =?utf-8?q?Any_Erlang_=E2=80=9Chierarchical_tim?= =?utf-8?b?aW5nIHdoZWVs4oCdIGxpYnJhcnk/?= In-Reply-To: <1981010432.6624170.1545136432232@mail.yahoo.com> References: <1981010432.6624170.1545136432232@mail.yahoo.com> Message-ID: Hi Vans I always ask first before re-implementing the wheel. The link is very good (did my home work and read almost all papers on the subject before asking). @Vans: thanks for implementation hints. What do you suggest for persistency? Is mnesia capable of handling millions terms? Best /Frank Why dont you write your own, since this is a special use case anyways that > has a ton of implementations, there is no way youl find an implemenation > that will fully satisfy you. Its quite simple too, Hashed and > Hierarchical Timing Wheels > , > scheme #2 here will be VERY performant on erlang. an ordered_set mnesia > table, using dirty_next to get the first element each 1-10ms to check if a > timer is ready to pop. Then spawn a new process and pass the event for > handling to it. > > Hashed and Hierarchical Timing Wheels > > Hashed and Hierarchical Timing Wheels: Data Structures for the Efficient > Implementation of a Timing Facility > > > > > On Tuesday, December 18, 2018, 1:22:44 a.m. EST, Torben Hoffmann < > torben.lehoff@REDACTED> wrote: > > > This is the nearest I can think of: > https://github.com/fra/ecron/blob/master/README.md > > Cheers, > Torben > On Tue, 18 Dec 2018 at 06:17, Frank Muller > wrote: > > Really, no library out there? > > /Frank > > Hi there > > I am looking for any Erlang implementation of a ?hierarchical timing > wheel? with disk persistency (if possible)? > > I need to handle a very large number of timers (around 10 million events) > in my app. Each timer will trigger an associated MFA event. > > I?ve one special case: some events can be triggered after a long period of > time (ex. 2 years). The rest of the timers can be considered short (in > minutes, hours or days at max). That?s why ?hierarchical timing wheel? > can solve this special case. > > Any help/idea/link appreciated. > > Thank you > /Frank > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- > https://www.linkedin.com/in/torbenhoffmann/ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank.muller.erl@REDACTED Tue Dec 18 16:04:17 2018 From: frank.muller.erl@REDACTED (Frank Muller) Date: Tue, 18 Dec 2018 16:04:17 +0100 Subject: [erlang-questions] Connect to an old Erlang node In-Reply-To: References: Message-ID: Hi Lukas How about thedistribution protocol version compatability with the +R option: http://erlang.org/doc/man/erl.html#compat_rel Will it help on my case? Best /Frank > > On Thu, Dec 13, 2018 at 8:07 AM Frank Muller > wrote: > >> Hi guys >> >> Can I disable this behaviour when connecting to an old node with no >> support >> for UTF8 atoms? >> >> (client@REDACTED)1> >> >> =ERROR REPORT==== 17-Nov-2017::00:32:12 === >> >> ** server@REDACTED: Connection attempt from node server@REDACTED rejected since >> it cannot handle ["UTF8_ATOMS"].** >> >> >> I?m not using UTF8 at all and just want to be able to connect. >> >> >> Is there a flag to disable this? >> > > No. The support to talk using latin1 atoms has been removed from the VM on > newer versions of Erlang. > > >> >> Thank you. >> >> /Frank >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vans_163@REDACTED Tue Dec 18 16:19:57 2018 From: vans_163@REDACTED (Vans S) Date: Tue, 18 Dec 2018 15:19:57 +0000 (UTC) Subject: [erlang-questions] =?utf-8?q?Any_Erlang_=E2=80=9Chierarchical_tim?= =?utf-8?b?aW5nIHdoZWVs4oCdIGxpYnJhcnk/?= In-Reply-To: References: <1981010432.6624170.1545136432232@mail.yahoo.com> Message-ID: <741722086.6742656.1545146397473@mail.yahoo.com> Mnesia would handle millions of disk persistented terms.? Assuming in this case youl only be calling :mnesia.next or dirty_next, and comparing the time on it, itl be super low latency and fast.? Inserts are also very fast into ordered_set.?? On Tuesday, December 18, 2018, 10:01:53 a.m. EST, Frank Muller wrote: Hi Vans I always ask first before re-implementing the wheel. The link is very good (did my home work and read almost all papers on the subject before asking). @Vans: thanks for implementation hints.What do you suggest for persistency? Is mnesia capable of handling millions terms? Best/Frank Why dont you write your own, since this is a special use case anyways that has a ton of implementations, there is no way youl find an implemenation that will fully satisfy you. Its quite simple too,?Hashed and Hierarchical Timing Wheels, scheme #2 here will be VERY performant on erlang.? an ordered_set mnesia table, using dirty_next to get the first element each 1-10ms to check if a timer is ready to pop. Then spawn a new process and pass the event for handling to it. | | | | Hashed and Hierarchical Timing Wheels Hashed and Hierarchical Timing Wheels: Data Structures for the Efficient Implementation of a Timing Facility | | | On Tuesday, December 18, 2018, 1:22:44 a.m. EST, Torben Hoffmann wrote: This is the nearest I can think of: https://github.com/fra/ecron/blob/master/README.md Cheers, Torben On Tue, 18 Dec 2018 at 06:17, Frank Muller wrote: Really, no library out there? /Frank Hi there? I am looking for any Erlang implementation of a ?hierarchical timing wheel? with disk persistency (if possible)? I need to handle a very large number of timers (around 10 million events) in my app. Each timer will trigger an associated MFA event.? I?ve one special case: some events can be triggered after a long period of time (ex. 2 years). The rest of the timers can be considered short (in minutes, hours or days at max). That?s why ?hierarchical timing wheel? can solve this special case. Any help/idea/link appreciated. Thank you/Frank _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -- https://www.linkedin.com/in/torbenhoffmann/ _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From lukas@REDACTED Tue Dec 18 16:36:52 2018 From: lukas@REDACTED (Lukas Larsson) Date: Tue, 18 Dec 2018 16:36:52 +0100 Subject: [erlang-questions] Connect to an old Erlang node In-Reply-To: References: Message-ID: On Tue, Dec 18, 2018 at 4:04 PM Frank Muller wrote: > Hi Lukas > > How about thedistribution protocol version compatability with the +R > option: > > http://erlang.org/doc/man/erl.html#compat_rel > > Will it help on my case? > No, it will not. https://github.com/erlang/otp/blob/master/erts/emulator/beam/erl_init.c#L1972 That option currently does not currently do anything at all. > > Best > /Frank > > >> >> On Thu, Dec 13, 2018 at 8:07 AM Frank Muller >> wrote: >> >>> Hi guys >>> >>> Can I disable this behaviour when connecting to an old node with no >>> support >>> for UTF8 atoms? >>> >>> (client@REDACTED)1> >>> >>> =ERROR REPORT==== 17-Nov-2017::00:32:12 === >>> >>> ** server@REDACTED: Connection attempt from node server@REDACTED rejected since >>> it cannot handle ["UTF8_ATOMS"].** >>> >>> >>> I?m not using UTF8 at all and just want to be able to connect. >>> >>> >>> Is there a flag to disable this? >>> >> >> No. The support to talk using latin1 atoms has been removed from the VM >> on newer versions of Erlang. >> >> >>> >>> Thank you. >>> >>> /Frank >>> _______________________________________________ >>> 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 frank.muller.erl@REDACTED Tue Dec 18 17:56:12 2018 From: frank.muller.erl@REDACTED (Frank Muller) Date: Tue, 18 Dec 2018 17:56:12 +0100 Subject: [erlang-questions] Connect to an old Erlang node In-Reply-To: References: Message-ID: Ok, thanks for the info Lukas /Frank > > On Tue, Dec 18, 2018 at 4:04 PM Frank Muller > wrote: > >> Hi Lukas >> >> How about thedistribution protocol version compatability with the +R >> option: >> >> http://erlang.org/doc/man/erl.html#compat_rel >> >> Will it help on my case? >> > > No, it will not. > > > https://github.com/erlang/otp/blob/master/erts/emulator/beam/erl_init.c#L1972 > > That option currently does not currently do anything at all. > > >> >> Best >> /Frank >> >> >>> >>> On Thu, Dec 13, 2018 at 8:07 AM Frank Muller >>> wrote: >>> >>>> Hi guys >>>> >>>> Can I disable this behaviour when connecting to an old node with no >>>> support >>>> for UTF8 atoms? >>>> >>>> (client@REDACTED)1> >>>> >>>> =ERROR REPORT==== 17-Nov-2017::00:32:12 === >>>> >>>> ** server@REDACTED: Connection attempt from node server@REDACTED rejected since >>>> it cannot handle ["UTF8_ATOMS"].** >>>> >>>> >>>> I?m not using UTF8 at all and just want to be able to connect. >>>> >>>> >>>> Is there a flag to disable this? >>>> >>> >>> No. The support to talk using latin1 atoms has been removed from the VM >>> on newer versions of Erlang. >>> >>> >>>> >>>> Thank you. >>>> >>>> /Frank >>>> _______________________________________________ >>>> 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 roger@REDACTED Tue Dec 18 20:21:27 2018 From: roger@REDACTED (Roger Lipscombe) Date: Tue, 18 Dec 2018 19:21:27 +0000 Subject: [erlang-questions] =?utf-8?q?Any_Erlang_=E2=80=9Chierarchical_tim?= =?utf-8?b?aW5nIHdoZWVs4oCdIGxpYnJhcnk/?= In-Reply-To: References: <1981010432.6624170.1545136432232@mail.yahoo.com> Message-ID: This isn't particularly applicable, because you're looking for an implementation in Erlang, rather than an implementation *in* Erlang, but if you're interested, there's a timer wheel implementation in erts/emulator/beam/time.c. It's not directly usable as a timer wheel from Erlang (or from a NIF, which is where my interest originated). For comparison, libcurl appears to use a splay tree for its timers -- or did, the last time I looked. On Tue, 18 Dec 2018 at 15:01, Frank Muller wrote: > Hi Vans > > I always ask first before re-implementing the wheel. The link is very good > (did my home work and read almost all papers on the subject before asking). > > @Vans: thanks for implementation hints. > What do you suggest for persistency? Is mnesia capable of handling > millions terms? > > Best > /Frank > > Why dont you write your own, since this is a special use case anyways that >> has a ton of implementations, there is no way youl find an implemenation >> that will fully satisfy you. Its quite simple too, Hashed and >> Hierarchical Timing Wheels >> , >> scheme #2 here will be VERY performant on erlang. an ordered_set mnesia >> table, using dirty_next to get the first element each 1-10ms to check if a >> timer is ready to pop. Then spawn a new process and pass the event for >> handling to it. >> >> Hashed and Hierarchical Timing Wheels >> >> Hashed and Hierarchical Timing Wheels: Data Structures for the Efficient >> Implementation of a Timing Facility >> >> >> >> >> On Tuesday, December 18, 2018, 1:22:44 a.m. EST, Torben Hoffmann < >> torben.lehoff@REDACTED> wrote: >> >> >> This is the nearest I can think of: >> https://github.com/fra/ecron/blob/master/README.md >> >> Cheers, >> Torben >> On Tue, 18 Dec 2018 at 06:17, Frank Muller >> wrote: >> >> Really, no library out there? >> >> /Frank >> >> Hi there >> >> I am looking for any Erlang implementation of a ?hierarchical timing >> wheel? with disk persistency (if possible)? >> >> I need to handle a very large number of timers (around 10 million events) >> in my app. Each timer will trigger an associated MFA event. >> >> I?ve one special case: some events can be triggered after a long period >> of time (ex. 2 years). The rest of the timers can be considered short (in >> minutes, hours or days at max). That?s why ?hierarchical timing wheel? >> can solve this special case. >> >> Any help/idea/link appreciated. >> >> Thank you >> /Frank >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> -- >> https://www.linkedin.com/in/torbenhoffmann/ >> >> _______________________________________________ >> 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 t@REDACTED Wed Dec 19 03:34:23 2018 From: t@REDACTED (Tristan Sloughter) Date: Tue, 18 Dec 2018 21:34:23 -0500 Subject: [erlang-questions] [ANN] Rebar3 CircleCI Orb Message-ID: CircleCI recently released Orbs (https://circleci.com/orbs/) for creating reusable workflow components. I've published a rebar3 Orb, https://circleci.com/orbs/registry/orb/tsloughter/rebar3, source on github https://github.com/tsloughter/rebar3_orb Currently it has commands and jobs for running common test, xref and dialyzer, it caches built dependencies between runs, keyed on a checksum of the rebar.lock file, and stores common test's html output as test artifacts so you can view them after a run. I'll be adding conditional support for cover that uploads to codecov and linting with elvis next. Tristan From mjtruog@REDACTED Wed Dec 19 04:19:31 2018 From: mjtruog@REDACTED (Michael Truog) Date: Tue, 18 Dec 2018 19:19:31 -0800 Subject: [erlang-questions] [ANN] CloudI 1.7.5 Released! Message-ID: <1c77e44d-f809-0b46-ed9b-dcd738ccaee0@gmail.com> Download 1.7.5 from https://osdn.net/dl/cloudi/cloudi-1.7.5.tar.gz CloudI (https://cloudi.org/) is a "universal integrator" using an Erlang core to provide fault-tolerance with efficiency and scalability. The CloudI API provides a minimal interface to communicate among services so programming language agnostic and protocol agnostic integration can occur.? CloudI currently integrates with the programming languages: C/C++, Elixir, Erlang, Go, Haskell, Java, JavaScript/node.js, OCaml, PHP, Perl, Python, and Ruby,? Many reusable services are included that rely on the CloudI service bus. The details for this release are below: ? * Added CloudI Service API nodes_status function to provide ??? current uptime, availability and cost information for ??? any CloudI node (using Erlang monotonic time) ? * Now both "*" and "?" are wildcard characters in service name ??? patterns that consume one or more characters, with "?" never ??? matching the next character in the string (i.e. "/?/" matches "/a/" ???? but never "/a/b/" while "/*/" will match either) ? * cloudi_service_http_cowboy was renamed to be ??? cloudi_service_http_cowboy1 ? * cloudi_service_router ssh server throughput was improved ? * All external dependencies were updated ? * Bugs were fixed and other improvements were added ??? (see the ChangeLog for more detail) Please mention any problems, issues, or ideas! Thanks, Michael SHA256 CHECKSUMS cloudi-1.7.5.tar.bz2 (13325103 bytes) a928e49a60c8436ffe8a514c986911cae5c40d6602bfbf8e0be373f0c1553abb cloudi-1.7.5.tar.gz? (16023442 bytes) ac0c0753e17eccaed190398adf5e5a3b50f584bd255e2b609a9ec34d783720e6 From starbelly@REDACTED Wed Dec 19 01:06:29 2018 From: starbelly@REDACTED (Bryan Paxton) Date: Tue, 18 Dec 2018 18:06:29 -0600 Subject: [erlang-questions] Change to a more descriptive atom when a crypto algorithm is not supported per FIPS Message-ID: ? A few times I have seen a good bit of confusion arise from getting "notsup" error from the crypto nif in the context of FIPS mode being enabled and a cryptographic algorithm not allowed in said mode. Thus I am suggesting that for this case we use "notsup_in_fips_mode"? as a returnable atom for the error, which I do believe would save people time when grokking the situation the ambiguous error.? ?I'd? be glad to do a PR for this and almost started on such but figured it best to check here before so. -- Bryan Paxton From mononcqc@REDACTED Wed Dec 19 14:04:09 2018 From: mononcqc@REDACTED (Fred Hebert) Date: Wed, 19 Dec 2018 08:04:09 -0500 Subject: [erlang-questions] 300k HTTP GET RPS on Erlang 21.2, benchmarking per scheduler polling In-Reply-To: <1522630353.6731828.1545143641036@mail.yahoo.com> References: <477143608.6439372.1545096976895.ref@mail.yahoo.com> <477143608.6439372.1545096976895@mail.yahoo.com> <1522630353.6731828.1545143641036@mail.yahoo.com> Message-ID: <20181219130408.GA780@ferdmbp.local> On 12/18, Vans S wrote: > I think OTHER is something to do with Ports / polling, because I just > removed the inet_drv and wrote a simple c nif to do TCP networking, > and the throughput doubled. I did not get around to recompiling erlang > with microstate accounting but without inet driver using an > unoptimized nonblocking tcp nif I got the msacc report to look like > >Using 2 schedulers because 10 physical cores generating load now just >barely fully saturated.? now 90% of the time is spent in emulator, 6% >is other, I am guessing 6% other is the NIF calls to the socket calls? > >The throughput was 250k for 2 physical cores.? If all scales linearly >that is 1.25m RPS for simple GET hello world benchmark. > >The NIF is >PoC?https://gist.github.com/vans163/d96fcc7c89d0cf25c819c5fb77769e81?ofcourse >its only useful in the case there is constant data on socket, otherwise >this PoC will break if there is idle connections that keep getting >polled.? This opens the possibility though to using something like >DPDK. I think you might have achieved this: https://twitter.com/seldo/status/800817973921386497 Chapter 15: 300% performance boosts by deleting data validity checks Of course, the driver may have a higher baseline overhead than a NIF, but you also got rid of all validation and handling of any edge case whatsoever. You claim your NIF is not optimized, but it is _extremely_ optimized: you removed all code that could have been useful for scenarios that are not the one you are actively testing, therefore getting rid of all their overheads. And you are doing so on a rather useless benchmark: hello worlds that parse nothing and therefore have nothing in common with any application in the wild that might care about the request's content. The benchmark results you get can therefore not be extrapolated to be relevant to any application out there. I would likely urge you, unless you are doing this for the fun of micro-optimizing edge cases, to consider basing your work on more representative benchmarks. From mononcqc@REDACTED Wed Dec 19 14:11:11 2018 From: mononcqc@REDACTED (Fred Hebert) Date: Wed, 19 Dec 2018 08:11:11 -0500 Subject: [erlang-questions] open_port + spawn and closing the spawned application when port closes In-Reply-To: <211674047.4069757.1544710993659@mail.yahoo.com> References: <211674047.4069757.1544710993659.ref@mail.yahoo.com> <211674047.4069757.1544710993659@mail.yahoo.com> Message-ID: <20181219131111.GB780@ferdmbp.local> On 12/13, Vans S wrote: >I recall there was a way to do this by basho but wondering if there are new alternatives recently. > >Basically the example is a simple one, open_port({spawn, "curl -L "http://releases.ubuntu.com/18.04.1.0/ubuntu-18.04.1.0-live-server-amd64.iso?" --progress-bar -o /dev/null"}) now kill the process, close the port, or kill the emulator.? The curl process keeps running.? I believe it was when the port closes, stdin/stdout closes for the process, and the work around was to wrap the process in a bash script that would detect stdin/out closed, and terminate the process it wrapped. > >Any thoughts on this, or perhaps help finding that bash script again? The safest option for a flexible case is https://github.com/saleyn/erlexec You might have also thought of just using something like `cat | ' which would try to stop and shut things down when stdin closes, but erlexec is a safer bet. From elbrujohalcon@REDACTED Wed Dec 19 14:12:18 2018 From: elbrujohalcon@REDACTED (Brujo Benavides) Date: Wed, 19 Dec 2018 10:12:18 -0300 Subject: [erlang-questions] [ANN] SpawnFest repos are now public Message-ID: <1ED1782F-D353-49FA-BF0B-D8DA6FCB0790@gmail.com> We just made all the repos for the 2018 edition public. You can find a list of them in this twitter thread or you can see them directly on github . There are many projects there that I'm sure will be useful for the community as a whole. Congratulations and good luck to all the teams that participated this year! Winners will be announced before the end of the year, but not on this list? we don?t want to spam (too much :P). Brujo Benavides -------------- next part -------------- An HTML attachment was scrubbed... URL: From per@REDACTED Wed Dec 19 15:43:02 2018 From: per@REDACTED (Per Hedeland) Date: Wed, 19 Dec 2018 15:43:02 +0100 Subject: [erlang-questions] open_port + spawn and closing the spawned application when port closes In-Reply-To: <20181219131111.GB780@ferdmbp.local> References: <211674047.4069757.1544710993659.ref@mail.yahoo.com> <211674047.4069757.1544710993659@mail.yahoo.com> <20181219131111.GB780@ferdmbp.local> Message-ID: <402677b4-a196-3a1a-7fcd-ddbd2c97e4f4@hedeland.org> On 2018-12-19 14:11, Fred Hebert wrote: > On 12/13, Vans S wrote: >> I recall there was a way to do this by basho but wondering if there are new alternatives recently. >> >> Basically the example is a simple one, open_port({spawn, "curl -L "http://releases.ubuntu.com/18.04.1.0/ubuntu-18.04.1.0-live-server-amd64.iso?" --progress-bar -o /dev/null"}) now kill the process, >> close the port, or kill the emulator. The curl process keeps running. I believe it was when the port closes, stdin/stdout closes for the process, and the work around was to wrap the process in a >> bash script that would detect stdin/out closed, and terminate the process it wrapped. >> >> Any thoughts on this, or perhaps help finding that bash script again? > > The safest option for a flexible case is https://github.com/saleyn/erlexec Erlexec is of course infinitely more flexible, but in case EOF -> kill "translation" is all you want, I believe a correctly written wrapper script is equally safe. So, to Vans, you will find both a bash script and a slightly improved/fixed version that doesn't specifically require bash at: http://erlang.org/pipermail/erlang-questions/2016-November/090901.html > You might have also thought of just using something like `cat | ' which would try to stop and shut things down when stdin closes, but erlexec is a safer bet. Well, yes, without a *very* liberal interpretation of "something like", that solution doesn't work at all - there is nothing in it that "would try to stop and shut things down". 'cat' will terminate when it sees EOF on its stdin, and as a consequence will see EOF on *its* stdin - just like it would have done if the 'cat |' part wasn't there at all - and that's all that will happen. --Per From otp@REDACTED Wed Dec 19 16:40:39 2018 From: otp@REDACTED (Erlang/OTP) Date: Wed, 19 Dec 2018 16:40:39 +0100 Subject: [erlang-questions] Patch Package OTP 20.2.0.1 Released Message-ID: <20181219154039.GA4623@erix.ericsson.se> Patch Package: OTP 20.2.0.1 Git Tag: OTP-20.2.0.1 Date: 2018-12-19 Trouble Report Id: OTP-15488 Seq num: ERIERL-231 System: OTP Release: 20 Application: erts-9.2.0.1 Predecessor: OTP 20.2 Check out the git tag OTP-20.2.0.1, and build a full OTP system including documentation. Apply one or more applications from this build as patches to your installation using the 'otp_patch_apply' tool. For information on install requirements, see descriptions for each application version below. --------------------------------------------------------------------- --- erts-9.2.0.1 ---------------------------------------------------- --------------------------------------------------------------------- The erts-9.2.0.1 application can be applied independently of other applications on a full OTP 20 installation. --- Improvements and New Features --- OTP-15488 Application(s): erts Related Id(s): ERIERL-231 Extra internal consistency checks wrt communication with erl_child_setup process. Full runtime dependencies of erts-9.2.0.1: kernel-5.0, sasl-3.0.1, stdlib-3.0 --------------------------------------------------------------------- --------------------------------------------------------------------- --------------------------------------------------------------------- From t6sn7gt@REDACTED Thu Dec 20 00:40:05 2018 From: t6sn7gt@REDACTED (Donald Steven) Date: Wed, 19 Dec 2018 18:40:05 -0500 Subject: [erlang-questions] read_file -- binary data object Message-ID: An HTML attachment was scrubbed... URL: From zxq9@REDACTED Thu Dec 20 00:48:27 2018 From: zxq9@REDACTED (zxq9@REDACTED) Date: Thu, 20 Dec 2018 08:48:27 +0900 Subject: [erlang-questions] read_file -- binary data object In-Reply-To: References: Message-ID: <7969494.nqc9s2zlSz@takoyaki> On 2018?12?19???? 18?40?05? JST Donald Steven wrote: > The manual for the function read_file/1 says: Returns {ok, Binary}, where Binary is a binary data object that contains the contents of Filename, or {error, Reason} if an error occurs. > > What is the type of this "binary data object" (a list?). (I'll want to access individual elements.) It is an Erlang binary. 1> Foo1 = "Something I'll write to disk.". "Something I'll write to disk." 2> Foo2 = <<"Something else I'll write to disk.">>. <<"Something else I'll write to disk.">> 3> Foo3 = <<1,2,3,4>>. <<1,2,3,4>> 4> file:write_file("foo1.txt", Foo1). ok 5> file:write_file("foo2.txt", Foo2). ok 6> file:write_file("foo3", Foo3). ok 7> file:read_file("foo1.txt"). {ok,<<"Something I'll write to disk.">>} 8> file:read_file("foo2.txt"). {ok,<<"Something else I'll write to disk.">>} 9> file:read_file("foo3"). {ok,<<1,2,3,4>>} If the above seems perplexing then check out the docs on Erlang binaries. They are awesome, especially when dealing with binary file formats or network data. http://erlang.org/doc/reference_manual/expressions.html#bit_syntax http://erlang.org/doc/programming_examples/bit_syntax.html http://erlang.org/doc/man/binary.html Also, keep in mind that "object" is a heavily overloaded term in computing. The docs mean "returns a self-contained thingy that can be labeled and carries a type (binary) native to the runtime". -Craig From soverdor@REDACTED Thu Dec 20 00:58:57 2018 From: soverdor@REDACTED (Sam Overdorf) Date: Wed, 19 Dec 2018 15:58:57 -0800 Subject: [erlang-questions] otp 21.2 In-Reply-To: <20181216003003.GH1783@thecloud.hijacked.us> References: <45a41641-81c2-50c5-d62f-59535e687c2e@potatochowder.com> <20181216003003.GH1783@thecloud.hijacked.us> Message-ID: I have decided that this is really dumb that I have to run the function "c:erlangrc()" just to load my ".erlang" file. Some of my erlang files have multiple entry points and I have to execute the function within each one of them (dumb idea). I'm use to having a configuration file that will get loaded every time something "erlang" gets executed. I don't care if I can't share my erlang with you. I have bigger things to make work and that is why I need and use the ".erlang" file. Sam On Sat, Dec 15, 2018 at 4:30 PM Andrew Thompson wrote: > > On Sat, Dec 15, 2018 at 03:51:18PM -0800, Sam Overdorf wrote: > > This kind of defeats the purpose of an ".rc" file. > > The unix world uses them to set default behavior for scripts and programs. > > Now I have to remember to add "c:erlangrc()" to each of my programs. > > If I forget to do this then OOPs things don't work correctly. > > This is like expecting bash shell scripts to source your ~/.bashrc. > .bashrc is only sourced for interactive shells, not non-interactive > shells, like the one invoked by the shebang line in a shell script. > > Arguably you're relying on incorrect behaviour in escript and you should > adjust your usage accordingly. > > Andrew > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From t6sn7gt@REDACTED Thu Dec 20 01:04:17 2018 From: t6sn7gt@REDACTED (Donald Steven) Date: Wed, 19 Dec 2018 19:04:17 -0500 Subject: [erlang-questions] read_file -- binary data object In-Reply-To: <7969494.nqc9s2zlSz@takoyaki> References: <7969494.nqc9s2zlSz@takoyaki> Message-ID: <9bffd3d3-50eb-eb46-666f-c5f1aba36c74@aim.com> Thanks Craig.? I don't think I expressed my question well. Taking your foo1,txt example, when I read it back (file:read_file("foo1.txt"), how do I access the individual characters of "Something I'll write to disk."? That is, if file:read_file("foo1.txt") yields {ok,<<"Something I'll write to disk.">>}, how do I read the "S", then the "o", etc.? Don On 12/19/2018 6.48 PM, zxq9@REDACTED wrote: > On 2018?12?19???? 18?40?05? JST Donald Steven wrote: >> The manual for the function read_file/1 says: Returns {ok, Binary}, where Binary is a binary data object that contains the contents of Filename, or {error, Reason} if an error occurs. >> >> What is the type of this "binary data object" (a list?). (I'll want to access individual elements.) > It is an Erlang binary. > > > 1> Foo1 = "Something I'll write to disk.". > "Something I'll write to disk." > 2> Foo2 = <<"Something else I'll write to disk.">>. > <<"Something else I'll write to disk.">> > 3> Foo3 = <<1,2,3,4>>. > <<1,2,3,4>> > 4> file:write_file("foo1.txt", Foo1). > ok > 5> file:write_file("foo2.txt", Foo2). > ok > 6> file:write_file("foo3", Foo3). > ok > 7> file:read_file("foo1.txt"). > {ok,<<"Something I'll write to disk.">>} > 8> file:read_file("foo2.txt"). > {ok,<<"Something else I'll write to disk.">>} > 9> file:read_file("foo3"). > {ok,<<1,2,3,4>>} > > > If the above seems perplexing then check out the docs on Erlang binaries. > They are awesome, especially when dealing with binary file formats or network data. > > http://erlang.org/doc/reference_manual/expressions.html#bit_syntax > http://erlang.org/doc/programming_examples/bit_syntax.html > http://erlang.org/doc/man/binary.html > > Also, keep in mind that "object" is a heavily overloaded term in computing. > The docs mean "returns a self-contained thingy that can be labeled and carries > a type (binary) native to the runtime". > > -Craig > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mjtruog@REDACTED Thu Dec 20 01:23:57 2018 From: mjtruog@REDACTED (Michael Truog) Date: Wed, 19 Dec 2018 16:23:57 -0800 Subject: [erlang-questions] otp 21.2 In-Reply-To: References: <45a41641-81c2-50c5-d62f-59535e687c2e@potatochowder.com> <20181216003003.GH1783@thecloud.hijacked.us> Message-ID: On 12/19/18 3:58 PM, Sam Overdorf wrote: > I have decided that this is really dumb that I have to run the > function "c:erlangrc()" just to load my ".erlang" file. > Some of my erlang files have multiple entry points and I have to > execute the function within each one of them (dumb idea). > > I'm use to having a configuration file that will get loaded every time > something "erlang" gets executed. > I don't care if I can't share my erlang with you. I have bigger things > to make work and that is why I need and use the ".erlang" file. > > Sam When Erlang is used in production, it is best to not have it loading a .erlang file that contains random things.? For your own experimentation or development, you can always load things from .erlang with c:erlangrc/1 as was previously described.? If Erlang loaded a .erlang file by default upon startup, it would be difficult to take it seriously for production use. Best Regards, Michael From by@REDACTED Thu Dec 20 01:59:01 2018 From: by@REDACTED (by) Date: Thu, 20 Dec 2018 08:59:01 +0800 Subject: [erlang-questions] read_file -- binary data object In-Reply-To: <9bffd3d3-50eb-eb46-666f-c5f1aba36c74@aim.com> References: <7969494.nqc9s2zlSz@takoyaki> <9bffd3d3-50eb-eb46-666f-c5f1aba36c74@aim.com> Message-ID: This can be achieved by pattern matching. Like <> = Bin. A B C stores the specified data with type integer(character) Yao > ? 2018?12?20??08:04?Donald Steven ??? > > Thanks Craig. I don't think I expressed my question well. > > Taking your foo1,txt example, when I read it back (file:read_file("foo1.txt"), how do I access the individual characters of "Something I'll write to disk." That is, if file:read_file("foo1.txt") yields {ok,<<"Something I'll write to disk.">>}, how do I read the "S", then the "o", etc.? > > Don > >> On 12/19/2018 6.48 PM, zxq9@REDACTED wrote: >>> On 2018?12?19???? 18?40?05? JST Donald Steven wrote: >>> The manual for the function read_file/1 says: Returns {ok, Binary}, where Binary is a binary data object that contains the contents of Filename, or {error, Reason} if an error occurs. >>> >>> What is the type of this "binary data object" (a list?). (I'll want to access individual elements.) >> It is an Erlang binary. >> >> >> 1> Foo1 = "Something I'll write to disk.". >> "Something I'll write to disk." >> 2> Foo2 = <<"Something else I'll write to disk.">>. >> <<"Something else I'll write to disk.">> >> 3> Foo3 = <<1,2,3,4>>. >> <<1,2,3,4>> >> 4> file:write_file("foo1.txt", Foo1). >> ok >> 5> file:write_file("foo2.txt", Foo2). >> ok >> 6> file:write_file("foo3", Foo3). >> ok >> 7> file:read_file("foo1.txt"). >> {ok,<<"Something I'll write to disk.">>} >> 8> file:read_file("foo2.txt"). >> {ok,<<"Something else I'll write to disk.">>} >> 9> file:read_file("foo3"). >> {ok,<<1,2,3,4>>} >> >> >> If the above seems perplexing then check out the docs on Erlang binaries. >> They are awesome, especially when dealing with binary file formats or network data. >> >> http://erlang.org/doc/reference_manual/expressions.html#bit_syntax >> http://erlang.org/doc/programming_examples/bit_syntax.html >> http://erlang.org/doc/man/binary.html >> >> Also, keep in mind that "object" is a heavily overloaded term in computing. >> The docs mean "returns a self-contained thingy that can be labeled and carries >> a type (binary) native to the runtime". >> >> -Craig >> _______________________________________________ >> 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 t6sn7gt@REDACTED Thu Dec 20 02:17:18 2018 From: t6sn7gt@REDACTED (Donald Steven) Date: Wed, 19 Dec 2018 20:17:18 -0500 Subject: [erlang-questions] read_file -- binary data object In-Reply-To: References: <7969494.nqc9s2zlSz@takoyaki> <9bffd3d3-50eb-eb46-666f-c5f1aba36c74@aim.com> Message-ID: <2bbb7c45-222f-a341-d869-e8b9599619a1@aim.com> When I try that A is bound to all the data in Bin.? I want A to be bound only to the first byte. On 12/19/2018 7.59 PM, by wrote: > <> = Bin. From 2QdxY4RzWzUUiLuE@REDACTED Thu Dec 20 02:22:53 2018 From: 2QdxY4RzWzUUiLuE@REDACTED (Dan Sommers) Date: Wed, 19 Dec 2018 19:22:53 -0600 Subject: [erlang-questions] read_file -- binary data object In-Reply-To: <9bffd3d3-50eb-eb46-666f-c5f1aba36c74@aim.com> References: <7969494.nqc9s2zlSz@takoyaki> <9bffd3d3-50eb-eb46-666f-c5f1aba36c74@aim.com> Message-ID: <85a4ed40-eda3-794e-8b9f-45431e2d4463@potatochowder.com> On 12/19/18 6:04 PM, Donald Steven wrote: > Taking your foo1,txt example, when I read it back > (file:read_file("foo1.txt"), how do I access the individual characters > of "Something I'll write to disk." That is, if > file:read_file("foo1.txt") yields {ok,<<"Something I'll write to > disk.">>}, how do I read the "S", then the "o", etc.? What is your ultimate intent with all of those individual characters? (1) If you want to create a new list from them, then convert the binary to a list and use a list comprehension: [operate_on_one_octet(Octet) || Octet <- binary:bin_to_list(Binary)] or perhaps lists:filter, lists:foldl, lists:map, etc. (2) If you want to run some side-effect-producing function on each one, then use lists:foreach: lists:foreach(fun print_one_octet(Octet) -> io:format("--> ~p <--~n", [Octet]) end, binary:bin_to_list([Binary])) Dan From t6sn7gt@REDACTED Thu Dec 20 02:38:58 2018 From: t6sn7gt@REDACTED (Donald Steven) Date: Wed, 19 Dec 2018 20:38:58 -0500 Subject: [erlang-questions] read_file -- binary data object In-Reply-To: <85a4ed40-eda3-794e-8b9f-45431e2d4463@potatochowder.com> References: <7969494.nqc9s2zlSz@takoyaki> <9bffd3d3-50eb-eb46-666f-c5f1aba36c74@aim.com> <85a4ed40-eda3-794e-8b9f-45431e2d4463@potatochowder.com> Message-ID: <777b9265-bb25-e78c-c22f-feeb5198f6c6@aim.com> An HTML attachment was scrubbed... URL: From t6sn7gt@REDACTED Thu Dec 20 04:30:10 2018 From: t6sn7gt@REDACTED (Donald Steven) Date: Wed, 19 Dec 2018 22:30:10 -0500 Subject: [erlang-questions] read_file -- binary data object In-Reply-To: <85a4ed40-eda3-794e-8b9f-45431e2d4463@potatochowder.com> References: <7969494.nqc9s2zlSz@takoyaki> <9bffd3d3-50eb-eb46-666f-c5f1aba36c74@aim.com> <85a4ed40-eda3-794e-8b9f-45431e2d4463@potatochowder.com> Message-ID: <3830719c-df72-70fc-95b6-11acefee9949@aim.com> Solved, thanks everyone.? I was confused by erlang:binary_to_list and binary:bin_to_list. On 12/19/2018 8.22 PM, Dan Sommers wrote: > On 12/19/18 6:04 PM, Donald Steven wrote: > > > Taking your foo1,txt example, when I read it back > > (file:read_file("foo1.txt"), how do I access the individual characters > > of "Something I'll write to disk."? That is, if > > file:read_file("foo1.txt") yields {ok,<<"Something I'll write to > > disk.">>}, how do I read the "S", then the "o", etc.? > > What is your ultimate intent with all of those individual characters? > > (1) If you want to create a new list from them, then convert the binary > to a list and use a list comprehension: > > ??? [operate_on_one_octet(Octet) || Octet <- binary:bin_to_list(Binary)] > > or perhaps lists:filter, lists:foldl, lists:map, etc. > > (2) If you want to run some side-effect-producing function on each one, > then use lists:foreach: > > ??? lists:foreach(fun print_one_octet(Octet) -> > ????????????????????? io:format("--> ~p <--~n", [Octet]) > ????????????????? end, > ????????????????? binary:bin_to_list([Binary])) > > Dan > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From vans_163@REDACTED Thu Dec 20 06:52:24 2018 From: vans_163@REDACTED (Vans S) Date: Thu, 20 Dec 2018 05:52:24 +0000 (UTC) Subject: [erlang-questions] 300k HTTP GET RPS on Erlang 21.2, benchmarking per scheduler polling In-Reply-To: <20181219130408.GA780@ferdmbp.local> References: <477143608.6439372.1545096976895.ref@mail.yahoo.com> <477143608.6439372.1545096976895@mail.yahoo.com> <1522630353.6731828.1545143641036@mail.yahoo.com> <20181219130408.GA780@ferdmbp.local> Message-ID: <1456496381.7864383.1545285144198@mail.yahoo.com> Removing unoptimised validity checks (parsing the request) got about a 2x speed up. from 300k to 600k~. Removing the inet_drv and replacing it with a very innefficient poll every 10ms C NIF that was polling from vm processes on 6000 connections + not doing validity checks got 1.25m~ theoretical as I ran out of cores to benchmark from.? So say a 2x speed up from using the inet_drv.? This is not optimized, a optimized C NIF for polling would use edge polling on groups of descriptors to avoid a kernel call every 10 ms + the enter C NIF overhead per connection. What I did remove in the inet_drv was some what I consider useless guarantees but guarantees that result in 1 extra memory copy / allocation plus extra cpu overhead.? For example inet_drv provides a guarantee that send will ALWAYS send all the bytes you pass it, keeping a copy of the buffer. I removed this gaurantee I dont think its appropriate for performance, the process doing the send should just keep track of the buffer, if a send results in a partial send, return the amount of bytes that was sent and allow the caller to mark its buffer. Also indeed the benchmark is not appropriate for 99.9% of the workloads non-cdn and non-caching-based web servers do, where the overhead of the work to generate the response itself will far outweight the overhead of parsing the request, BUT it is never the less interesting to see just how low the VM overhead is. (I dont consider inet_drv as part of VM when I refer to VM) On Wednesday, December 19, 2018, 8:04:17 a.m. EST, Fred Hebert wrote: On 12/18, Vans S wrote: > I think OTHER is something to do with Ports / polling, because I just > removed the inet_drv and wrote a simple c nif to do TCP networking, > and the throughput doubled. I did not get around to recompiling erlang > with microstate accounting but without inet driver using an > unoptimized nonblocking tcp nif I got the msacc report to look like > >Using 2 schedulers because 10 physical cores generating load now just >barely fully saturated.? now 90% of the time is spent in emulator, 6% >is other, I am guessing 6% other is the NIF calls to the socket calls? > >The throughput was 250k for 2 physical cores.? If all scales linearly >that is 1.25m RPS for simple GET hello world benchmark. > >The NIF is >PoC?https://gist.github.com/vans163/d96fcc7c89d0cf25c819c5fb77769e81?ofcourse >its only useful in the case there is constant data on socket, otherwise >this PoC will break if there is idle connections that keep getting >polled.? This opens the possibility though to using something like >DPDK. I think you might have achieved this: https://twitter.com/seldo/status/800817973921386497 Chapter 15: 300% performance boosts by deleting data validity checks Of course, the driver may have a higher baseline overhead than a NIF, but you also got rid of all validation and handling of any edge case whatsoever. You claim your NIF is not optimized, but it is _extremely_ optimized: you removed all code that could have been useful for scenarios that are not the one you are actively testing, therefore getting rid of all their overheads. And you are doing so on a rather useless benchmark: hello worlds that parse nothing and therefore have nothing in common with any application in the wild that might care about the request's content. The benchmark results you get can therefore not be extrapolated to be relevant to any application out there. I would likely urge you, unless you are doing this for the fun of micro-optimizing edge cases, to consider basing your work on more representative benchmarks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From zxq9@REDACTED Thu Dec 20 07:42:01 2018 From: zxq9@REDACTED (zxq9@REDACTED) Date: Thu, 20 Dec 2018 15:42:01 +0900 Subject: [erlang-questions] read_file -- binary data object In-Reply-To: <9bffd3d3-50eb-eb46-666f-c5f1aba36c74@aim.com> References: <7969494.nqc9s2zlSz@takoyaki> <9bffd3d3-50eb-eb46-666f-c5f1aba36c74@aim.com> Message-ID: <1807356.BIf63fHUgS@takoyaki> On 2018?12?19???? 19?04?17? JST you wrote: > Thanks Craig. I don't think I expressed my question well. > > Taking your foo1,txt example, when I read it back > (file:read_file("foo1.txt"), how do I access the individual characters > of "Something I'll write to disk." That is, if > file:read_file("foo1.txt") yields {ok,<<"Something I'll write to > disk.">>}, how do I read the "S", then the "o", etc.? Gotcha Once I have a binary I can loop over it the same way I would a list. Continuing with our previous example of "foo1.txt"... 1> PrintCodepoints = fun 1> P(<>) -> 1> ok = io:format("Codepoint: ~w~n", [Char]), 1> P(Rest); 1> P(<<>>) -> 1> io:format("Done!~n") 1> end. #Fun 2> {ok, Bin} = file:read_file("foo1.txt"). {ok,<<"Something I'll write to disk.">>} 3> PrintCodepoints(Bin). Codepoint: 83 Codepoint: 111 Codepoint: 109 Codepoint: 101 Codepoint: 116 Codepoint: 104 Codepoint: 105 Codepoint: 110 Codepoint: 103 Codepoint: 32 Codepoint: 73 Codepoint: 39 Codepoint: 108 Codepoint: 108 Codepoint: 32 Codepoint: 119 Codepoint: 114 Codepoint: 105 Codepoint: 116 Codepoint: 101 Codepoint: 32 Codepoint: 116 Codepoint: 111 Codepoint: 32 Codepoint: 100 Codepoint: 105 Codepoint: 115 Codepoint: 107 Codepoint: 46 Done! ok Hm. That came out a bit longer vertically than I intended, but you get the idea. Obviously you would want to define that as a normal function, not a named lambda, but the shell is really convenient for just showing you how it would go. codepoints(<>) -> ok = io:format("Codepoint: ~w~n", [Char]), codepoints(Rest); codepoints(<<>>) -> io:format("Done!~n"). Put anything in there you might want to imagine. -Craig From erlang@REDACTED Thu Dec 20 10:49:40 2018 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 20 Dec 2018 10:49:40 +0100 Subject: [erlang-questions] read_file -- binary data object In-Reply-To: <7969494.nqc9s2zlSz@takoyaki> References: <7969494.nqc9s2zlSz@takoyaki> Message-ID: A binary is just an area of memory containing raw bytes. L = binary_to_list(B) converts the binary B into a list of integers L where each integer is in the range 0..255 list_to_binary(L) is the inverse. A list of small integers of length N takes 16*N bytes of storage (on a 64 bit word size erlang) A binary of size N takes N+C bytes of storage where C is a small constant Random access on lists is bad - random access on binaries is far better. There are primitives to access the individual elements of lists and binaries. There are also some fancy bit-level things (the binary syntax) so you can extract ranges of bits from binaries in a convenient manner. Cheers /Joe On Thu, Dec 20, 2018 at 12:48 AM wrote: > > On 2018?12?19???? 18?40?05? JST Donald Steven wrote: > > The manual for the function read_file/1 says: Returns {ok, Binary}, where Binary is a binary data object that contains the contents of Filename, or {error, Reason} if an error occurs. > > > > What is the type of this "binary data object" (a list?). (I'll want to access individual elements.) > > It is an Erlang binary. > > > 1> Foo1 = "Something I'll write to disk.". > "Something I'll write to disk." > 2> Foo2 = <<"Something else I'll write to disk.">>. > <<"Something else I'll write to disk.">> > 3> Foo3 = <<1,2,3,4>>. > <<1,2,3,4>> > 4> file:write_file("foo1.txt", Foo1). > ok > 5> file:write_file("foo2.txt", Foo2). > ok > 6> file:write_file("foo3", Foo3). > ok > 7> file:read_file("foo1.txt"). > {ok,<<"Something I'll write to disk.">>} > 8> file:read_file("foo2.txt"). > {ok,<<"Something else I'll write to disk.">>} > 9> file:read_file("foo3"). > {ok,<<1,2,3,4>>} > > > If the above seems perplexing then check out the docs on Erlang binaries. > They are awesome, especially when dealing with binary file formats or network data. > > http://erlang.org/doc/reference_manual/expressions.html#bit_syntax > http://erlang.org/doc/programming_examples/bit_syntax.html > http://erlang.org/doc/man/binary.html > > Also, keep in mind that "object" is a heavily overloaded term in computing. > The docs mean "returns a self-contained thingy that can be labeled and carries > a type (binary) native to the runtime". > > -Craig > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From t6sn7gt@REDACTED Thu Dec 20 23:27:47 2018 From: t6sn7gt@REDACTED (Donald Steven) Date: Thu, 20 Dec 2018 17:27:47 -0500 Subject: [erlang-questions] read_file -- binary data object In-Reply-To: References: <7969494.nqc9s2zlSz@takoyaki> Message-ID: <1a7849ae-afb2-d032-5a29-25a12d741980@aim.com> Thanks Joe, much appreciated. On 12/20/2018 4.49 AM, Joe Armstrong wrote: > A binary is just an area of memory containing raw bytes. > > L = binary_to_list(B) converts the binary B into a list of integers L where > each integer is in the range 0..255 > > list_to_binary(L) is the inverse. > > A list of small integers of length N takes 16*N bytes of storage (on a > 64 bit word size erlang) > A binary of size N takes N+C bytes of storage where C is a small constant > > Random access on lists is bad - random access on binaries is far better. > > There are primitives to access the individual elements of lists and binaries. > > There are also some fancy bit-level things (the binary syntax) so you > can extract ranges of bits from binaries in a convenient manner. > > Cheers > > /Joe > > > On Thu, Dec 20, 2018 at 12:48 AM wrote: >> On 2018?12?19???? 18?40?05? JST Donald Steven wrote: >>> The manual for the function read_file/1 says: Returns {ok, Binary}, where Binary is a binary data object that contains the contents of Filename, or {error, Reason} if an error occurs. >>> >>> What is the type of this "binary data object" (a list?). (I'll want to access individual elements.) >> It is an Erlang binary. >> >> >> 1> Foo1 = "Something I'll write to disk.". >> "Something I'll write to disk." >> 2> Foo2 = <<"Something else I'll write to disk.">>. >> <<"Something else I'll write to disk.">> >> 3> Foo3 = <<1,2,3,4>>. >> <<1,2,3,4>> >> 4> file:write_file("foo1.txt", Foo1). >> ok >> 5> file:write_file("foo2.txt", Foo2). >> ok >> 6> file:write_file("foo3", Foo3). >> ok >> 7> file:read_file("foo1.txt"). >> {ok,<<"Something I'll write to disk.">>} >> 8> file:read_file("foo2.txt"). >> {ok,<<"Something else I'll write to disk.">>} >> 9> file:read_file("foo3"). >> {ok,<<1,2,3,4>>} >> >> >> If the above seems perplexing then check out the docs on Erlang binaries. >> They are awesome, especially when dealing with binary file formats or network data. >> >> http://erlang.org/doc/reference_manual/expressions.html#bit_syntax >> http://erlang.org/doc/programming_examples/bit_syntax.html >> http://erlang.org/doc/man/binary.html >> >> Also, keep in mind that "object" is a heavily overloaded term in computing. >> The docs mean "returns a self-contained thingy that can be labeled and carries >> a type (binary) native to the runtime". >> >> -Craig >> _______________________________________________ >> 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 matthias@REDACTED Fri Dec 21 00:26:38 2018 From: matthias@REDACTED (Matthias Lang) Date: Fri, 21 Dec 2018 00:26:38 +0100 Subject: [erlang-questions] Big band playing In-Reply-To: <7d090675-e9ef-013e-db41-9e386f51b79f@cs.ntua.gr> References: <601e4ab3-532c-06fe-5e2b-c7b283475b2a@cs.ntua.gr> <7d090675-e9ef-013e-db41-9e386f51b79f@cs.ntua.gr> Message-ID: <20181220232638.GA27798@hec.corelatus.se> On 15. December 2018, Kostis Sagonas wrote: > I was able to reproduce this on an old R12 version that I still have around: > > Erlang (BEAM) emulator version 5.6.5 [source] [64-bit] [smp:64] > [async-threads:0] [hipe] [kernel-poll:false] > > Eshell V5.6.5 (abort with ^G) > 1> (-1299341865233935136534120785510400) band (-1). > -1299341865233953583278194495062016 > > I would not be surprised if this bug existed even before Erlang/OTP became > open source. I can't go back that far, but I can get closer. We have a rack with a reference system for every model we've sold. The oldest is a big-endian 50 MHz PPC from 2002. Re-flashing that with the oldest firmware I can easily install: Eshell V5.1.2 (abort with ^G) 1> init:script_id(). {"OTP APN 181 01","R8B"} 2> (-1299341865233935136534120785510400) band (-1). -1299341865233935136534120785575936 % -0x4010000000000000000000010000 On newer (relatively) hardware (a little-endian 32-bit ARM): Erlang R14B03 (erts-5.8.4) [source] [rq:1] [async-threads:0] [kernel-poll:false] 1> (-1299341865233935136534120785510400) band (-1). -1299341865233935136534125080477696 % -0x4010000000000000000100000000 Same Erlang version but on 64-bit Intel hardware: Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:16:16] [rq:16] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.8.4 (abort with ^G) 1> (-1299341865233935136534120785510400) band (-1). -1299341865233953583278194495062016 % -0x4010000000010000000000000000 Matthias From soverdor@REDACTED Fri Dec 21 01:01:13 2018 From: soverdor@REDACTED (Sam Overdorf) Date: Thu, 20 Dec 2018 16:01:13 -0800 Subject: [erlang-questions] otp 21.2 In-Reply-To: References: <45a41641-81c2-50c5-d62f-59535e687c2e@potatochowder.com> <20181216003003.GH1783@thecloud.hijacked.us> Message-ID: I don't know about you but if I am responsible for a production environment I am in control of how everything starts and stops and everything in between. My goal for having all of this control is I want my production environment to run simply and smoothly for all of my users. My way of making it simple and smooth is to control everything and the more tools I have to do this the better. Sam On Wed, Dec 19, 2018 at 4:23 PM Michael Truog wrote: > > On 12/19/18 3:58 PM, Sam Overdorf wrote: > > I have decided that this is really dumb that I have to run the > > function "c:erlangrc()" just to load my ".erlang" file. > > Some of my erlang files have multiple entry points and I have to > > execute the function within each one of them (dumb idea). > > > > I'm use to having a configuration file that will get loaded every time > > something "erlang" gets executed. > > I don't care if I can't share my erlang with you. I have bigger things > > to make work and that is why I need and use the ".erlang" file. > > > > Sam > When Erlang is used in production, it is best to not have it loading a > .erlang file that contains random things. For your own experimentation > or development, you can always load things from .erlang with > c:erlangrc/1 as was previously described. If Erlang loaded a .erlang > file by default upon startup, it would be difficult to take it seriously > for production use. > > Best Regards, > Michael From mjtruog@REDACTED Fri Dec 21 03:42:33 2018 From: mjtruog@REDACTED (Michael Truog) Date: Thu, 20 Dec 2018 18:42:33 -0800 Subject: [erlang-questions] otp 21.2 In-Reply-To: References: <45a41641-81c2-50c5-d62f-59535e687c2e@potatochowder.com> <20181216003003.GH1783@thecloud.hijacked.us> Message-ID: On 12/20/18 4:01 PM, Sam Overdorf wrote: > I don't know about you but if I am responsible for a production > environment I am in control of how everything starts and stops and > everything in between. > My goal for having all of this control is I want my production > environment to run simply and smoothly for all of my users. > My way of making it simple and smooth is to control everything and the > more tools I have to do this the better. > Loading random source code from a file at ${HOME}/.erlang that lacks visibility and is outside of the release, as part of the release, as if it was meant to be there does not help the release be more dependable.? The random source code can cause problems, and avoiding the potential for it to be the source of problems is a great way to pursue having a dependable release.? Random source code can always be entered into the shell, which should be logged, or added to a module that is properly within the release and that gives it visibility, allowing it to be tracked. Best Regards, Michael From otp@REDACTED Fri Dec 21 10:16:57 2018 From: otp@REDACTED (Erlang/OTP) Date: Fri, 21 Dec 2018 10:16:57 +0100 Subject: [erlang-questions] Patch Package OTP 21.2.1 Released Message-ID: <20181221091657.GA18677@erix.ericsson.se> Patch Package: OTP 21.2.1 Git Tag: OTP-21.2.1 Date: 2018-12-21 Trouble Report Id: OTP-15485, OTP-15486, OTP-15487, OTP-15489 Seq num: ERL-308, ERL-804 System: OTP Release: 21 Application: erts-10.2.1, ssl-9.1.1 Predecessor: OTP 21.2 Check out the git tag OTP-21.2.1, and build a full OTP system including documentation. Apply one or more applications from this build as patches to your installation using the 'otp_patch_apply' tool. For information on install requirements, see descriptions for each application version below. --------------------------------------------------------------------- --- erts-10.2.1 ----------------------------------------------------- --------------------------------------------------------------------- Note! The erts-10.2.1 application can *not* be applied independently of other applications on an arbitrary OTP 21 installation. On a full OTP 21 installation, also the following runtime dependencies have to be satisfied: -- kernel-6.1 (first satisfied in OTP 21.1) -- sasl-3.3 (first satisfied in OTP 21.2) --- Fixed Bugs and Malfunctions --- OTP-15485 Application(s): erts Fixed bug on big endian architectures when changing file permissions or ownership with file:change_mode, change_owner, change_group or write_file_info. Bug exists since OTP-21.0. OTP-15486 Application(s): erts Related Id(s): PR-2061 Fixed bug in atomics with option {signed,false} when returned values are (1 bsl 63) or larger. Could cause heap corruption leading to VM crash or other unpleasant symptoms. Bug exists since OTP-21.2 when module atomics was introduced. OTP-15487 Application(s): erts Related Id(s): ERL-804 Fixed bug in operator band of two negative operands causing erroneous result if the absolute value of one of the operands have the lowest N*W bits as zero and the other absolute value is not larger than N*W bits. N is an integer of 1 or larger and W is 32 or 64 depending on word size. Full runtime dependencies of erts-10.2.1: kernel-6.1, sasl-3.3, stdlib-3.5 --------------------------------------------------------------------- --- ssl-9.1.1 ------------------------------------------------------- --------------------------------------------------------------------- The ssl-9.1.1 application can be applied independently of other applications on a full OTP 21 installation. --- Fixed Bugs and Malfunctions --- OTP-15489 Application(s): ssl Related Id(s): ERL-308 Fixed renegotiation bug. Client did not handle server initiated renegotiation correctly after rewrite to two connection processes, due to ERL-622 commit d87ac1c55188f5ba5cdf72384125d94d42118c18. This could manifest it self as a " bad_record_mac" alert. Also included are some optimizations Full runtime dependencies of ssl-9.1.1: crypto-4.2, erts-10.0, inets-5.10.7, kernel-6.0, public_key-1.5, stdlib-3.5 --------------------------------------------------------------------- --------------------------------------------------------------------- --------------------------------------------------------------------- From sverker@REDACTED Fri Dec 21 12:22:24 2018 From: sverker@REDACTED (Sverker Eriksson) Date: Fri, 21 Dec 2018 12:22:24 +0100 Subject: [erlang-questions] Big band playing In-Reply-To: <20181220232638.GA27798@hec.corelatus.se> References: <601e4ab3-532c-06fe-5e2b-c7b283475b2a@cs.ntua.gr> <7d090675-e9ef-013e-db41-9e386f51b79f@cs.ntua.gr> <20181220232638.GA27798@hec.corelatus.se> Message-ID: <1545391344.5257.8.camel@erlang.org> On fre, 2018-12-21 at 00:26 +0100, Matthias Lang wrote: > On 15. December 2018, Kostis Sagonas wrote: > > > > > I was able to reproduce this on an old R12 version that I still have around: > > > > Erlang (BEAM) emulator version 5.6.5 [source] [64-bit] [smp:64] > > [async-threads:0] [hipe] [kernel-poll:false] > > > > Eshell V5.6.5??(abort with ^G) > > 1> (-1299341865233935136534120785510400) band (-1). > > -1299341865233953583278194495062016 > > > > I would not be surprised if this bug existed even before Erlang/OTP became > > open source. > I can't go back that far, but I can get closer. > > We have a rack with a reference system for every model we've sold. > The oldest is a big-endian 50 MHz PPC from 2002. Re-flashing that with > the oldest firmware I can easily install: > > ? Eshell V5.1.2??(abort with ^G) > ? 1> init:script_id(). > ? {"OTP??APN 181 01","R8B"} > ? 2> (-1299341865233935136534120785510400) band (-1). > ? -1299341865233935136534120785575936 > ? % -0x4010000000000000000000010000 > > On newer (relatively) hardware (a little-endian 32-bit ARM): > > ? Erlang R14B03 (erts-5.8.4) [source] [rq:1] [async-threads:0] [kernel- > poll:false] > ? 1> (-1299341865233935136534120785510400) band (-1). > ? -1299341865233935136534125080477696 > ? % -0x4010000000000000000100000000 > > Same Erlang version but on 64-bit Intel hardware: > > ? Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:16:16] [rq:16] [async- > threads:0] [hipe] [kernel-poll:false] > > ? Eshell V5.8.4??(abort with ^G) > ? 1> (-1299341865233935136534120785510400) band (-1). > ? -1299341865233953583278194495062016 > ? % -0x4010000000010000000000000000 > And now the Big Buggy Band finally gone silent in OTP-21.2.1: Erlang/OTP 21 [erts-10.2.1] [source] [64-bit] [smp:24:24] [ds:24:24:10] [async- threads:1] [hipe] Eshell V10.2.1??(abort with ^G) 1> (-1299341865233935136534120785510400) band (-1). -1299341865233935136534120785510400 /Sverker From marc@REDACTED Fri Dec 21 14:41:47 2018 From: marc@REDACTED (Marc Worrell) Date: Fri, 21 Dec 2018 14:41:47 +0100 Subject: [erlang-questions] [ANN] Zotonic 0.43 - with security fixes Message-ID: Hi, Zotonic is the Erlang Content Management System and Web Framework. We have released 0.43.0. This includes security fixes and the changes mentioned below NOTE: If you have a blog site derived from the skel/blog then replace the archives.tpl file in your site with the one provided in priv/skel/blog/archives.tpl This also fixes a reflected XSS problem in the admin. We request people to update their 0.x installation to 0.43 to mitigate this problem. Main changes are: * Allowed uploadable files in mod_acl_user_groups are now configurable * Security fixes for reflected XSS in the admin and skel/blog/archives.tpl * Hardened HTTP headers for securing Zotonic sessions and requests * mod_twitter now uses polling for fetching tweets, stopped using deprecated streaming API ## Compatibility If you include a page of your site inside a frame on another site, then set the ``allow_frame`` option on the affected dispatch rule. Download and full release notes are here: https://github.com/zotonic/zotonic/releases/tag/0.43.0 Regards from the Zotonic core team, Marc Worrell From soverdor@REDACTED Sat Dec 22 00:24:24 2018 From: soverdor@REDACTED (Sam Overdorf) Date: Fri, 21 Dec 2018 15:24:24 -0800 Subject: [erlang-questions] otp 21.2 In-Reply-To: References: <45a41641-81c2-50c5-d62f-59535e687c2e@potatochowder.com> <20181216003003.GH1783@thecloud.hijacked.us> Message-ID: It is hardly random source. It is only stuff supported by me because it is my application supported by me. Sam On Thu, Dec 20, 2018 at 6:42 PM Michael Truog wrote: > > On 12/20/18 4:01 PM, Sam Overdorf wrote: > > I don't know about you but if I am responsible for a production > > environment I am in control of how everything starts and stops and > > everything in between. > > My goal for having all of this control is I want my production > > environment to run simply and smoothly for all of my users. > > My way of making it simple and smooth is to control everything and the > > more tools I have to do this the better. > > > Loading random source code from a file at ${HOME}/.erlang that lacks > visibility and is outside of the release, as part of the release, as if > it was meant to be there does not help the release be more dependable. > The random source code can cause problems, and avoiding the potential > for it to be the source of problems is a great way to pursue having a > dependable release. Random source code can always be entered into the > shell, which should be logged, or added to a module that is properly > within the release and that gives it visibility, allowing it to be tracked. > > Best Regards, > Michael From t6sn7gt@REDACTED Sat Dec 22 13:51:00 2018 From: t6sn7gt@REDACTED (Donald Steven) Date: Sat, 22 Dec 2018 07:51:00 -0500 Subject: [erlang-questions] Access to process dictionary Message-ID: <7edb8469-7917-3d05-c237-63293d8ce401@aim.com> Do two function calls with the same name but one parameter different (see below) share access to the same process dictionary or does each have a distinct instance? Example: funA(param1, param2) -> do something. funA(param1, differentparam2) -> do something different. === I could just use an if statement within one function call, but I'd like to know if they share the same process dictionary. Thanks. From eric.pailleau@REDACTED Sat Dec 22 14:56:29 2018 From: eric.pailleau@REDACTED (Eric Pailleau) Date: Sat, 22 Dec 2018 14:56:29 +0100 Subject: [erlang-questions] Access to process dictionary In-Reply-To: <7edb8469-7917-3d05-c237-63293d8ce401@aim.com> References: <7edb8469-7917-3d05-c237-63293d8ce401@aim.com> Message-ID: <0qiisqlqeps1llqk4mn9qnav.1545486989861@email.android.com> Hi, Process dictionary is a dictionary for a process. If you call each functions from different processes, they are independents. From a single process two functions cannot be called at same time. Envoy? depuis mon mobile ---- Donald Steven a ?crit ---- >Do two function calls with the same name but one parameter different >(see below) share access to the same process dictionary or does each >have a distinct instance? > > >Example: > > >funA(param1, param2) -> do something. > >funA(param1, differentparam2) -> do something different. > > >=== > > >I could just use an if statement within one function call, but I'd like >to know if they share the same process dictionary. Thanks. > >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Sat Dec 22 21:19:58 2018 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Sat, 22 Dec 2018 21:19:58 +0100 Subject: [erlang-questions] otp 21.2 In-Reply-To: References: <45a41641-81c2-50c5-d62f-59535e687c2e@potatochowder.com> <20181216003003.GH1783@thecloud.hijacked.us> Message-ID: On Sat, Dec 22, 2018 at 12:16 AM Sam Overdorf wrote: > It is hardly random source. It is only stuff supported by me because > it is my application supported by me. > > I have some pretty nasty war stories where people couldn't build software on their development machine, whereas the CI system and other users happily built the software. The culprit turned out to be .erlangrc. It is of course easy when you control the environment, but many hours have been wasted on this, trust me. Regard this is a deliberate design trade-off in the language. My hunch is it saves around 10 people whenever it inconveniences 1. -------------- next part -------------- An HTML attachment was scrubbed... URL: From t6sn7gt@REDACTED Sun Dec 23 01:59:11 2018 From: t6sn7gt@REDACTED (Donald Steven) Date: Sat, 22 Dec 2018 19:59:11 -0500 Subject: [erlang-questions] Access to process dictionary In-Reply-To: <0qiisqlqeps1llqk4mn9qnav.1545486989861@email.android.com> References: <7edb8469-7917-3d05-c237-63293d8ce401@aim.com> <0qiisqlqeps1llqk4mn9qnav.1545486989861@email.android.com> Message-ID: An HTML attachment was scrubbed... URL: From eric.pailleau@REDACTED Sun Dec 23 10:13:02 2018 From: eric.pailleau@REDACTED (Eric Pailleau) Date: Sun, 23 Dec 2018 10:13:02 +0100 Subject: [erlang-questions] Access to process dictionary In-Reply-To: References: <7edb8469-7917-3d05-c237-63293d8ce401@aim.com> <0qiisqlqeps1llqk4mn9qnav.1545486989861@email.android.com> Message-ID: You should however avoid to use process dictionaries if possible. It is handy to store things, but generally a sign that your code is missing something. For instance if you face some processes crashes, your process dictionary will be lost, while using states in OTP libs will be shown in crash report. Easier for debugging. Regards Envoy? depuis mon mobile ---- Donald Steven a ?crit ---- >Merci Eric! > >On 12/22/2018 8.56 AM, Eric Pailleau wrote: > >Hi, > >Process dictionary is a dictionary for a process. > >If you call each functions from different processes, they are independents. > >From a single process two functions cannot be called at same time. > > >Envoy? depuis mon mobile > > > >---- Donald Steven a ?crit ---- > >Do two function calls with the same name but one parameter different > >(see below) share access to the same process dictionary or does each > >have a distinct instance? > > > > > >Example: > > > > > >funA(param1, param2) -> do something. > > > >funA(param1, differentparam2) -> do something different. > > > > > >=== > > > > > >I could just use an if statement within one function call, but I'd like > >to know if they share the same process dictionary. Thanks. > > > >_______________________________________________ > >erlang-questions mailing list > >erlang-questions@REDACTED > >http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pierrefenoll@REDACTED Sun Dec 23 11:15:29 2018 From: pierrefenoll@REDACTED (Pierre Fenoll) Date: Sun, 23 Dec 2018 11:15:29 +0100 Subject: [erlang-questions] Access to process dictionary In-Reply-To: References: <7edb8469-7917-3d05-c237-63293d8ce401@aim.com> <0qiisqlqeps1llqk4mn9qnav.1545486989861@email.android.com> Message-ID: Hi list. Am I the only one not seeing the first email of most threads? Or is it my gmail mobile client that does its thing? Thanks & be well On Sun 23 Dec 2018 at 10:13, Eric Pailleau wrote: > You should however avoid to use process dictionaries if possible. > > It is handy to store things, but generally a sign that your code is > missing something. > > For instance if you face some processes crashes, your process dictionary > will be lost, while using states in OTP libs will be shown in crash report. > Easier for debugging. > > Regards > > Envoy? depuis mon mobile > > > ---- Donald Steven a ?crit ---- > > Merci Eric! > > On 12/22/2018 8.56 AM, Eric Pailleau wrote: > > Hi, > > Process dictionary is a dictionary for a process. > > If you call each functions from different processes, they are > independents. > > From a single process two functions cannot be called at same time. > > Envoy? depuis mon mobile > > > ---- Donald Steven a ?crit ---- > > Do two function calls with the same name but one parameter different > > (see below) share access to the same process dictionary or does each > > have a distinct instance? > > > > > > Example: > > > > > > funA(param1, param2) -> do something. > > > > funA(param1, differentparam2) -> do something different. > > > > > > === > > > > > > I could just use an if statement within one function call, but I'd like > > to know if they share the same process dictionary. Thanks. > > > > _______________________________________________ > > 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 > -- Cheers, -- Pierre Fenoll -------------- next part -------------- An HTML attachment was scrubbed... URL: From matwey.kornilov@REDACTED Sun Dec 23 11:19:37 2018 From: matwey.kornilov@REDACTED (Matwey V. Kornilov) Date: Sun, 23 Dec 2018 13:19:37 +0300 Subject: [erlang-questions] Patch package OTP 21.0.5 released In-Reply-To: References: Message-ID: Just for the record. I have a python prototype to walk over notes.xml as proposed by Kenneth: https://github.com/matwey/obs-service-erlang_changes ??, 22 ???. 2018 ?. ? 12:11, Lukas Larsson : > > Hello, > > On Tue, Aug 14, 2018 at 9:55 PM Matwey V. Kornilov wrote: >> >> >> Could you please opensource the tool which is used to produce this mails >> from OTP sources? >> > > The tools does not generate the email from OTP sources, but from our internal ticket database. So it is not possible to run it outside of our environment. > > Lukas -- With best regards, Matwey V. Kornilov From essen@REDACTED Sun Dec 23 11:51:50 2018 From: essen@REDACTED (=?UTF-8?Q?Lo=c3=afc_Hoguin?=) Date: Sun, 23 Dec 2018 11:51:50 +0100 Subject: [erlang-questions] Access to process dictionary In-Reply-To: References: <7edb8469-7917-3d05-c237-63293d8ce401@aim.com> <0qiisqlqeps1llqk4mn9qnav.1545486989861@email.android.com> Message-ID: <48d1a0f1-c7f5-ecce-a245-913355836d37@ninenines.eu> It's you. :-) On 23/12/2018 11:15, Pierre Fenoll wrote: > Hi list. > Am I the only one not seeing the first email of most threads? Or is it > my gmail mobile client that does its thing? > Thanks & be well > > On Sun 23 Dec 2018 at 10:13, Eric Pailleau > wrote: > > You should however avoid to use process dictionaries if possible. > > It is handy to store things, but generally a sign that your code is > missing something. > > > For instance if you face some processes crashes, your process > dictionary will be lost, while using states in OTP libs will be > shown in crash report. Easier for debugging. > > > Regards > > > Envoy? depuis mon mobile > > > > ---- Donald Steven a ?crit ---- > > Merci Eric! > > On 12/22/2018 8.56 AM, Eric Pailleau wrote: >> >> Hi, >> >> Process dictionary is a dictionary for a process. >> >> If you call each functions from different processes, they are >> independents. >> >> From a single process two functions cannot be called at same time. >> >> >> Envoy? depuis mon mobile >> >> >> >> ---- Donald Steven a ?crit ---- >> >> Do two function calls with the same name but one parameter different >> >> (see below) share access to the same process dictionary or does each >> >> have a distinct instance? >> >> >> >> >> >> Example: >> >> >> >> >> >> funA(param1, param2) -> do something. >> >> >> >> funA(param1, differentparam2) -> do something different. >> >> >> >> >> >> === >> >> >> >> >> >> I could just use an if statement within one function call, but I'd >> like >> >> to know if they share the same process dictionary. Thanks. >> >> >> >> _______________________________________________ >> >> 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 > > -- > > Cheers, > -- > Pierre Fenoll > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Lo?c Hoguin https://ninenines.eu From igor.clark@REDACTED Sun Dec 23 12:48:08 2018 From: igor.clark@REDACTED (Igor Clark) Date: Sun, 23 Dec 2018 11:48:08 +0000 Subject: [erlang-questions] Access to process dictionary In-Reply-To: <48d1a0f1-c7f5-ecce-a245-913355836d37@ninenines.eu> References: <7edb8469-7917-3d05-c237-63293d8ce401@aim.com> <0qiisqlqeps1llqk4mn9qnav.1545486989861@email.android.com> <48d1a0f1-c7f5-ecce-a245-913355836d37@ninenines.eu> Message-ID: <9C0359D7-02F4-4D62-893E-01694C23A04D@gmail.com> I frequently miss emails from some particular people, whether at the start or in the middle of a thread, making it look like threads are missing messages, because my receiving gmail account puts them in spam as it doesn?t like their email provider?s DKIM headers, or something. Especially when they come from yahoo.com. I go to the spam folder and remove the spam tag and they show up again. Pierre, as you?re on gmail, you may be getting something similar? > On 23 Dec 2018, at 10:51, Lo?c Hoguin wrote: > > It's you. :-) > >> On 23/12/2018 11:15, Pierre Fenoll wrote: >> Hi list. >> Am I the only one not seeing the first email of most threads? Or is it my gmail mobile client that does its thing? >> Thanks & be well >> On Sun 23 Dec 2018 at 10:13, Eric Pailleau > wrote: >> You should however avoid to use process dictionaries if possible. >> It is handy to store things, but generally a sign that your code is >> missing something. >> For instance if you face some processes crashes, your process >> dictionary will be lost, while using states in OTP libs will be >> shown in crash report. Easier for debugging. >> Regards >> Envoy? depuis mon mobile >> ---- Donald Steven a ?crit ---- >> Merci Eric! >>> On 12/22/2018 8.56 AM, Eric Pailleau wrote: >>> >>> Hi, >>> >>> Process dictionary is a dictionary for a process. >>> >>> If you call each functions from different processes, they are >>> independents. >>> >>> From a single process two functions cannot be called at same time. >>> >>> >>> Envoy? depuis mon mobile >>> >>> >>> >>> ---- Donald Steven a ?crit ---- >>> >>> Do two function calls with the same name but one parameter different >>> >>> (see below) share access to the same process dictionary or does each >>> >>> have a distinct instance? >>> >>> >>> >>> >>> >>> Example: >>> >>> >>> >>> >>> >>> funA(param1, param2) -> do something. >>> >>> >>> >>> funA(param1, differentparam2) -> do something different. >>> >>> >>> >>> >>> >>> === >>> >>> >>> >>> >>> >>> I could just use an if statement within one function call, but I'd >>> like >>> >>> to know if they share the same process dictionary. Thanks. >>> >>> >>> >>> _______________________________________________ >>> >>> 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 >> -- >> Cheers, >> -- >> Pierre Fenoll >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > -- > Lo?c Hoguin > https://ninenines.eu > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From vances@REDACTED Sun Dec 23 12:57:55 2018 From: vances@REDACTED (Vance Shipley) Date: Sun, 23 Dec 2018 17:27:55 +0530 Subject: [erlang-questions] Access to process dictionary In-Reply-To: References: <7edb8469-7917-3d05-c237-63293d8ce401@aim.com> <0qiisqlqeps1llqk4mn9qnav.1545486989861@email.android.com> Message-ID: On Sun, Dec 23, 2018 at 2:43 PM Eric Pailleau wrote: > You should however avoid to use process dictionaries if possible. Yeah, don't do that. If you are new to functional programming and think the process dictionary is the answer to the question :"where are the global variables?" you are on the wrong track. The process dictionary is for OTP and other tools, it's not something you should be using for general work. -- -Vance From t6sn7gt@REDACTED Sun Dec 23 14:02:56 2018 From: t6sn7gt@REDACTED (Donald Steven) Date: Sun, 23 Dec 2018 08:02:56 -0500 Subject: [erlang-questions] Access to process dictionary In-Reply-To: References: <7edb8469-7917-3d05-c237-63293d8ce401@aim.com> <0qiisqlqeps1llqk4mn9qnav.1545486989861@email.android.com> Message-ID: Vance, Thanks for your note.? I've heard that injunction before and have been successful until recently in not using it.? However, I was unable to solve the following exercise without it. Just for fun, I wanted to try and develop an Erlang version of getc (the old Kernighan and Ritchie "Software Tools") so that I could not only read a character from a binary buffer but 'put back' a character (or more than one) if I needed to.? Further, instances of this getc function had to be able to be called from time to time, not successively-recursively as in while getc /= eof putc, etc. So I needed to know where in the input buffer I was; that is, to save the buffer index.? In a procedural language, I'd just have a global index and increment it after a getc and decrement it after a put back character.? With a process dictionary I was able to do this.? Without it, I was stumped. If you have a non-process-dictionary solution, I'm all ears. Best, Don On 12/23/2018 6:57 AM, Vance Shipley wrote: > On Sun, Dec 23, 2018 at 2:43 PM Eric Pailleau wrote: >> You should however avoid to use process dictionaries if possible. > Yeah, don't do that. If you are new to functional programming and > think the process dictionary is the answer to the question :"where are > the global variables?" you are on the wrong track. > The process dictionary is for OTP and other tools, it's not something > you should be using for general work. > From vances@REDACTED Sun Dec 23 14:30:21 2018 From: vances@REDACTED (Vance Shipley) Date: Sun, 23 Dec 2018 19:00:21 +0530 Subject: [erlang-questions] Access to process dictionary In-Reply-To: References: <7edb8469-7917-3d05-c237-63293d8ce401@aim.com> <0qiisqlqeps1llqk4mn9qnav.1545486989861@email.android.com> Message-ID: On Sun, Dec 23, 2018 at 6:32 PM Donald Steven wrote: > So I needed to know where in the input buffer I was; that is, to save the buffer index. Sure, we very often have state we need to maintain. In functional programming you pass in all the information needed for a function to perform it's work. Here you would pass the buffer index as an argument to your function. > If you have a non-process-dictionary solution, I'm all ears. Look at the OTP kernel application's disk_log: chunk/2 function: http://erlang.org/doc/man/disk_log.html#chunk-2 It takes 'Log' and 'Continuation' arguments. The first time it's called you provide the value 'start' for 'Continuation' and the result is a tuple of '{Contnuation, Terms}' where Continuation is an opaque value which you use in the next call to chunk/2. The function is reentrant because the caller is keeping the state. Where to keep it? Basically you do the same thing, you keep passing it in an argument to the functions being executed by your process. Look at the OTP stdlib application's gen_server behaviour: http://erlang.org/doc/man/gen_server.html#Module:init-1 Every function includes a 'State' argument which carries around all your stateful stuff. This is where your "global variable" type stuff lives. -- -Vance From sperber@REDACTED Sun Dec 23 15:39:57 2018 From: sperber@REDACTED (Michael Sperber) Date: Sun, 23 Dec 2018 15:39:57 +0100 Subject: [erlang-questions] Call for Participation: BOB 2019 (March 22, Berlin) Message-ID: ================================================================================ BOB 2019 Conference ?What happens if we simply use what?s best?? March 22, 2019, Berlin http://bobkonf.de/2019/ Program: http://bobkonf.de/2019/en/program.html Registration: http://bobkonf.de/2019/en/registration.html ================================================================================ BOB is the conference for developers, architects and decision-makers to explore technologies beyond the mainstream in software development, and to find the best tools available to software developers today. Our goal is for all participants of BOB to return home with new insights that enable them to improve their own software development experiences. The program features 14 talks and 8 tutorials on current topics: http://bobkonf.de/2019/en/program.html The subject range of talks includes functional programming, formal methods, event sourcing, music, advanced SQL, logic, and feeling The tutorials feature introductions to Racket, Clojure, Functional Programming, TypeScript, type-level programming, SQL indexing, probabilistic programming, and hardware. Gabriele Keller will give the keynote talk. Registration is open online: http://bobkonf.de/2019/en/registration.html NOTE: The early-bird rates expire on February 19, 2019! BOB cooperates with the RacketFest conference on the following day: https://racketfest.com/ From attila.r.nohl@REDACTED Sun Dec 23 22:50:11 2018 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Sun, 23 Dec 2018 22:50:11 +0100 Subject: [erlang-questions] Access to process dictionary In-Reply-To: References: <7edb8469-7917-3d05-c237-63293d8ce401@aim.com> <0qiisqlqeps1llqk4mn9qnav.1545486989861@email.android.com> Message-ID: Eric Pailleau ezt ?rta (id?pont: 2018. dec. 23., V, 10:13): > > You should however avoid to use process dictionaries if possible. > > It is handy to store things, but generally a sign that your code is missing something. > > > For instance if you face some processes crashes, your process dictionary will be lost, while using states in OTP libs will be shown in crash report. Easier for debugging. I do see the process dictionary in crash reports (I'm not sure if lager puts it there or it is there by default). Process dictionary is useful for read-only data (i.e. not state): put stuff there at process startup, then don't have to worry about passing yet an other value around, all function can access that piece of data. From eric.pailleau@REDACTED Mon Dec 24 00:02:16 2018 From: eric.pailleau@REDACTED (Eric Pailleau) Date: Mon, 24 Dec 2018 00:02:16 +0100 Subject: [erlang-questions] Access to process dictionary In-Reply-To: References: <7edb8469-7917-3d05-c237-63293d8ce401@aim.com> <0qiisqlqeps1llqk4mn9qnav.1545486989861@email.android.com> Message-ID: Hi, Yes you are right. I forgot this. Anyway process dictionary should be avoid because same dictionary entry name could be used in different library code called in same process. Let say you create an entry 'foo' in your code, but you use external code having same idea. Your dictionary can be overwritten. It is not safe. Envoy? depuis mon mobile ---- Attila Rajmund Nohl a ?crit ---- >Eric Pailleau ezt ?rta (id?pont: 2018. dec. >23., V, 10:13): >> >> You should however avoid to use process dictionaries if possible. >> >> It is handy to store things, but generally a sign that your code is missing something. >> >> >> For instance if you face some processes crashes, your process dictionary will be lost, while using states in OTP libs will be shown in crash report. Easier for debugging. > >I do see the process dictionary in crash reports (I'm not sure if >lager puts it there or it is there by default). Process dictionary is >useful for read-only data (i.e. not state): put stuff there at process >startup, then don't have to worry about passing yet an other value >around, all function can access that piece of data. >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From t6sn7gt@REDACTED Mon Dec 24 01:26:47 2018 From: t6sn7gt@REDACTED (Donald Steven) Date: Sun, 23 Dec 2018 19:26:47 -0500 Subject: [erlang-questions] Don't understand the error message: call to local/imported function ... is illegal in guard Message-ID: This code works: ??? AlphaNumericChar = isAlphaNumeric(C), ??? if AlphaNumericChar -> but this code (which is functionally identical): ??? if isAlphaNumeric(C) -> produces an error message: call to local/imported function isAlphaNumeric/1 is illegal in guard Why? From zxq9@REDACTED Mon Dec 24 03:24:39 2018 From: zxq9@REDACTED (zxq9@REDACTED) Date: Mon, 24 Dec 2018 11:24:39 +0900 Subject: [erlang-questions] Access to process dictionary In-Reply-To: References: <7edb8469-7917-3d05-c237-63293d8ce401@aim.com> Message-ID: <4272990.rzK7TuVrv7@takoyaki> On 2018?12?23???? 8?02?56? JST Donald Steven wrote: > So I needed to know where in the input buffer I was; that is, to save > the buffer index. In a procedural language, I'd just have a global > index and increment it after a getc and decrement it after a put back > character. With a process dictionary I was able to do this. Without > it, I was stumped. > > > If you have a non-process-dictionary solution, I'm all ears. Consider this simple state-keeping service loop: -module(simple). -export([start/1, stop/1]). -export([add/2, sub/2]). start(X) -> spawn(fun() -> loop(X) end). add(PID, Amount) -> PID ! {add, Amount}, ok. sub(PID, Amount) -> PID ! {sub, Amount}, ok. stop(PID) -> PID ! stop, ok. loop(X) -> ok = io:format("~p: X is ~p~n", [self(), X]), receive {add, Y} -> NewX = X + Y, loop(NewX); {sub, Y} -> NewX = X - Y, loop(NewX); stop -> ok = io:format("Bye!~n"), exit(normal); Unexpected -> ok = io:format("I don't understand ~tp~n", [Unexpected]), loop(X) end. This process spawns with whatever value we give the start/1 function and keeps it in state as a state variable, not in the process dictionary. The "life" of this process is the main service loop, loop/1, and the add/2, sub/2, and stop/1 functions are all just functionally defined interfaces to make interacting with the process sane (blasting naked messages from random bits of code all over a project quickly becomes an exploding complexity problem). This program just keeps looping, retaining the current value throughout its life until you send it a `stop` message. Every process is a different little guy, all his own and has no visibility or concern about whatever is going on with other processes. In the use example below I spawn two processes from the simple.erl module pasted above and send them different messages. 1> c(simple). {ok,simple} 2> P1 = simple:start(0). <0.72.0>: X is 0 <0.72.0> 3> P2 = simple:start(100). <0.74.0>: X is 100 <0.74.0> 4> simple:sub(P1, 10). <0.72.0>: X is -10 ok 5> simple:sub(P2, 10). <0.74.0>: X is 90 ok 6> simple:add(P1, 1000). <0.72.0>: X is 990 ok 7> simple:add(P1, 50). <0.72.0>: X is 1040 ok 8> simple:sub(P2, 1000). <0.74.0>: X is -910 ok Think carefully about the above code and why it works the way it does. For a more fully fleshed-out (but still minimal) OTP example consider the Example Server code. https://gitlab.com/zxq9/example-server/tree/master es_client.erl https://gitlab.com/zxq9/example-server/blob/master/src/es_client.erl Very similar to the above code -- it is a OTP compliant process that handles a socket and receives messages from other chatters. es_client_man.erl https://gitlab.com/zxq9/example-server/blob/master/src/es_client_man.erl Also similar to the above code, but is written as a gen_server for convenience. You don't see the loop/3 function -- it is hidden higher up in gen_server code -- what you do see are the callback functions that handle incoming messages: handle_call/3, handle_cast/2, and handle_info/2. I recommend playing around with the simple.erl a bit and rewriting it to do whatever you want first. Then clone the Example Server repository (it can be launched with the ./start script, open a telnet port with es:listen(PortNumber) is how you make it listen) and edit that to make it do whatever you want on the network. With Erlang you just have to write a bunch of little programs and mess around editing existing programs until it all suddenly clicks! -Craig From t6sn7gt@REDACTED Mon Dec 24 04:14:24 2018 From: t6sn7gt@REDACTED (Donald Steven) Date: Sun, 23 Dec 2018 22:14:24 -0500 Subject: [erlang-questions] Don't understand the error message: call to local/imported function ... is illegal in guard In-Reply-To: References: Message-ID: <7236a204-596b-3283-110e-56a6780dad7e@aim.com> Thanks Yao. On 12/23/2018 8.02 PM, by wrote: > Only limited expressions are permitted after ?if?(guard), and the user defined function does not in the list. > I believe there is a list on Erlang Doc about what is permitted. > > By the way, this limitation is for avoiding side effects when evaluating expressions. > > Yao > >> ? 2018?12?24??08:26?Donald Steven ??? >> >> This code works: >> >> AlphaNumericChar = isAlphaNumeric(C), >> if AlphaNumericChar -> >> >> but this code (which is functionally identical): >> >> if isAlphaNumeric(C) -> >> >> produces an error message: call to local/imported function isAlphaNumeric/1 is illegal in guard >> >> Why? >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> From g@REDACTED Mon Dec 24 10:45:46 2018 From: g@REDACTED (Guilherme Andrade) Date: Mon, 24 Dec 2018 09:45:46 +0000 Subject: [erlang-questions] Don't understand the error message: call to local/imported function ... is illegal in guard In-Reply-To: References: Message-ID: Only certain built-in functions may be used in if clauses, function guards, case clause guards, and so on. They are listed under 'Expressions'[1], on the reference manual. What I believe you would like to do is usually achieved using case expressions, which allow the evaluation of regular function calls. 'If' clauses are uncommon nowadays and it's rare for them to be considered more appropriate than the equivalent case clause or function head pattern. [1]: http://erlang.org/doc/reference_manual/expressions.html#guard-sequences On Mon, 24 Dec 2018 at 00:26, Donald Steven wrote: > This code works: > > AlphaNumericChar = isAlphaNumeric(C), > if AlphaNumericChar -> > > but this code (which is functionally identical): > > if isAlphaNumeric(C) -> > > produces an error message: call to local/imported function > isAlphaNumeric/1 is illegal in guard > > Why? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Guilherme -------------- next part -------------- An HTML attachment was scrubbed... URL: From attila.r.nohl@REDACTED Mon Dec 24 10:50:50 2018 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Mon, 24 Dec 2018 10:50:50 +0100 Subject: [erlang-questions] Access to process dictionary In-Reply-To: References: <7edb8469-7917-3d05-c237-63293d8ce401@aim.com> <0qiisqlqeps1llqk4mn9qnav.1545486989861@email.android.com> Message-ID: The same is true for e.g. public named ETS tables or even for modules. If a different library uses the same name, it's a problem. 2018. dec. 24., H?t 0:10 d?tummal Eric Pailleau ezt ?rta: > Hi, > > Yes you are right. I forgot this. > > Anyway process dictionary should be avoid because same dictionary entry > name could be used in different library code called in same process. > > Let say you create an entry 'foo' in your code, but you use external code > having same idea. Your dictionary can be overwritten. It is not safe. > > Envoy? depuis mon mobile > > > ---- Attila Rajmund Nohl a ?crit ---- > > Eric Pailleau ezt ?rta (id?pont: 2018. dec. > 23., V, 10:13): > > > > You should however avoid to use process dictionaries if possible. > > > > It is handy to store things, but generally a sign that your code is > missing something. > > > > > > For instance if you face some processes crashes, your process dictionary > will be lost, while using states in OTP libs will be shown in crash report. > Easier for debugging. > > I do see the process dictionary in crash reports (I'm not sure if > lager puts it there or it is there by default). Process dictionary is > useful for read-only data (i.e. not state): put stuff there at process > startup, then don't have to worry about passing yet an other value > around, all function can access that piece of data. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From t6sn7gt@REDACTED Mon Dec 24 13:54:16 2018 From: t6sn7gt@REDACTED (Donald Steven) Date: Mon, 24 Dec 2018 07:54:16 -0500 Subject: [erlang-questions] Don't understand the error message: call to local/imported function ... is illegal in guard In-Reply-To: References: Message-ID: <08c07db6-40a8-688f-3812-a2218b38c037@aim.com> An HTML attachment was scrubbed... URL: From by@REDACTED Mon Dec 24 02:02:05 2018 From: by@REDACTED (by) Date: Mon, 24 Dec 2018 09:02:05 +0800 Subject: [erlang-questions] Don't understand the error message: call to local/imported function ... is illegal in guard In-Reply-To: References: Message-ID: Only limited expressions are permitted after ?if?(guard), and the user defined function does not in the list. I believe there is a list on Erlang Doc about what is permitted. By the way, this limitation is for avoiding side effects when evaluating expressions. Yao > ? 2018?12?24??08:26?Donald Steven ??? > > This code works: > > AlphaNumericChar = isAlphaNumeric(C), > if AlphaNumericChar -> > > but this code (which is functionally identical): > > if isAlphaNumeric(C) -> > > produces an error message: call to local/imported function isAlphaNumeric/1 is illegal in guard > > Why? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From zxq9@REDACTED Mon Dec 24 02:56:32 2018 From: zxq9@REDACTED (zxq9@REDACTED) Date: Mon, 24 Dec 2018 10:56:32 +0900 Subject: [erlang-questions] Don't understand the error message: call to local/imported function ... is illegal in guard In-Reply-To: References: Message-ID: <2384862.7aQ6lkDsy3@takoyaki> On 2018?12?23???? 19?26?47? JST Donald Steven wrote: > This code works: > > AlphaNumericChar = isAlphaNumeric(C), > if AlphaNumericChar -> > > but this code (which is functionally identical): > > if isAlphaNumeric(C) -> > > produces an error message: call to local/imported function > isAlphaNumeric/1 is illegal in guard > > Why? The context of the call. In a function head, specifically, you are only allowed to use a small set of pre-defined built-in functions. Using your own functions in guards (or anything outside the set of legal guard functions) is illegal. foo(Args) when tuple_check(Args) -> blah(); foo(_) -> blee(). tuple_check(Args) when is_tuple(Args) -> true; tuple_check(_) -> false. The above definition of foo/1 will fail to compile because use of my own defined function tuple_check/1 is illegal. The second version is legal because is_tuple/1 is a BIF that is on the whitelist of functions permitted in guards. foo(Args) when is_tuple(Args) -> blah(); foo(_) -> blee(). Note that when we say "permitted in guards" we are only talking about guards in function heads. You can do whatever you want in guards in `case` statements. The doc reference for guards has a list of the legal BIFs: http://erlang.org/doc/reference_manual/expressions.html#guard-sequences -Craig From eric.pailleau@REDACTED Mon Dec 24 16:30:28 2018 From: eric.pailleau@REDACTED (Eric Pailleau) Date: Mon, 24 Dec 2018 16:30:28 +0100 Subject: [erlang-questions] Access to process dictionary In-Reply-To: References: <7edb8469-7917-3d05-c237-63293d8ce401@aim.com> <0qiisqlqeps1llqk4mn9qnav.1545486989861@email.android.com> Message-ID: Yeah, A common workaround is to prefix all your entries with the name of your module, but it is not a full guarantee. 'Use the state, Luke... ' Envoy? depuis mon mobile ---- Attila Rajmund Nohl a ?crit ---- >The same is true for e.g. public named ETS tables or even for modules. If a >different library uses the same name, it's a problem. > >2018. dec. 24., H?t 0:10 d?tummal Eric Pailleau >ezt ?rta: > >> Hi, >> >> Yes you are right. I forgot this. >> >> Anyway process dictionary should be avoid because same dictionary entry >> name could be used in different library code called in same process. >> >> Let say you create an entry 'foo' in your code, but you use external code >> having same idea. Your dictionary can be overwritten. It is not safe. >> >> Envoy? depuis mon mobile >> >> >> ---- Attila Rajmund Nohl a ?crit ---- >> >> Eric Pailleau ezt ?rta (id?pont: 2018. dec. >> 23., V, 10:13): >> > >> > You should however avoid to use process dictionaries if possible. >> > >> > It is handy to store things, but generally a sign that your code is >> missing something. >> > >> > >> > For instance if you face some processes crashes, your process dictionary >> will be lost, while using states in OTP libs will be shown in crash report. >> Easier for debugging. >> >> I do see the process dictionary in crash reports (I'm not sure if >> lager puts it there or it is there by default). Process dictionary is >> useful for read-only data (i.e. not state): put stuff there at process >> startup, then don't have to worry about passing yet an other value >> around, all function can access that piece of data. >> _______________________________________________ >> 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 frank.muller.erl@REDACTED Mon Dec 24 17:35:08 2018 From: frank.muller.erl@REDACTED (Frank Muller) Date: Mon, 24 Dec 2018 17:35:08 +0100 Subject: [erlang-questions] 300k HTTP GET RPS on Erlang 21.2, benchmarking per scheduler polling In-Reply-To: <20181219130408.GA780@ferdmbp.local> References: <477143608.6439372.1545096976895.ref@mail.yahoo.com> <477143608.6439372.1545096976895@mail.yahoo.com> <1522630353.6731828.1545143641036@mail.yahoo.com> <20181219130408.GA780@ferdmbp.local> Message-ID: Comparing apples to oranges will certainly mislead you and bias your benchmark. We always found Cowboy faster than Elli, Yaws or Misultin to name a few. We switched to Cowboy in prod few years ago and we didn?t regret it. The author is doing a great job maintaining it and making the API consistent, and the doc up to date. Yes, it?s slower than Nginx but who really cares? Cowboy scales well and it?s in pure Erlang. Merry Christmas /Frank On 12/18, Vans S wrote: > > I think OTHER is something to do with Ports / polling, because I just > > removed the inet_drv and wrote a simple c nif to do TCP networking, > > and the throughput doubled. I did not get around to recompiling erlang > > with microstate accounting but without inet driver using an > > unoptimized nonblocking tcp nif I got the msacc report to look like > > > >Using 2 schedulers because 10 physical cores generating load now just > >barely fully saturated. now 90% of the time is spent in emulator, 6% > >is other, I am guessing 6% other is the NIF calls to the socket calls? > > > >The throughput was 250k for 2 physical cores. If all scales linearly > >that is 1.25m RPS for simple GET hello world benchmark. > > > >The NIF is > >PoC https://gist.github.com/vans163/d96fcc7c89d0cf25c819c5fb77769e81 ofcourse > > >its only useful in the case there is constant data on socket, otherwise > >this PoC will break if there is idle connections that keep getting > >polled. This opens the possibility though to using something like > >DPDK. > > I think you might have achieved this: > > https://twitter.com/seldo/status/800817973921386497 > > Chapter 15: 300% performance boosts by deleting data validity checks > > Of course, the driver may have a higher baseline overhead than a NIF, > but you also got rid of all validation and handling of any edge case > whatsoever. > > You claim your NIF is not optimized, but it is _extremely_ optimized: > you removed all code that could have been useful for scenarios that are > not the one you are actively testing, therefore getting rid of all their > overheads. > > And you are doing so on a rather useless benchmark: hello worlds that > parse nothing and therefore have nothing in common with any application > in the wild that might care about the request's content. The benchmark > results you get can therefore not be extrapolated to be relevant to any > application out there. > > I would likely urge you, unless you are doing this for the fun of > micro-optimizing edge cases, to consider basing your work on more > representative benchmarks. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Wed Dec 26 13:32:37 2018 From: vances@REDACTED (Vance Shipley) Date: Wed, 26 Dec 2018 18:02:37 +0530 Subject: [erlang-questions] xmerl: XSD Circular Dependency Message-ID: Is there a way to get xmerl_xsd:process_schemas/2 to handle a set of XSD with circular dependencies? -- -Vance From bchesneau@REDACTED Wed Dec 26 15:45:36 2018 From: bchesneau@REDACTED (Benoit Chesneau) Date: Wed, 26 Dec 2018 15:45:36 +0100 Subject: [erlang-questions] Access to process dictionary In-Reply-To: References: <7edb8469-7917-3d05-c237-63293d8ce401@aim.com> <0qiisqlqeps1llqk4mn9qnav.1545486989861@email.android.com> Message-ID: nope i got that too... and recently received a probe test as well. Not sure what's the issue. Benoit On Sun, Dec 23, 2018 at 11:15 AM Pierre Fenoll wrote: > Hi list. > Am I the only one not seeing the first email of most threads? Or is it my > gmail mobile client that does its thing? > Thanks & be well > > On Sun 23 Dec 2018 at 10:13, Eric Pailleau > wrote: > >> You should however avoid to use process dictionaries if possible. >> >> It is handy to store things, but generally a sign that your code is >> missing something. >> >> For instance if you face some processes crashes, your process dictionary >> will be lost, while using states in OTP libs will be shown in crash report. >> Easier for debugging. >> >> Regards >> >> Envoy? depuis mon mobile >> >> >> ---- Donald Steven a ?crit ---- >> >> Merci Eric! >> >> On 12/22/2018 8.56 AM, Eric Pailleau wrote: >> >> Hi, >> >> Process dictionary is a dictionary for a process. >> >> If you call each functions from different processes, they are >> independents. >> >> From a single process two functions cannot be called at same time. >> >> Envoy? depuis mon mobile >> >> >> ---- Donald Steven a ?crit ---- >> >> Do two function calls with the same name but one parameter different >> >> (see below) share access to the same process dictionary or does each >> >> have a distinct instance? >> >> >> >> >> >> Example: >> >> >> >> >> >> funA(param1, param2) -> do something. >> >> >> >> funA(param1, differentparam2) -> do something different. >> >> >> >> >> >> === >> >> >> >> >> >> I could just use an if statement within one function call, but I'd like >> >> to know if they share the same process dictionary. Thanks. >> >> >> >> _______________________________________________ >> >> 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 >> > -- > > Cheers, > -- > Pierre Fenoll > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From otp@REDACTED Fri Dec 28 10:42:32 2018 From: otp@REDACTED (Erlang/OTP) Date: Fri, 28 Dec 2018 10:42:32 +0100 Subject: [erlang-questions] Patch Package OTP 21.2.2 Released Message-ID: <20181228094231.GA38304@erix.ericsson.se> Patch Package: OTP 21.2.2 Git Tag: OTP-21.2.2 Date: 2018-12-28 Trouble Report Id: OTP-15397 Seq num: ERL-801 System: OTP Release: 21 Application: ssh-4.7.3 Predecessor: OTP 21.2.1 Check out the git tag OTP-21.2.2, and build a full OTP system including documentation. Apply one or more applications from this build as patches to your installation using the 'otp_patch_apply' tool. For information on install requirements, see descriptions for each application version below. --------------------------------------------------------------------- --- ssh-4.7.3 ------------------------------------------------------- --------------------------------------------------------------------- The ssh-4.7.3 application can be applied independently of other applications on a full OTP 21 installation. --- Fixed Bugs and Malfunctions --- OTP-15397 Application(s): ssh Related Id(s): ERL-801 Fixed port leakage if a ssh:daemon call failed. Full runtime dependencies of ssh-4.7.3: crypto-4.2, erts-6.0, kernel-3.0, public_key-1.5.2, stdlib-3.3 --------------------------------------------------------------------- --------------------------------------------------------------------- --------------------------------------------------------------------- From 0x6e6562@REDACTED Fri Dec 28 17:30:47 2018 From: 0x6e6562@REDACTED (Ben Hood) Date: Fri, 28 Dec 2018 16:30:47 +0000 Subject: [erlang-questions] remsh failing silently Message-ID: Hi, I'm failing to invoke remsh on an OTP 17.5.6.10 build (cross compiled for ppc64). Kicking off the first node: $ erl -sname a -setcookie 1 Eshell V6.4.1.7 (abort with ^G) (a@REDACTED)1> I try to connect to it from a second node (to no avail): $ erl -sname b -remsh a@REDACTED -setcookie 1 Eshell V6.4.1.7 (abort with ^G) (b@REDACTED)1> nodes(). [] (b@REDACTED)2> The port mapper indicates that both nodes registered with it: $ epmd -names epmd: up and running on port 4369 with data: name a at port 46201 name b at port 35447 However, if I actively ping the the first node from the second, the ping succeeds and I assume that the net_kernel subsystem has joined the nodes: (b@REDACTED)2> net_adm:ping('a@REDACTED'). pong (b@REDACTED)3> nodes(). [a@REDACTED] (b@REDACTED)4> So I'm left wondering why the remsh argument can't trigger the same node join when the second Erlang process is started. The same invocation works perfectly well on more up to date versions of OTP, but I'm prevented from just doing a large version upgrade. Is there some way to get the runtime to output verbose diagnostics to try to debug this? TIA, Ben From 0x6e6562@REDACTED Sat Dec 29 15:33:09 2018 From: 0x6e6562@REDACTED (Ben Hood) Date: Sat, 29 Dec 2018 14:33:09 +0000 Subject: [erlang-questions] remsh failing silently In-Reply-To: References: Message-ID: On Sat, Dec 29, 2018 at 9:42 AM T Ty wrote: > 3. In b@REDACTED shell hit Ctrl-G > 4. At the --> prompt type > r 'a@REDACTED' > c 2 > > If that all works then there should be no reason for the remsh not to work. Many thanks for the heads up, much appreciated. Unfortunately on the ppc machine Crtl-G is not being interpreted (but Ctrl-C is): $ erl -sname a -setcookie 1 Eshell V6.4.1.7 (abort with ^G) (a@REDACTED)1> ^G (a@REDACTED)1> ^C BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution So I guess I'll need to get to the bottom of this symptom first. For background context, the OTP 17.5.6.10 for ppc64 was cross compiled and statically linked against libncurses - potentially the statically linked libncurses was not packaged correctly which leads to terminal character issues? From frank.muller.erl@REDACTED Sat Dec 29 18:17:15 2018 From: frank.muller.erl@REDACTED (Frank Muller) Date: Sat, 29 Dec 2018 18:17:15 +0100 Subject: [erlang-questions] =?utf-8?q?Unable_to_compile_21=2E2=2E2_because?= =?utf-8?b?IG9mIOKAnHd44oCd?= Message-ID: Hello everyone I?m trying to compile 21.2.2 on Ubuntu 16.04 using kerl but without wx. But the process failed on ?dbg_wx_filedialog_win.beam? (see kerl?s below). Question: why it keeps trying to compile dbg_wx_XXX.erl modules after I clearly specified ?without-wx? I don?t need anything related to wx. How I can fix this please? ___________________________________ [...] ********************************************************************* ********************** APPLICATIONS DISABLED ********************** ********************************************************************* odbc : odbc disabled by user. odbc : User gave --without-odbc option wx : User gave --without-wx option ********************************************************************* ********************************************************************* ********************** APPLICATIONS INFORMATION ******************* ********************************************************************* wx : Can not link the wx driver, wx will NOT be useable ********************************************************************* ********************************************************************* ********************** DOCUMENTATION INFORMATION ****************** ********************************************************************* documentation : xsltproc is missing. fop is missing. xmllint is missing. The documentation can not be built. ********************************************************************* [...] /home/frank/.kerl/builds/21.2.2/otp_src_git/make/x86_64-unknown-linux-gnu/ otp.mk:131: recipe for target '../ebin/dbg_wx_filedialog_win.beam' failed make[3]: *** [../ebin/dbg_wx_filedialog_win.beam] Error 1 make[3]: Leaving directory '/home/frank/.kerl/builds/21.2 .2/otp_src_git/lib/debugger/src' /home/frank/.kerl/builds/21.2.2/otp_src_git/make/otp_subdir.mk:29: recipe for target 'opt' failed make[2]: *** [opt] Error 2 make[2]: Leaving directory '/home/frank/.kerl/builds/21.2 .2/otp_src_git/lib/debugger' /home/frank/.kerl/builds/21.2.2/otp_src_git/make/otp_subdir.mk:29: recipe for target 'opt' failed make[1]: *** [opt] Error 2 make[1]: Leaving directory '/home/frank/.kerl/builds/21.2.2/otp_src_git/lib' Makefile:488: recipe for target 'libs' failed make: *** [libs] Error 2 ___________________________________ My Ubuntu-16.04 config: $ uname -a Linux 3.14.32-xxxx-grs-ipv6-64 #9 SMP Thu Oct 20 14:53:52 CEST 2016 x86_64 x86_64 x86_64 GNU/Linux $ gcc --version gcc (Ubuntu 7.4.0-1ubuntu1~16.04~ppa1) 7.4.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE $ kerl version 1.3.4 Happy new year !!! Best /Frank -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank.muller.erl@REDACTED Sat Dec 29 18:29:14 2018 From: frank.muller.erl@REDACTED (Frank Muller) Date: Sat, 29 Dec 2018 18:29:14 +0100 Subject: [erlang-questions] =?utf-8?q?Unable_to_compile_21=2E2=2E2_because?= =?utf-8?b?IG9mIOKAnHd44oCd?= In-Reply-To: References: Message-ID: And I got the very same error on CentOS7 (?without-wx): _______________________________________________________________ [...] === Entering application debugger gmake[3]: Entering directory `/home/frank/.kerl/builds/21.2 .2/otp_src_git/lib/debugger/src' ERLC ../ebin/debugger.beam ERLC ../ebin/i.beam ERLC ../ebin/int.beam ERLC ../ebin/dbg_debugged.beam ERLC ../ebin/dbg_icmd.beam ERLC ../ebin/dbg_idb.beam ERLC ../ebin/dbg_ieval.beam ERLC ../ebin/dbg_iload.beam ERLC ../ebin/dbg_iserver.beam ERLC ../ebin/dbg_istk.beam ERLC ../ebin/dbg_wx_break.beam ERLC ../ebin/dbg_wx_break_win.beam ERLC ../ebin/dbg_wx_code.beam ERLC ../ebin/dbg_wx_filedialog_win.beam compile: warnings being treated as errors dbg_wx_filedialog_win.erl:22: behaviour wx_object undefined gmake[3]: *** [../ebin/dbg_wx_filedialog_win.beam] Error 1 gmake[3]: Leaving directory `/home/frank/.kerl/builds/21.2 .2/otp_src_git/lib/debugger/src' gmake[2]: *** [opt] Error 2 gmake[2]: Leaving directory `/home/frank/.kerl/builds/21.2 .2/otp_src_git/lib/debugger' gmake[1]: *** [opt] Error 2 gmake[1]: Leaving directory `/home/frank/.kerl/builds/21.2 .2/otp_src_git/lib' gmake: *** [libs] Error 2 _______________________________________________________________ My CentOS7?s config: $ uname -a Linux xxxx-std-ipv6-64 #1 SMP Mon Oct 23 11:35:59 CEST 2017 x86_64 x86_64 x86_64 GNU/Linux $ gcc --version gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5) Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ kerl version 1.8.5 Best /Frank wrote : > Hello everyone > > I?m trying to compile 21.2.2 on Ubuntu 16.04 using kerl but without wx. > > But the process failed on ?dbg_wx_filedialog_win.beam? (see kerl?s below). > > Question: why it keeps trying to compile dbg_wx_XXX.erl modules after I > clearly specified ?without-wx? I don?t need anything related to wx. How I > can fix this please? > > ___________________________________ > > [...] > ********************************************************************* > ********************** APPLICATIONS DISABLED ********************** > ********************************************************************* > > odbc : odbc disabled by user. > odbc : User gave --without-odbc option > wx : User gave --without-wx option > > ********************************************************************* > ********************************************************************* > ********************** APPLICATIONS INFORMATION ******************* > ********************************************************************* > > wx : Can not link the wx driver, wx will NOT be useable > > ********************************************************************* > ********************************************************************* > ********************** DOCUMENTATION INFORMATION ****************** > ********************************************************************* > > documentation : > xsltproc is missing. > fop is missing. > xmllint is missing. > The documentation can not be built. > > ********************************************************************* > [...] > /home/frank/.kerl/builds/21.2.2/otp_src_git/make/x86_64-unknown-linux-gnu/ > otp.mk:131: recipe for > target '../ebin/dbg_wx_filedialog_win.beam' failed > make[3]: *** [../ebin/dbg_wx_filedialog_win.beam] Error 1 > make[3]: Leaving directory '/home/frank/.kerl/builds/21.2 > .2/otp_src_git/lib/debugger/src' > /home/frank/.kerl/builds/21.2.2/otp_src_git/make/otp_subdir.mk:29: recipe > for target 'opt' failed > make[2]: *** [opt] Error 2 > make[2]: Leaving directory '/home/frank/.kerl/builds/21.2 > .2/otp_src_git/lib/debugger' > /home/frank/.kerl/builds/21.2.2/otp_src_git/make/otp_subdir.mk:29: recipe > for target 'opt' failed > make[1]: *** [opt] Error 2 > make[1]: Leaving directory '/home/frank/.kerl/builds/21.2 > .2/otp_src_git/lib' > Makefile:488: recipe for target 'libs' failed > make: *** [libs] Error 2 > > ___________________________________ > > My Ubuntu-16.04 config: > > $ uname -a > Linux 3.14.32-xxxx-grs-ipv6-64 #9 SMP Thu Oct 20 14:53:52 CEST 2016 x86_64 > x86_64 x86_64 GNU/Linux > > $ gcc --version > gcc (Ubuntu 7.4.0-1ubuntu1~16.04~ppa1) 7.4.0 > Copyright (C) 2017 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE > > $ kerl version > 1.3.4 > > Happy new year !!! > > Best > /Frank -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikpelinux@REDACTED Sun Dec 30 14:00:58 2018 From: mikpelinux@REDACTED (Mikael Pettersson) Date: Sun, 30 Dec 2018 14:00:58 +0100 Subject: [erlang-questions] =?utf-8?q?Unable_to_compile_21=2E2=2E2_because?= =?utf-8?b?IG9mIOKAnHd44oCd?= In-Reply-To: References: Message-ID: On Sat, Dec 29, 2018 at 6:29 PM Frank Muller wrote: > > And I got the very same error on CentOS7 (?without-wx): > > _______________________________________________________________ > [...] > === Entering application debugger > gmake[3]: Entering directory `/home/frank/.kerl/builds/21.2.2/otp_src_git/lib/debugger/src' > ERLC ../ebin/debugger.beam > ERLC ../ebin/i.beam > ERLC ../ebin/int.beam > ERLC ../ebin/dbg_debugged.beam > ERLC ../ebin/dbg_icmd.beam > ERLC ../ebin/dbg_idb.beam > ERLC ../ebin/dbg_ieval.beam > ERLC ../ebin/dbg_iload.beam > ERLC ../ebin/dbg_iserver.beam > ERLC ../ebin/dbg_istk.beam > ERLC ../ebin/dbg_wx_break.beam > ERLC ../ebin/dbg_wx_break_win.beam > ERLC ../ebin/dbg_wx_code.beam > ERLC ../ebin/dbg_wx_filedialog_win.beam > compile: warnings being treated as errors > dbg_wx_filedialog_win.erl:22: behaviour wx_object undefined > gmake[3]: *** [../ebin/dbg_wx_filedialog_win.beam] Error 1 > gmake[3]: Leaving directory `/home/frank/.kerl/builds/21.2.2/otp_src_git/lib/debugger/src' > gmake[2]: *** [opt] Error 2 > gmake[2]: Leaving directory `/home/frank/.kerl/builds/21.2.2/otp_src_git/lib/debugger' > gmake[1]: *** [opt] Error 2 > gmake[1]: Leaving directory `/home/frank/.kerl/builds/21.2.2/otp_src_git/lib' > gmake: *** [libs] Error 2 I can reproduce this error on Fedora 28 (not using kerl). Adding --without-debugger doesn't help, but omitting --without-wx does. And to be clear, I also does not have wxWidgets so I also get the "wx will not be usable" warning. From mikpelinux@REDACTED Sun Dec 30 15:34:41 2018 From: mikpelinux@REDACTED (Mikael Pettersson) Date: Sun, 30 Dec 2018 15:34:41 +0100 Subject: [erlang-questions] remsh failing silently In-Reply-To: References: Message-ID: On Sat, Dec 29, 2018 at 3:33 PM Ben Hood <0x6e6562@REDACTED> wrote: > > On Sat, Dec 29, 2018 at 9:42 AM T Ty wrote: > > 3. In b@REDACTED shell hit Ctrl-G > > 4. At the --> prompt type > > r 'a@REDACTED' > > c 2 > > > > If that all works then there should be no reason for the remsh not to work. > > Many thanks for the heads up, much appreciated. > > Unfortunately on the ppc machine Crtl-G is not being interpreted (but > Ctrl-C is): > > $ erl -sname a -setcookie 1 > Eshell V6.4.1.7 (abort with ^G) > (a@REDACTED)1> ^G > (a@REDACTED)1> ^C > BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded > (v)ersion (k)ill (D)b-tables (d)istribution > > So I guess I'll need to get to the bottom of this symptom first. > > For background context, the OTP 17.5.6.10 for ppc64 was cross compiled > and statically linked against libncurses - potentially the statically > linked libncurses was not packaged correctly which leads to terminal > character issues? For the record, I just built OTP 17.5.6.10 natively on powerpc64-unknown-linux-gnu, and ^G works just fine there in the Erlang shell. I'd have to suspect your cross compilation setup. Could be some ./configure test not doing the right thing in the cross compile case. From frank.muller.erl@REDACTED Sun Dec 30 17:44:00 2018 From: frank.muller.erl@REDACTED (Frank Muller) Date: Sun, 30 Dec 2018 17:44:00 +0100 Subject: [erlang-questions] =?utf-8?q?Unable_to_compile_21=2E2=2E2_because?= =?utf-8?b?IG9mIOKAnHd44oCd?= In-Reply-To: References: Message-ID: Hi Mikael By simply omitting ?without-wx, I was able to successfully compile it on both Ubuntu and CentOS7. I also noticed that this option only works when you don?t build Erlang from ?git?. Thanks again !!! /Frank On Sat, Dec 29, 2018 at 6:29 PM Frank Muller > wrote: > > > > And I got the very same error on CentOS7 (?without-wx): > > > > _______________________________________________________________ > > [...] > > === Entering application debugger > > gmake[3]: Entering directory > `/home/frank/.kerl/builds/21.2.2/otp_src_git/lib/debugger/src' > > ERLC ../ebin/debugger.beam > > ERLC ../ebin/i.beam > > ERLC ../ebin/int.beam > > ERLC ../ebin/dbg_debugged.beam > > ERLC ../ebin/dbg_icmd.beam > > ERLC ../ebin/dbg_idb.beam > > ERLC ../ebin/dbg_ieval.beam > > ERLC ../ebin/dbg_iload.beam > > ERLC ../ebin/dbg_iserver.beam > > ERLC ../ebin/dbg_istk.beam > > ERLC ../ebin/dbg_wx_break.beam > > ERLC ../ebin/dbg_wx_break_win.beam > > ERLC ../ebin/dbg_wx_code.beam > > ERLC ../ebin/dbg_wx_filedialog_win.beam > > compile: warnings being treated as errors > > dbg_wx_filedialog_win.erl:22: behaviour wx_object undefined > > gmake[3]: *** [../ebin/dbg_wx_filedialog_win.beam] Error 1 > > gmake[3]: Leaving directory > `/home/frank/.kerl/builds/21.2.2/otp_src_git/lib/debugger/src' > > gmake[2]: *** [opt] Error 2 > > gmake[2]: Leaving directory > `/home/frank/.kerl/builds/21.2.2/otp_src_git/lib/debugger' > > gmake[1]: *** [opt] Error 2 > > gmake[1]: Leaving directory > `/home/frank/.kerl/builds/21.2.2/otp_src_git/lib' > > gmake: *** [libs] Error 2 > > I can reproduce this error on Fedora 28 (not using kerl). Adding > --without-debugger doesn't help, but omitting --without-wx does. And > to be clear, I also does not have wxWidgets so I also get the "wx will > not be usable" warning. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From t6sn7gt@REDACTED Sun Dec 30 19:34:55 2018 From: t6sn7gt@REDACTED (Donald Steven) Date: Sun, 30 Dec 2018 13:34:55 -0500 Subject: [erlang-questions] Access to process dictionary In-Reply-To: <4272990.rzK7TuVrv7@takoyaki> References: <7edb8469-7917-3d05-c237-63293d8ce401@aim.com> <4272990.rzK7TuVrv7@takoyaki> Message-ID: An HTML attachment was scrubbed... URL: From t6sn7gt@REDACTED Sun Dec 30 20:37:23 2018 From: t6sn7gt@REDACTED (Donald Steven) Date: Sun, 30 Dec 2018 14:37:23 -0500 Subject: [erlang-questions] Access to process dictionary In-Reply-To: <25AAF531-BBF4-4256-93B7-300B427BCE27@uninet.ee> References: <7edb8469-7917-3d05-c237-63293d8ce401@aim.com> <4272990.rzK7TuVrv7@takoyaki> <25AAF531-BBF4-4256-93B7-300B427BCE27@uninet.ee> Message-ID: <777b46e2-0e7c-f6bd-fa29-94e685e50bdb@aim.com> Yes!!? Thanks Taavi. I'll have to study why the first version didn't fly. On 12/30/2018 1.48 PM, taavi@REDACTED wrote: > ? ?Pid = start(1000), > ? ?Pid ! {add, 1}. From vans_163@REDACTED Mon Dec 31 17:37:38 2018 From: vans_163@REDACTED (Vans S) Date: Mon, 31 Dec 2018 16:37:38 +0000 (UTC) Subject: [erlang-questions] display floats without -e? References: <1045210247.12216694.1546274258569.ref@mail.yahoo.com> Message-ID: <1045210247.12216694.1546274258569@mail.yahoo.com> 1> 0.0001.0.00012> 0.00001.1.0e-5 Once floats get to the 4th/5th decimal place they start being displayed with the e-x notation.? Is there a way to make them always display "normally", for example 0.00001 in this case.? The problem is when you turn the float into a string, its also displayed as 1.0e-5, adding a format function works yes, but gets annoying to maintain when you need to do arithmetic on the floats.? LIke sorting by the value. Also debugging becomes annoying when you see the e-5, e-6, etc notation everywhere and have to match it up. Is there a way to compile / add arg to the VM to not do this? -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmytro.lytovchenko@REDACTED Mon Dec 31 19:11:58 2018 From: dmytro.lytovchenko@REDACTED (Dmytro Lytovchenko) Date: Mon, 31 Dec 2018 19:11:58 +0100 Subject: [erlang-questions] display floats without -e? In-Reply-To: <1045210247.12216694.1546274258569@mail.yahoo.com> References: <1045210247.12216694.1546274258569.ref@mail.yahoo.com> <1045210247.12216694.1546274258569@mail.yahoo.com> Message-ID: A quick answer without much thinking You can avoid this by specifying precision, i.e. io_lib:format("~.6f",[F]). On Mon, 31 Dec 2018 at 17:37, Vans S wrote: > 1> 0.0001. > 0.0001 > 2> 0.00001. > 1.0e-5 > > Once floats get to the 4th/5th decimal place they start being displayed > with the e-x notation. Is there a way to make them always display > "normally", for example 0.00001 in this case. The problem is when you turn > the float into a string, its also displayed as 1.0e-5, adding a format > function works yes, but gets annoying to maintain when you need to do > arithmetic on the floats. LIke sorting by the value. > > Also debugging becomes annoying when you see the e-5, e-6, etc notation > everywhere and have to match it up. > > Is there a way to compile / add arg to the VM to not do this? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From 2QdxY4RzWzUUiLuE@REDACTED Mon Dec 31 20:31:30 2018 From: 2QdxY4RzWzUUiLuE@REDACTED (Dan Sommers) Date: Mon, 31 Dec 2018 13:31:30 -0600 Subject: [erlang-questions] display floats without -e? In-Reply-To: <1045210247.12216694.1546274258569@mail.yahoo.com> References: <1045210247.12216694.1546274258569.ref@mail.yahoo.com> <1045210247.12216694.1546274258569@mail.yahoo.com> Message-ID: <2a399915-91a6-bb67-b45b-ffee0d72a14a@potatochowder.com> On 12/31/18 10:37 AM, Vans S wrote: > > 1> 0.0001. > 0.0001 > > 2> 0.00001. > 1.0e-5 > Once floats get to the 4th/5th decimal place they start being > displayed with the e-x notation. Is there a way to make them always > display "normally", for example 0.00001 in this case ... At some point, it's shorter and easier to read with the e-x notation. Consider a number like 1e-44. The last thing I want is to have to count all those zeros. ;-) But you probably knew that. > ... The problem is when you turn the float into a string, its also > displayed as 1.0e-5, adding a format function works yes, but gets > annoying to maintain when you need to do arithmetic on the floats. > LIke sorting by the value. I'm confused: if you're doing arithmetic on the floats, why are you concerned with the strings? If you're sorting the strings, then you'll probably either (a) have to ensure a consistent format, perhaps with something like a ~24.18.0e specifier, or (b) convert the strings back to floats and suffer various rounding errors. > Also debugging becomes annoying when you see the e-5, e-6, etc > notation everywhere and have to match it up. On that we agree. :-) > Is there a way to compile / add arg to the VM to not do this? I'm pretty new at Erlang, so I'm probably missing a lot, but how are you displaying the values now if not with a format function? (I guess there's io:write, but at that point, you're awfully close to calling io:fwrite anyway.) Are you just using the shell to do immediate calculations? I'm sure that the shell has its own default formatting, or maybe it just calls io:write. Dan