From getonga@REDACTED Thu Jun 1 05:10:28 2017 From: getonga@REDACTED (=?utf-8?B?Z2V0b25nYQ==?=) Date: Thu, 1 Jun 2017 11:10:28 +0800 Subject: [erlang-questions] It seems that erlang 20 rc2 not include multi-pollset, still in plan? Message-ID: -------------- next part -------------- An HTML attachment was scrubbed... URL: From billcyz@REDACTED Thu Jun 1 07:54:26 2017 From: billcyz@REDACTED (yuzhu chen) Date: Thu, 1 Jun 2017 17:54:26 +1200 Subject: [erlang-questions] Can't start process when starting erlang node. Message-ID: I was trying to start a supervisor and a gen_server process while one node is created from the command-line, I use the following command to start the node: erl -name vm01@REDACTED -s ets_sup start vm02@REDACTED calc However, I found the process is undefined when I use whereis to check the process on the newly created node. I got no problems running ets_sup and ets_srv on the node shell directly, but starting the node from command line doesn't work. I want to know why this happening? ets_sup.erl: -module(ets_sup).-behaviour(supervisor).-export([start/1, start_link/1, init/1]). start([A, B]) -> start_link([A, B]). start_link([A, B]) -> supervisor:start_link({local, ?MODULE}, ?MODULE, [A, B]). init([A, B]) -> {ok, {{one_for_all, 0, 1}, [{ets_srv, {ets_srv, start_link, [A, B]}, permanent, 5000, worker, [ets_srv]}]}}. ets_srv.erl: -module(ets_srv).-behaviour(gen_server).-compile(export_all). -record(state, {a, b}). start_link(A,B) -> gen_server:start_link({local, ?MODULE}, ?MODULE, [A, B], []). init([A, B]) -> {ok, #state{a = A, b = B}}. check_sys() -> gen_server:call(?MODULE, check_sys). handle_call(check_sys, _From, #state{a = A, b = B} = State) -> {reply, {A, B}, State}. handle_info(_Info, State) -> {noreply, State}. handle_cast(_Req, State) -> {noreply, State}. code_change(_Ol, State, _Ex) -> {ok, State}. terminate(_R, _S) -> ok. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominik_pawlak@REDACTED Thu Jun 1 09:52:00 2017 From: dominik_pawlak@REDACTED (Dominik Pawlak) Date: Thu, 1 Jun 2017 09:52:00 +0200 Subject: [erlang-questions] Reg: SNMP v3 not working with AES In-Reply-To: References: <7c0d8e07-8662-017b-d1a5-c962022f585d@yahoo.co.uk> Message-ID: <6fd02615-a271-4908-abb1-7a9430e99eb5@yahoo.co.uk> I guess not that many people are using snmp in erlang. I should have made the PR a long time ago, but I never had the time. If you want, go ahead and use the patch as base for a PR. Best, Dominik On 31.05.2017 18:42, Alex Anto Navis Lawrence wrote: > Hi Dominik, > > Thanks a lot for the help. I was on the same line of fix based on > RFC-3826 (3.1.2.1. AES > Encryption Key and IV) where I got the response and got stuck with > decryption problem. > > Now I saw the patch and applied the remaining changes(git > ) on decryption > got the whole thing workings. Thanks a lot for your help, you saved a > lot for me. ?? > > Any idea on this why this is not fixed in latest erlang code. ?. Can i > be any help to make this to raise for a PR for the same. ? > > Thanks, > Alex > > On Wed, May 31, 2017 at 7:41 PM, Dominik Pawlak > > wrote: > > Hello Alex, > This looks similar to: > http://erlang.org/pipermail/erlang-questions/2016-September/090132.html > > > Basically, there was a bug for AES encryption in snmp library > (exactly what you are pointing in your mail). You can fix it by > applying a patch that is attached in the above post. > > Best, > Dominik Pawlak > > > On 31.05.2017 10:10, Alex Anto Navis Lawrence wrote: >> Hello friends, >> >> I have been trying to make the SNMP v3 work with AES, but >> couldn't. Please find the code in the below gist. >> >> Erlang/OTP 19 >> Elixir: 1.4.2 >> >> https://gist.github.com/alexnavis/8eec113cabc47a43a5a6d1eb870352fb >> >> >> *Problem:* >> SNMP packet is sent out but there is no response from the server. >> Code gist has the working Net-SNMP shell utility working command. >> It fails in the receive block timeout since no packet is received >> (I verified with wireshark). The same code works if it is the DES >> algorithm. >> >> *Code:* >> >> From the erlang code for AES, it uses Local EngineBoots and >> EngineTime to create the IV. SaltFun() is a incremental value >> which is sent as part of the authorizationParameters in the UDP >> headers. I feel using local engineBoots and engineTime might be >> wrong since the remote agent will not have any idea about our >> snmp_manager boots and engine time. Any thoughts on this ? >> >> |snmp_usm.erl. aes_encrypt(PrivKey, Data, SaltFun, EngineBoots, >> EngineTime) -> AesKey = PrivKey, Salt = SaltFun(), IV = >> list_to_binary([?i32(EngineBoots), ?i32(EngineTime) | Salt]), >> EncData = crypto:block_encrypt(?BLOCK_CIPHER_AES, AesKey, IV, >> Data), {ok, binary_to_list(EncData), Salt}.| >> >> Any pointers will be really helpful. Thanks. >> >> >> -- >> Thanks, >> Alex Anto Navis. L >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > > > -- > Thanks, > Alex Anto Navis. L -------------- next part -------------- An HTML attachment was scrubbed... URL: From lukas@REDACTED Thu Jun 1 10:08:03 2017 From: lukas@REDACTED (Lukas Larsson) Date: Thu, 1 Jun 2017 10:08:03 +0200 Subject: [erlang-questions] Erlang/OTP 20.0-rc2 is available for testing In-Reply-To: References: Message-ID: Hello Everyone, As some of you have seen, the multiple-pollset implementation is still not present in OTP 20-RC2. The implementation that we did that was almost ready by OTP 20-RC1 has turned out to have un-acceptable performance regressions for systems that mainly consist of Erlang processes communicating with each other. There is no quick fix to this problem, so we have had to rethink our original approach to polling. We are continuing to work on the problem and plan to have a solution ready "soon", it will however not be part OTP 20. Technical details: Our original approach was to simply spread the I/O polling to each scheduler so that all schedulers were responsible for polling of fd's of ports and nifs that executed on them. This had the side-effect of making it much slower to wake up schedulers to do work (because now all scheduler sleep in poll rather than on a futex). Because of this we have decided to move the I/O polling from the scheduler threads to separate thread(s). Lukas On Wed, May 31, 2017 at 8:16 PM, Kenneth Lundin wrote: > OTP 20 Release Candidate 2 > > This is the second of two release candidates before the OTP 20 release. > The intention with this release is that you as users try it and give us > feedback if something does not work as expected. Could be a bug, an > unexpected incompatibility, a significant change of characteristics in > negative direction, etc. > > There are only minor changes compared to the first release candidate, some > of them listed below: > > - erts: ./configure --enable-lock-counter will enable building of an > additional emulator that has support for > lock counting. (The option previously existed, but would turn on lock > counting in the default emulator > being built.) To start the lock-counting emulator, use erl -emu_type > lcnt. > - kernel: Added the process_flag message_queue_data = off_heap to the > code_server process in order to improve characteristics during code > upgrade, which can generate a huge amount of messages. > > Here are some of the most important news in OTP 20 (same as in RC1): > Potential Incompatibilities > > - > > ERTS: > - The non SMP Erlang VM is deprecated and not built by default > - Remove deprecated erlang:hash/2 > - erlang:statistics/1 with scheduler_wall_time now also includes > info about dirty CPU schedulers. > - The new purge strategy introduced in OTP 19.1 is mandatory and > slightly incompatible for processes holding funs > see erlang:check_process_code/3. > - The NIF library reload is not supported anymore. > - > > Asn1: Deprecated module and functions removed (asn1rt, asn1ct:encode/3 > and decode/3) > - > > Ssh: client only option in a call to start a daemon will now fail > > Highlights Erts: > > - Dirty schedulers enabled and supported on VM with SMP support. > - support for ?dirty? BIFs and ?dirty? GC. > - erlang:garbage_collect/2 for control of minor or major GC > - Erlang literals are no longer copied when sending messages. > - Improved performance for large ETS tables, >256 entries (except > ordered_set) > - erlang:system_info/1 atom_count and atom_limit > - Reduced memory pressure by converting sub-binaries to heap-binaries > during GC > - enif_select, map an external event to message > > Compiler: > > - Code generation for complicated guards is improved. > - Warnings for repeated identical map keys. #{'a'=>1, 'b'=>2, 'a'=>3} > will warn for the repeated key a. > - By default there is now a warning when export_all is used. Can be > disabled > - Pattern matching for maps is optimized > - New option deterministic to omit path to source + options info the > BEAM file. > - Atoms may now contain arbitrary unicode characters. > - compile:file/2 has an option to include extra chunks in the BEAM > file. > > Misc other applications > > - Unnamed ets tables optimized > - A new event manager to handle a subset of OS signals in Erlang > - Optimized sets add_element, del_element and union > - Added rand:jump/0-1 > - When a gen_server crashes, the stacktrace for the client will be > printed to facilitate debugging. > - take/2 has been added to dict, orddict, and gb_trees. > - take_any/2 has been added to gb_trees > - Significantly updated string module with unicode support > - erl_tar support for long path names and new file formats > - Dtls: Documented API, experimental > - SSH: improving security, removing and adding algorithms > - New math:fmod/2 > > For more details see > http://erlang.org/download/otp_src_20.0-rc2.readme > > Pre built versions for Windows can be fetched here: > http://erlang.org/download/otp_win32_20.0-rc2.exe > http://erlang.org/download/otp_win64_20.0-rc2.exe > > On line documentation can be browsed here: > www.erlang.org/documentation/doc-9.0-rc2/doc/ > > Thanks to all contributors. > /The Erlang/OTP team at Ericsson > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Oliver.Korpilla@REDACTED Thu Jun 1 11:15:32 2017 From: Oliver.Korpilla@REDACTED (Oliver Korpilla) Date: Thu, 1 Jun 2017 11:15:32 +0200 Subject: [erlang-questions] Mnesia tables don't finish syncing Message-ID: Hello. I have a system with multiple nodes, one is central and the other start later and connect to central. All tables are RAM copies, even schema. On startup of the slave nodes I do: 1) Connect nodes 2) Spawn a process on central and do mnesia:add_table_copy for each table for my new node (including schema) 3) mnesia:wait_for_tables for all of these tables I repeat steps 2) and 3) up to 5 times total with a wait time of 2s. In about 3% of cases (regression test run) it seems not to work no matter how long I wait. What I see from step 2) is as expected, the calls to mnesia:add_table_copy return a) {atomic, ok} on the first try b) {aborted, {already_exists, , }} on all further tries And no matter how many retries, in the failure scenarios the list of failed tables I still wait for does not get shorter. Could people on this list please make further suggestions where I could look for faults? And how could I find them? So far I have no way to pinpoint the actual error except that when I of course try to access such tables I get "badarg". But I don't see why the sync fails. How do I get more logs or a report pinpointing the actual problem? Thank you and kind regards, Oliver From mohammedmazharuddin@REDACTED Thu Jun 1 11:56:46 2017 From: mohammedmazharuddin@REDACTED (Mohammed mazhar uddin) Date: Thu, 1 Jun 2017 15:26:46 +0530 Subject: [erlang-questions] slave:start/3 bash: myapp: command not found {error, timeout} Message-ID: Hi all, i am trying to start a slave node from my already existing node and i am getting a timeout error , do anyone have any idea why i am i getting this error? Here is what i am doing, (SCC@REDACTED)1> slave:start('192.168.21.29', abc, "-setcookie utl"). and the error i am getting is, bash: my_app: command not found {error,timeout}. A reply would be greatly appreciated. Regards, Mohammed Mazhar Uddin. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mohammedmazharuddin@REDACTED Thu Jun 1 12:02:52 2017 From: mohammedmazharuddin@REDACTED (Mohammed mazhar uddin) Date: Thu, 1 Jun 2017 15:32:52 +0530 Subject: [erlang-questions] Timeout when a slave node is started with a rebar3 release. Message-ID: Hi, I meet a difficulty to start salve nodes when my application is packaged with Rebar. When i call slave:start_link/3, the return is :{error, timeout}. The slave is started on the same host than the master with the same cookie. Note that my code works when i run it under a classic erl context. Any Idea ? Thanks in advance! Best regards, Mohammed Mazhar Uddin. -------------- next part -------------- An HTML attachment was scrubbed... URL: From benmmurphy@REDACTED Fri Jun 2 11:09:03 2017 From: benmmurphy@REDACTED (Ben Murphy) Date: Fri, 2 Jun 2017 10:09:03 +0100 Subject: [erlang-questions] The Danger of gen:server timeout Message-ID: So a bunch of gen_server:* methods allow you to return a timeout value. So if you were thinking about how this would be implemented you would expect if elapsed time >Timeout it would send a timeout message to your process. This is true. However, if elapsed time > much greater than Timeout then a timeout message could be sent to your process :/ How is this possible? If your process receives a system message before the timeout then the timeout is reset without considering how long you have waited before receiving a system message. For example: you could be waiting 1 month for a timeout then after 20 days someone did sys:get_state on your process then you are waiting another 1 month for your timeout.. -module(wtf). -behaviour(gen_server). -export([init/1, code_change/3, handle_call/3, handle_cast/2, handle_info/2, terminate/2]). init(_Args) -> TS = erlang:timestamp(), io:format("init: ~p~n", [TS]), {ok, TS, 30 * 1000}. handle_info(Message, TS) -> io:format(user, "handle info :~p ~p ~n", [Message, erlang:timestamp()]), Now = erlang:timestamp(), io:format(user, "difference: ~p ~n", [timer:now_diff(Now, TS)]), {noreply, TS}. code_change(_1, _2, _3) -> throw(wtf). handle_call(_1, _2, _3) -> throw(wtf). handle_cast(_1, _2) -> throw(wtf). terminate(_1, _2) -> ok. Erlang/OTP 19 [erts-8.0] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] Eshell V8.0 (abort with ^G) 1> {ok, Pid} = gen_server:start_link(wtf, [], []). init: {1496,394234,956218} {ok,<0.59.0>} 2> sys:get_state(Pid). {1496,394234,956218} 3> handle info :timeout {1496,394279,244306} difference: 44288466 From stamarit@REDACTED Fri Jun 2 13:25:27 2017 From: stamarit@REDACTED (Salvador Tamarit) Date: Fri, 2 Jun 2017 13:25:27 +0200 Subject: [erlang-questions] CfP: 2nd Workshop on Actors and Active Objects (WAO 2017); Satellite event of iFM17 [Extended] Message-ID: [Apologies if you receive multiple copies of this announcement.] CALL FOR PAPERS WAO 2017 2nd Workshop on Actors and Active Objects A Satellite workshop of iFM 2017 Torino, Italy 18 September 2017 http://costa.ls.fi.upm.es/wao17 Description of the workshop =========================== Distribution and concurrency are currently mainstream. The Internet and the broad availability of multi-processors radically influence software. This brings renewed interest in developing both new concurrency models and associated programming languages techniques that help in understanding, analyzing, and verifying the behavior of concurrent and distributed programs. The actors or active objects concurrency model has emerged as an alternative to the usual thread-based concurrency model, providing programmers with high-level concurrency constructs that help in producing concurrent applications more modularly and in a less error-prone way. It is gaining a lot of popularity mainly because of the success of languages like Scala and Erlang. Also, most mainstream languages are nowadays providing actors or active-objects libraries. The objective of the workshop is to discuss about current evolution of actors and active objects and related languages, technology and tools. The goal is to make the workshop an active discussion forum for all work related to actor languages and active-objects in order to have a better view on the current and future trends in this field and perhaps build longer term collaborations. The workshop will be a mixture of invited presentations and short tutorials on state-of-the-art languages/techniques/tools by experts in the field, presentations of recently published high-quality papers, prototype demonstrations, and presentations of proofs-of-concept and promising ideas. Invited speaker =============== Lars Ake Fredlund, Technical University of Madrid Important dates =============== Abstract submission: June 7, 2017 (extended) Paper submission: June 9, 2017 (extended) Notification: July 10, 2017 Submission information ====================== We solicit papers in the following categories: (1) Regular research papers of at most 12 pages (excluding references) describing original scientific research results or its relevance to real applications. Case studies and tool demonstrations are also welcome, in these cases with a maximum length of 8 pages. The paper should explain why the technique/case-study/tool is relevant for the community, and, in particular, for practitioners. Submissions will be judged on the basis of significance, relevance, correctness, originality, and clarity. (2) Position papers of at most 4 pages describing exciting but not fully polished research (proofs-of-concept, promising ideas, etc.). (3) High-quality already published papers. Authors will send an extended abstract of at most 2 pages describing the work and a link to the publication. Revised versions of accepted papers of category (1), taking into account the feedback received at the workshop, will be published in a volume of the Electronic Proceedings in Theoretical Computer Science (EPTCS) series after the workshop. For submissions in categories (2) and (3) there will be a light-weight reviewing process where submissions will be judged on their interest to the workshop audience. Papers will be submitted (in PDF format) through Easychair at https://easychair.org/conferences/?conf=wao2017 Organisers ========== Miguel Gomez-Zamalloa, Complutense University of Madrid, Spain Guillermo Roman-Diez, Technical University of Madrid, Spain All questions about the workshop can be addressed to them via mail: mzamalloa@REDACTED groman@REDACTED Program Committee ================== Gul Agha University of Illinois at Urbana-Champaign Nikolaos Bezirgiannis Centrum Wiskunde & Informatica (CWI) Richard Bubel Technische Universitat Darmstadt Stijn De Gouw Open University (OU), The Netherlands Enrique Martin-Martin Complutense University of Madrid Ludovic Henrio CNRS, Sophia Antipolis, France Ka I Pun University of Oslo Rudolf Schlatte University of Oslo Kostis Sagonas Uppsala University Salvador Tamarit Technical University of Madrid -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Fri Jun 2 13:59:23 2017 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Fri, 02 Jun 2017 11:59:23 +0000 Subject: [erlang-questions] The Danger of gen:server timeout In-Reply-To: References: Message-ID: Here is the crux of what you are toying with: Erlang has two kinds of timeouts: idle timeouts and point-in-time timeouts. The timeouts you can set in a gen_server are idle timeouts, so they are implemented basically as receive ... after Timeout -> ... end What this means is that any message which arrives in the mailbox cancels the timeout. In particular, your sys:get_state/1 call invokes such a message, resetting the timeout. If you want a point-in-time timeout, there is another tool for this: erlang:send_after/3. It will deliver a message through another timer system and even if the process is active, you will get the timer in a relatively timely fashion. You are not guaranteed to get the timer precisely at the point if the system is heavily loaded, but usually you get it within a couple of ms of where you want at worst. This is the essence of being soft-realtime, amont other things. The gen_server timeouts are nice to use for the situation where idling means you can do some janitorial work in your process or do a hibernation. I often have some janitorial work that runs either on a counter (every 100 message) and also on an idle timer (20 seconds has passed with no message). On Fri, Jun 2, 2017 at 11:09 AM Ben Murphy wrote: > So a bunch of gen_server:* methods allow you to return a timeout > value. So if you were thinking about how this would be implemented you > would expect if elapsed time >Timeout it would send a timeout message > to your process. This is true. However, if elapsed time > much greater > than Timeout then a timeout message could be sent to your process :/ > How is this possible? > > If your process receives a system message before the timeout then the > timeout is reset without considering how long you have waited before > receiving a system message. For example: you could be waiting 1 month > for a timeout then after 20 days someone did sys:get_state on your > process then you are waiting another 1 month for your timeout.. > > -module(wtf). > -behaviour(gen_server). > > -export([init/1, code_change/3, handle_call/3, handle_cast/2, > handle_info/2, terminate/2]). > > init(_Args) -> > TS = erlang:timestamp(), > io:format("init: ~p~n", [TS]), > {ok, TS, 30 * 1000}. > > > handle_info(Message, TS) -> > io:format(user, "handle info :~p ~p ~n", [Message, erlang:timestamp()]), > Now = erlang:timestamp(), > io:format(user, "difference: ~p ~n", [timer:now_diff(Now, TS)]), > {noreply, TS}. > > > code_change(_1, _2, _3) -> > throw(wtf). > handle_call(_1, _2, _3) -> > throw(wtf). > handle_cast(_1, _2) -> > throw(wtf). > terminate(_1, _2) -> > ok. > > Erlang/OTP 19 [erts-8.0] [source] [64-bit] [smp:4:4] > [async-threads:10] [hipe] [kernel-poll:false] > > Eshell V8.0 (abort with ^G) > 1> {ok, Pid} = gen_server:start_link(wtf, [], []). > init: {1496,394234,956218} > {ok,<0.59.0>} > 2> sys:get_state(Pid). > {1496,394234,956218} > 3> handle info :timeout {1496,394279,244306} > difference: 44288466 > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Catenacci@REDACTED Fri Jun 2 14:14:31 2017 From: Catenacci@REDACTED (Onorio Catenacci) Date: Fri, 2 Jun 2017 08:14:31 -0400 Subject: [erlang-questions] [ANN] New Chocolatey NuGet BEAM Packages Message-ID: Hi all, For those who care the Chocolatey NuGet Packages for Elixir and Erlang are updated. https://onor.io/2017/06/02/new-chocolatey-nuget-beam-packages Package for Rebar has also been updated but it's still pending approval. -- Onorio Catenacci http://onor.io http://www.google.com/+OnorioCatenacci -------------- next part -------------- An HTML attachment was scrubbed... URL: From freza@REDACTED Fri Jun 2 14:25:14 2017 From: freza@REDACTED (Jachym Holecek) Date: Fri, 2 Jun 2017 08:25:14 -0400 Subject: [erlang-questions] The Danger of gen:server timeout In-Reply-To: References: Message-ID: <20170602122513.GA22233@circlewave.NET> # Jesper Louis Andersen 2017-06-02: > Here is the crux of what you are toying with: Erlang has two kinds of > timeouts: idle timeouts and point-in-time timeouts. The timeouts you can > set in a gen_server are idle timeouts, so they are implemented basically as > > receive > ... > after Timeout -> > ... > end They may happen to be implemented that way in gen_server, but it is debatable whether this is intentional (might have been purely for simplicity) and whether this is correct as far as expectations go -- system messages are not seen by the user code running the gen_server process (they are handled under the hood), so as far as user logic is concerned the server had been idle despite these under-the-hood messages perhaps flowing through. Not that this has ever been an issue for me personally, and as you indicate it's extremely easy to work around explicitely... But I do recall implementing idle timeouts with erlang:start_timer/X without resetting the timer on system messages in a custom behaviour module on at least one occasion, and I recall thinking implemention in gen_server / gen_fsm (which I used as reference) was a bit suspicious, although in a harmless way. So there's that. BR, -- Jachym From roger@REDACTED Fri Jun 2 16:28:25 2017 From: roger@REDACTED (Roger Lipscombe) Date: Fri, 2 Jun 2017 15:28:25 +0100 Subject: [erlang-questions] Calling disconnect_node crashes script with "init terminating in do_boot (noconnection)" Message-ID: I've got an escriptized script that was working fine yesterday when talking to an Erlang 17.x node. Today, I'm attempting to use it to talk to an Erlang 19.x node, and my script is dying. The script connects to remote nodes, loads a beam module into them, calls that module using RPC and then disconnects. But when I call erlang:disconnect_node(Node), my escript dies with the following: {"init terminating in do_boot",noconnection} init terminating in do_boot (noconnection) Crash dump is being written to: erl_crash.dump...done This doesn't appear to be trappable (try/catch doesn't appear to work); the only way I can seem to avoid it is by removing the call to disconnect_node. I've run the script under Erlang 17 and Erlang 19, talking to the Erlang 19 node, and it fails in the same way. Yesterday, running under Erlang 17, talking to an Erlang 17 node, it was fine. What can I do to investigate this further? From Oliver.Korpilla@REDACTED Sat Jun 3 08:28:27 2017 From: Oliver.Korpilla@REDACTED (Oliver Korpilla) Date: Sat, 3 Jun 2017 08:28:27 +0200 Subject: [erlang-questions] gproc_dist finicky about latecomers Message-ID: Hello. I use gproc/gproc_dist with gen_leader_revival. I have the gproc_dist all application option on and do use global names. It works fine if and only if I connect nodes first and then start gproc afterwards for additional nodes joining the cluster. If I start gproc before connecting nodes, every node insists on being the leader (I queried through the gproc API for each node) and they stick with their opinion. global aggregated counters in turn do not work, failing my application's simple loadbalancing. I ran into this problem twice: * When originally writing my application startup. * When redoing the startup and forgetting why I started gproc at a specific time. I hoped to document this somehow. Do people observe the same with locks_leader? Regards, Oliver From lars.thorsen@REDACTED Mon Jun 5 10:45:47 2017 From: lars.thorsen@REDACTED (Lars Thorsen) Date: Mon, 5 Jun 2017 08:45:47 +0000 Subject: [erlang-questions] Patch package OTP 19.3.5 released Message-ID: Patch Package: OTP 19.3.5 Git Tag: OTP-19.3.5 Date: 2017-06-05 Trouble Report Id: OTP-14418, OTP-14430 Seq num: System: OTP Release: 19 Application: erts-8.3.4, xmerl-1.3.14 Predecessor: OTP 19.3.4 Check out the git tag OTP-19.3.5, 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-8.3.4 ------------------------------------------------------ --------------------------------------------------------------------- Note! The erts-8.3.4 application can *not* be applied independently of other applications on an arbitrary OTP 19 installation. On a full OTP 19 installation, also the following runtime dependency has to be satisfied: -- sasl-3.0.1 (first satisfied in OTP 19.1) --- Fixed Bugs and Malfunctions --- OTP-14418 Application(s): erts Related Id(s): ERIERL-15 Add option to make SIGTERM trigger the OS default behaviour instead of doing a gracefull shutdown. To activate this bahviour the environment variable ERL_ZZ_SIGTERM_KILL should be set to "true". This option only works in OTP 19 as OTP 20 will have a different way to deal with SIGTERM. Full runtime dependencies of erts-8.3.4: kernel-5.0, sasl-3.0.1, stdlib-3.0 --------------------------------------------------------------------- --- xmerl-1.3.14 ---------------------------------------------------- --------------------------------------------------------------------- The xmerl-1.3.14 application can be applied independently of other applications on a full OTP 19 installation. --- Fixed Bugs and Malfunctions --- OTP-14430 Application(s): xmerl A couple of bugs are fixed in the sax parser (xmerl_sax_parser). -- The continuation function was not called correctly when the XML directive was fragmented. -- When the event callback modules (xmerl_sax_old_dom and xmerl_sax_simple) got an endDocument event at certain conditions the parser crashed. -- Replaced internal ets table with map to avoid table leakage. Full runtime dependencies of xmerl-1.3.14: erts-6.0, kernel-3.0, stdlib-2.5 --------------------------------------------------------------------- --------------------------------------------------------------------- --------------------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Mon Jun 5 10:47:19 2017 From: ok@REDACTED (ok@REDACTED) Date: Mon, 5 Jun 2017 20:47:19 +1200 Subject: [erlang-questions] -protocol declartion idea, worth an EEP? Message-ID: One of the things I've wanted for a long time in Erlang is a way to check message passing. Now that we have the Dialyzer, it occurred to me that there's a simple thing we could do that wouldn't achieve everything we might want (it's not UBF) but might be useful in catching typos at least. Before writing it up as an EEP, I thought I'm check with the mailing list whether it makes sense to other people. It seems like the kind of thing that must have been thought of before, so maybe there is some flaw in it that I'm not seeing. -protocol(). says that the following function and the functions it calls may only receive messages that conform to the . Taking the as a union type (counting a type that is not a union type as a union of one element), each element of the union must have at least one corresponding receive. [I know 'corresponding' is vague; this is one of the things the EEP would spell out.] What if a function calls another that is not known until run time? That requires a change to the type language: Fun :: fun( OptRcv) %% any function | fun((...) -> Type OptRcv) %% any arity, returning Type | fun(() -> Type OptRcv) | fun((TList) -> Type OptRcv) OptRcv :: /* empty */ | receive Type If you want to specify that a function doesn't receive anything, use 'receive none()'; any empty OptRcv says nothing about the function's protocol. -spec could be extended too. -spec Module:Function(ArgType1, ..., ArgTypeN) -> ReturnType OptRcv. This would not let us check that sends and receives matched up properly, although part 2 of the EEP would address that. But it would provide (1) a place to document the programmer's intentions about the messages a process should receive (2) a way to check that patterns in receives were supposed to be there, catching typos (3) a way to check that everything that is supposed to be received might be received somewhere; this would have false negatives, but it's still better than what we have. From joe@REDACTED Mon Jun 5 13:02:35 2017 From: joe@REDACTED (Joe Harrison) Date: Mon, 05 Jun 2017 11:02:35 +0000 Subject: [erlang-questions] -protocol declartion idea, worth an EEP? In-Reply-To: References: Message-ID: <614871496660555@web6j.yandex.ru> > One of the things I've wanted for a long time in Erlang is > a way to check message passing. Now that we have the > Dialyzer, it occurred to me that there's a simple thing we > could do that wouldn't achieve everything we might want > (it's not UBF) but might be useful in catching typos at least. I'm actually working on exactly this at the moment. Though I'm not relying on Dialyzer, there has been work on using Dialyzer for this purpose: "Detection of Asynchronous Message Passing Errors Using Static Analysis" by M. Christakis and K. Sagonas > Before writing it up as an EEP, I thought I'm check with the > mailing list whether it makes sense to other people. It seems > like the kind of thing that must have been thought of before, > so maybe there is some flaw in it that I'm not seeing. The problem I see is simple. If you have an irrefutable pattern, it covers *all* of your receive specifications: receive A -> ok end. > If you want to specify that a function doesn't receive > anything, use 'receive none()'; any empty OptRcv says nothing > about the function's protocol. I disagree. This would mean that all "pure" functions require annotations. This seems pretty tedious. > This would not let us check that sends and receives matched up > properly, although part 2 of the EEP would address that. But > it would provide > (1) a place to document the programmer's intentions > ????about the messages a process should receive I love this style of programming. We should always let the programmer communicate their intentions to the compiler. > (2) a way to check that patterns in receives were supposed to > ????be there, catching typos See my irrefutable pattern comment above. I do however, think it would be very useful in a classroom setting. We teach our undergraduate students Erlang and one of my anecdotal observations is something similar to the following: client(Server) -> Server ! hello, receive akc -> ok end, client(Server). server() -> receive {hello, Client} -> Client ! ack end, server(). In these settings I believe the analysis would be useful. In OTP settings, I think that the headers of the handle_call, handle_cast, and handle_info functions serve as informal receive specifications. > (3) a way to check that everything that is supposed to be > ????received might be received somewhere; this would have > ????false negatives, but it's still better than what we have. I agree, it's better than nothing. I feel like the biggest point of contention would be the style of the receive specifications, and I would like to see this as an EEP :) - Joe https://cs.kent.ac.uk/~jrh53 From ok@REDACTED Mon Jun 5 15:16:36 2017 From: ok@REDACTED (ok@REDACTED) Date: Tue, 6 Jun 2017 01:16:36 +1200 Subject: [erlang-questions] -protocol declartion idea, worth an EEP? In-Reply-To: <614871496660555@web6j.yandex.ru> References: <614871496660555@web6j.yandex.ru> Message-ID: <7d307fdf3513eb81317382908e150986.squirrel@chasm.otago.ac.nz> > The problem I see is simple. If you have an irrefutable pattern, > it covers *all* of your receive specifications: > > receive > A -> ok > end. Or more generally, the "catch-all" idiom receive good1 -> ... ; good2 -> ... ; _ -> loop(...) % discard bad messages end I was thinking of having a macro ?CATCHALL for this, with different translations for ordinary compilation (_) and checking (something else). Or perhaps more simply, treating a single wild-card in receive as a special case. > >> If you want to specify that a function doesn't receive >> anything, use 'receive none()'; any empty OptRcv says nothing >> about the function's protocol. > > I disagree. This would mean that all "pure" functions require > annotations. This seems pretty tedious. The problem is that right now fun() and -spec say *nothing* about reception. Backwards compatibility seems to require not changing that. The idea was that a checker should *infer* 'receive none()' for pure functions, and that this should *refine* a given -spec. One thing I was after was that you should normally require just one -protocol declaration per process, with the receive part of the functions it calls being inferred. From joe@REDACTED Mon Jun 5 16:56:01 2017 From: joe@REDACTED (Joe Harrison) Date: Mon, 05 Jun 2017 15:56:01 +0100 Subject: [erlang-questions] -protocol declartion idea, worth an EEP? In-Reply-To: <7d307fdf3513eb81317382908e150986.squirrel@chasm.otago.ac.nz> References: <614871496660555@web6j.yandex.ru> <7d307fdf3513eb81317382908e150986.squirrel@chasm.otago.ac.nz> Message-ID: <57491496674561@web35g.yandex.ru> > Or more generally, the "catch-all" idiom > ???receive > ??????good1 -> ... > ????; good2 -> ... > ????; _ -> loop(...) % discard bad messages > ???end Yes, definitely. I was assuming that A was unbound. > I was thinking of having a macro ?CATCHALL for this, > with different translations for ordinary compilation > (_) and checking (something else). Or perhaps more > simply, treating a single wild-card in receive as a > special case. You're right. Wildcards are definitely a special case that can hide a lot of (dangerous) communication problems. Though I'm not clear where this macro should be: in the protocol spec or the receive? > The problem is that right now fun() and -spec say *nothing* > about reception. Backwards compatibility seems to require > not changing that. > > The idea was that a checker should *infer* 'receive none()' > for pure functions, and that this should *refine* a given > -spec. Oh right. That makes much more sense :) > One thing I was after was that you should normally require > just one -protocol declaration per process, with the > receive part of the functions it calls being inferred. Yep! It seems like a good idea to make these compositional. - Joe From mjtruog@REDACTED Mon Jun 5 19:35:40 2017 From: mjtruog@REDACTED (Michael Truog) Date: Mon, 5 Jun 2017 10:35:40 -0700 Subject: [erlang-questions] -protocol declartion idea, worth an EEP? In-Reply-To: <7d307fdf3513eb81317382908e150986.squirrel@chasm.otago.ac.nz> References: <614871496660555@web6j.yandex.ru> <7d307fdf3513eb81317382908e150986.squirrel@chasm.otago.ac.nz> Message-ID: <5935966C.20403@gmail.com> On 06/05/2017 06:16 AM, ok@REDACTED wrote: >>> If you want to specify that a function doesn't receive >>> anything, use 'receive none()'; any empty OptRcv says nothing >>> about the function's protocol. >> I disagree. This would mean that all "pure" functions require >> annotations. This seems pretty tedious. > The problem is that right now fun() and -spec say *nothing* > about reception. Backwards compatibility seems to require > not changing that. > > The idea was that a checker should *infer* 'receive none()' > for pure functions, and that this should *refine* a given > -spec. > > One thing I was after was that you should normally require > just one -protocol declaration per process, with the > receive part of the functions it calls being inferred. I believe it is more important to be able to mark functions impure or pure within the Erlang type specification as described at https://bugs.erlang.org/browse/ERL-373 than to clarify the received messages, though it would be nice to have both. In practice, the code paths taken with a receive won't benefit clearly with the -protocol addition, when considering how receives are normally buried in an Erlang behaviour (it is considered beneficial to use Erlang behaviours in practice, and often explicit receives are typical in academic exercises which may refer back to Erlang in earlier days before OTP existed). If we could mark functions as impure or pure and have it inferred/checked with dialyzer, there would always be a clear benefit at any level of abstraction. From Adam.Bloom@REDACTED Mon Jun 5 20:27:02 2017 From: Adam.Bloom@REDACTED (Bloom, Adam) Date: Mon, 5 Jun 2017 18:27:02 +0000 Subject: [erlang-questions] SSL peer certificate verification - RabbitMQ Message-ID: Hello, Hoping that one of you knows some secrets you can impart in me to get SSL peer verification working from RabbitMQ. I?ve been digging through the source code of the underlying Erlang SSL library to no avail. In particular, I?m struggling to understand the depth setting. According to the docs (http://erlang.org/doc/man/ssl.html): {depth, integer()} Maximum number of non-self-issued intermediate certificates that can follow the peer certificate in a valid certification path. So, if depth is 0 the PEER must be signed by the trusted ROOT-CA directly; if 1 the path can be PEER, CA, ROOT-CA; if 2 the path can be PEER, CA, CA, ROOT-CA, and so on. The default value is 1. I have two certificates (client and server) signed by the same intermediate CA. I would like to restrict rabbitmq to only accept connections from this (and potentially one more) intermediate CA. My initial thought was to set depth to 0 and place the intermediate ca (followed by the root ca) in the CA cert file. If I do this, the client is unable to connect and the server logs the following error: SSL: certify: ssl_handshake.erl:1627:Fatal error: handshake failure - {bad_cert,max_path_length_reached}. If I change depth to 1, the connection works. Rabbitmq also allows a cert signed by another intermediate ca (same root) to connect, which is what I?d like to prevent. This follows from the ssl man page though. Can someone please advise me on the proper use of the ?depth? setting in the Erlang ssl library such that only certificates signed by the trusted intermediate are able to connect? Do I need to remove the root CA from the CA cert file and explore partial_chain handlers? Here are my current ssl_options settings from rabbitmq: {ssl_options, [ {cacertfile, "/etc/rabbitmq/certs/cacert.pem"}, {certfile, "/etc/rabbitmq/certs/cert.pem"}, {keyfile, "/etc/rabbitmq/certs/key.pem"}, {verify, verify_peer}, {depth, 1}, {fail_if_no_peer_cert, true}, {versions, ['tlsv1.2']} ]}, Thanks, Adam -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul.joseph.davis@REDACTED Mon Jun 5 23:28:49 2017 From: paul.joseph.davis@REDACTED (Paul Davis) Date: Mon, 5 Jun 2017 16:28:49 -0500 Subject: [erlang-questions] Curiosity on Abstract Format for try_catch clauses Message-ID: Howdy, I've been working on a tool using erl_scan, erl_parse, and friends lately and stumbled over an oddity in the Abstract Format for try_catch clauses: https://github.com/erlang/otp/blob/OTP-19.3.5/lib/stdlib/src/erl_parse.yrl#L456-L464 For some reason there's a {var, Anno, '_'} expression inserted in the Patterns for each try_catch clause and it left me scratching my head what it was doing there. I haven't read enough to what happens afterwords but my only guess is that there's something internally that gets matched with the ignore pattern. Given that its ignored I figured its probably historical but thought it curious enough to ask if anyone had some insight on that. I did try and look through the history but that bit of Abstract Format is nearly unchanged since the first commit of R13B03 in the public repository: https://github.com/erlang/otp/blob/84adefa331c4159d432d22840663c38f155cd4c1/lib/stdlib/src/erl_parse.yrl#L415-L423 Thanks, Paul From zxq9@REDACTED Tue Jun 6 00:38:55 2017 From: zxq9@REDACTED (zxq9) Date: Tue, 06 Jun 2017 07:38:55 +0900 Subject: [erlang-questions] -protocol declartion idea, worth an EEP? In-Reply-To: <5935966C.20403@gmail.com> References: <7d307fdf3513eb81317382908e150986.squirrel@chasm.otago.ac.nz> <5935966C.20403@gmail.com> Message-ID: <11261327.Kkyl31OrVs@changa> On 2017?06?05? ??? 10:35:40 Michael Truog wrote: > On 06/05/2017 06:16 AM, ok@REDACTED wrote: > >>> If you want to specify that a function doesn't receive > >>> anything, use 'receive none()'; any empty OptRcv says nothing > >>> about the function's protocol. > >> I disagree. This would mean that all "pure" functions require > >> annotations. This seems pretty tedious. > > The problem is that right now fun() and -spec say *nothing* > > about reception. Backwards compatibility seems to require > > not changing that. > > > > The idea was that a checker should *infer* 'receive none()' > > for pure functions, and that this should *refine* a given > > -spec. > > > > One thing I was after was that you should normally require > > just one -protocol declaration per process, with the > > receive part of the functions it calls being inferred. > > I believe it is more important to be able to mark functions impure or pure within the Erlang type specification as described at https://bugs.erlang.org/browse/ERL-373 than to clarify the received messages, though it would be nice to have both. In practice, the code paths taken with a receive won't benefit clearly with the -protocol addition, when considering how receives are normally buried in an Erlang behaviour (it is considered beneficial to use Erlang behaviours in practice, and often explicit receives are typical in academic exercises which may refer back to Erlang in earlier days before OTP existed). If we could mark functions as impure or pure and have it inferred/checked with dialyzer, there would always be a clear benefit at any level of abstraction. I totally agree, to the point that I often annotate pure functions: https://github.com/zxq9/zuuid/blob/master/src/zuuid.erl#L34-L39 BUT These are two very different issues. What ROK is getting at is having a way to declare a message protocol (as a verifiable contract) by which a certain process is going to live and abide by (at the "living objects" level of the system), whereas declaring functional purity is strictly functional annotation. These are entirely orthogonal issues, but both absolutely critical to providing a way for a programmer to formally declare the intent of some code and have that intent checked by a tool like Dialyzer. That said... OTP and extension of generic behaviors (OTP or otherwise) is an interesting issue because while it is often useful to have one module in src/ equate to one type of process that will be spawned, leveraging gen_server with another layer of abstraction is not uncommon (consider wx) -- and neither is writing OTP-compliant pure Erlang processes that contain their own naked 'receive' clauses when dealing with code that needs to have extremely low latency (tight socket handling code comes to mind). That means that the parts of a process' definition that might include informal declarations of valid incoming and outgoing message forms may be spread across several code modules and shared across processes -- and this gets tricky to determine how to define. Even a good syntax for how to write this is not easy to pull out of a hat. The traditional way to sort of wish the protocol message adherence issue away has been to use behaviors and abstract all message passing behind public interface functions that are as explicitly typed as one can manage -- and yet this still fails to really give us a solid contract by which processes have to live in a way that dialyzer can check for us, as it forces side-effecty message-involved functions to be conflated with any other functions. (This approach is also one that seems to be heavily used and almost never discussed in these terms.) Hmmm... Anyway, I certainly think a -pure declaration in Dialyzer would be much easier to implement in the short-term than a process-level message protocol declaration. But I deeply wish we had both already -- and always have. -Craig From ok@REDACTED Tue Jun 6 00:42:49 2017 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 6 Jun 2017 10:42:49 +1200 Subject: [erlang-questions] -protocol declartion idea, worth an EEP? In-Reply-To: <5935966C.20403@gmail.com> References: <614871496660555@web6j.yandex.ru> <7d307fdf3513eb81317382908e150986.squirrel@chasm.otago.ac.nz> <5935966C.20403@gmail.com> Message-ID: <88511322-6CAF-40A6-A4B2-6A913E5F2BD7@cs.otago.ac.nz> > On 6/06/2017, at 5:35 AM, Michael Truog wrote: > I believe it is more important to be able to mark functions impure or pure Actually that was something I was working on with SERC just before funs were introduced into Erlang and completely derailed my ideas. One issue is that 'pure' or 'impure' is far too coarse a classification. For example, we might want to distinguish - termination - terminates in bounded time - terminates in finite time - not known to terminate - process dictionary - no dependency on process dictionary - reads specified parts of process dictionary - writes (and maybe reads) specified parts of process dictionary - input/output - does no I/O - reads - writes - opens and closes - inter-process communication - does it create processes or not - does it send messages or not - does it receive messages (which?) or not And that isn't meant to be a complete list. Another issue is higher-order functions. map(F, [X|Xs]) -> [F(X) | map(F, Xs)]; map(_, []) -> []. is itself pure, but if F has any effects, map(F, ...) may (but need not) have those effects too. So we need a type like map/2 :: (A -> B effect E, list(A)) -> list(B) effect E+finite. Since then, Erlang has gone through at least three different type systems (the Wadler one, the Armstrong one, and the one it now has), and I never did get around to trying to adapt a proper "effect" system to the Dialyzer approach. From mjtruog@REDACTED Tue Jun 6 03:55:15 2017 From: mjtruog@REDACTED (Michael Truog) Date: Mon, 5 Jun 2017 18:55:15 -0700 Subject: [erlang-questions] -protocol declartion idea, worth an EEP? In-Reply-To: <88511322-6CAF-40A6-A4B2-6A913E5F2BD7@cs.otago.ac.nz> References: <614871496660555@web6j.yandex.ru> <7d307fdf3513eb81317382908e150986.squirrel@chasm.otago.ac.nz> <5935966C.20403@gmail.com> <88511322-6CAF-40A6-A4B2-6A913E5F2BD7@cs.otago.ac.nz> Message-ID: <59360B83.6030306@gmail.com> On 06/05/2017 03:42 PM, Richard A. O'Keefe wrote: >> On 6/06/2017, at 5:35 AM, Michael Truog wrote: >> I believe it is more important to be able to mark functions impure or pure > Actually that was something I was working on with SERC just before > funs were introduced into Erlang and completely derailed my ideas. > > One issue is that 'pure' or 'impure' is far too coarse a classification. It would be nice to have finer granularity than just 'pure' or 'impure', though it seems very easy to make this purity concept complex enough that people don't use it. Having the ability to distinguish between "operational purity" and "mathematical purity" (as they were described in https://bugs.erlang.org/browse/ERL-373) would be interesting, though it would go beyond the concept of purity that is present in Haskell, which is already complex, and would require that people care about the difference (I don't think most people would care, in practice, since their concerns would be likely focused only on their logic they are attempting to develop, while they assume the compilation platform remains (generally) constant). I would expect that Erlang, as a dynamically typed language, would favor simplicity in the purity concept, instead of providing more granularity, though I personally would like more granularity (i.e., to keep the function types in any Erlang system simple, and able to handle future changes more easily, even if the changes span separate module versions and Erlang versions). > For example, we might want to distinguish > - termination > - terminates in bounded time > - terminates in finite time > - not known to terminate I would assume most analysis of normal source code wouldn't be able to say anything too useful about termination (due to normal complexity), but I don't know much about this. I mainly just consider that dialyzer is already pushing speed and memory limits which shouldn't be taxed much more (especially if this would only ever work on toy examples). I would rather that dialyzer is always part of compilation (even if it always remains a separate executable) to get similar lint-ing when compared to statically typed languages. > - process dictionary > - no dependency on process dictionary > - reads specified parts of process dictionary > - writes (and maybe reads) specified parts of process dictionary I like the idea of being able to distinguish between local mutable data (the process dictionary) and global mutable data (ets, etc.), to show the scope of the mutability used in the function. It is likely reasonable to say global mutable data use permits local mutable data use, where global mutable data use is considered "more impure" than local mutable data use (i.e., using ets allows you to use the process dictionary, without being specific about using the process dictionary). Having separate levels of impurity could convey an increasing potential for error (more impurity requires more testing at a system level to ensure state is being managed according to expectations). > - input/output > - does no I/O > - reads > - writes > - opens and closes > - inter-process communication > - does it create processes or not > - does it send messages or not > - does it receive messages (which?) or not I think it is best to group I/O as it relates to the Erlang port type, so sockets and Erlang port processes would be treated the same. That I/O is separate from Erlang messages, which relates more to the -protocol declaration idea. > And that isn't meant to be a complete list. > > Another issue is higher-order functions. > > map(F, [X|Xs]) -> [F(X) | map(F, Xs)]; > map(_, []) -> []. > > is itself pure, but if F has any effects, map(F, ...) may > (but need not) have those effects too. So we need a type > like > map/2 :: (A -> B effect E, list(A)) -> list(B) effect E+finite. If dialyzer could infer the purity from the anonymous function, then we should be able to avoid making the syntax for the type specification more complex. That may require that functions never default to being "impure" and just stay ambiguous, until it can be inferred from type specifications based on the call path (or things like catching exceptions, local/global mutable state, etc.). > > Since then, Erlang has gone through at least three different > type systems (the Wadler one, the Armstrong one, and the one > it now has), and I never did get around to trying to adapt a > proper "effect" system to the Dialyzer approach. From denc716@REDACTED Tue Jun 6 04:38:11 2017 From: denc716@REDACTED (derek) Date: Mon, 5 Jun 2017 19:38:11 -0700 Subject: [erlang-questions] How about make the erl to be relocatable ? for multiple erlang versions installed on a same host Message-ID: the default erl is a shell script, like this: #!/bin/sh [...] # %CopyrightEnd% # ROOTDIR="/usr/lib/erlang" ... Where the ROOTDIR is set to a hard code string at installation time, and it makes the erl script not relocatable, sometimes we want to install multiple erlang versions for testing features, like this following is my way to test install esl packaged erlang-20.0-rc2, all just extract "install" to my $HOME/opt/... without sysadmin permission: # download the deb or rpm package $ wget -P ./Downloads -m https://packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_20.0-rc2-1~debian~jessie_amd64.deb # the deb is an ar format, you can use standard ar/tar tools to extract to local ./usr/lib/erlang/ $ ar p ./Downloads/ packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_20.0-rc2-1~debian~jessie_amd64.deb data.tar.xz | tar --xz -xvv ./usr/lib/erlang/ # or to extract the rpm, it is cpio format: # rpm2cpio ./Downloads/ packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_20.0-rc2-1~centos~6_amd64.rpm | cpio -vid './usr/lib/erlang/*' Once I get ./usr/lib/erlang/ I usually renamed to ./opt/ ... $ mv -v ./usr/lib/erlang/ ./opt/esl-erlang_20.0-rc2-1~debian~jessie Then a problem is this erl doesn't run, because it tries to access the hard coded ROOTDIR from /usr/lib/erlang (does not exist) (the "bash -xe" is only to show how does the shell script run, but not necessary) $ bash -xe ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl + ROOTDIR=/usr/lib/erlang + BINDIR=/usr/lib/erlang/erts-9.0/bin + EMU=beam ++ echo ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl ++ sed 's/.*\///' + PROGNAME=erl + export EMU + export ROOTDIR + export BINDIR + export PROGNAME + exec /usr/lib/erlang/erts-9.0/bin/erlexec ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl: line 29: /usr/lib/erlang/erts-9.0/bin/erlexec: No such file or directory So I back it up and make little changes to make it read path from where it's installed: $ \cp -va ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl{,.orig} `./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl' -> `./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl.orig' $ vim ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl Diff is here: $ diff -u ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl{.orig,} --- ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl.orig 2017-06-06 01:57:50.796140791 +0000 +++ ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl 2017-06-06 01:59:15.713988348 +0000 @@ -18,10 +18,12 @@ # # %CopyrightEnd% # -ROOTDIR="/usr/lib/erlang" +# ROOTDIR="/usr/lib/erlang" +ROOTDIR="$(readlink -f ${0%/*}/..)" BINDIR=$ROOTDIR/erts-9.0/bin EMU=beam -PROGNAME=`echo $0 | sed 's/.*\///'` +# PROGNAME=`echo $0 | sed 's/.*\///'` +PROGNAME="${0##*/}" export EMU export ROOTDIR export BINDIR Then it runs: $ bash -xe ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl ++ readlink -f ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/.. + ROOTDIR=/home/username/opt/esl-erlang_20.0-rc2-1~debian~jessie + BINDIR=/home/username/opt/esl-erlang_20.0-rc2-1~debian~jessie/erts-9.0/bin + EMU=beam + PROGNAME=erl + export EMU + export ROOTDIR + export BINDIR + export PROGNAME + exec /home/username/opt/esl-erlang_20.0-rc2-1~debian~jessie/erts-9.0/bin/erlexec Erlang/OTP 20 [RELEASE CANDIDATE 2] [erts-9.0] [source] [64-bit] [smp:24:24] [ds:24:24:10] [async-threads:10] [hipe] [kernel-poll:false] Eshell V9.0 (abort with ^G) 1> I am aware of there is a "Install" script can be used to install itself to another location, but the problem remains: it's still hard coded of new install path: ./opt/esl-erlang_20.0-rc2-1~debian~jessie/Install The problem need to be solved, especially when used with docker's bind mount feature, it can be mounted to a complete different path, I hope the erl can still run without any change: Here it shows my changed erl escript can still run when bind mounted to the container's "/opt/esl-erlang_20.0-rc2-1~debian~jessie" $ docker run -it --rm -v $PWD/opt:/opt:ro ubuntu bash -xe /opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl ++ readlink -f /opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/.. + ROOTDIR=/opt/esl-erlang_20.0-rc2-1~debian~jessie + BINDIR=/opt/esl-erlang_20.0-rc2-1~debian~jessie/erts-9.0/bin + EMU=beam + PROGNAME=erl + export EMU + export ROOTDIR + export BINDIR + export PROGNAME + exec /opt/esl-erlang_20.0-rc2-1~debian~jessie/erts-9.0/bin/erlexec Erlang/OTP 20 [RELEASE CANDIDATE 2] [erts-9.0] [source] [64-bit] [smp:24:24] [ds:24:24:10] [async-threads:10] [hipe] [kernel-poll:false] Eshell V9.0 (abort with ^G) 1> User switch command --> q Or add to PATH: $ docker run -it --rm -v $PWD/opt:/opt:ro -e PATH=/opt/esl-erlang_20.0-rc2-1~debian~jessie/bin:$PATH -e LANG=C.UTF-8 ubuntu erl +pc unicode Erlang/OTP 20 [RELEASE CANDIDATE 2] [erts-9.0] [source] [64-bit] [smp:24:24] [ds:24:24:10] [async-threads:10] [hipe] [kernel-poll:false] Eshell V9.0 (abort with ^G) 1> io:format("~tp~n", [{'hello_??????_??', <<"Hello, ??; ??????"/utf8>>, "Hello, ??; ??????"}]). {'hello_??????_??',<<"Hello, ??; ??????"/utf8>>,"Hello, ??; ??????"} ok 2> User switch command --> q Hopefully this entertains; I can make a PR to https://github.com/erlang/otp if somebody like. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mjtruog@REDACTED Tue Jun 6 05:17:45 2017 From: mjtruog@REDACTED (Michael Truog) Date: Mon, 5 Jun 2017 20:17:45 -0700 Subject: [erlang-questions] How about make the erl to be relocatable ? for multiple erlang versions installed on a same host In-Reply-To: References: Message-ID: <59361ED9.6010300@gmail.com> What I find useful to handle multiple Erlang versions, is to move the installation directory in lib to separate name, and use a symbolic link when switching between versions. The installation is has been setup for awhile in a way where this doesn't break, which is nice. So, PREFIX=="/usr/local" if installing from source, but whatever it is: cd PREFIX/lib/ mv erlang erlang_VERSION ln -s erlang_VERSION erlang In the future, to switch versions, you only need to change the symbolic link target. I don't see a good reason to change the erl executable to handle testing separate versions, because your concerns seem focused on troubles dealing with packages. That would likely be an issue with packages, where the package manager wants to enforce having 1 version of something. If the packages were built to have the version number in the path, then the problem could be avoided (and the solution is similar to the info above), but it would remain a package problem. On 06/05/2017 07:38 PM, derek wrote: > > the default erl is a shell script, like this: > > #!/bin/sh > [...] > # %CopyrightEnd% > # > ROOTDIR="/usr/lib/erlang" > ... > > > Where the ROOTDIR is set to a hard code string at installation time, and it makes the erl script not relocatable, > > sometimes we want to install multiple erlang versions for testing features, like this following is my way to test install esl packaged erlang-20.0-rc2, all just extract "install" to my $HOME/opt/... without sysadmin permission: > > # download the deb or rpm package > $ wget -P ./Downloads -m https://packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_20.0-rc2-1~debian~jessie_amd64.deb > > # the deb is an ar format, you can use standard ar/tar tools to extract to local ./usr/lib/erlang/ > $ ar p ./Downloads/packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_20.0-rc2-1~debian~jessie_amd64.deb data.tar.xz | tar --xz -xvv ./usr/lib/erlang/ > > # or to extract the rpm, it is cpio format: > # rpm2cpio ./Downloads/packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_20.0-rc2-1~centos~6_amd64.rpm | cpio -vid './usr/lib/erlang/*' > > Once I get ./usr/lib/erlang/ I usually renamed to ./opt/ ... > > $ mv -v ./usr/lib/erlang/ ./opt/esl-erlang_20.0-rc2-1~debian~jessie > > Then a problem is this erl doesn't run, because it tries to access the hard coded ROOTDIR from /usr/lib/erlang (does not exist) > > (the "bash -xe" is only to show how does the shell script run, but not necessary) > > $ bash -xe ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl > + ROOTDIR=/usr/lib/erlang > + BINDIR=/usr/lib/erlang/erts-9.0/bin > + EMU=beam > ++ echo ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl > ++ sed 's/.*\///' > + PROGNAME=erl > + export EMU > + export ROOTDIR > + export BINDIR > + export PROGNAME > + exec /usr/lib/erlang/erts-9.0/bin/erlexec > ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl: line 29: /usr/lib/erlang/erts-9.0/bin/erlexec: No such file or directory > > So I back it up and make little changes to make it read path from where it's installed: > > $ \cp -va ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl{,.orig} > `./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl' -> `./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl.orig' > > $ vim ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl > > Diff is here: > > $ diff -u ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl{.orig,} > --- ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl.orig2017-06-06 01:57:50.796140791 +0000 > +++ ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl2017-06-06 01:59:15.713988348 +0000 > @@ -18,10 +18,12 @@ > # > # %CopyrightEnd% > # > -ROOTDIR="/usr/lib/erlang" > +# ROOTDIR="/usr/lib/erlang" > +ROOTDIR="$(readlink -f ${0%/*}/..)" > BINDIR=$ROOTDIR/erts-9.0/bin > EMU=beam > -PROGNAME=`echo $0 | sed 's/.*\///'` > +# PROGNAME=`echo $0 | sed 's/.*\///'` > +PROGNAME="${0##*/}" > export EMU > export ROOTDIR > export BINDIR > > Then it runs: > > $ bash -xe ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl > ++ readlink -f ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/.. > + ROOTDIR=/home/username/opt/esl-erlang_20.0-rc2-1~debian~jessie > + BINDIR=/home/username/opt/esl-erlang_20.0-rc2-1~debian~jessie/erts-9.0/bin > + EMU=beam > + PROGNAME=erl > + export EMU > + export ROOTDIR > + export BINDIR > + export PROGNAME > + exec /home/username/opt/esl-erlang_20.0-rc2-1~debian~jessie/erts-9.0/bin/erlexec > Erlang/OTP 20 [RELEASE CANDIDATE 2] [erts-9.0] [source] [64-bit] [smp:24:24] [ds:24:24:10] [async-threads:10] [hipe] [kernel-poll:false] > > Eshell V9.0 (abort with ^G) > 1> > > I am aware of there is a "Install" script can be used to install itself to another location, but the problem remains: it's still hard coded of new install path: > ./opt/esl-erlang_20.0-rc2-1~debian~jessie/Install > > > The problem need to be solved, especially when used with docker's bind mount feature, it can be mounted to a complete different path, I hope the erl can still run without any change: > > Here it shows my changed erl escript can still run when bind mounted to the container's "/opt/esl-erlang_20.0-rc2-1~debian~jessie" > > $ docker run -it --rm -v $PWD/opt:/opt:ro ubuntu bash -xe /opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl > ++ readlink -f /opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/.. > + ROOTDIR=/opt/esl-erlang_20.0-rc2-1~debian~jessie > + BINDIR=/opt/esl-erlang_20.0-rc2-1~debian~jessie/erts-9.0/bin > + EMU=beam > + PROGNAME=erl > + export EMU > + export ROOTDIR > + export BINDIR > + export PROGNAME > + exec /opt/esl-erlang_20.0-rc2-1~debian~jessie/erts-9.0/bin/erlexec > Erlang/OTP 20 [RELEASE CANDIDATE 2] [erts-9.0] [source] [64-bit] [smp:24:24] [ds:24:24:10] [async-threads:10] [hipe] [kernel-poll:false] > > Eshell V9.0 (abort with ^G) > 1> > User switch command > --> q > > Or add to PATH: > > $ docker run -it --rm -v $PWD/opt:/opt:ro -e PATH=/opt/esl-erlang_20.0-rc2-1~debian~jessie/bin:$PATH -e LANG=C.UTF-8 ubuntu erl +pc unicode > Erlang/OTP 20 [RELEASE CANDIDATE 2] [erts-9.0] [source] [64-bit] [smp:24:24] [ds:24:24:10] [async-threads:10] [hipe] [kernel-poll:false] > > Eshell V9.0 (abort with ^G) > 1> io:format("~tp~n", [{'hello_??????_??', <<"Hello, ??; ??????"/utf8>>, "Hello, ??; ??????"}]). > {'hello_??????_??',<<"Hello, ??; ??????"/utf8>>,"Hello, ??; ??????"} > ok > 2> > User switch command > --> q > > > Hopefully this entertains; I can make a PR to https://github.com/erlang/otp if somebody like. > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Tue Jun 6 05:37:43 2017 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 6 Jun 2017 15:37:43 +1200 Subject: [erlang-questions] -protocol declartion idea, worth an EEP? In-Reply-To: <59360B83.6030306@gmail.com> References: <614871496660555@web6j.yandex.ru> <7d307fdf3513eb81317382908e150986.squirrel@chasm.otago.ac.nz> <5935966C.20403@gmail.com> <88511322-6CAF-40A6-A4B2-6A913E5F2BD7@cs.otago.ac.nz> <59360B83.6030306@gmail.com> Message-ID: > On 6/06/2017, at 1:55 PM, Michael Truog wrote: > >> > It would be nice to have finer granularity than just 'pure' or 'impure', though it seems > very easy to make this purity concept complex enough that people don't use it. Fair comment. I guess my point is not clear. Here it is explicitly: if someone calls an Erlang function "pure", I don't know what they mean. As a specific example, I don't know whether X = f(A), g(), Y = f(A) guarantees that X =:= Y. Why might it not? Because while f/1 might not *change* anything, it might *read* mutable data which g/0 might change. > I would assume most analysis of normal source code wouldn't be able to say > anything too useful about termination (due to normal complexity), but I don't > know much about this. The Mercury people added termination analysis to their compiler and were able to automatically show termination for about 70% of the procedures they checked. That relied on mode and type analysis, but Erlang doesn't have modes. The one difference in Erlang of course is that people deliberately write functions (the dispatch loops of processes) which aren't *meant* to terminate (except when told to by a message). [would be nice to have dialyzer always part of compilation] agreed. [simple purity hierarchy] agreed. [simple type system desirable] as long as it does the job, agreed. The first requirement of any type system is that programmers should understand it well enough to use it effectively. From hanzer@REDACTED Mon Jun 5 23:22:18 2017 From: hanzer@REDACTED (Adam Jensen) Date: Mon, 5 Jun 2017 17:22:18 -0400 Subject: [erlang-questions] Erlang/OTP 20.0-rc2 is available for testing In-Reply-To: References: Message-ID: <20170605172218.25788c54ee6bb37745d76bb8@riseup.net> Hi, I am attempting to build Erlang/OTP 20.0-rc2 with clang/llvm Release 4.0 on Scientific Linux 7.3 (a RHEL clone). "$ERL_TOP/HOWTO/INSTALL.md" seems to suggest that compiling with clang is supported/possible but "configure" dies fairly early [for me]. [hanzer@REDACTED otp]$ ./configure --prefix=$HOME/.local/otp-20.0-rc2 Ignoring the --cache-file argument since it can cause the system to be erroneously configured Disabling caching checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking for gcc... /home/hanzer/.local/llvm/bin/clang checking whether the C compiler works... no configure: error: in `/home/hanzer/build/otp': configure: error: C compiler cannot create executables See `config.log' for more details [hanzer@REDACTED otp]$ cat config.log | nc termbin.com 9999 http://termbin.com/74uzy If anyone wants to reproduce this, the entire process so far is: ---- sudo rpm -Uvh http://ftp.scientificlinux.org/linux/scientific/7x/external_products/softwarecollections/yum-conf-softwarecollections-2.0-1.el7.noarch.rpm # See scl enable {devtoolset-6,python27} bash mkdir build export BASE=$HOME/build cd $BASE svn co http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_400/final/ llvm_Rel400 cd $BASE/llvm_Rel400/tools svn co http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_400/final/ clang svn co http://llvm.org/svn/llvm-project/lld/tags/RELEASE_400/final/ lld svn co http://llvm.org/svn/llvm-project/polly/tags/RELEASE_400/final/ polly cd $BASE/llvm_Rel400/tools/clang/tools svn co http://llvm.org/svn/llvm-project/clang-tools-extra/tags/RELEASE_400/final/ extra cd $BASE/llvm_Rel400/projects svn co http://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_400/final/ compiler-rt svn co http://llvm.org/svn/llvm-project/openmp/tags/RELEASE_400/final/ openmp svn co http://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_400/final/ libcxx svn co http://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_400/final/ libcxxabi svn co http://llvm.org/svn/llvm-project/test-suite/tags/RELEASE_400/final/ test-suite mkdir $BASE/build_llvm cd $BASE/build_llvm cmake3 -G "Unix Makefiles" \ -C $BASE/llvm_Rel400/tools/clang/cmake/caches/PGO-stage2-instrumented.cmake \ -DLLVM_TARGETS_TO_BUILD=all \ -DLLVM_BUILD_TOOLS=on \ -DLLVM_BUILD_EXAMPLES=on \ -DLLVM_BUILD_TESTS=on \ -DCMAKE_INSTALL_PREFIX=$HOME/.local/llvm \ -DCMAKE_BUILD_TYPE=Release $BASE/llvm_Rel400 \ $BASE/llvm_Rel400 make -j4 2>&1 | tee build.log make -j4 check-llvm 2>&1 | tee check-llvm.log make -j4 check-clang 2>&1 | tee check-clang.log make install export PATH=$PATH:$HOME/.local/llvm/bin export LANG=C export CC=clang export CXX=clang++ export CPP=clang-cpp export LD=lld export RANLIB=llvm-ranlib export AR=llvm-ar export GETCONF=llvm-config export CFLAGS="-O4" export CXXFLAGS="-O4" export CPPFLAGS="-I/usr/include -I /usr/local/include -I$HOME/.local/llvm/include" export LDFLAGS="-L/usr/lib -L/usr/lib64 -L/usr/local/lib -L/usr/local/lib64 -L$HOME/.local/llvm/lib" export LIBS=/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64:$HOME/.local/llvm/lib/ cd $BASE git clone https://github.com/erlang/otp.git cd $BASE/otp git checkout OTP-20.0-rc2 export ERL_TOP=`pwd` ./otp_build autoconf export MAKEFLAGS=-j4 ./configure --prefix=$HOME/.local/otp-20.0-rc2 make 2>&1 | tee build.log make release_tests cd release/tests/test_server $ERL_TOP/bin/erl -s ts install -s ts smoke_test batch -s init stop make install cd $ERL_TOP export PATH=$ERL_TOP/bin:$PATH make docs make install-docs From lankeanandrao@REDACTED Tue Jun 6 08:15:11 2017 From: lankeanandrao@REDACTED (lankeanandrao) Date: Tue, 6 Jun 2017 11:45:11 +0530 Subject: [erlang-questions] Where the Erlang node tick response will get stored ?. Message-ID: Hi all, I am running my application in a distributed way, with one server node and multiple client nodes and all nodes are started in visible mode. Here I want to know when all the client nodes are connected to the server node, the client nodes will send the tick message to server node and as same as the server will send tick message to all client nodes, here all the client nodes send tick response to the server node. So here my question is 1. Where the tick response came from multiple client nodes is getting stored? 2. If it is getting stored in kernel buffer, what is the buffer size and how to find that? 3. How the tick response's of multiple nodes is getting served by the Erlang kernel? Note: The net tick time is set to 5 Second in all the nodes. Thanks & Regards, Anand Rao L From freza@REDACTED Tue Jun 6 10:43:17 2017 From: freza@REDACTED (Jachym Holecek) Date: Tue, 6 Jun 2017 04:43:17 -0400 Subject: [erlang-questions] Erlang/OTP 20.0-rc2 is available for testing In-Reply-To: <20170605172218.25788c54ee6bb37745d76bb8@riseup.net> References: <20170605172218.25788c54ee6bb37745d76bb8@riseup.net> Message-ID: <20170606084316.GA29170@circlewave.net> Hi, # Adam Jensen 2017-06-05: > [hanzer@REDACTED otp]$ cat config.log | nc termbin.com 9999 > http://termbin.com/74uzy The failing command was: configure:2617: /home/hanzer/.local/llvm/bin/clang -O4 -I/home/hanzer/.local/llvm/include -L/home/hanzer/.local/llvm/lib conftest.c /usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64:/home/hanzer/.local/llvm/lib/ >&5 clang-4.0: error: no such file or directory: '/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64:/home/hanzer/.local/llvm/lib/' clang-4.0: warning: -O4 is equivalent to -O3 [-Wdeprecated] Meaning the problem most likely is: > If anyone wants to reproduce this, the entire process so far is: > > ---- > > [...] > > export PATH=$PATH:$HOME/.local/llvm/bin > > export LANG=C > export CC=clang > export CXX=clang++ > export CPP=clang-cpp > export LD=lld > export RANLIB=llvm-ranlib > export AR=llvm-ar > export GETCONF=llvm-config > export CFLAGS="-O4" > export CXXFLAGS="-O4" > export CPPFLAGS="-I/usr/include -I /usr/local/include -I$HOME/.local/llvm/include" > export LDFLAGS="-L/usr/lib -L/usr/lib64 -L/usr/local/lib -L/usr/local/lib64 -L$HOME/.local/llvm/lib" > export LIBS=/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64:$HOME/.local/llvm/lib/ The LIBS line above -- IIRC that's supposed to hold list of additional libraries to link against, in the form of readily digestable linker arguments. Instead you're giving it an unintelligible colon-separated thing. So keeping LIBS empty should sort it out. BR, -- Jachym From attila.r.nohl@REDACTED Tue Jun 6 10:58:26 2017 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Tue, 6 Jun 2017 10:58:26 +0200 Subject: [erlang-questions] How about make the erl to be relocatable ? for multiple erlang versions installed on a same host In-Reply-To: References: Message-ID: Hello! I'm not sure if I totally understand your problem, but I see two solutions: 1, use kerl (https://github.com/kerl/kerl) to manage your installations. Download, build and install all required Erlang versions, then simply activate the one you need to use. 2, create a Docker image for each required Erlang version and install your software inside that image (possibly using bind mount). 2017-06-06 4:38 GMT+02:00 derek : > > the default erl is a shell script, like this: > > #!/bin/sh > [...] > # %CopyrightEnd% > # > ROOTDIR="/usr/lib/erlang" > ... > > > Where the ROOTDIR is set to a hard code string at installation time, and it > makes the erl script not relocatable, > > sometimes we want to install multiple erlang versions for testing features, > like this following is my way to test install esl packaged erlang-20.0-rc2, > all just extract "install" to my $HOME/opt/... without sysadmin permission: > > # download the deb or rpm package > $ wget -P ./Downloads -m > https://packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_20.0-rc2-1~debian~jessie_amd64.deb > > # the deb is an ar format, you can use standard ar/tar tools to extract to > local ./usr/lib/erlang/ > $ ar p > ./Downloads/packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_20.0-rc2-1~debian~jessie_amd64.deb > data.tar.xz | tar --xz -xvv ./usr/lib/erlang/ > > # or to extract the rpm, it is cpio format: > # rpm2cpio > ./Downloads/packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_20.0-rc2-1~centos~6_amd64.rpm > | cpio -vid './usr/lib/erlang/*' > > Once I get ./usr/lib/erlang/ I usually renamed to ./opt/ ... > > $ mv -v ./usr/lib/erlang/ ./opt/esl-erlang_20.0-rc2-1~debian~jessie > > Then a problem is this erl doesn't run, because it tries to access the hard > coded ROOTDIR from /usr/lib/erlang (does not exist) > > (the "bash -xe" is only to show how does the shell script run, but not > necessary) > > $ bash -xe ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl > + ROOTDIR=/usr/lib/erlang > + BINDIR=/usr/lib/erlang/erts-9.0/bin > + EMU=beam > ++ echo ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl > ++ sed 's/.*\///' > + PROGNAME=erl > + export EMU > + export ROOTDIR > + export BINDIR > + export PROGNAME > + exec /usr/lib/erlang/erts-9.0/bin/erlexec > ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl: line 29: > /usr/lib/erlang/erts-9.0/bin/erlexec: No such file or directory > > So I back it up and make little changes to make it read path from where it's > installed: > > $ \cp -va ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl{,.orig} > `./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl' -> > `./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl.orig' > > $ vim ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl > > Diff is here: > > $ diff -u ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl{.orig,} > --- ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl.orig 2017-06-06 > 01:57:50.796140791 +0000 > +++ ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl 2017-06-06 > 01:59:15.713988348 +0000 > @@ -18,10 +18,12 @@ > # > # %CopyrightEnd% > # > -ROOTDIR="/usr/lib/erlang" > +# ROOTDIR="/usr/lib/erlang" > +ROOTDIR="$(readlink -f ${0%/*}/..)" > BINDIR=$ROOTDIR/erts-9.0/bin > EMU=beam > -PROGNAME=`echo $0 | sed 's/.*\///'` > +# PROGNAME=`echo $0 | sed 's/.*\///'` > +PROGNAME="${0##*/}" > export EMU > export ROOTDIR > export BINDIR > > Then it runs: > > $ bash -xe ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl > ++ readlink -f ./opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/.. > + ROOTDIR=/home/username/opt/esl-erlang_20.0-rc2-1~debian~jessie > + BINDIR=/home/username/opt/esl-erlang_20.0-rc2-1~debian~jessie/erts-9.0/bin > + EMU=beam > + PROGNAME=erl > + export EMU > + export ROOTDIR > + export BINDIR > + export PROGNAME > + exec > /home/username/opt/esl-erlang_20.0-rc2-1~debian~jessie/erts-9.0/bin/erlexec > Erlang/OTP 20 [RELEASE CANDIDATE 2] [erts-9.0] [source] [64-bit] [smp:24:24] > [ds:24:24:10] [async-threads:10] [hipe] [kernel-poll:false] > > Eshell V9.0 (abort with ^G) > 1> > > I am aware of there is a "Install" script can be used to install itself to > another location, but the problem remains: it's still hard coded of new > install path: > ./opt/esl-erlang_20.0-rc2-1~debian~jessie/Install > > > The problem need to be solved, especially when used with docker's bind mount > feature, it can be mounted to a complete different path, I hope the erl can > still run without any change: > > Here it shows my changed erl escript can still run when bind mounted to the > container's "/opt/esl-erlang_20.0-rc2-1~debian~jessie" > > $ docker run -it --rm -v $PWD/opt:/opt:ro ubuntu bash -xe > /opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/erl > ++ readlink -f /opt/esl-erlang_20.0-rc2-1~debian~jessie/bin/.. > + ROOTDIR=/opt/esl-erlang_20.0-rc2-1~debian~jessie > + BINDIR=/opt/esl-erlang_20.0-rc2-1~debian~jessie/erts-9.0/bin > + EMU=beam > + PROGNAME=erl > + export EMU > + export ROOTDIR > + export BINDIR > + export PROGNAME > + exec /opt/esl-erlang_20.0-rc2-1~debian~jessie/erts-9.0/bin/erlexec > Erlang/OTP 20 [RELEASE CANDIDATE 2] [erts-9.0] [source] [64-bit] [smp:24:24] > [ds:24:24:10] [async-threads:10] [hipe] [kernel-poll:false] > > Eshell V9.0 (abort with ^G) > 1> > User switch command > --> q > > Or add to PATH: > > $ docker run -it --rm -v $PWD/opt:/opt:ro -e > PATH=/opt/esl-erlang_20.0-rc2-1~debian~jessie/bin:$PATH -e LANG=C.UTF-8 > ubuntu erl +pc unicode > Erlang/OTP 20 [RELEASE CANDIDATE 2] [erts-9.0] [source] [64-bit] [smp:24:24] > [ds:24:24:10] [async-threads:10] [hipe] [kernel-poll:false] > > Eshell V9.0 (abort with ^G) > 1> io:format("~tp~n", [{'hello_??????_??', <<"Hello, ??; ??????"/utf8>>, > "Hello, ??; ??????"}]). > {'hello_??????_??',<<"Hello, ??; ??????"/utf8>>,"Hello, ??; ??????"} > ok > 2> > User switch command > --> q > > > Hopefully this entertains; I can make a PR to https://github.com/erlang/otp > if somebody like. > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From S.J.Thompson@REDACTED Tue Jun 6 15:14:59 2017 From: S.J.Thompson@REDACTED (Simon Thompson) Date: Tue, 6 Jun 2017 14:14:59 +0100 Subject: [erlang-questions] Erlang Functional programming MOOC running again Message-ID: Missed it 1st time round? The Erlang functional #programming MOOC running on FutureLearn from the 19th of June. https://t.co/Epp1hMqBlP The concurrency MOOC will be coming around again too, in a couple of months time. Simon #FLerlangfunc Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson@REDACTED | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt From ulf@REDACTED Tue Jun 6 17:46:38 2017 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 6 Jun 2017 16:46:38 +0100 Subject: [erlang-questions] Erlang/OTP 20.0-rc2 is available for testing In-Reply-To: References: Message-ID: I like the ets:select_replace/2 function. Of course, in the first case where I thought it might be useful, I ended up wishing for an extended version. ;-) https://github.com/uwiger/gproc/blob/master/src/gproc_pool.erl#L465 The 'claim' operation performs a chunked select of workers in a given pool, and for each chunk of workers, tries to claim one by incrementing a counter value - if the value went from 0 to 1, the claim succeeded. A select_replace() function could handle the atomic claim operation, but what I would want to do is to limit it to only one replace and to return the resulting object - not just the count. This could potentially be supported by a select_replace/3 function. As far as I can recall, gproc_pool is competitive in terms of performance. Such an extended select_replace() function _should_ give a significant speedup, especially in the case of large busy pools (which possibly haven't been benchmarked.) BR, Ulf W 2017-05-31 19:16 GMT+01:00 Kenneth Lundin : > OTP 20 Release Candidate 2 > > This is the second of two release candidates before the OTP 20 release. > [...] > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Tue Jun 6 18:10:52 2017 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 6 Jun 2017 17:10:52 +0100 Subject: [erlang-questions] Where the Erlang node tick response will get stored ?. In-Reply-To: References: Message-ID: The tick message is received in dist_util:con_loop/2: https://github.com/erlang/otp/blob/master/lib/kernel/src/dist_util.erl#L486 There is a con_loop for each 1:1 node connection, and the tick state simply keeps track of the number of tick intervals for which no data has been received on the connection (note that at least ticks should have been received.) Based on experience, with such a short ticktime, you might want to pay attention to the +zdbbl setting for erl (dist_buf_busy_limit). If it is set too low, there is a risk that the ticker process is suspended and the connection times out. I believe this is less of a problem than it used to be, when the distribution buffer busy limit was much lower (and not configurable.) BR, Ulf W 2017-06-06 7:15 GMT+01:00 lankeanandrao : > Hi all, > > I am running my application in a distributed way, with one server > node and multiple client nodes and all nodes are started in visible mode. > Here I want to know when all the client nodes are connected to the server > node, the client nodes will send the tick message to server node and as > same as the server will send tick message to all client nodes, here all the > client nodes send tick response to the server node. So here my question is > > 1. Where the tick response came from multiple client nodes is getting > stored? > > 2. If it is getting stored in kernel buffer, what is the buffer size > and how to find that? > > 3. How the tick response's of multiple nodes is getting served by the > Erlang kernel? > > Note: The net tick time is set to 5 Second in all the nodes. > > Thanks & Regards, > Anand Rao L > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Tue Jun 6 18:16:00 2017 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 6 Jun 2017 17:16:00 +0100 Subject: [erlang-questions] gproc_dist finicky about latecomers In-Reply-To: References: Message-ID: Just as an update, I'm (very slowly) finishing a rewrite of gproc to add some extension capability. After that, I thought I'd take a look at making the locks_leader the default. However, there is a reported issue with locks_leader that I'd have to take a look at first ( https://github.com/uwiger/locks/issues/30). I apologize for having paid so little attention to this lately. BR, Ulf W 2017-06-03 7:28 GMT+01:00 Oliver Korpilla : > Hello. > > I use gproc/gproc_dist with gen_leader_revival. I have the gproc_dist all > application option on and do use global names. > > It works fine if and only if I connect nodes first and then start gproc > afterwards for additional nodes joining the cluster. > > If I start gproc before connecting nodes, every node insists on being the > leader (I queried through the gproc API for each node) and they stick with > their opinion. global aggregated counters in turn do not work, failing my > application's simple loadbalancing. > > I ran into this problem twice: > > * When originally writing my application startup. > * When redoing the startup and forgetting why I started gproc at a > specific time. > > I hoped to document this somehow. > > Do people observe the same with locks_leader? > > Regards, > Oliver > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Oliver.Korpilla@REDACTED Tue Jun 6 18:20:49 2017 From: Oliver.Korpilla@REDACTED (Oliver Korpilla) Date: Tue, 6 Jun 2017 18:20:49 +0200 Subject: [erlang-questions] gproc_dist finicky about latecomers In-Reply-To: References: Message-ID: Hello, Ulf. First of all: Thanks for gproc! It is very central to what I'm doing, so I'm only documenting a current limitation, I'm _not_ complaining. :) Looking forward to future improvements. :) Cheers, Oliver? ? Gesendet:?Dienstag, 06. Juni 2017 um 18:16 Uhr Von:?"Ulf Wiger" An:?"Oliver Korpilla" Cc:?erlang-questions Betreff:?Re: [erlang-questions] gproc_dist finicky about latecomers Just as an update, I'm (very slowly) finishing a rewrite of gproc to add some extension capability. After that, I thought I'd take a look at making the locks_leader the default. However, there is a reported issue with locks_leader that I'd have to take a look at first (https://github.com/uwiger/locks/issues/30). I apologize for having paid so little attention to this lately. ? BR, Ulf W ? 2017-06-03 7:28 GMT+01:00 Oliver Korpilla :Hello. I use gproc/gproc_dist with gen_leader_revival. I have the gproc_dist all application option on and do use global names. It works fine if and only if I connect nodes first and then start gproc afterwards for additional nodes joining the cluster. If I start gproc before connecting nodes, every node insists on being the leader (I queried through the gproc API for each node) and they stick with their opinion. global aggregated counters in turn do not work, failing my application's simple loadbalancing. I ran into this problem twice: * When originally writing my application startup. * When redoing the startup and forgetting why I started gproc at a specific time. I hoped to document this somehow. Do people observe the same with locks_leader? Regards, Oliver _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED[mailto:erlang-questions@REDACTED] http://erlang.org/mailman/listinfo/erlang-questions From ulf@REDACTED Tue Jun 6 18:50:04 2017 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 6 Jun 2017 17:50:04 +0100 Subject: [erlang-questions] wildcarded resource counters in Gproc In-Reply-To: <8A3DC2E3-4584-4949-999E-A37E42399674@gmail.com> References: <8A3DC2E3-4584-4949-999E-A37E42399674@gmail.com> Message-ID: That wasn't what the catch was for. Rather, it optimistically tries to update an aggregated counter that may or may not be there. It should NOT be created if it doesn't exist. The change that Garrett didn't like was that it optimistically tried to update TWO different aggregated counters instead of just one. BR, Ulf W 2017-01-21 15:48 GMT+00:00 Anthony Ramine : > Out of curiosity, shouldn't you use ets:update_counter/4? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Tue Jun 6 18:51:52 2017 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 6 Jun 2017 17:51:52 +0100 Subject: [erlang-questions] Mnesia Version 4.14 - Documentation Issue In-Reply-To: References: Message-ID: Not documentation exactly, but at least there are two backend plugins available from Klarna: https://github.com/klarna/mnesia_eleveldb https://github.com/klarna/mnesia_pg The former is actually used in anger, whereas the Postgres backend is just experimental and incomplete. BR, Ulf W 2017-01-05 14:24 GMT+00:00 Walter Weinmann : > In this version, an external backend plugin api was announced, but it > seems that even in OTP 19.2 still the documentation is missing - or am I > wrong here? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hanzer@REDACTED Wed Jun 7 01:24:39 2017 From: hanzer@REDACTED (Adam Jensen) Date: Tue, 6 Jun 2017 19:24:39 -0400 Subject: [erlang-questions] Erlang/OTP 20.0-rc2 is available for testing In-Reply-To: <20170605172218.25788c54ee6bb37745d76bb8@riseup.net> References: <20170605172218.25788c54ee6bb37745d76bb8@riseup.net> Message-ID: <20170606192439.5d2f97a284d737c14db39c74@riseup.net> On Mon, 5 Jun 2017 17:22:18 -0400 Adam Jensen wrote: > Hi, > > I am attempting to build Erlang/OTP 20.0-rc2 with clang/llvm Release 4.0 on Scientific Linux 7.3 (a RHEL clone). "$ERL_TOP/HOWTO/INSTALL.md" seems to suggest that compiling with clang is supported/possible but "configure" dies fairly early [for me]. > [snip] > export LIBS=/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64:$HOME/.local/llvm/lib/ Someone described the problem (outside of the mailing list) which was my misuse/misunderstanding of the "LIBS" environment variable. When "LIBS" is left unset, the compilation completes and passes the tests as expected. Thanks! From lankeanandrao@REDACTED Wed Jun 7 09:17:22 2017 From: lankeanandrao@REDACTED (lankeanandrao) Date: Wed, 7 Jun 2017 12:47:22 +0530 Subject: [erlang-questions] Where the Erlang node tick response will get stored ?. In-Reply-To: References: Message-ID: <6bbb28df-7d9d-2511-33c5-6afc6c3c849e@utl.in> Hi Ulf, Here you are saying that there will be separate con_loop for 1:1 node connection, is it means that how many client nodes are connected to server node those many instances of con_loop will run in server. Example : server@REDACTED and multiple clients client1@REDACTED, client2@REDACTED ... ClientN@REDACTED all are in cluster and all client nodes are connected to server, now in server to connect server@REDACTED to client1@REDACTED - 1st con_loop server@REDACTED to client2@REDACTED - 2nd con_loop server@REDACTED to clientN@REDACTED - nth con_loop multiple con_loops will run in server for connecting to each client node. Thanks & Regards, Anand Rao L On Tuesday 06 June 2017 09:40 PM, Ulf Wiger wrote: > The tick message is received in dist_util:con_loop/2: > > https://github.com/erlang/otp/blob/master/lib/kernel/src/dist_util.erl#L486 > > There is a con_loop for each 1:1 node connection, and the tick state > simply keeps track of the number of tick intervals for which no data > has been received on the connection (note that at least ticks should > have been received.) > > Based on experience, with such a short ticktime, you might want to pay > attention to the +zdbbl setting for erl (dist_buf_busy_limit). If it > is set too low, there is a risk that the ticker process is suspended > and the connection times out. I believe this is less of a problem than > it used to be, when the distribution buffer busy limit was much lower > (and not configurable.) > > BR, > Ulf W > > 2017-06-06 7:15 GMT+01:00 lankeanandrao >: > > Hi all, > > I am running my application in a distributed way, with one > server node and multiple client nodes and all nodes are started in > visible mode. Here I want to know when all the client nodes are > connected to the server node, the client nodes will send the tick > message to server node and as same as the server will send tick > message to all client nodes, here all the client nodes send tick > response to the server node. So here my question is > > 1. Where the tick response came from multiple client nodes is > getting stored? > > 2. If it is getting stored in kernel buffer, what is the buffer > size and how to find that? > > 3. How the tick response's of multiple nodes is getting served > by the Erlang kernel? > > Note: The net tick time is set to 5 Second in all the nodes. > > Thanks & Regards, > Anand Rao L > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From S.J.Thompson@REDACTED Wed Jun 7 11:57:39 2017 From: S.J.Thompson@REDACTED (Simon Thompson) Date: Wed, 7 Jun 2017 10:57:39 +0100 Subject: [erlang-questions] Call for participation: Trends in Functional Programming in Education 2015 (in association with TFP 2017) Message-ID: Trends in Functional Programming in Education, 2017 Call for participation https://www.cs.kent.ac.uk/people/staff/sjt/TFPIE2017/ Programme timings https://www.cs.kent.ac.uk/people/staff/sjt/TFPIE2017/TFPIE_2017/Programme.html The sixth workshop on Trends in Functional Programming in Education, 2017, which is to be held on the Canterbury campus of the University of Kent on Thursday, 22 June. Registration is included with that for TFP 2017, 19?21 June. Morning: functional programming and online learning A particular topic of this year's TFPIE will be MOOCs and other online learning and we've managed to gather people from most of the current MOOCs in functional programming to come to an informal symposium. Keynote: Heather Miller of EFPL and Northeastern University will begin the symposium by giving a keynote on this topic. Heather works on and around the Scala programming language and is Executive Director of the Scala Center. This will be followed by a presentation from Yann R?gis-Gianas and Benjamin Canou about the MOOC on OCaml, and a round table discussion including Heather, the OCaml MOOC team, Jeremy Singer (Haskell), and Simon Thompson (Erlang). The morning will conclude with two regular presentations: - Stephen Adams. Teaching Erlang through the Internet: An Experience Report - Jeremy Singer and Blair Archibald. Functional Baby Talk: Analysis of Code Fragments from Novice Haskell Programmers Afternoon: TFPIE regular programme The afternoon will begin with a best lecture: Colin Runciman (York) on the topic of Purely Functional Queues The meeting will then have four regular presentations: - Marco T. Morazan. Vector Programming Using Structural Recursion - Curtis d'Alves, Tanya Bouman, Christopher Schankula, Jenell Hogg, Levin Noronha, Emily Horsman, Rumsha Siddiqui and Christopher K. Anand. Using Elm to Introduce Algebraic Thinking to K-8 Students - Hans-Wolfgang Loidl, Phil Barker and Sanusi Usman. Enhancing the Learning Experience on Programming-focused Courses via Electronic Assessment Tools (Extended Abstract) - Juan Carlos Saenz-Carrasco and Mike Stannett. Overcoming Non Distributivity: A Case Study in Functional Programming The meeting will conclude with a lightning talks session for attendees and others to give short talks about work in progress or projects that they would like to get started, followed by a plenary discussion on future directions for the community and the workshop. Programme committee Dr Laura Castro, University of A Coru?a Prof Ralf L?mmel, University of Koblenz-Landau Dr Elena Machkasova, University of Minnesota, Morris Prof Michel Mauny, Inria, Paris Dr Jeremy Singer, University of Glasgow Prof Simon Thompson, University of Kent (chair) Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson@REDACTED | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt From ulf@REDACTED Wed Jun 7 16:02:41 2017 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 7 Jun 2017 15:02:41 +0100 Subject: [erlang-questions] BEAM micro-optimization: term comparison (> 0) versus pattern-matching In-Reply-To: <22771.29808.891451.257658@gargle.gargle.HOWL> References: <22770.25282.691552.422821@gargle.gargle.HOWL> <22771.29808.891451.257658@gargle.gargle.HOWL> Message-ID: 2017-04-16 14:41 GMT+01:00 Mikael Pettersson : > Mikael Pettersson writes: > ... > f is option 1 above, g is option 2. h is g with added is_integer/1 check. > i is f but with integer tags not atoms. j wraps the two cases as [X|[]] > and {Y}. > k is j but with Y left unwrapped. l is j but swaps the order and checks > with > is_integer/1 before matching on [Y|_]. > Just a note: [X|[]] and [X] result in identical abstract code. BR, Ulf W -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Wed Jun 7 17:43:48 2017 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 7 Jun 2017 16:43:48 +0100 Subject: [erlang-questions] Where the Erlang node tick response will get stored ?. In-Reply-To: <6bbb28df-7d9d-2511-33c5-6afc6c3c849e@utl.in> References: <6bbb28df-7d9d-2511-33c5-6afc6c3c849e@utl.in> Message-ID: Yes? This is in line with Erlang's design philosophy, and the processes are small. This is from a node I just fired up: Eshell V7.3.1 (abort with ^G) (a@REDACTED)1> net:ping('b@REDACTED'). pong (a@REDACTED)2> i(). Pid Initial Call Heap Reds Msgs Registered Current Function Stack ... <0.43.0> inet_tcp_dist:do_setup/7 376 1043 0 dist_util:con_loop/9 11 (a@REDACTED)3> i(0,43,0). [{current_function,{dist_util,con_loop,9}}, ..., {total_heap_size,752}, {heap_size,376}, {stack_size,11}, {reductions,1085}, ...] (Sizes are in heap words - 8 bytes on my machine, so ca 6K bytes total heap size.) You can easily verify that connecting additional nodes will cause additional con_loop() processes to be started, one per connected node. The size of these processes can be expected to stay pretty much constant. BR, Ulf W 2017-06-07 8:17 GMT+01:00 lankeanandrao : > Hi Ulf, > Here you are saying that there will be separate con_loop for 1:1 node > connection, is it means that how many client nodes are connected to server > node those many instances of con_loop will run in server. > > Example : > server@REDACTED and multiple clients client1@REDACTED, client2@REDACTED ... > ClientN@REDACTED all are in cluster and all client nodes are connected to > server, now in server to connect > server@REDACTED to client1@REDACTED - 1st con_loop > server@REDACTED to client2@REDACTED - 2nd con_loop > server@REDACTED to clientN@REDACTED - nth con_loop > multiple con_loops will run in server for connecting to each client > node. > > Thanks & Regards, > Anand Rao L > > On Tuesday 06 June 2017 09:40 PM, Ulf Wiger wrote: > > The tick message is received in dist_util:con_loop/2: > > https://github.com/erlang/otp/blob/master/lib/kernel/src/ > dist_util.erl#L486 > > There is a con_loop for each 1:1 node connection, and the tick state > simply keeps track of the number of tick intervals for which no data has > been received on the connection (note that at least ticks should have been > received.) > > Based on experience, with such a short ticktime, you might want to pay > attention to the +zdbbl setting for erl (dist_buf_busy_limit). If it is set > too low, there is a risk that the ticker process is suspended and the > connection times out. I believe this is less of a problem than it used to > be, when the distribution buffer busy limit was much lower (and not > configurable.) > > BR, > Ulf W > > 2017-06-06 7:15 GMT+01:00 lankeanandrao : > >> Hi all, >> >> I am running my application in a distributed way, with one server >> node and multiple client nodes and all nodes are started in visible mode. >> Here I want to know when all the client nodes are connected to the server >> node, the client nodes will send the tick message to server node and as >> same as the server will send tick message to all client nodes, here all the >> client nodes send tick response to the server node. So here my question is >> >> 1. Where the tick response came from multiple client nodes is getting >> stored? >> >> 2. If it is getting stored in kernel buffer, what is the buffer size >> and how to find that? >> >> 3. How the tick response's of multiple nodes is getting served by the >> Erlang kernel? >> >> Note: The net tick time is set to 5 Second in all the nodes. >> >> Thanks & Regards, >> Anand Rao L >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From konstantinos.kallas@REDACTED Wed Jun 7 19:28:16 2017 From: konstantinos.kallas@REDACTED (Konstantinos Kallas) Date: Wed, 7 Jun 2017 17:28:16 +0000 Subject: [erlang-questions] erlang:trace_pattern internals Message-ID: Hi all, I noticed that tracing the execution time of functions using erlang trace bifs is kind of slow (not unexpectedly). Looking at the docs I found the following in: http://erlang.org/doc/man/erlang.html#trace_pattern-2 ?Time spent in the function is accumulated in two other counters, seconds and microseconds? How does this happen in detail? Could someone explain how does trace_pattern with call_time option works internally? Thank you in advance. Best regards, Konstantinos Kallas -------------- next part -------------- An HTML attachment was scrubbed... URL: From ingela.andin@REDACTED Wed Jun 7 23:07:58 2017 From: ingela.andin@REDACTED (Ingela Andin) Date: Wed, 7 Jun 2017 23:07:58 +0200 Subject: [erlang-questions] SSL peer certificate verification - RabbitMQ In-Reply-To: References: Message-ID: Hi! You should use the partial chain option. The fun shall return the intermediate cert present in the inputed Chain that it wants to trust. The depth option specifies the maximum intermediate CAs there can be in the chain, that is not what you want. *"{partial_chain, fun(Chain::[DerCert]) -> {trusted_ca, DerCert} | unknown_ca }* Claim an intermediate CA in the chain as trusted. TLS then performs public_key:pkix_path_validation/3 with the selected CA as trusted anchor and the rest of the chain." Regards Ingela Erlang/OTP team 2017-06-05 20:27 GMT+02:00 Bloom, Adam : > Hello, > > > > Hoping that one of you knows some secrets you can impart in me to get SSL > peer verification working from RabbitMQ. I?ve been digging through the > source code of the underlying Erlang SSL library to no avail. In > particular, I?m struggling to understand the depth setting. According to > the docs (http://erlang.org/doc/man/ssl.html): > > > > {depth, integer()} > > Maximum number of non-self-issued intermediate certificates that can > follow the peer certificate in a valid certification path. So, if depth is > 0 the PEER must be signed by the trusted ROOT-CA directly; if 1 the path > can be PEER, CA, ROOT-CA; if 2 the path can be PEER, CA, CA, ROOT-CA, and > so on. The default value is 1. > > > > I have two certificates (client and server) signed by the same > intermediate CA. I would like to restrict rabbitmq to only accept > connections from this (and potentially one more) intermediate CA. My > initial thought was to set depth to 0 and place the intermediate ca > (followed by the root ca) in the CA cert file. If I do this, the client is > unable to connect and the server logs the following error: > > SSL: certify: ssl_handshake.erl:1627:Fatal error: handshake failure - > {bad_cert,max_path_length_reached}. > > > > If I change depth to 1, the connection works. Rabbitmq also allows a cert > signed by another intermediate ca (same root) to connect, which is what I?d > like to prevent. This follows from the ssl man page though. > > > > Can someone please advise me on the proper use of the ?depth? setting in > the Erlang ssl library such that only certificates signed by the trusted > intermediate are able to connect? Do I need to remove the root CA from the > CA cert file and explore partial_chain handlers? > > > > Here are my current ssl_options settings from rabbitmq: > > {ssl_options, [ > > {cacertfile, "/etc/rabbitmq/certs/cacert.pem"}, > > {certfile, "/etc/rabbitmq/certs/cert.pem"}, > > {keyfile, "/etc/rabbitmq/certs/key.pem"}, > > {verify, verify_peer}, > > {depth, 1}, > > {fail_if_no_peer_cert, true}, > > {versions, ['tlsv1.2']} > > ]}, > > > > Thanks, > > > > Adam > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Adam.Bloom@REDACTED Thu Jun 8 00:35:56 2017 From: Adam.Bloom@REDACTED (Bloom, Adam) Date: Wed, 7 Jun 2017 22:35:56 +0000 Subject: [erlang-questions] SSL peer certificate verification - RabbitMQ In-Reply-To: References: Message-ID: <1347873C-FE32-4232-AEA4-C3EFA49A2546@viasat.com> Hi Ingela, Ok, that?s what I was starting to think the right approach is as well. Do you have an example of implementing this function? I?m just a rabbitmq user, not an Erlang developer. But sounds like I?ll get to learn a thing or two about a new language ? Adam From: Ingela Andin Date: Wednesday, June 7, 2017 at 2:07 PM To: Adam Bloom Cc: "erlang-questions@REDACTED" Subject: Re: [erlang-questions] SSL peer certificate verification - RabbitMQ Hi! You should use the partial chain option. The fun shall return the intermediate cert present in the inputed Chain that it wants to trust. The depth option specifies the maximum intermediate CAs there can be in the chain, that is not what you want. "{partial_chain, fun(Chain::[DerCert]) -> {trusted_ca, DerCert} | unknown_ca } Claim an intermediate CA in the chain as trusted. TLS then performs public_key:pkix_path_validation/3 with the selected CA as trusted anchor and the rest of the chain." Regards Ingela Erlang/OTP team 2017-06-05 20:27 GMT+02:00 Bloom, Adam >: Hello, Hoping that one of you knows some secrets you can impart in me to get SSL peer verification working from RabbitMQ. I?ve been digging through the source code of the underlying Erlang SSL library to no avail. In particular, I?m struggling to understand the depth setting. According to the docs (http://erlang.org/doc/man/ssl.html): {depth, integer()} Maximum number of non-self-issued intermediate certificates that can follow the peer certificate in a valid certification path. So, if depth is 0 the PEER must be signed by the trusted ROOT-CA directly; if 1 the path can be PEER, CA, ROOT-CA; if 2 the path can be PEER, CA, CA, ROOT-CA, and so on. The default value is 1. I have two certificates (client and server) signed by the same intermediate CA. I would like to restrict rabbitmq to only accept connections from this (and potentially one more) intermediate CA. My initial thought was to set depth to 0 and place the intermediate ca (followed by the root ca) in the CA cert file. If I do this, the client is unable to connect and the server logs the following error: SSL: certify: ssl_handshake.erl:1627:Fatal error: handshake failure - {bad_cert,max_path_length_reached}. If I change depth to 1, the connection works. Rabbitmq also allows a cert signed by another intermediate ca (same root) to connect, which is what I?d like to prevent. This follows from the ssl man page though. Can someone please advise me on the proper use of the ?depth? setting in the Erlang ssl library such that only certificates signed by the trusted intermediate are able to connect? Do I need to remove the root CA from the CA cert file and explore partial_chain handlers? Here are my current ssl_options settings from rabbitmq: {ssl_options, [ {cacertfile, "/etc/rabbitmq/certs/cacert.pem"}, {certfile, "/etc/rabbitmq/certs/cert.pem"}, {keyfile, "/etc/rabbitmq/certs/key.pem"}, {verify, verify_peer}, {depth, 1}, {fail_if_no_peer_cert, true}, {versions, ['tlsv1.2']} ]}, Thanks, Adam _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From mjtruog@REDACTED Thu Jun 8 05:31:35 2017 From: mjtruog@REDACTED (Michael Truog) Date: Wed, 7 Jun 2017 20:31:35 -0700 Subject: [erlang-questions] [ANN] CloudI 1.7.1 Released! Message-ID: Download 1.7.1 from http://sourceforge.net/projects/cloudi/files/latest/download (description/checksums at the bottom of this email) CloudI (http://cloudi.org/) as an open-source project is at an interesting point because after 32 releases during the past ~7.5 years there doesn't appear to be anything major that needs to be added or changed in the cloudi_core Erlang source code, including the dependencies and the CloudI API implementations. More tests, documentation, tutorials, other services, remain for the future, but the project is at a good point where you should try to break it, if you feel so inclined. Thank you for reporting problems in the past! The details for this release are below: * backwards compatibility difference: * cpg (CloudI Process Groups) source code was changed to minimize distributed Erlang communication (and local messaging) without attempting to remain compatible with cpg versions before 1.7.1 (i.e., prevent CloudI 1.7.1 nodes from communicating with older nodes by using different cookie settings or other means). * Using the CloudI API functions send_sync or recv_async during the service's initialization previously returned an error, but will now cause the service to crash, to pursue fail-fast operation and to keep the effect the same for both internal and external services. * All CloudI source code is under a MIT license instead of a BSD-style license to make reuse simpler and to be GPL-compatible * The chroot external service configuration option was added (http://cloudi.org/api.html#2_services_add_config_opts) * The order external service configuration options are applied changed from owner, limit, nice, directory to chroot, limit, nice, owner, directory which means that the user/group responsible for running CloudI influences the permissions for chroot, limit, nice (and cgroup). This order will not need to change in the future. * Erlang/OTP 20.0 compilation/runtime works * Bugs were fixed and other improvements were added (see the ChangeLog for more detail) CloudI 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. Please mention any problems, issues, or ideas! Thanks, Michael SHA256 CHECKSUMS cloudi-1.7.1.tar.gz (16508746 bytes) f3ce440073f2c31078da03453cac7a8fc05ab4ba182481b8a53a5aa4c9872ab2 cloudi-1.7.1.tar.bz2 (13956243 bytes) 23512faeefd1a18763ba2af1c949149c697f2ce29f28a77419d6a107c0e97420 From Oliver.Korpilla@REDACTED Thu Jun 8 09:41:35 2017 From: Oliver.Korpilla@REDACTED (Oliver Korpilla) Date: Thu, 8 Jun 2017 09:41:35 +0200 Subject: [erlang-questions] Mnesia tables don't finish syncing In-Reply-To: References: Message-ID: Hello, I made progress with this. I can get Mnesia to sync like this: 1) worker node comes up 2) connects to central node (repeat until connection is made) 3) starts Mnesia 4) spawn on central node: mnesia:change_config(extra_db_nodes, nodes()) 5) call locally mnesia:set_master_nodes([]) As for the DB tables this works. Simply works. However, now I traded one sync problem ("Does Mnesia sync its tables between nodes?") with another ("Is Mnesia on central node finished with Mnesia start?") In case the central node boots up after the worker nodes it can happen sporadically that the spawn (#4 above) crashes on central node and Mnesia with it. Error message is then {case_clause, starting, [...] The mnesia:change_config is not simply returning an error code, as far as I can see the call simply fails and takes Mnesia with it? (Please correct me if I misunderstand.) I do retry when something else but {ok, _} is returned but this simply seems to crash Mnesia altogether? I looked for any way to query any way to protect myself against this interim state and tried the following: Query mnesia:system_info(running_db_nodes) and check if central node is in the list. But apparently this query is updated before Mnesia is really up. And my call into mnesia:change_config/2 still crashes. How can I synchronize DB startup between nodes better? Thank you and best regards, Oliver? ? Gesendet:?Donnerstag, 01. Juni 2017 um 11:15 Uhr Von:?"Oliver Korpilla" An:?erlang-questions@REDACTED Betreff:?[erlang-questions] Mnesia tables don't finish syncing Hello. I have a system with multiple nodes, one is central and the other start later and connect to central. All tables are RAM copies, even schema. On startup of the slave nodes I do: 1) Connect nodes 2) Spawn a process on central and do mnesia:add_table_copy for each table for my new node (including schema) 3) mnesia:wait_for_tables for all of these tables I repeat steps 2) and 3) up to 5 times total with a wait time of 2s. In about 3% of cases (regression test run) it seems not to work no matter how long I wait. What I see from step 2) is as expected, the calls to mnesia:add_table_copy return a) {atomic, ok} on the first try b) {aborted, {already_exists,
, }} on all further tries And no matter how many retries, in the failure scenarios the list of failed tables I still wait for does not get shorter. Could people on this list please make further suggestions where I could look for faults? And how could I find them? So far I have no way to pinpoint the actual error except that when I of course try to access such tables I get "badarg". But I don't see why the sync fails. How do I get more logs or a report pinpointing the actual problem? Thank you and kind regards, Oliver _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From rickard@REDACTED Thu Jun 8 15:02:12 2017 From: rickard@REDACTED (Rickard Green) Date: Thu, 8 Jun 2017 15:02:12 +0200 Subject: [erlang-questions] Patch package OTP 19.3.6 released Message-ID: <0793ed5f-e515-4dd8-3d89-f0c8a5768147@erlang.org> Patch Package: OTP 19.3.6 Git Tag: OTP-19.3.6 Date: 2017-06-08 Trouble Report Id: OTP-14441, OTP-14444, OTP-14451 Seq num: ERIERL-24, ERL-430 System: OTP Release: 19 Application: erts-8.3.5 Predecessor: OTP 19.3.5 Check out the git tag OTP-19.3.6, 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-8.3.5 ------------------------------------------------------ --------------------------------------------------------------------- Note! The erts-8.3.5 application can *not* be applied independently of other applications on an arbitrary OTP 19 installation. On a full OTP 19 installation, also the following runtime dependency has to be satisfied: -- sasl-3.0.1 (first satisfied in OTP 19.1) --- Fixed Bugs and Malfunctions --- OTP-14441 Application(s): erts Related Id(s): ERL-430 Active-mode TCP sockets are now cleaned up properly on send/shutdown errors. OTP-14444 Application(s): erts Related Id(s): ERIERL-24 A code purge operation could under certain circumstances expand the size of hibernated processes. OTP-14451 Application(s): erts Fix so that the ERL_ZZ_SIGTERM_KILL introduced in erts-8.3.4 works. Full runtime dependencies of erts-8.3.5: kernel-5.0, sasl-3.0.1, stdlib-3.0 --------------------------------------------------------------------- --------------------------------------------------------------------- --------------------------------------------------------------------- From frank.muller.erl@REDACTED Fri Jun 9 07:44:56 2017 From: frank.muller.erl@REDACTED (Frank Muller) Date: Fri, 09 Jun 2017 05:44:56 +0000 Subject: [erlang-questions] ets:update_counter/3 optimal settings Message-ID: Hi Everyone, I've some troubles to understand the optimal settings for this little simple problem: Two Erlang processes A and B. 1. Process A randomly increments a counter during its lifetime using "ets :update_counter/3" 2. Process B reads the counter every X seconds and reset it to 0. I decided to use these options when creating the table: {write_concurrency, true}, %% A and B {read_concurrency, false} %% only B Are these settings correct and more importantly "optimal" (please elaborate your answer)? /Frank -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex0player@REDACTED Fri Jun 9 08:08:49 2017 From: alex0player@REDACTED (Alex S.) Date: Fri, 9 Jun 2017 09:08:49 +0300 Subject: [erlang-questions] ets:update_counter/3 optimal settings In-Reply-To: References: Message-ID: Sounds right to me, with the caveat that read + reset to zero can lose some data if you are preempted between those two calls. My usual approach is read and decrement by -N, where N is the value I just read. > 9 ???? 2017 ?., ? 8:44, Frank Muller ???????(?): > > Hi Everyone, > > I've some troubles to understand the optimal settings for this little simple problem: > > Two Erlang processes A and B. > > 1. Process A randomly increments a counter during its lifetime using "ets:update_counter/3" > > 2. Process B reads the counter every X seconds and reset it to 0. > > I decided to use these options when creating the table: > > {write_concurrency, true}, %% A and B > {read_concurrency, false} %% only B > > Are these settings correct and more importantly "optimal" (please elaborate your answer)? > > /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 Fri Jun 9 08:25:18 2017 From: frank.muller.erl@REDACTED (Frank Muller) Date: Fri, 09 Jun 2017 06:25:18 +0000 Subject: [erlang-questions] ets:update_counter/3 optimal settings In-Reply-To: References: Message-ID: Hi Alex, Thanks for the tip. Anything else I should be aware of? /Frank Le ven. 9 juin 2017 ? 08:08, Alex S. a ?crit : > Sounds right to me, with the caveat that read + reset to zero can lose > some data if you are preempted between those two calls. My usual approach > is read and decrement by -N, where N is the value I just read. > > 9 ???? 2017 ?., ? 8:44, Frank Muller > ???????(?): > > Hi Everyone, > > I've some troubles to understand the optimal settings for this little > simple problem: > > Two Erlang processes A and B. > > 1. Process A randomly increments a counter during its lifetime using "ets > :update_counter/3" > > 2. Process B reads the counter every X seconds and reset it to 0. > > I decided to use these options when creating the table: > > {write_concurrency, true}, %% A and B > {read_concurrency, false} %% only B > > Are these settings correct and more importantly "optimal" (please > elaborate your answer)? > > /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 Fri Jun 9 09:56:08 2017 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Fri, 09 Jun 2017 07:56:08 +0000 Subject: [erlang-questions] ets:update_counter/3 optimal settings In-Reply-To: References: Message-ID: On Fri, Jun 9, 2017 at 7:45 AM Frank Muller wrote: > Hi Everyone, > > I've some troubles to understand the optimal settings for this little > simple problem: > > Two Erlang processes A and B. > > If you need the speed, then measure. If you only have two processes, chances are that you can't measure any kind of difference really, because a single RX mutex would be enough for you to handle both processes. The read_concurrency and write_concurrency options tend to kick in at a certain core count and two processes can at most invoke 2 cores, and even then the chance is that they won't run at the same time in which case most of the points here are moot. Rule of thumb: a read or write to ETS takes less than 1us. So you can often run about a million of them per second. -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank.muller.erl@REDACTED Fri Jun 9 10:13:06 2017 From: frank.muller.erl@REDACTED (Frank Muller) Date: Fri, 09 Jun 2017 08:13:06 +0000 Subject: [erlang-questions] ets:update_counter/3 optimal settings In-Reply-To: References: Message-ID: Thanks Jesper! /Frank Le ven. 9 juin 2017 ? 09:56, Jesper Louis Andersen < jesper.louis.andersen@REDACTED> a ?crit : > On Fri, Jun 9, 2017 at 7:45 AM Frank Muller > wrote: > >> Hi Everyone, >> >> I've some troubles to understand the optimal settings for this little >> simple problem: >> >> Two Erlang processes A and B. >> >> > If you need the speed, then measure. If you only have two processes, > chances are that you can't measure any kind of difference really, because a > single RX mutex would be enough for you to handle both processes. The > read_concurrency and write_concurrency options tend to kick in at a certain > core count and two processes can at most invoke 2 cores, and even then the > chance is that they won't run at the same time in which case most of the > points here are moot. > > Rule of thumb: a read or write to ETS takes less than 1us. So you can > often run about a million of them per second. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony@REDACTED Fri Jun 9 12:33:31 2017 From: tony@REDACTED (Tony Rogvall) Date: Fri, 9 Jun 2017 12:33:31 +0200 Subject: [erlang-questions] ets:update_counter/3 optimal settings In-Reply-To: References: Message-ID: <3A5F16F7-1886-4DDA-8038-19BBEDB09E54@rogvall.se> > On 9 jun 2017, at 08:08, Alex S. wrote: > > Sounds right to me, with the caveat that read + reset to zero can lose some data if you are preempted between those two calls. My usual approach is read and decrement by -N, where N is the value I just read. When counter is none negative this can be done atomically like: hd(ets:update_counter(Tab, Key, [{Pos,0},{Pos,0,0,0}])). /Tony >> 9 ???? 2017 ?., ? 8:44, Frank Muller ???????(?): >> >> Hi Everyone, >> >> I've some troubles to understand the optimal settings for this little simple problem: >> >> Two Erlang processes A and B. >> >> 1. Process A randomly increments a counter during its lifetime using "ets:update_counter/3" >> >> 2. Process B reads the counter every X seconds and reset it to 0. >> >> I decided to use these options when creating the table: >> >> {write_concurrency, true}, %% A and B >> {read_concurrency, false} %% only B >> >> Are these settings correct and more importantly "optimal" (please elaborate your answer)? >> >> /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 -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: Message signed with OpenPGP using GPGMail URL: From buday.gergely@REDACTED Fri Jun 9 11:41:27 2017 From: buday.gergely@REDACTED (Gergely Buday) Date: Fri, 09 Jun 2017 11:41:27 +0200 Subject: [erlang-questions] concurrent libraries for business applications Message-ID: Hi, I am doing research in concurrent programming and would like to read concurrent Erlang libraries for business applications. What libraries should I read? Clearly, there are important libraries for business applications that implement various standards that are not inherently concurrent. I would be interested in libraries that use concurrency heavily. Best - Gergely From frank.muller.erl@REDACTED Fri Jun 9 14:03:54 2017 From: frank.muller.erl@REDACTED (Frank Muller) Date: Fri, 09 Jun 2017 12:03:54 +0000 Subject: [erlang-questions] ets:update_counter/3 optimal settings In-Reply-To: <3A5F16F7-1886-4DDA-8038-19BBEDB09E54@rogvall.se> References: <3A5F16F7-1886-4DDA-8038-19BBEDB09E54@rogvall.se> Message-ID: That's what I've implemented at the first place Tony. But I like Alex's idea too. /Frank Le ven. 9 juin 2017 ? 12:33, Tony Rogvall a ?crit : > > > On 9 jun 2017, at 08:08, Alex S. wrote: > > > > Sounds right to me, with the caveat that read + reset to zero can lose > some data if you are preempted between those two calls. My usual approach > is read and decrement by -N, where N is the value I just read. > > When counter is none negative this can be done atomically like: > > hd(ets:update_counter(Tab, Key, [{Pos,0},{Pos,0,0,0}])). > > /Tony > > >> 9 ???? 2017 ?., ? 8:44, Frank Muller > ???????(?): > >> > >> Hi Everyone, > >> > >> I've some troubles to understand the optimal settings for this little > simple problem: > >> > >> Two Erlang processes A and B. > >> > >> 1. Process A randomly increments a counter during its lifetime using > "ets:update_counter/3" > >> > >> 2. Process B reads the counter every X seconds and reset it to 0. > >> > >> I decided to use these options when creating the table: > >> > >> {write_concurrency, true}, %% A and B > >> {read_concurrency, false} %% only B > >> > >> Are these settings correct and more importantly "optimal" (please > elaborate your answer)? > >> > >> /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 max.lapshin@REDACTED Fri Jun 9 15:47:16 2017 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 9 Jun 2017 16:47:16 +0300 Subject: [erlang-questions] ets:update_counter/3 optimal settings In-Reply-To: References: Message-ID: Sometimes may help something like: ets:update_counter(Table, Key, [{#record.field, 0}, {#record.field, -10000000000, 0, 0}]). On Fri, Jun 9, 2017 at 9:08 AM, Alex S. wrote: > Sounds right to me, with the caveat that read + reset to zero can lose > some data if you are preempted between those two calls. My usual approach > is read and decrement by -N, where N is the value I just read. > > 9 ???? 2017 ?., ? 8:44, Frank Muller > ???????(?): > > Hi Everyone, > > I've some troubles to understand the optimal settings for this little > simple problem: > > Two Erlang processes A and B. > > 1. Process A randomly increments a counter during its lifetime using "ets > :update_counter/3" > > 2. Process B reads the counter every X seconds and reset it to 0. > > I decided to use these options when creating the table: > > {write_concurrency, true}, %% A and B > {read_concurrency, false} %% only B > > Are these settings correct and more importantly "optimal" (please > elaborate your answer)? > > /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 Fri Jun 9 15:52:00 2017 From: frank.muller.erl@REDACTED (Frank Muller) Date: Fri, 09 Jun 2017 13:52:00 +0000 Subject: [erlang-questions] ets:update_counter/3 optimal settings In-Reply-To: References: Message-ID: Max, in which case you can use this trick ? /Frank Le ven. 9 juin 2017 ? 15:47, Max Lapshin a ?crit : > Sometimes may help something like: > > > ets:update_counter(Table, Key, [{#record.field, 0}, {#record.field, > -10000000000, 0, 0}]). > > > On Fri, Jun 9, 2017 at 9:08 AM, Alex S. wrote: > >> Sounds right to me, with the caveat that read + reset to zero can lose >> some data if you are preempted between those two calls. My usual approach >> is read and decrement by -N, where N is the value I just read. >> >> 9 ???? 2017 ?., ? 8:44, Frank Muller >> ???????(?): >> >> Hi Everyone, >> >> I've some troubles to understand the optimal settings for this little >> simple problem: >> >> Two Erlang processes A and B. >> >> 1. Process A randomly increments a counter during its lifetime using "ets >> :update_counter/3" >> >> 2. Process B reads the counter every X seconds and reset it to 0. >> >> I decided to use these options when creating the table: >> >> {write_concurrency, true}, %% A and B >> {read_concurrency, false} %% only B >> >> Are these settings correct and more importantly "optimal" (please >> elaborate your answer)? >> >> /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 max.lapshin@REDACTED Fri Jun 9 15:55:22 2017 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 9 Jun 2017 16:55:22 +0300 Subject: [erlang-questions] ets:update_counter/3 optimal settings In-Reply-To: References: Message-ID: If you are 100% sure that you can give such negative decrement that will be always bigger than you value. Not very good way to program, but you can get atomic "read-and-reset" counter that can be ok for example for counters like network bytes. -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank.muller.erl@REDACTED Fri Jun 9 16:04:04 2017 From: frank.muller.erl@REDACTED (Frank Muller) Date: Fri, 09 Jun 2017 14:04:04 +0000 Subject: [erlang-questions] ets:update_counter/3 optimal settings In-Reply-To: References: Message-ID: Ok, thanks a lot! /Frank Le ven. 9 juin 2017 ? 15:55, Max Lapshin a ?crit : > If you are 100% sure that you can give such negative decrement that will > be always bigger than you value. > > Not very good way to program, but you can get atomic "read-and-reset" > counter that can be ok for example for counters like network bytes. > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Fri Jun 9 18:06:40 2017 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 9 Jun 2017 19:06:40 +0300 Subject: [erlang-questions] How to capture all output to console during Common Test? Message-ID: Hi. I'm running ct_run and want somehow to capture all output made to console (io:format, ct:print). Is it possible? -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Sat Jun 10 03:09:26 2017 From: mononcqc@REDACTED (Fred Hebert) Date: Fri, 9 Jun 2017 21:09:26 -0400 Subject: [erlang-questions] How to capture all output to console during Common Test? In-Reply-To: References: Message-ID: <20170610010925.GD22798@ferdmbp.local> On 06/09, Max Lapshin wrote: >Hi. > >I'm running ct_run and want somehow to capture all output made to console >(io:format, ct:print). Is it possible? I ended up doing this for rebar3 through the cth_readable library. The only practical way I found to hijack all traffic was to use a parse transform to replace the function and tunnel it through my own. Here's the parse transform I used for ct:pal/2-3 : https://github.com/ferd/cth_readable/blob/master/src/cth_readable_transform.erl https://github.com/ferd/cth_readable/blob/master/src/cth_readable_failonly.erl shows how I got to capture and redirect most of lager and error_logger's traffic as well, but it's fairly messy. Regards, Fred. From gordeev.vladimir.v@REDACTED Sat Jun 10 09:14:41 2017 From: gordeev.vladimir.v@REDACTED (Vladimir Gordeev) Date: Sat, 10 Jun 2017 10:14:41 +0300 Subject: [erlang-questions] How to capture all output to console during Common Test? In-Reply-To: <20170610010925.GD22798@ferdmbp.local> References: <20170610010925.GD22798@ferdmbp.local> Message-ID: Well, it's possible to start your own Erlang IO server, start it in ct hook during init, and then make it as a group leader for root ct process. http://erlang.org/doc/apps/stdlib/io_protocol.html So just start your own process that handles io_reply, io_request, and then erlang:group_leader(MyCustomIOServerPid, CtRootPid), On Sat, Jun 10, 2017 at 4:09 AM, Fred Hebert wrote: > On 06/09, Max Lapshin wrote: > >> Hi. >> >> I'm running ct_run and want somehow to capture all output made to console >> (io:format, ct:print). Is it possible? >> > > I ended up doing this for rebar3 through the cth_readable library. The > only practical way I found to hijack all traffic was to use a parse > transform to replace the function and tunnel it through my own. > > Here's the parse transform I used for ct:pal/2-3 : > https://github.com/ferd/cth_readable/blob/master/src/cth_rea > dable_transform.erl > > https://github.com/ferd/cth_readable/blob/master/src/cth_rea > dable_failonly.erl shows how I got to capture and redirect most of lager > and error_logger's traffic as well, but it's fairly messy. > > Regards, > Fred. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From marco.molteni@REDACTED Sun Jun 11 08:32:46 2017 From: marco.molteni@REDACTED (Marco Molteni) Date: Sun, 11 Jun 2017 08:32:46 +0200 Subject: [erlang-questions] How to capture all output to console during Common Test? In-Reply-To: References: Message-ID: <711FD039-1DE8-4A9F-8C5C-0713C2E5B1D0@laposte.net> On 9 Jun 2017, at 18:06, Max Lapshin wrote: > I'm running ct_run and want somehow to capture all output made to console (io:format, ct:print). Is it possible? I wrote mock_io [1] to capture/inject I/O for EUnit. If it doesn't work out of the box with CT, it should be easy to adapt, I'll be happy to accept patches :-) marco [1] https://github.com/marco-m/mock_io From eric.pailleau@REDACTED Sun Jun 11 11:53:04 2017 From: eric.pailleau@REDACTED (PAILLEAU Eric) Date: Sun, 11 Jun 2017 11:53:04 +0200 Subject: [erlang-questions] How to capture all output to console during Common Test? In-Reply-To: References: Message-ID: <03890b91-5a3f-ed25-aa1c-0351a304919a@wanadoo.fr> Le 09/06/2017 ? 18:06, Max Lapshin a ?crit : > Hi. > > I'm running ct_run and want somehow to capture all output made to > console (io:format, ct:print). Is it possible? > Hi max, you may have a look to io_server/0 and io_server/1 in https://github.com/erlang/otp/blob/master/lib/observer/src/observer_procinfo.erl was done to catch 'rb' output in observer. cheers From vans_163@REDACTED Mon Jun 12 09:34:03 2017 From: vans_163@REDACTED (Vans S) Date: Mon, 12 Jun 2017 07:34:03 +0000 (UTC) Subject: [erlang-questions] DTLS server example? References: <134469690.9322965.1497252843091.ref@mail.yahoo.com> Message-ID: <134469690.9322965.1497252843091@mail.yahoo.com> I am trying to implement a DTLS server but having trouble. The DTLS client works great, used RoadRunners patches and example. For the server side I had success to what I think was accepting a peer using the undocumented 'dtls' module directly, but I cannot send to the socket. Does anyone have a clue how to create a DTLS server in erlang? -------------- next part -------------- An HTML attachment was scrubbed... URL: From aschultz@REDACTED Mon Jun 12 09:45:28 2017 From: aschultz@REDACTED (Andreas Schultz) Date: Mon, 12 Jun 2017 09:45:28 +0200 (CEST) Subject: [erlang-questions] DTLS server example? In-Reply-To: <134469690.9322965.1497252843091@mail.yahoo.com> References: <134469690.9322965.1497252843091.ref@mail.yahoo.com> <134469690.9322965.1497252843091@mail.yahoo.com> Message-ID: <88414996.336100.1497253528645.JavaMail.zimbra@tpip.net> Hi Vans, I haven't played with it yet, but with the DTLS stack in R20 creating a DTLS server should be mostly identical to a TLS server. For an example on how this works with my old, patched version, you could check out the CAPWAP [1] project. Regards Andreas [1]: https://github.com/travelping/capwap ----- On Jun 12, 2017, at 9:34 AM, Vans S wrote: > I am trying to implement a DTLS server but having trouble. > The DTLS client works great, used RoadRunners patches and example. > For the server side I had success to what I think was accepting a peer using the > undocumented 'dtls' module directly, but I cannot send to the socket. > Does anyone have a clue how to create a DTLS server in erlang? > _______________________________________________ > 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 Jun 13 09:51:45 2017 From: vans_163@REDACTED (Vans S) Date: Tue, 13 Jun 2017 07:51:45 +0000 (UTC) Subject: [erlang-questions] DTLS server example? In-Reply-To: References: <134469690.9322965.1497252843091.ref@mail.yahoo.com> <134469690.9322965.1497252843091@mail.yahoo.com> <88414996.336100.1497253528645.JavaMail.zimbra@tpip.net> Message-ID: <2144126667.10408263.1497340305672@mail.yahoo.com> Thank you for the encouragement, I got it working, the key was to call transport_accept then ssl_accept, I was calling one or the other. On Monday, June 12, 2017 8:34 AM, Ingela Andin wrote: Hi! Only difference to TLS is that you need to provide the option {protocol, dtls}. Regards Ingela? On Mon, Jun 12, 2017 at 9:45 AM, Andreas Schultz wrote: Hi Vans, I haven't played with it yet, but with the DTLS stack in R20 creating a DTLS server should be mostly identical to a TLS server. For an example on how this works with my old, patched version, you could check out the CAPWAP [1] project. RegardsAndreas [1]:?https://github.com/ travelping/capwap ----- On Jun 12, 2017, at 9:34 AM, Vans S wrote: I am trying to implement a DTLS server but having trouble. The DTLS client works great, used RoadRunners patches and example. For the server side I had success to what I think was accepting a peer using the undocumented 'dtls' module directly, but I cannot send to the socket. Does anyone have a clue how to create a DTLS server in erlang? ______________________________ _________________ 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 vans_163@REDACTED Tue Jun 13 10:08:13 2017 From: vans_163@REDACTED (Vans S) Date: Tue, 13 Jun 2017 08:08:13 +0000 (UTC) Subject: [erlang-questions] squelching warnings References: <1065974867.10431387.1497341293972.ref@mail.yahoo.com> Message-ID: <1065974867.10431387.1497341293972@mail.yahoo.com> Is there a way to squelch new OTP 20 warnings? Particularly "Warning:export_all flag enabled..." "Warning: undefined callback function.." -------------- next part -------------- An HTML attachment was scrubbed... URL: From vans_163@REDACTED Tue Jun 13 11:20:42 2017 From: vans_163@REDACTED (Vans S) Date: Tue, 13 Jun 2017 09:20:42 +0000 (UTC) Subject: [erlang-questions] DTLS server example? In-Reply-To: <2144126667.10408263.1497340305672@mail.yahoo.com> References: <134469690.9322965.1497252843091.ref@mail.yahoo.com> <134469690.9322965.1497252843091@mail.yahoo.com> <88414996.336100.1497253528645.JavaMail.zimbra@tpip.net> <2144126667.10408263.1497340305672@mail.yahoo.com> Message-ID: <1479904865.10501067.1497345642718@mail.yahoo.com> Slight problem now. Testing on localhost everything works fine. ?Now I am testing on a remote server with large latency and I keep getting this error on the client, SSL: {connection, flight_retransmission_timeout} Fatal error: unexpected message. I tested using pydtls as the client and this error does not happen.? Also the server shows a "unexpected message" tls_alert. Does not happen with pydtls as the client. On Tuesday, June 13, 2017 3:51 AM, Vans S wrote: Thank you for the encouragement, I got it working, the key was to call transport_accept then ssl_accept, I was calling one or the other. On Monday, June 12, 2017 8:34 AM, Ingela Andin wrote: Hi! Only difference to TLS is that you need to provide the option {protocol, dtls}. Regards Ingela? On Mon, Jun 12, 2017 at 9:45 AM, Andreas Schultz wrote: Hi Vans, I haven't played with it yet, but with the DTLS stack in R20 creating a DTLS server should be mostly identical to a TLS server. For an example on how this works with my old, patched version, you could check out the CAPWAP [1] project. RegardsAndreas [1]:?https://github.com/ travelping/capwap ----- On Jun 12, 2017, at 9:34 AM, Vans S wrote: I am trying to implement a DTLS server but having trouble. The DTLS client works great, used RoadRunners patches and example. For the server side I had success to what I think was accepting a peer using the undocumented 'dtls' module directly, but I cannot send to the socket. Does anyone have a clue how to create a DTLS server in erlang? ______________________________ _________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/ listinfo/erlang-questions ______________________________ _________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/ listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Tue Jun 13 21:56:20 2017 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 13 Jun 2017 22:56:20 +0300 Subject: [erlang-questions] How to capture all output to console during Common Test? In-Reply-To: References: <20170610010925.GD22798@ferdmbp.local> Message-ID: On Sat, Jun 10, 2017 at 10:14 AM, Vladimir Gordeev < gordeev.vladimir.v@REDACTED> wrote: > Well, it's possible to start your own Erlang IO server, start it in ct > hook during init, and then make it as a group leader for root ct process. > > http://erlang.org/doc/apps/stdlib/io_protocol.html > > So just start your own process that handles io_reply, io_request, and then > > erlang:group_leader(MyCustomIOServerPid, CtRootPid), > Have you tried to do it? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ingela.andin@REDACTED Tue Jun 13 22:22:31 2017 From: ingela.andin@REDACTED (Ingela Andin) Date: Tue, 13 Jun 2017 22:22:31 +0200 Subject: [erlang-questions] DTLS server example? In-Reply-To: <88414996.336100.1497253528645.JavaMail.zimbra@tpip.net> References: <134469690.9322965.1497252843091.ref@mail.yahoo.com> <134469690.9322965.1497252843091@mail.yahoo.com> <88414996.336100.1497253528645.JavaMail.zimbra@tpip.net> Message-ID: Hi! This particular problem described below is fixed on latest master. And there are some mor fixes in testing that probably will make OTP 20. DTLS support will however be experimental in 20 as we have not had time to battle tested it as much as we want to to be able to ensure the same quality as for TLS. Regards Ingela Erlang/OTP team - Ericsson AB Slight problem now. Testing on localhost everything works fine. Now I am testing on a remote server with large latency and I keep getting this error on the client, SSL: {connection, flight_retransmission_timeout} Fatal error: unexpected message. I tested using pydtls as the client and this error does not happen. Also the server shows a "unexpected message" tls_alert. Does not happen with pydtls as the client. On Tuesday, June 13, 2017 3:51 AM, Vans S wrote: Thank you for the encouragement, I got it working, the key was to call transport_accept then ssl_accept, I was calling one or the other. On Monday, June 12, 2017 8:34 AM, Ingela Andin wrote: Hi! Only difference to TLS is that you need to provide the option {protocol, dtls}. Regards Ingela 2017-06-12 9:45 GMT+02:00 Andreas Schultz : > Hi Vans, > > I haven't played with it yet, but with the DTLS stack in R20 creating a > DTLS server should be mostly identical to a TLS server. > > For an example on how this works with my old, patched version, you could > check out the CAPWAP [1] project. > > Regards > Andreas > > [1]: https://github.com/travelping/capwap > > ----- On Jun 12, 2017, at 9:34 AM, Vans S wrote: > > I am trying to implement a DTLS server but having trouble. > > The DTLS client works great, used RoadRunners patches and example. > > For the server side I had success to what I think was accepting a peer > using the undocumented 'dtls' module directly, but I cannot send to the > socket. > > Does anyone have a clue how to create a DTLS server in erlang? > > _______________________________________________ > 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 vans_163@REDACTED Wed Jun 14 05:31:50 2017 From: vans_163@REDACTED (Vans S) Date: Wed, 14 Jun 2017 03:31:50 +0000 (UTC) Subject: [erlang-questions] DTLS server example? In-Reply-To: References: <134469690.9322965.1497252843091.ref@mail.yahoo.com> <134469690.9322965.1497252843091@mail.yahoo.com> <88414996.336100.1497253528645.JavaMail.zimbra@tpip.net> Message-ID: <782862378.11521801.1497411110257@mail.yahoo.com> I was on OTP 20 rc2, master fixes that issue. ?Another issue I found is this. I have a send_after procing every 100 ms sending binary:copy(<<"a">>, N*1024) bytes. Client to server. If N is 1-7 the server receives the bytes, as soon as N becomes 8 or higher, even N=8*1024-32, the server gets an error: SSL: {connection, {alert,2,20,{"dtls_record.erl,538},undefined}: ssl_connection.erl:845: Fatal error: unexpected message ** Reason for termination ==** {{key_exists,{{10,66,50,37},58874}},? ? [{gb_trees,insert_1,4,[{file,"gb_trees.erl"},{line,319}]},? ? ?{gb_trees,insert,3,[{file,"gb_trees.erl"},{line,278}]},? ? ?{dtls_udp_listener,setup_new_connection,5,? ? ? ? ? ? ? ? ? ? ? ? [{file,"dtls_udp_listener.erl"},{line,238}]},? ? ?{dtls_udp_listener,handle_info,2,? ? ? ? ? ? ? ? ? ? ? ? [{file,"dtls_udp_listener.erl"},{line,138}]},? ? ?{gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,616}]},? ? ?{gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,686}]},? ? ?{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]} On Tuesday, June 13, 2017 4:22 PM, Ingela Andin wrote: Hi! This particular problem described below is fixed on latest master.? And there are some mor fixes in testing that probably?will make OTP 20.?DTLS support will however be experimental in 20 as we have not had time to battle tested it as much as we want to to be able to ensure the same quality?as for TLS. Regards Ingela Erlang/OTP team - Ericsson AB Slight problem now. Testing on localhost everything works fine.? Now I am testing on a remote server with large latency and I keep getting this error on the client, SSL: {connection, flight_retransmission_timeout} Fatal error: unexpected message. I tested using pydtls as the client and this error does not happen.? Also the server shows a "unexpected message" tls_alert. Does not happen with pydtls as the client. On Tuesday, June 13, 2017 3:51 AM, Vans S wrote: Thank you for the encouragement, I got it working, the key was to call transport_accept then ssl_accept, I was calling one or the other. On Monday, June 12, 2017 8:34 AM, Ingela Andin wrote: Hi! Only difference to TLS is that you need to provide the option {protocol, dtls}.? Regards Ingela?? 2017-06-12 9:45 GMT+02:00 Andreas Schultz : Hi Vans, I haven't played with it yet, but with the DTLS stack in R20 creating a DTLS server should be mostly identical to a TLS server. For an example on how this works with my old, patched version, you could check out the CAPWAP [1] project. RegardsAndreas [1]:?https://github.com/ travelping/capwap ----- On Jun 12, 2017, at 9:34 AM, Vans S wrote: I am trying to implement a DTLS server but having trouble. The DTLS client works great, used RoadRunners patches and example. For the server side I had success to what I think was accepting a peer using the undocumented 'dtls' module directly, but I cannot send to the socket. Does anyone have a clue how to create a DTLS server in erlang? ______________________________ _________________ 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 vans_163@REDACTED Wed Jun 14 06:24:20 2017 From: vans_163@REDACTED (Vans S) Date: Wed, 14 Jun 2017 04:24:20 +0000 (UTC) Subject: [erlang-questions] DTLS server example? In-Reply-To: <782862378.11521801.1497411110257@mail.yahoo.com> References: <134469690.9322965.1497252843091.ref@mail.yahoo.com> <134469690.9322965.1497252843091@mail.yahoo.com> <88414996.336100.1497253528645.JavaMail.zimbra@tpip.net> <782862378.11521801.1497411110257@mail.yahoo.com> Message-ID: <1219988421.11543364.1497414260981@mail.yahoo.com> Increasing buffer sizes rec|snd|buffer on both client and serer to 1024*1024 seems to solve this BUT sending large binaries like 75*1024 makes the other party not receive the send with no erors. On Tuesday, June 13, 2017 11:36 PM, Vans S wrote: I was on OTP 20 rc2, master fixes that issue. ?Another issue I found is this. I have a send_after procing every 100 ms sending binary:copy(<<"a">>, N*1024) bytes. Client to server. If N is 1-7 the server receives the bytes, as soon as N becomes 8 or higher, even N=8*1024-32, the server gets an error: SSL: {connection, {alert,2,20,{"dtls_record.erl,538},undefined}: ssl_connection.erl:845: Fatal error: unexpected message ** Reason for termination ==** {{key_exists,{{10,66,50,37},58874}},? ? [{gb_trees,insert_1,4,[{file,"gb_trees.erl"},{line,319}]},? ? ?{gb_trees,insert,3,[{file,"gb_trees.erl"},{line,278}]},? ? ?{dtls_udp_listener,setup_new_connection,5,? ? ? ? ? ? ? ? ? ? ? ? [{file,"dtls_udp_listener.erl"},{line,238}]},? ? ?{dtls_udp_listener,handle_info,2,? ? ? ? ? ? ? ? ? ? ? ? [{file,"dtls_udp_listener.erl"},{line,138}]},? ? ?{gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,616}]},? ? ?{gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,686}]},? ? ?{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]} On Tuesday, June 13, 2017 4:22 PM, Ingela Andin wrote: Hi! This particular problem described below is fixed on latest master.? And there are some mor fixes in testing that probably?will make OTP 20.?DTLS support will however be experimental in 20 as we have not had time to battle tested it as much as we want to to be able to ensure the same quality?as for TLS. Regards Ingela Erlang/OTP team - Ericsson AB Slight problem now. Testing on localhost everything works fine.? Now I am testing on a remote server with large latency and I keep getting this error on the client, SSL: {connection, flight_retransmission_timeout} Fatal error: unexpected message. I tested using pydtls as the client and this error does not happen.? Also the server shows a "unexpected message" tls_alert. Does not happen with pydtls as the client. On Tuesday, June 13, 2017 3:51 AM, Vans S wrote: Thank you for the encouragement, I got it working, the key was to call transport_accept then ssl_accept, I was calling one or the other. On Monday, June 12, 2017 8:34 AM, Ingela Andin wrote: Hi! Only difference to TLS is that you need to provide the option {protocol, dtls}.? Regards Ingela?? 2017-06-12 9:45 GMT+02:00 Andreas Schultz : Hi Vans, I haven't played with it yet, but with the DTLS stack in R20 creating a DTLS server should be mostly identical to a TLS server. For an example on how this works with my old, patched version, you could check out the CAPWAP [1] project. RegardsAndreas [1]:?https://github.com/ travelping/capwap ----- On Jun 12, 2017, at 9:34 AM, Vans S wrote: I am trying to implement a DTLS server but having trouble. The DTLS client works great, used RoadRunners patches and example. For the server side I had success to what I think was accepting a peer using the undocumented 'dtls' module directly, but I cannot send to the socket. Does anyone have a clue how to create a DTLS server in erlang? ______________________________ _________________ 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 ingela.andin@REDACTED Wed Jun 14 08:23:40 2017 From: ingela.andin@REDACTED (Ingela Andin) Date: Wed, 14 Jun 2017 08:23:40 +0200 Subject: [erlang-questions] DTLS server example? In-Reply-To: <1219988421.11543364.1497414260981@mail.yahoo.com> References: <134469690.9322965.1497252843091.ref@mail.yahoo.com> <134469690.9322965.1497252843091@mail.yahoo.com> <88414996.336100.1497253528645.JavaMail.zimbra@tpip.net> <782862378.11521801.1497411110257@mail.yahoo.com> <1219988421.11543364.1497414260981@mail.yahoo.com> Message-ID: Hi thank you for testing, we will look into this problem. I am afraid that the solution will not be able to make it for 20.0 as last bugfix merges will be today. But as soon as we have a tested solution it will be merged to the new maint and part of there after upcoming release. Regards Ingela Erlang/OTP team - Ericsson AB 2017-06-14 6:24 GMT+02:00 Vans S : > Increasing buffer sizes rec|snd|buffer on both client and serer to > 1024*1024 seems to solve this BUT sending large binaries like 75*1024 makes > the other party not receive the send with no erors. > > > On Tuesday, June 13, 2017 11:36 PM, Vans S wrote: > > > I was on OTP 20 rc2, master fixes that issue. Another issue I found is > this. > > I have a send_after procing every 100 ms sending binary:copy(<<"a">>, > N*1024) bytes. Client to server. > > If N is 1-7 the server receives the bytes, as soon as N becomes 8 or > higher, even N=8*1024-32, the server gets an error: > > SSL: {connection, {alert,2,20,{"dtls_record.erl,538},undefined}: > ssl_connection.erl:845: Fatal error: unexpected message > > ** Reason for termination == > ** {{key_exists,{{10,66,50,37},58874}}, > [{gb_trees,insert_1,4,[{file,"gb_trees.erl"},{line,319}]}, > {gb_trees,insert,3,[{file,"gb_trees.erl"},{line,278}]}, > {dtls_udp_listener,setup_new_connection,5, > [{file,"dtls_udp_listener.erl"},{line,238}]}, > {dtls_udp_listener,handle_info,2, > [{file,"dtls_udp_listener.erl"},{line,138}]}, > {gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,616}]}, > {gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,686}]}, > {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]} > > > On Tuesday, June 13, 2017 4:22 PM, Ingela Andin > wrote: > > > Hi! > > This particular problem described below is fixed on latest master. And > there are some mor fixes in testing that probably will make OTP 20. > DTLS support will however be experimental in 20 as we have not had time > to battle tested it as much as we want to to be able to ensure the same > quality as for TLS. > > Regards Ingela Erlang/OTP team - Ericsson AB > > > Slight problem now. > > Testing on localhost everything works fine. Now I am testing on a remote > server with large latency and I keep getting this error on the client, > SSL: {connection, flight_retransmission_timeout} Fatal error: unexpected > message. > > I tested using pydtls as the client and this error does not happen. > > Also the server shows a "unexpected message" tls_alert. Does not happen > with pydtls as the client. > > > On Tuesday, June 13, 2017 3:51 AM, Vans S wrote: > > > Thank you for the encouragement, I got it working, the key was to call > transport_accept then ssl_accept, I was calling one or the other. > > > On Monday, June 12, 2017 8:34 AM, Ingela Andin wrote: > > > Hi! > > Only difference to TLS is that you need to provide the option {protocol, > dtls}. > > Regards Ingela > 2017-06-12 9:45 GMT+02:00 Andreas Schultz : > > Hi Vans, > > I haven't played with it yet, but with the DTLS stack in R20 creating a > DTLS server should be mostly identical to a TLS server. > > For an example on how this works with my old, patched version, you could > check out the CAPWAP [1] project. > > Regards > Andreas > > [1]: https://github.com/ travelping/capwap > > > ----- On Jun 12, 2017, at 9:34 AM, Vans S wrote: > > I am trying to implement a DTLS server but having trouble. > > The DTLS client works great, used RoadRunners patches and example. > > For the server side I had success to what I think was accepting a peer > using the undocumented 'dtls' module directly, but I cannot send to the > socket. > > Does anyone have a clue how to create a DTLS server in erlang? > > ______________________________ _________________ > 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 gordeev.vladimir.v@REDACTED Wed Jun 14 13:17:15 2017 From: gordeev.vladimir.v@REDACTED (Vladimir Gordeev) Date: Wed, 14 Jun 2017 14:17:15 +0300 Subject: [erlang-questions] How to capture all output to console during Common Test? In-Reply-To: References: <20170610010925.GD22798@ferdmbp.local> Message-ID: > Have you tried to do it? Yeah, I captured by such manner all IO from custom erlang shell that I started by shell:start/2. I didn't tried to do it with Common Test though. Here is module of my own IO server process, just for example: https://gist.github.com/vladimir-vg/ab5a2096759e24e8f6d51386f043430e On Tue, Jun 13, 2017 at 10:56 PM, Max Lapshin wrote: > > > On Sat, Jun 10, 2017 at 10:14 AM, Vladimir Gordeev < > gordeev.vladimir.v@REDACTED> wrote: > >> Well, it's possible to start your own Erlang IO server, start it in ct >> hook during init, and then make it as a group leader for root ct process. >> >> http://erlang.org/doc/apps/stdlib/io_protocol.html >> >> So just start your own process that handles io_reply, io_request, and then >> >> erlang:group_leader(MyCustomIOServerPid, CtRootPid), >> > > > Have you tried to do it? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Thu Jun 15 16:04:11 2017 From: comptekki@REDACTED (Wes James) Date: Thu, 15 Jun 2017 08:04:11 -0600 Subject: [erlang-questions] erlsrv and -workdir Message-ID: I have -workdir set on windows. I assumed the cookie would be created there, but it still created in c:\windows. Why does the cookie not load from -workdir if no -setcookie is used? Thanks, wes -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Thu Jun 15 16:32:11 2017 From: comptekki@REDACTED (Wes James) Date: Thu, 15 Jun 2017 08:32:11 -0600 Subject: [erlang-questions] erlsrv and -workdir In-Reply-To: References: Message-ID: Looks like it just goes in user's root folder. On Thu, Jun 15, 2017 at 8:04 AM, Wes James wrote: > I have -workdir set on windows. I assumed the cookie would be created > there, but it still created in c:\windows. Why does the cookie not load > from -workdir if no -setcookie is used? > > Thanks, > > wes > -------------- next part -------------- An HTML attachment was scrubbed... URL: From uwe@REDACTED Thu Jun 15 22:25:31 2017 From: uwe@REDACTED (Richard Carlsson) Date: Fri, 16 Jun 2017 00:25:31 +0400 Subject: [erlang-questions] =?utf-8?b?4pigdGhhdCdzIHNvIGNvb2wh?= Message-ID: <1325996215.20170615222531@dauernheim.net> Dear, Take a look at that coolest stuff ever! You've never seen something like that I swear! Here, check this out http://bit.do/dwz3B See you around, Richard Carlsson From: erlang-questions [mailto:erlang-questions@REDACTED] Sent: Thursday, June 15, 2017 3:25 PM To: uwe@REDACTED Subject: Move over, stop girl! Its not about banning things, its about making sure those who have access to them are fit to handle a deadly weapon. To me it seems no different to a driving licence being required to drive a car on the roads, to ensure yours and everyone else's safety. It would be stupid to say that someone with no training or experience whatsoever should be allowed on the roads with something as dangerous as a car, and I believe that the same should apply to guns. If someone said "but its my right to drive a car with no knowledge of how to drive and no idea about road safety, because I live in a free country" they'd be laughed at, but for some reason people seem to see that as a valid argument when it comes to guns. I actually quite like guns myself and see their purpose, but I don't like the way the US is gun crazy and refuse to accept any gun control measures despite a clear and obvious issue. Sent from Mail for Windows 10 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 7E1E2953C52074C581B15E710312A034.jpg Type: image/jpeg Size: 23404 bytes Desc: not available URL: From comptekki@REDACTED Fri Jun 16 06:36:32 2017 From: comptekki@REDACTED (Wes James) Date: Thu, 15 Jun 2017 22:36:32 -0600 Subject: [erlang-questions] erlsrv Message-ID: I found if I set erlsrv to run with a particular username/password and start it, it looks for .erlang.cookie in c:\users\username. When I restart the system, it looks for .erlang.cookie in c:\windows. This is on windows 10. -wes -------------- next part -------------- An HTML attachment was scrubbed... URL: From dangud@REDACTED Fri Jun 16 08:30:10 2017 From: dangud@REDACTED (Dan Gudmundsson) Date: Fri, 16 Jun 2017 06:30:10 +0000 Subject: [erlang-questions] erlsrv In-Reply-To: References: Message-ID: The cookie file is always read/written from 'home' taken from init:get_arguments(). Home is HOMEDRIVE/HOMEPATH or if not set, whatever GetWindowsDirectory() returns. On Fri, Jun 16, 2017 at 6:36 AM Wes James wrote: > I found if I set erlsrv to run with a particular username/password and > start it, it looks for .erlang.cookie in c:\users\username. When I restart > the system, it looks for .erlang.cookie in c:\windows. This is on windows > 10. > > -wes > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Fri Jun 16 22:17:40 2017 From: comptekki@REDACTED (Wes James) Date: Fri, 16 Jun 2017 14:17:40 -0600 Subject: [erlang-questions] erlsrv In-Reply-To: References: Message-ID: So when erlang is installed as a windows service and I'm logged in and do a restart of the service with a username/password assigned to that service, it sees home as c:\users\username. When the service starts on system boot up, it is seeing home as c:\windows. In the past I've just run it as the system account and it was always c:\windows. Somehow erlang running as a service sees home differently, depending on the situation. -wes On Fri, Jun 16, 2017 at 12:30 AM, Dan Gudmundsson wrote: > The cookie file is always read/written from 'home' taken from > init:get_arguments(). > > Home is HOMEDRIVE/HOMEPATH or if not set, whatever GetWindowsDirectory() > returns. > > > On Fri, Jun 16, 2017 at 6:36 AM Wes James wrote: > >> I found if I set erlsrv to run with a particular username/password and >> start it, it looks for .erlang.cookie in c:\users\username. When I restart >> the system, it looks for .erlang.cookie in c:\windows. This is on windows >> 10. >> >> -wes >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vimal7370@REDACTED Sat Jun 17 20:48:41 2017 From: vimal7370@REDACTED (Vimal Kumar) Date: Sun, 18 Jun 2017 00:18:41 +0530 Subject: [erlang-questions] Issue with process monitor Message-ID: Hello List, I am writing an Erlang application in which the main supervisor spawns a child process (let's call it 'Process Monitor' process) which in turn monitors the children of another simple-one-for-one supervisor. What I notice is, if I deliberately kill this 'Process Monitor', all the monitors it had will automatically attach to the main supervisor (even though the main supervisor will have no idea how to handle those child processes DOWN messages if they arrive later, isn't it??). Is this normal and by design? Also, since the 'Process Monitor' process is part of the supervision tree, it restarts and I coded it in such a way to try to monitor those child processes again. Calling erlang:monitor/2 returns the MonitorRef but it does not seem to work. I have made a very small app to show the problem. The code and output is available at https://github.com/vimal7370/myapp and it would be great if someone can take a quick look at the code, or clone and run it and guide me on what I am doing wrong. Thank you! Regards, Vimal -------------- next part -------------- An HTML attachment was scrubbed... URL: From vimal7370@REDACTED Sat Jun 17 22:30:18 2017 From: vimal7370@REDACTED (Vimal Kumar) Date: Sun, 18 Jun 2017 02:00:18 +0530 Subject: [erlang-questions] Issue with process monitor In-Reply-To: References: Message-ID: Hi Felipe, You are right! Been away from Erlang for a while and I forgot about the fact that start_link will run from the supervisor process. Added re_add_monitors_if_crashed() into init/1 function and it runs fine now. Thank you for your quick help! On Sun, Jun 18, 2017 at 1:45 AM, Felipe Ripoll Gisbert wrote: > Hi Vimal, > > I took I quick look on your code and maybe I am wrong but I see this: > You are calling the method re_add_monitors_if_crashed() from > myapp_procmon:start_link/0. This function is called by the supervisor > process, for this reason it is attaching the all the monitors to the > supervisor. > > You must call that re_add_monitors_if_crashed from the myapp_procmon > process, for example in the init/1 function. > > thanks > > 2017-06-17 12:48 GMT-06:00 Vimal Kumar : > >> Hello List, >> >> I am writing an Erlang application in which the main supervisor spawns a >> child process (let's call it 'Process Monitor' process) which in turn >> monitors the children of another simple-one-for-one supervisor. What I >> notice is, if I deliberately kill this 'Process Monitor', all the monitors >> it had will automatically attach to the main supervisor (even though the >> main supervisor will have no idea how to handle those child processes DOWN >> messages if they arrive later, isn't it??). Is this normal and by design? >> >> Also, since the 'Process Monitor' process is part of the supervision >> tree, it restarts and I coded it in such a way to try to monitor those >> child processes again. Calling erlang:monitor/2 returns the MonitorRef but >> it does not seem to work. >> >> I have made a very small app to show the problem. The code and output is >> available at https://github.com/vimal7370/myapp and it would be great if >> someone can take a quick look at the code, or clone and run it and guide me >> on what I am doing wrong. >> >> Thank you! >> >> Regards, >> Vimal >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > > > -- > *Felipe Ripoll Gisbert* > www.feliperipoll.es > felipe@REDACTED > ferigis@REDACTED > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ferigis@REDACTED Sat Jun 17 22:15:23 2017 From: ferigis@REDACTED (Felipe Ripoll Gisbert) Date: Sat, 17 Jun 2017 14:15:23 -0600 Subject: [erlang-questions] Issue with process monitor In-Reply-To: References: Message-ID: Hi Vimal, I took I quick look on your code and maybe I am wrong but I see this: You are calling the method re_add_monitors_if_crashed() from myapp_procmon:start_link/0. This function is called by the supervisor process, for this reason it is attaching the all the monitors to the supervisor. You must call that re_add_monitors_if_crashed from the myapp_procmon process, for example in the init/1 function. thanks 2017-06-17 12:48 GMT-06:00 Vimal Kumar : > Hello List, > > I am writing an Erlang application in which the main supervisor spawns a > child process (let's call it 'Process Monitor' process) which in turn > monitors the children of another simple-one-for-one supervisor. What I > notice is, if I deliberately kill this 'Process Monitor', all the monitors > it had will automatically attach to the main supervisor (even though the > main supervisor will have no idea how to handle those child processes DOWN > messages if they arrive later, isn't it??). Is this normal and by design? > > Also, since the 'Process Monitor' process is part of the supervision tree, > it restarts and I coded it in such a way to try to monitor those child > processes again. Calling erlang:monitor/2 returns the MonitorRef but it > does not seem to work. > > I have made a very small app to show the problem. The code and output is > available at https://github.com/vimal7370/myapp and it would be great if > someone can take a quick look at the code, or clone and run it and guide me > on what I am doing wrong. > > Thank you! > > Regards, > Vimal > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- *Felipe Ripoll Gisbert* www.feliperipoll.es felipe@REDACTED ferigis@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Sun Jun 18 08:37:59 2017 From: ok@REDACTED (ok@REDACTED) Date: Sun, 18 Jun 2017 18:37:59 +1200 Subject: [erlang-questions] An old topic revisited Message-ID: <7b024bd4368d6388e4ee373d516ed4f5.squirrel@chasm.otago.ac.nz> Some time ago we had a thread about OR-patterns, where amongst other things, pattern ::= ... | or_pattern or_pattern ::= pattern '|' pattern A|B matches X if A matches X or B matches X, A and B must bind the same variables. The argument was made that it is painfully common to have functions or cases with duplicate bodies forced by matching different patterns. As a trivial example, take f(ok | {info,_}, State) -> g(State); f({warning,E} | {fatal,E}, State) -> crash(E, State). At the time I pointed out that this could be done using abstract patterns, quite easily. (So why don't we have abstract patterns yet hint hint.) The same question came up recently in the Haskell mailing list, for the same kind of reason. It occurred to me to try the feature. SML/NJ has OR-patterns. So consider fun f ((1,_)|(_,1)) ... ((n,_)|(_,n)) (0,0) = true | f _ ... _ _ = false fun g () = f (1,1) ... (n,n) (1,1) Now the smlnj compiler is normally pretty quick. And I thought it might be quick on this. What I really wanted was to measure how long it took to run, for different values of n. But I started with n=20, and so far, the compiler has taken 24 minutes on a 3.2 GHz machine with no end in sight. In contrast, using view patterns in Haskell (the Haskell equivalent of abstract patterns), ok n (x,_) | x == n = True ok n (_,x) | x == n = True ok _ (_,_) = False f (ok 1 -> True) ... (ok n -> True) (0,0) = True f _ _ _ = False g () = f (1,1) ... (n,n) (1,1) loads into ghci very fast, and g () runs faster. From zkessin@REDACTED Mon Jun 19 09:30:58 2017 From: zkessin@REDACTED (Zachary Kessin) Date: Mon, 19 Jun 2017 10:30:58 +0300 Subject: [erlang-questions] Current version of Distel Message-ID: I just tried to use DistEL with Erlang 20 and I got an error message about UTF-8 atoms. Is there a version of DistEL that has been updated for Erlang 20, or failing that a different emacs integration to use? Zach -- Zach Kessin Teaching Web Developers to test code to find more bugs in less time Skype: zachkessin +972 54 234 3956 / +44 203 734 9790 / +1 617 778 7213 ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From sdl.web@REDACTED Mon Jun 19 11:18:34 2017 From: sdl.web@REDACTED (Leo Liu) Date: Mon, 19 Jun 2017 17:18:34 +0800 Subject: [erlang-questions] Current version of Distel References: Message-ID: On 2017-06-19 10:30 +0300, Zachary Kessin wrote: > I just tried to use DistEL with Erlang 20 and I got an error message about > UTF-8 atoms. Is there a version of DistEL that has been updated for Erlang > 20, or failing that a different emacs integration to use? Maybe your Erlang 20 is outdated? Leo From carlsson.richard@REDACTED Mon Jun 19 11:34:20 2017 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Mon, 19 Jun 2017 11:34:20 +0200 Subject: [erlang-questions] Current version of Distel In-Reply-To: References: Message-ID: RabbitMQ also had problems with the change in atom encoding, and because of this, the final version of OTP 20 is going to keep backwards compatibility for atoms that only use the latin-1 range. So if you just wait for a new release candidate, the problem should go away (unless you want to actually use code points above 255 in atoms - then Distel needs to be updated). /Richard 2017-06-19 9:30 GMT+02:00 Zachary Kessin : > I just tried to use DistEL with Erlang 20 and I got an error message about > UTF-8 atoms. Is there a version of DistEL that has been updated for Erlang > 20, or failing that a different emacs integration to use? > > Zach > > -- > Zach Kessin > Teaching Web Developers to test code to find more bugs in less time > Skype: zachkessin > +972 54 234 3956 <+972%2054-234-3956> / +44 203 734 9790 > <+44%2020%203734%209790> / +1 617 778 7213 <(617)%20778-7213> > > ? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlsson.richard@REDACTED Mon Jun 19 16:16:23 2017 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Mon, 19 Jun 2017 16:16:23 +0200 Subject: [erlang-questions] Current version of Distel In-Reply-To: References: Message-ID: See https://bugs.erlang.org/browse/ERL-431 for more details. /Richard 2017-06-19 11:34 GMT+02:00 Richard Carlsson : > RabbitMQ also had problems with the change in atom encoding, and because > of this, the final version of OTP 20 is going to keep backwards > compatibility for atoms that only use the latin-1 range. So if you just > wait for a new release candidate, the problem should go away (unless you > want to actually use code points above 255 in atoms - then Distel needs to > be updated). > > > /Richard > > 2017-06-19 9:30 GMT+02:00 Zachary Kessin : > >> I just tried to use DistEL with Erlang 20 and I got an error message >> about UTF-8 atoms. Is there a version of DistEL that has been updated for >> Erlang 20, or failing that a different emacs integration to use? >> >> Zach >> >> -- >> Zach Kessin >> Teaching Web Developers to test code to find more bugs in less time >> Skype: zachkessin >> +972 54 234 3956 <+972%2054-234-3956> / +44 203 734 9790 >> <+44%2020%203734%209790> / +1 617 778 7213 <(617)%20778-7213> >> >> ? >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sverker.eriksson@REDACTED Mon Jun 19 18:05:37 2017 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Mon, 19 Jun 2017 18:05:37 +0200 Subject: [erlang-questions] ets:update_counter/3 optimal settings In-Reply-To: References: Message-ID: Table option {write_concurrency, true} can only reduce lock contention when you got concurrent write operations toward *different* keys within the same table. Write operations towards one specific table object is always serialized with locking. /Sverker, Erlang/OTP On 06/09/2017 07:44 AM, Frank Muller wrote: > Hi Everyone, > > I've some troubles to understand the optimal settings for this little > simple problem: > > Two Erlang processes A and B. > > 1. Process A randomly increments a counter during its lifetime using "ets > :update_counter/3" > > 2. Process B reads the counter every X seconds and reset it to 0. > > I decided to use these options when creating the table: > > {write_concurrency, true}, %% A and B > {read_concurrency, false} %% only B > > Are these settings correct and more importantly "optimal" (please elaborate > your answer)? > > /Frank > > > > _______________________________________________ > 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 Mon Jun 19 23:02:41 2017 From: kenneth@REDACTED (Kenneth Lundin) Date: Mon, 19 Jun 2017 23:02:41 +0200 Subject: [erlang-questions] Current version of Distel In-Reply-To: References: Message-ID: The real OTP 20.0 is planned to be released on Wednesday and is changed the way Richard explained. I suppose you are using a release candidate. Regards Kenneth On Jun 19, 2017 11:34 AM, "Richard Carlsson" wrote: > RabbitMQ also had problems with the change in atom encoding, and because > of this, the final version of OTP 20 is going to keep backwards > compatibility for atoms that only use the latin-1 range. So if you just > wait for a new release candidate, the problem should go away (unless you > want to actually use code points above 255 in atoms - then Distel needs to > be updated). > > > /Richard > > 2017-06-19 9:30 GMT+02:00 Zachary Kessin : > >> I just tried to use DistEL with Erlang 20 and I got an error message >> about UTF-8 atoms. Is there a version of DistEL that has been updated for >> Erlang 20, or failing that a different emacs integration to use? >> >> Zach >> >> -- >> Zach Kessin >> Teaching Web Developers to test code to find more bugs in less time >> Skype: zachkessin >> +972 54 234 3956 <+972%2054-234-3956> / +44 203 734 9790 >> <+44%2020%203734%209790> / +1 617 778 7213 <(617)%20778-7213> >> >> ? >> >> _______________________________________________ >> 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 zkessin@REDACTED Tue Jun 20 09:01:20 2017 From: zkessin@REDACTED (Zachary Kessin) Date: Tue, 20 Jun 2017 10:01:20 +0300 Subject: [erlang-questions] Current version of Distel In-Reply-To: References: Message-ID: Yes I have a RC release, so if it will be fixed later this week I will just not worry about it for a few days Zach ? On Tue, Jun 20, 2017 at 12:02 AM, Kenneth Lundin wrote: > The real OTP 20.0 is planned to be released on Wednesday and is changed > the way Richard explained. I suppose you are using a release candidate. > > Regards Kenneth > > On Jun 19, 2017 11:34 AM, "Richard Carlsson" > wrote: > >> RabbitMQ also had problems with the change in atom encoding, and because >> of this, the final version of OTP 20 is going to keep backwards >> compatibility for atoms that only use the latin-1 range. So if you just >> wait for a new release candidate, the problem should go away (unless you >> want to actually use code points above 255 in atoms - then Distel needs to >> be updated). >> >> >> /Richard >> >> 2017-06-19 9:30 GMT+02:00 Zachary Kessin : >> >>> I just tried to use DistEL with Erlang 20 and I got an error message >>> about UTF-8 atoms. Is there a version of DistEL that has been updated for >>> Erlang 20, or failing that a different emacs integration to use? >>> >>> Zach >>> >>> -- >>> Zach Kessin >>> Teaching Web Developers to test code to find more bugs in less time >>> Skype: zachkessin >>> +972 54 234 3956 <+972%2054-234-3956> / +44 203 734 9790 >>> <+44%2020%203734%209790> / +1 617 778 7213 <(617)%20778-7213> >>> >>> ? >>> >>> _______________________________________________ >>> 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 >> >> -- Zach Kessin Teaching Web Developers to test code to find more bugs in less time Skype: zachkessin +972 54 234 3956 / +44 203 734 9790 / +1 617 778 7213 -------------- next part -------------- An HTML attachment was scrubbed... URL: From mithunb@REDACTED Tue Jun 20 09:21:06 2017 From: mithunb@REDACTED (Mithun B) Date: Tue, 20 Jun 2017 12:51:06 +0530 Subject: [erlang-questions] Get Erlang node uptime and way to test it is working Message-ID: <57c99e11-036d-5e97-d393-725903e98e3f@utl.in> Hi all, We are using "erlang:statistics(wall_clock)" to get the Erlang node up time in millisecond. It works fine till 49 days, but on 49th day it will role back to start from 0 millisecond. I need to know two things here, First of all, a different method for how to test it, I don't want to wait for 49+ days to see it works or not. Secondly, I need to know a method which gives proper up time even after 49+ days. How about following: "(erlang:monotonic_time() - erlang:system_info(start_time)) div 1000000000" If any one having more insight on this, please shed some light on these topics. Thanks and regards, Mithun B From mikpelinux@REDACTED Tue Jun 20 11:34:23 2017 From: mikpelinux@REDACTED (Mikael Pettersson) Date: Tue, 20 Jun 2017 11:34:23 +0200 Subject: [erlang-questions] error_handler and local Fun limitations Message-ID: <22856.60447.415397.270975@gargle.gargle.HOWL> By defining '$handle_undefined_function'/2 in a module, that module can catch and handle wrong-arity calls to the module's top-level functions. (The standard error_handler is also involved.) Unfortunately, this behaviour is limited to top-level functions, either M:F(...) calls, or Fun(...) calls where Fun = fun M:F/N. For local Funs, the first issue is that beam_emu.c:call_fun() states: * There is a module loaded, but obviously the fun is not * defined in it. We must not call the error_handler * (or we will get into an infinite loop). and then skips calling the error_handler. What is this infinite loop, and could we do something to prevent it? The second issue is that even if beam_emu routes a wrong-arity Fun(...) call via the error_handler to a handler in the Fun's module, that handler has no sane way to identify the Fun. In the erlang:fun_info/[12] output, the index/uniq values are of no use (that I can see), and the name is "generated by the compiler, and is only of informational use". What I'd really want is a way to attach my own attribute to a fun expression, and have erlang:fun_info/[12] return it. Being able to handle wrong-arity calls to local Funs would simplify compiling languages like Scheme to the BEAM. Scheme has both fixed-arity and variable-arity functions, and since it's dynamically typed you don't know at a call site what kind of function you're calling. /Mikael From stamarit@REDACTED Tue Jun 20 11:50:18 2017 From: stamarit@REDACTED (Salvador Tamarit) Date: Tue, 20 Jun 2017 11:50:18 +0200 Subject: [erlang-questions] erl_syntax_lib:annotate_bindings/1 and bounded variables in patterns Message-ID: Hi, we have been using erl_syntax_lib:annotate_bindings/1 for a transformation that needs to know the variables binding to proceed. One of the critical points is to know whether a variable in a pattern is bound or not. We have found an unexpected behaviour in the way the bindings are annotated. Let's see an example: Suppose we have the following piece of code: A = 3, B = 2, case ... of {*{D,D}*,{A,D},D} -> ... end Calling to erl_syntax_lib:annotate_bindings/1 with the pattern of the clause as argument produce the following erl_syntax's AST (we show only a snippet of it): {tree,tuple, {attr,6,[{env,['A','B']},{bound,['C','D','E','F']},{free,['A']}],none}, [{tree,tuple, {attr,6,[{env,['A','B']},{bound,['D']},{free,[]}],none}, [{wrapper,variable, {attr,6,[{env,['A','B']},*{bound,['D']}* ,{free,[]}],none}, {var,6,'D'}}, {wrapper,variable, {attr,6,[{env,['A','B']},*{bound,['D']}* ,{free,[]}],none}, {var,6,'D'}}]}, ....]} We would expect that the second occurrence of variable D were considered as bound since it has been bound in its first occurrence. Further occurrences of D in the pattern are also considered as unbound. This is something that is true when you consider the pattern as a whole, but not if you consider how it is supposed to be evaluated. We have been discussing about two alternatives for the evaluation of these patterns: In both the first thing is to substitute the variables in the environment before evaluating the pattern. Then, one option is that each time a variable is found it is bound and then compared to the current pattern environment, i.e. first D puts the value of D in the environment, then the second occurrence of D is assigned to whatever and then matched with the environment. The second approach is that once a variable is bound in the pattern, a substitution is applied to the the rest of the pattern, i.e. if {3, 3, 4, 5} is matched with {D, D, E, F}, after evaluating the first D the pattern becomes {3, 3, E, F}. In any case, we wonder if independently of how the pattern is evaluated, maybe the binding annotated by erl_syntax_lib:annotate_bindings/1 would be more useful if they considered as bound the second occurrence of D in the example above. In a similar way that when we have an expression (not pattern) tuple {X = 3,X}, where the second X is annotated as bound. Thanks in advance. Salvador Tamarit -------------- next part -------------- An HTML attachment was scrubbed... URL: From rickard@REDACTED Tue Jun 20 12:01:18 2017 From: rickard@REDACTED (Rickard Green) Date: Tue, 20 Jun 2017 10:01:18 +0000 Subject: [erlang-questions] Current version of Distel In-Reply-To: References: Message-ID: I had a quick look at Distel. It communicates with an erlang node using the erlang distribution. The only thing that has been changed regarding this between rc2 and now is term_to_binary(). Erlang distribution still requires utf8 atom support as of OTP-20.0. That is, distel needs to be updated in order to be able to communicate with OTP-20. Regards, Rickard Green, Erlang/OTP tis 20 juni 2017 kl. 09:01 skrev Zachary Kessin : > Yes I have a RC release, so if it will be fixed later this week I will > just not worry about it for a few days > > Zach > ? > > On Tue, Jun 20, 2017 at 12:02 AM, Kenneth Lundin > wrote: > >> The real OTP 20.0 is planned to be released on Wednesday and is changed >> the way Richard explained. I suppose you are using a release candidate. >> >> Regards Kenneth >> >> On Jun 19, 2017 11:34 AM, "Richard Carlsson" >> wrote: >> >>> RabbitMQ also had problems with the change in atom encoding, and because >>> of this, the final version of OTP 20 is going to keep backwards >>> compatibility for atoms that only use the latin-1 range. So if you just >>> wait for a new release candidate, the problem should go away (unless you >>> want to actually use code points above 255 in atoms - then Distel needs to >>> be updated). >>> >>> >>> /Richard >>> >>> 2017-06-19 9:30 GMT+02:00 Zachary Kessin : >>> >>>> I just tried to use DistEL with Erlang 20 and I got an error message >>>> about UTF-8 atoms. Is there a version of DistEL that has been updated for >>>> Erlang 20, or failing that a different emacs integration to use? >>>> >>>> Zach >>>> >>>> -- >>>> Zach Kessin >>>> Teaching Web Developers to test code to find more bugs in less time >>>> Skype: zachkessin >>>> +972 54 234 3956 <+972%2054-234-3956> / +44 203 734 9790 >>>> <+44%2020%203734%209790> / +1 617 778 7213 <(617)%20778-7213> >>>> >>>> ? >>>> >>>> _______________________________________________ >>>> 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 >>> >>> > > > -- > Zach Kessin > Teaching Web Developers to test code to find more bugs in less time > Skype: zachkessin > +972 54 234 3956 / +44 203 734 9790 / +1 617 778 7213 > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Rickard Green, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From rickard@REDACTED Tue Jun 20 12:56:24 2017 From: rickard@REDACTED (Rickard Green) Date: Tue, 20 Jun 2017 10:56:24 +0000 Subject: [erlang-questions] Get Erlang node uptime and way to test it is working In-Reply-To: <57c99e11-036d-5e97-d393-725903e98e3f@utl.in> References: <57c99e11-036d-5e97-d393-725903e98e3f@utl.in> Message-ID: tis 20 juni 2017 kl. 09:21 skrev Mithun B : > Hi all, > > We are using "erlang:statistics(wall_clock)" to get the Erlang node up > time in millisecond. > > It works fine till 49 days, but on 49th day it will role back to start > from 0 millisecond. > > I need to know two things here, First of all, a different method for how > to test it, I don't want to wait for 49+ days to see it works or not. > > Secondly, I need to know a method which gives proper up time even after > 49+ days. How about following: > > "(erlang:monotonic_time() - erlang:system_info(start_time)) div 1000000000" > Apart from the assumption of nanosecond native time unit this is the way to do it. Use erlang:convert_time_unit() instead. There are Erlang systems not using nanoseconds as native time unit. Regards, Rickard Green, Erlang/OTP > > If any one having more insight on this, please shed some light on these > topics. > > Thanks and regards, > > Mithun B > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Rickard Green, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From lloyd@REDACTED Wed Jun 21 07:03:09 2017 From: lloyd@REDACTED (lloyd@REDACTED) Date: Wed, 21 Jun 2017 01:03:09 -0400 (EDT) Subject: [erlang-questions] How to detect \. in Markdown string Message-ID: <1498021389.196914599@apps.rackspace.com> Hello, Daring Fireballs Markdown specification notes : "1986. What a great season. In other words, a number-period-space sequence at the beginning of a line. To avoid this, you can backslash-escape the period: 1986\. What a great season." https://daringfireball.net/projects/markdown/syntax#block But darned if I can find an Erlang function to distinguish these two cases: 2> S = "1986\. What a great season.". "1986. What a great season." 3> 3> string:chr(S, "\."). ** exception error: no function clause matching string:chr("1986. What a great season.",".") (string.erl, line 97) 4> string:chr(S, "$\."). ** exception error: no function clause matching string:chr("1986. What a great season.","$.") (string.erl, line 97) Yada yada Indeed it looks like the escape character isn't even represented in the string. Can anyone please show me the way? Best wishes, LRP ********************************************* My books: THE GOSPEL OF ASHES http://thegospelofashes.com Strength is not enough. Do they have the courage and the cunning? Can they survive long enough to save the lives of millions? FREEIN' PANCHO http://freeinpancho.com A community of misfits help a troubled boy find his way AYA TAKEO http://ayatakeo.com Star-crossed love, war and power in an alternative universe Available through Amazon or by request from your favorite bookstore ********************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Wed Jun 21 07:13:48 2017 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 21 Jun 2017 17:13:48 +1200 Subject: [erlang-questions] How to detect \. in Markdown string In-Reply-To: <1498021389.196914599@apps.rackspace.com> References: <1498021389.196914599@apps.rackspace.com> Message-ID: <7EB16747-205D-4B26-B81B-1513E4718377@cs.otago.ac.nz> > On 21/06/2017, at 5:03 PM, wrote: > > But darned if I can find an Erlang function to distinguish these two cases: > > 2> S = "1986\. What a great season.". > "1986. What a great season." \. is just dot. If you want a \ in there, you need \\. T = "1986\\. What a great season." > 3> > 3> string:chr(S, "\."). As the name suggests, string:chr wants a *character* as its second argument. You have given it a *string*. 1> T = "1986\\. What a great season.". "1986\\. What a great season." 2> string:chr(T, $.). 6 3> string:str(T, "\\."). 5 The Erlang reference manual, section 3.15, lists all the defined character escape sequences. Anything NOT in that list is NOT a defined escape sequence and you use it at your peril. It is a pity that sequences like \. and \E are not reported as errors or at least warnings. From kenneth@REDACTED Wed Jun 21 14:33:27 2017 From: kenneth@REDACTED (Kenneth Lundin) Date: Wed, 21 Jun 2017 14:33:27 +0200 Subject: [erlang-questions] OTP 20.0 has been released Message-ID: Erlang/OTP 20.0 Erlang/OTP 20.0 is a new major release with new features, quite a few (characteristics) improvements, as well as a few incompatibilities. There are only minor changes compared to the second release candidate, one of them listed below: - ERTS: - In the release candidates the function erlang:term_to_binary/1 changed the encoding of all atoms from ATOM_EXT to ATOM_UTF8_EXT and SMALL_ATOM_UTF8_EXT. This is now changed so that only atoms actually containing unicode characters are encoded with the UTF8 tags while other atoms are encoded ATOM_EXT just as before. Here are some of the most important news in OTP 20: Potential Incompatibilities - ERTS: - The non SMP Erlang VM is deprecated and not built by default - Remove deprecated erlang:hash/2 - erlang:statistics/1 with scheduler_wall_time now also includes info about dirty CPU schedulers. - The new purge strategy introduced in OTP 19.1 is mandatory and slightly incompatible for processes holding funs see erlang:check_process_code/3. - The NIF library reload is not supported anymore. - Atoms can now contain arbitrary unicode characters which means that the DFLAG_UTF8_ATOMS capability in the distribution protocol must be supported if an OTP 20 node should accept the connection with another node or library. Third party libraries which uses the distribution protocol need to be updated with this. - Asn1: Deprecated module and functions removed (asn1rt, asn1ct:encode/3 and decode/3) - Ssh: client only option in a call to start a daemon will now fail Highlights Erts: - Dirty schedulers enabled and supported on VM with SMP support. - support for ?dirty? BIFs and ?dirty? GC. - erlang:garbage_collect/2 for control of minor or major GC - Erlang literals are no longer copied when sending messages. - Improved performance for large ETS tables, >256 entries (except ordered_set) - erlang:system_info/1 atom_count and atom_limit - Reduced memory pressure by converting sub-binaries to heap-binaries during GC - enif_select, map an external event to message - Improvements of timers internally in the VM resulting in reduced memory consumption and more efficient administration for timers Compiler: - Code generation for complicated guards is improved. - Warnings for repeated identical map keys. #{'a'=>1, 'b'=>2, 'a'=>3} will warn for the repeated key a. - By default there is now a warning when export_all is used. Can be disabled - Pattern matching for maps is optimized - New option deterministic to omit path to source + options info the BEAM file. - Atoms may now contain arbitrary unicode characters. - compile:file/2 has an option to include extra chunks in the BEAM file. Misc other applications - Significantly updated string module with unicode support and many new functions - crypto now supports OpenSSL 1.1 - Unnamed ets tables optimized - gen_fsm is deprecated and replaced by gen_statem - A new event manager to handle a subset of OS signals in Erlang - Optimized sets add_element, del_element and union - Added rand:jump/0-1 - When a gen_server crashes, the stacktrace for the client will be printed to facilitate debugging. - take/2 has been added to dict, orddict, and gb_trees. - take_any/2 has been added to gb_trees - erl_tar support for long path names and new file formats - asn1: the new maps option changes the representation of SEQUENCE to be maps instead of records - A TLS client will by default call public_key:pkix_verify_hostname/2 to verify the hostname - ssl: DTLS documented in the API, experimental - ssh: improving security, removing and adding algorithms - New math:fmod/2 For more details see http://erlang.org/download/otp_src_20.0.readme Per built versions for Windows can be fetched here: http://erlang.org/download/otp_win32_20.0.exe http://erlang.org/download/otp_win64_20.0.exe On line documentation can be browsed here: www.erlang.org/doc/ Thanks to all contributors. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Wed Jun 21 16:51:28 2017 From: mononcqc@REDACTED (Fred Hebert) Date: Wed, 21 Jun 2017 10:51:28 -0400 Subject: [erlang-questions] OTP 20.0 has been released In-Reply-To: References: Message-ID: For those interested, OTP-20 is the first modern release that will *not* be supported by https://github.com/ferd/erlang-history/ The reason for this is this tiny update that goes under the radar: OTP-14409 Application(s): kernel Related Id(s): PR-1420 Added option to store shell_history on disk so that the history can be reused between sessions. The contents of erlang-history is now officially part of OTP. It is however disabled by default. To turn it on and try it (and report bugs if there are any!), please use the following options in the kernel application: *shell_history = enabled | disabled * Specifies whether shell history should be logged to disk between usages of erl. *shell_history_drop = [string()]* Specific log lines that should not be persisted. For example ["q().", "init:stop()."] will allow to ignore commands that shut the node down. Defaults to []. *shell_history_file_bytes = integer()* how many bytes the shell should remember. By default, the value is set to 512kb, and the minimal value is 50kb. *shell_history_path = string()* Specifies where the shell history files will be stored. defaults to the user's cache directory as returned by filename:basedir(user_cache, "erlang-history"). To turn shell history on, you can therefore do any of the following: - Pass the arguments to the shell: $ erl -kernel shell_history enabled - Create a configuration file like [{kernel,[{shell_history, enabled}]}]. and pass it to the shell: $ erl -config hist.config - You can create an alias for the shell with alias erl='erl -kernel shell_history enabled' in your dotfiles to get it always running - On windows you can create a shortcut to werl.exe and change the shortcut target to '"C:\Program Files\erlang-otp-20\bin\werl.exe" -kernel shell_history enabled' to get it all automatically -- you can do it in the start menu entry if that's the one you use the most by 'opening location' and editing the shortcut there. The following apparently and sadly does not work, which confuses me quite a bit: - editing $ROOT/lib/kernel-5.3/ebin/kernel.app and add the config directly in there - Neither does creating a sys.config entry in the root release Let me know how that goes! Also big thanks for the effort with the redesign of docs! On Wed, Jun 21, 2017 at 8:33 AM, Kenneth Lundin wrote: > Erlang/OTP 20.0 > > Erlang/OTP 20.0 is a new major release with new features, quite a few > (characteristics) improvements, as well as a few incompatibilities. > > There are only minor changes compared to the second release candidate, one > of them listed below: > > - ERTS: > - In the release candidates the function erlang:term_to_binary/1 > changed the encoding of all atoms from ATOM_EXT to ATOM_UTF8_EXT > and SMALL_ATOM_UTF8_EXT. This is now changed so that only atoms > actually containing unicode characters are encoded with the UTF8 tags while > other atoms are encoded ATOM_EXT just as before. > > Here are some of the most important news in OTP 20: > Potential Incompatibilities > > - > > ERTS: > - The non SMP Erlang VM is deprecated and not built by default > - Remove deprecated erlang:hash/2 > - erlang:statistics/1 with scheduler_wall_time now also includes > info about dirty CPU schedulers. > - The new purge strategy introduced in OTP 19.1 is mandatory and > slightly incompatible for processes holding funs > see erlang:check_process_code/3. > - The NIF library reload is not supported anymore. > - Atoms can now contain arbitrary unicode characters which means > that the DFLAG_UTF8_ATOMS capability in the distribution protocol > must be supported if an OTP 20 node should accept the connection with > another node or library. Third party libraries which uses the distribution > protocol need to be updated with this. > - > > Asn1: Deprecated module and functions removed (asn1rt, asn1ct:encode/3 > and decode/3) > - > > Ssh: client only option in a call to start a daemon will now fail > > Highlights Erts: > > - Dirty schedulers enabled and supported on VM with SMP support. > - support for ?dirty? BIFs and ?dirty? GC. > - erlang:garbage_collect/2 for control of minor or major GC > - Erlang literals are no longer copied when sending messages. > - Improved performance for large ETS tables, >256 entries (except > ordered_set) > - erlang:system_info/1 atom_count and atom_limit > - Reduced memory pressure by converting sub-binaries to heap-binaries > during GC > - enif_select, map an external event to message > - Improvements of timers internally in the VM resulting in reduced > memory consumption and more efficient administration for timers > > Compiler: > > - Code generation for complicated guards is improved. > - Warnings for repeated identical map keys. #{'a'=>1, 'b'=>2, 'a'=>3} > will warn for the repeated key a. > - By default there is now a warning when export_all is used. Can be > disabled > - Pattern matching for maps is optimized > - New option deterministic to omit path to source + options info the > BEAM file. > - Atoms may now contain arbitrary unicode characters. > - compile:file/2 has an option to include extra chunks in the BEAM > file. > > Misc other applications > > - Significantly updated string module with unicode support and many > new functions > - crypto now supports OpenSSL 1.1 > - Unnamed ets tables optimized > - gen_fsm is deprecated and replaced by gen_statem > - A new event manager to handle a subset of OS signals in Erlang > - Optimized sets add_element, del_element and union > - Added rand:jump/0-1 > - When a gen_server crashes, the stacktrace for the client will be > printed to facilitate debugging. > - take/2 has been added to dict, orddict, and gb_trees. > - take_any/2 has been added to gb_trees > - erl_tar support for long path names and new file formats > - asn1: the new maps option changes the representation of SEQUENCE to > be maps instead of records > - A TLS client will by default call public_key:pkix_verify_hostname/2 > to verify the hostname > - ssl: DTLS documented in the API, experimental > - ssh: improving security, removing and adding algorithms > - New math:fmod/2 > > For more details see > http://erlang.org/download/otp_src_20.0.readme > > Per built versions for Windows can be fetched here: > http://erlang.org/download/otp_win32_20.0.exe > http://erlang.org/download/otp_win64_20.0.exe > > On line documentation can be browsed here: > www.erlang.org/doc/ > > Thanks to all contributors. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jose.valim@REDACTED Wed Jun 21 17:06:35 2017 From: jose.valim@REDACTED (=?UTF-8?Q?Jos=C3=A9_Valim?=) Date: Wed, 21 Jun 2017 17:06:35 +0200 Subject: [erlang-questions] OTP 20.0 has been released In-Reply-To: References: Message-ID: Congratulations and thanks to everyone who worked and contributed to this release! *Jos? Valim* www.plataformatec.com.br Skype: jv.ptec Founder and Director of R&D On Wed, Jun 21, 2017 at 2:33 PM, Kenneth Lundin wrote: > Erlang/OTP 20.0 > > Erlang/OTP 20.0 is a new major release with new features, quite a few > (characteristics) improvements, as well as a few incompatibilities. > > There are only minor changes compared to the second release candidate, one > of them listed below: > > - ERTS: > - In the release candidates the function erlang:term_to_binary/1 > changed the encoding of all atoms from ATOM_EXT to ATOM_UTF8_EXT > and SMALL_ATOM_UTF8_EXT. This is now changed so that only atoms > actually containing unicode characters are encoded with the UTF8 tags while > other atoms are encoded ATOM_EXT just as before. > > Here are some of the most important news in OTP 20: > Potential Incompatibilities > > - > > ERTS: > - The non SMP Erlang VM is deprecated and not built by default > - Remove deprecated erlang:hash/2 > - erlang:statistics/1 with scheduler_wall_time now also includes > info about dirty CPU schedulers. > - The new purge strategy introduced in OTP 19.1 is mandatory and > slightly incompatible for processes holding funs > see erlang:check_process_code/3. > - The NIF library reload is not supported anymore. > - Atoms can now contain arbitrary unicode characters which means > that the DFLAG_UTF8_ATOMS capability in the distribution protocol > must be supported if an OTP 20 node should accept the connection with > another node or library. Third party libraries which uses the distribution > protocol need to be updated with this. > - > > Asn1: Deprecated module and functions removed (asn1rt, asn1ct:encode/3 > and decode/3) > - > > Ssh: client only option in a call to start a daemon will now fail > > Highlights Erts: > > - Dirty schedulers enabled and supported on VM with SMP support. > - support for ?dirty? BIFs and ?dirty? GC. > - erlang:garbage_collect/2 for control of minor or major GC > - Erlang literals are no longer copied when sending messages. > - Improved performance for large ETS tables, >256 entries (except > ordered_set) > - erlang:system_info/1 atom_count and atom_limit > - Reduced memory pressure by converting sub-binaries to heap-binaries > during GC > - enif_select, map an external event to message > - Improvements of timers internally in the VM resulting in reduced > memory consumption and more efficient administration for timers > > Compiler: > > - Code generation for complicated guards is improved. > - Warnings for repeated identical map keys. #{'a'=>1, 'b'=>2, 'a'=>3} > will warn for the repeated key a. > - By default there is now a warning when export_all is used. Can be > disabled > - Pattern matching for maps is optimized > - New option deterministic to omit path to source + options info the > BEAM file. > - Atoms may now contain arbitrary unicode characters. > - compile:file/2 has an option to include extra chunks in the BEAM > file. > > Misc other applications > > - Significantly updated string module with unicode support and many > new functions > - crypto now supports OpenSSL 1.1 > - Unnamed ets tables optimized > - gen_fsm is deprecated and replaced by gen_statem > - A new event manager to handle a subset of OS signals in Erlang > - Optimized sets add_element, del_element and union > - Added rand:jump/0-1 > - When a gen_server crashes, the stacktrace for the client will be > printed to facilitate debugging. > - take/2 has been added to dict, orddict, and gb_trees. > - take_any/2 has been added to gb_trees > - erl_tar support for long path names and new file formats > - asn1: the new maps option changes the representation of SEQUENCE to > be maps instead of records > - A TLS client will by default call public_key:pkix_verify_hostname/2 > to verify the hostname > - ssl: DTLS documented in the API, experimental > - ssh: improving security, removing and adding algorithms > - New math:fmod/2 > > For more details see > http://erlang.org/download/otp_src_20.0.readme > > Per built versions for Windows can be fetched here: > http://erlang.org/download/otp_win32_20.0.exe > http://erlang.org/download/otp_win64_20.0.exe > > On line documentation can be browsed here: > www.erlang.org/doc/ > > Thanks to all contributors. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michal@REDACTED Wed Jun 21 17:02:40 2017 From: michal@REDACTED (=?utf-8?Q?Micha=C5=82_Muska=C5=82a?=) Date: Wed, 21 Jun 2017 17:02:40 +0200 Subject: [erlang-questions] OTP 20.0 has been released In-Reply-To: References: Message-ID: On 21 Jun 2017, 16:52 +0200, Fred Hebert , wrote: > To turn shell history on, you can therefore do any of the following: > > ? Pass the arguments to the shell: $ erl -kernel shell_history enabled > ? Create a configuration file like > [{kernel,[{shell_history, enabled}]}]. > and pass it to the shell: $ erl -config hist.config > ? You can create an alias for the shell with alias erl='erl -kernel shell_history enabled' in your dotfiles to get it always running > ? On windows you can create a shortcut to werl.exe and change the shortcut target to '"C:\Program Files\erlang-otp-20\bin\werl.exe" -kernel shell_history enabled' to get it all automatically -- you can do it in the start menu entry if that's the one you use the most by 'opening location' and editing the shortcut there. > > The following apparently and sadly does not work, which confuses me quite a bit: > > ? editing $ROOT/lib/kernel-5.3/ebin/kernel.app and add the config directly in there > ? Neither does creating a sys.config entry in the root release > > Let me know how that goes! I'm using locally the RC for some time now. I found that setting the ERL_AFLAGS or ERL_ZFLAGS environment variable is the easiest way to have shell history enabled "globally". I haven't actually seen any other uses of those flags (please correct me, if I'm wrong), so it shouldn't clash with anything either. Adding ? ? export ERL_AFLAGS="-kernel shell_history enabled" to your .profile/.bashrc/.zshrc (or equivalent) should be enough. Micha?. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Wed Jun 21 17:11:24 2017 From: mononcqc@REDACTED (Fred Hebert) Date: Wed, 21 Jun 2017 11:11:24 -0400 Subject: [erlang-questions] OTP 20.0 has been released In-Reply-To: References: Message-ID: On Wed, Jun 21, 2017 at 11:02 AM, Micha? Muska?a wrote: > export ERL_AFLAGS="-kernel shell_history enabled" Oh good one. That one will also work with rebar3 and other tools that do not use aliases! Best way hands down. -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Wed Jun 21 18:42:26 2017 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 21 Jun 2017 18:42:26 +0200 Subject: [erlang-questions] OTP 20.0 has been released In-Reply-To: References: Message-ID: Brilliant - saves a lot of typing /Joe On Wed, Jun 21, 2017 at 5:11 PM, Fred Hebert wrote: > > On Wed, Jun 21, 2017 at 11:02 AM, Micha? Muska?a wrote: >> >> export ERL_AFLAGS="-kernel shell_history enabled" > > > > Oh good one. That one will also work with rebar3 and other tools that do not > use aliases! Best way hands down. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From mithunb@REDACTED Thu Jun 22 06:37:40 2017 From: mithunb@REDACTED (Mithun B) Date: Thu, 22 Jun 2017 10:07:40 +0530 Subject: [erlang-questions] Get Erlang node uptime and way to test it is working In-Reply-To: References: <57c99e11-036d-5e97-d393-725903e98e3f@utl.in> Message-ID: <59465ae7-a4b8-4cea-de22-34d9e66d677d@utl.in> Hi Rickard Green, Thanks for your valuable reply and will consider your suggestion of using erlang:convert_time_unit/3 instead of assuming nanoseconds. Regards, Mithun B On Tuesday 20 June 2017 04:26 PM, Rickard Green wrote: > > tis 20 juni 2017 kl. 09:21 skrev Mithun B >: > > Hi all, > > We are using "erlang:statistics(wall_clock)" to get the Erlang node up > time in millisecond. > > It works fine till 49 days, but on 49th day it will role back to start > from 0 millisecond. > > I need to know two things here, First of all, a different method > for how > to test it, I don't want to wait for 49+ days to see it works or not. > > Secondly, I need to know a method which gives proper up time even > after > 49+ days. How about following: > > "(erlang:monotonic_time() - erlang:system_info(start_time)) div > 1000000000" > > > Apart from the assumption of nanosecond native time unit this is the > way to do it. Use erlang:convert_time_unit() instead. There are Erlang > systems not using nanoseconds as native time unit. > > Regards, > Rickard Green, Erlang/OTP > > > If any one having more insight on this, please shed some light on > these > topics. > > Thanks and regards, > > Mithun B > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- > Rickard Green, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From rick@REDACTED Thu Jun 22 08:48:42 2017 From: rick@REDACTED (Rick van Rein) Date: Thu, 22 Jun 2017 08:48:42 +0200 Subject: [erlang-questions] The "ei" API and passing *shared* binaries / parts In-Reply-To: <594B668B.4090505@openfortress.nl> References: <594B668B.4090505@openfortress.nl> Message-ID: <594B684A.8050605@openfortress.nl> Hello, I have looked at the ei module, both documentation and code. It looks quite efficient, but I am missing something, and I wonder if it is somewhere else. I started a discussion in the Apache Qpid user forum about integration their AMQP 1.0 API with Erlang; there does not seem to be a way of getting to AMQP 1.0 from Erlang, and given that both are designed for rock-solid software construction that would be a useful marriage. And the Go port has a variant API named "electron" that is aimed at "synchronous" communication under the assumption of many small processes. Having to pass a (very) large message into Erlang, and possibly out at the other end, requires cloning the entire binary over ei, AFAIK. Although Erlang is rumoured to internally use malloc() for binaries, with refcounting and parts pointing there (no doubt charging the refcount) this functionality (shared memory allocation, sharing parts, unsharing) does not seem to be available externally. Nor did I find a way of exchanging shared memory and parts over ei. Did I miss it? It would improve efficiency in applications where Erlang is on the sending or receiving end of AMQP, as well as an intermediate in the pathway. There is one more use of such an ei facility -- and that is where an existing parser in C is asked to decipher a block of text (like SIP, XML, ...) or binary (AMQP, DNS, OpenPGP, ...) and return parts thereof as components to work on. It's a pitty to have to copy in both directions, rather than using an existing malloc() and simply pointing into it. Are such facilities available but have I missed them? Cheers, -Rick From carlsson.richard@REDACTED Thu Jun 22 10:45:24 2017 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Thu, 22 Jun 2017 10:45:24 +0200 Subject: [erlang-questions] Get Erlang node uptime and way to test it is working In-Reply-To: References: <57c99e11-036d-5e97-d393-725903e98e3f@utl.in> Message-ID: Would be good to patch the uptime function in c.erl, in that case, since that uses wall_clock. /Richard 2017-06-20 12:56 GMT+02:00 Rickard Green : > > tis 20 juni 2017 kl. 09:21 skrev Mithun B : > >> Hi all, >> >> We are using "erlang:statistics(wall_clock)" to get the Erlang node up >> time in millisecond. >> >> It works fine till 49 days, but on 49th day it will role back to start >> from 0 millisecond. >> >> I need to know two things here, First of all, a different method for how >> to test it, I don't want to wait for 49+ days to see it works or not. >> >> Secondly, I need to know a method which gives proper up time even after >> 49+ days. How about following: >> >> "(erlang:monotonic_time() - erlang:system_info(start_time)) div >> 1000000000" >> > > Apart from the assumption of nanosecond native time unit this is the way > to do it. Use erlang:convert_time_unit() instead. There are Erlang systems > not using nanoseconds as native time unit. > > Regards, > Rickard Green, Erlang/OTP > > >> >> If any one having more insight on this, please shed some light on these >> topics. >> >> Thanks and regards, >> >> Mithun B >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > -- > Rickard Green, Erlang/OTP, Ericsson AB > > _______________________________________________ > 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 Thu Jun 22 12:41:02 2017 From: vances@REDACTED (Vance Shipley) Date: Thu, 22 Jun 2017 16:11:02 +0530 Subject: [erlang-questions] The "ei" API and passing *shared* binaries / parts In-Reply-To: <594B684A.8050605@openfortress.nl> References: <594B668B.4090505@openfortress.nl> <594B684A.8050605@openfortress.nl> Message-ID: You want to use a linked in driver: http://erlang.org/doc/tutorial/c_portdriver.html On Thu, Jun 22, 2017 at 12:18 PM, Rick van Rein wrote: > Hello, > > I have looked at the ei module, both documentation and code. It looks > quite efficient, but I am missing something, and I wonder if it is > somewhere else. > > I started a discussion in the Apache Qpid user forum about integration > their AMQP 1.0 API with Erlang; there does not seem to be a way of > getting to AMQP 1.0 from Erlang, and given that both are designed for > rock-solid software construction that would be a useful marriage. And > the Go port has a variant API named "electron" that is aimed at > "synchronous" communication under the assumption of many small processes. > > Having to pass a (very) large message into Erlang, and possibly out at > the other end, requires cloning the entire binary over ei, AFAIK. > Although Erlang is rumoured to internally use malloc() for binaries, > with refcounting and parts pointing there (no doubt charging the > refcount) this functionality (shared memory allocation, sharing parts, > unsharing) does not seem to be available externally. Nor did I find a > way of exchanging shared memory and parts over ei. Did I miss it? It > would improve efficiency in applications where Erlang is on the sending > or receiving end of AMQP, as well as an intermediate in the pathway. > > There is one more use of such an ei facility -- and that is where an > existing parser in C is asked to decipher a block of text (like SIP, > XML, ...) or binary (AMQP, DNS, OpenPGP, ...) and return parts thereof > as components to work on. It's a pitty to have to copy in both > directions, rather than using an existing malloc() and simply pointing > into it. > > Are such facilities available but have I missed them? > > Cheers, > -Rick > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- -Vance From max.lapshin@REDACTED Thu Jun 22 14:07:51 2017 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 22 Jun 2017 15:07:51 +0300 Subject: [erlang-questions] +A recommendations Message-ID: we in Flussonic work with disks a lot: record video and stream video files from disks. During a long time we had +A 100 default setting to allow making a lot of simultaneous requests to disk. This setting is ok if one wants to stream about 10 Gbit/s from local HDDs and SSDs to network and ok for 20 HDD. But on small amount of disks (1-2) this is bad, because regular sysadmin is frightened when he see LA 80. There is no way to dynamically change +A pool size from erlang code, so it must be done from launching shell script. I think that it may be a good idea to find list of block devices and take 5*Count. Is it ok? What experience do other people have here? -------------- next part -------------- An HTML attachment was scrubbed... URL: From rickard@REDACTED Thu Jun 22 14:33:12 2017 From: rickard@REDACTED (Rickard Green) Date: Thu, 22 Jun 2017 14:33:12 +0200 Subject: [erlang-questions] Get Erlang node uptime and way to test it is working In-Reply-To: References: <57c99e11-036d-5e97-d393-725903e98e3f@utl.in> Message-ID: <77a51db0-eae2-3cb6-64b2-60305531cca6@erlang.org> Hmm, looked closer at statistics(wall_clock) and found that it is buggy on 32-bit architectures. This due to an unfortunate cast which causes it to wrap after approximately 50 days. This will be fixed in an upcoming patches for OTP 19 and 20. Internally erlang:statistics(wall_clock) use Erlang monotonic time, so it will be as accurate as using erlang monotonic time directly. It is however not as efficient as using erlang monotonic time directly due to the locking that is needs. That is, the recommended way to get this info is: erlang:convert_time_unit(erlang:monotonic_time() - erlang:system_info(start_time), native, TheTimeUnitYouWant). Regards, Rickard, Erlang/OTP, Ericsson AB On 06/22/2017 10:45 AM, Richard Carlsson wrote: > Would be good to patch the uptime function in c.erl, in that case, since > that uses wall_clock. > > > /Richard > > 2017-06-20 12:56 GMT+02:00 Rickard Green >: > > > tis 20 juni 2017 kl. 09:21 skrev Mithun B >: > > Hi all, > > We are using "erlang:statistics(wall_clock)" to get the Erlang > node up > time in millisecond. > > It works fine till 49 days, but on 49th day it will role back to > start > from 0 millisecond. > > I need to know two things here, First of all, a different method > for how > to test it, I don't want to wait for 49+ days to see it works or > not. > > Secondly, I need to know a method which gives proper up time > even after > 49+ days. How about following: > > "(erlang:monotonic_time() - erlang:system_info(start_time)) div > 1000000000" > > > Apart from the assumption of nanosecond native time unit this is the > way to do it. Use erlang:convert_time_unit() instead. There are > Erlang systems not using nanoseconds as native time unit. > > Regards, > Rickard Green, Erlang/OTP > > > If any one having more insight on this, please shed some light > on these > topics. > > Thanks and regards, > > Mithun B > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > -- > Rickard Green, Erlang/OTP, Ericsson AB > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > From kjnilsson@REDACTED Thu Jun 22 18:15:53 2017 From: kjnilsson@REDACTED (Karl Nilsson) Date: Thu, 22 Jun 2017 16:15:53 +0000 Subject: [erlang-questions] The "ei" API and passing *shared* binaries / parts In-Reply-To: <594B684A.8050605@openfortress.nl> References: <594B668B.4090505@openfortress.nl> <594B684A.8050605@openfortress.nl> Message-ID: Hi, I don't know anything about `ei` but we recently wrote an AMQP 1.0 client in erlang [1]. It isn't 100% complete and is unlikely to provide the kind of performance you may be expecting given you are looking at the internals of the runtime itself but it works and it covers the subset of functionality required for RabbitMQ projects. We have done basic testing against QPid. [1] https://github.com/rabbitmq/rabbitmq-amqp1.0-client Cheers Karl On Thu, 22 Jun 2017 at 08:33 Rick van Rein wrote: > Hello, > > I have looked at the ei module, both documentation and code. It looks > quite efficient, but I am missing something, and I wonder if it is > somewhere else. > > I started a discussion in the Apache Qpid user forum about integration > their AMQP 1.0 API with Erlang; there does not seem to be a way of > getting to AMQP 1.0 from Erlang, and given that both are designed for > rock-solid software construction that would be a useful marriage. And > the Go port has a variant API named "electron" that is aimed at > "synchronous" communication under the assumption of many small processes. > > Having to pass a (very) large message into Erlang, and possibly out at > the other end, requires cloning the entire binary over ei, AFAIK. > Although Erlang is rumoured to internally use malloc() for binaries, > with refcounting and parts pointing there (no doubt charging the > refcount) this functionality (shared memory allocation, sharing parts, > unsharing) does not seem to be available externally. Nor did I find a > way of exchanging shared memory and parts over ei. Did I miss it? It > would improve efficiency in applications where Erlang is on the sending > or receiving end of AMQP, as well as an intermediate in the pathway. > > There is one more use of such an ei facility -- and that is where an > existing parser in C is asked to decipher a block of text (like SIP, > XML, ...) or binary (AMQP, DNS, OpenPGP, ...) and return parts thereof > as components to work on. It's a pitty to have to copy in both > directions, rather than using an existing malloc() and simply pointing > into it. > > Are such facilities available but have I missed them? > > Cheers, > -Rick > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rick@REDACTED Thu Jun 22 19:41:22 2017 From: rick@REDACTED (Rick van Rein) Date: Thu, 22 Jun 2017 19:41:22 +0200 Subject: [erlang-questions] The "ei" API and passing *shared* binaries / parts In-Reply-To: References: <594B668B.4090505@openfortress.nl> <594B684A.8050605@openfortress.nl> Message-ID: <594C0142.6020404@openfortress.nl> Hi Karl, Yes, thanks for that. I was also pointed to this work in the Qpid list discussion, I'm really happy that this work has started. My comment in this thread and here was indeed commenting on the efficiency of the ei interface, which is orthogonal to the code wish answered by this client -- which I'm keen on giving a spin sometime soon. Thanks, -Rick From shobhitpratap1@REDACTED Fri Jun 23 11:14:59 2017 From: shobhitpratap1@REDACTED (Shobhit Singh) Date: Fri, 23 Jun 2017 11:14:59 +0200 Subject: [erlang-questions] Crypto Library Truncates the last bytes of ciphertext Message-ID: Hi All, I am facing a problem with encrypting AES 256 bit CBC in Erlang and then decrypting it in c code. Whereas Encryption/decryption works in Erlang and C but not from one to another. the same data I Encrypted and decrypted in C and then made a Hex dump. The actual Encrypted data Erlang is senginh is 128 Bytes and the same data Encrypted by C openssl library is 144 bytes. That's normal cipher text are usually long. Here's the output This is send by Erlang Encrypted = 128 a5 ab d0 68 18 61 ad 82 b1 63 32 16 33 b4 70 7b 24 12 d0 aa fa 83 c3 a2 b6 a2 fd 0e 79 f2 3d 3c ca ac 4a 79 df 32 80 ff 86 33 fd 5b c3 ae 5a 5d 4d 41 01 73 77 40 19 83 2f f5 44 9c a3 91 6f 7d 8f d0 ff 35 83 dc ae f3 40 78 e5 15 56 6b 8b 94 a4 27 90 6a e8 40 fc ea 1a d0 8a bb d5 f4 d2 0b ae 2f 7e 04 61 b3 c2 55 08 cf 74 8c ec 03 91 d15f 6a 24 79 f1 e4 99 78 e2 7d e3 8a 82 b7 d9 27 This is Output of Openssl (c) library fof the same data. Encrypted = 144 a5 ab d0 68 18 61 ad 82 b1 63 32 16 33 b4 70 7b 24 12 d0 aa fa 83 c3 a2 b6 a2 fd 0e 79 f2 3d 3c ca ac 4a 79 df 32 80 ff 86 33 fd 5b c3 ae 5a 5d 4d 41 01 73 77 40 19 83 2f f5 44 9c a3 91 6f 7d 8f d0 ff 35 83 dc ae f3 40 78 e5 15 56 6b 8b 94 a4 27 90 6a e8 40 fc ea 1a d0 8a bb d5 f4 d2 0b ae 2f 7e 04 61 b3 c2 55 08 cf 74 8c ec 03 91 d1 5f 6a 24 79 f1 e4 99 78 e2 7d e3 8a 82 b7 d9 27 f7 01 c0 ed 95 e3 14 e5 d2 62 21 da a9 1d 2a e7 The last 16 bytes are missing from Erlang. Is there any other API I need to call from Erlang Crypto library. Erlang Code: Ivec = "1200000000000000",Key = "586E36EEE726B37F70A6F7B770764E99",Data = "encrypt[38ce517c95b011bbfc999f36d09e4feb92d22dd8,38ce517c95b011bbfc999f36d09e4feb92d22222]",PaddedText = string:left(Data ++ ",",128,$0),%%Data is "encrypt[38ce517c95b011bbfc999f36d09e4feb92d22dd8,38ce517c95b011bbfc999f36d09e4feb92d22222],0000000000000000000000000000000000000"EncryptedText = crypto:block_encrypt(aes_cbc256, Key, Ivec, PaddedText),%%Send to C code Thanks, Shobhit -------------- next part -------------- An HTML attachment was scrubbed... URL: From shobhitpratap1@REDACTED Fri Jun 23 15:59:24 2017 From: shobhitpratap1@REDACTED (Shobhit Singh) Date: Fri, 23 Jun 2017 15:59:24 +0200 Subject: [erlang-questions] Crypto Library Truncates the last bytes of ciphertext In-Reply-To: References: Message-ID: This is already fixed, please ignore. This is fixed on the c side by adding padding equals to 0. Thanks On Fri, Jun 23, 2017 at 11:14 AM, Shobhit Singh wrote: > Hi All, > > I am facing a problem with encrypting AES 256 bit CBC in Erlang and then > decrypting it in c code. Whereas Encryption/decryption works in Erlang and > C but not from one to another. > > the same data I Encrypted and decrypted in C and then made a Hex dump. The > actual Encrypted data Erlang is senginh is 128 Bytes and the same data > Encrypted by C openssl library is 144 bytes. That's normal cipher text are > usually long. Here's the output > > This is send by Erlang > > Encrypted = 128 > > a5 ab d0 68 18 61 ad 82 b1 63 32 16 33 b4 70 7b 24 12 d0 aa fa 83 c3 a2 b6 a2 fd 0e 79 f2 3d 3c > ca ac 4a 79 df 32 80 ff 86 33 fd 5b c3 ae 5a 5d 4d 41 01 73 77 40 19 83 2f f5 44 9c a3 91 6f 7d 8f d0 ff 35 83 dc ae f3 40 78 e5 15 56 6b 8b 94 > a4 27 90 6a e8 40 fc ea 1a d0 8a bb d5 f4 d2 0b > ae 2f 7e 04 61 b3 c2 55 08 cf 74 8c ec 03 91 d15f 6a 24 79 f1 e4 99 78 e2 7d e3 8a 82 b7 d9 27 > > This is Output of Openssl (c) library fof the same data. > > Encrypted = 144 > > a5 ab d0 68 18 61 ad 82 b1 63 32 16 33 b4 70 7b 24 12 d0 aa fa 83 c3 a2 b6 a2 fd 0e 79 f2 3d 3c > ca ac 4a 79 df 32 80 ff 86 33 fd 5b c3 ae 5a 5d 4d 41 01 73 77 40 19 83 2f f5 44 9c a3 91 6f 7d 8f d0 ff 35 83 dc ae f3 40 78 e5 15 56 6b 8b 94 > a4 27 90 6a e8 40 fc ea 1a d0 8a bb d5 f4 d2 0b > ae 2f 7e 04 61 b3 c2 55 08 cf 74 8c ec 03 91 d1 5f 6a 24 79 f1 e4 99 78 e2 7d e3 8a 82 b7 d9 27 > f7 01 c0 ed 95 e3 14 e5 d2 62 21 da a9 1d 2a e7 > > The last 16 bytes are missing from Erlang. Is there any other API I need > to call from Erlang Crypto library. > > > Erlang Code: > > Ivec = "1200000000000000",Key = "586E36EEE726B37F70A6F7B770764E99",Data = "encrypt[38ce517c95b011bbfc999f36d09e4feb92d22dd8,38ce517c95b011bbfc999f36d09e4feb92d22222]",PaddedText = string:left(Data ++ ",",128,$0),%%Data is "encrypt[38ce517c95b011bbfc999f36d09e4feb92d22dd8,38ce517c95b011bbfc999f36d09e4feb92d22222],0000000000000000000000000000000000000"EncryptedText = crypto:block_encrypt(aes_cbc256, Key, Ivec, PaddedText),%%Send to C code > > > Thanks, > Shobhit > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ml_news@REDACTED Sat Jun 24 15:58:56 2017 From: ml_news@REDACTED (Manfred Lotz) Date: Sat, 24 Jun 2017 15:58:56 +0200 Subject: [erlang-questions] dialyzer: building PLT problem Message-ID: <20170624155856.24e7afcc@arcor.com> Hi there, My system is GNU/Linux Fedora 25, erlang 19.3.4-1 (rpm packages from Fedora). When trying to build the PLT using the suggested: dialyzer --build_plt --apps erts kernel stdlib mnesia First dialyzer outputs: Compiling some key modules to native code... then I get 26 times a 'Native loading ... failed' each followed by a {{badmatch,ok},... line. Here dialyzer is hanging. I don't want to post all output here as there are some 1720 lines. Any ideas appreciated. -- Manfred From pguyot@REDACTED Sun Jun 25 18:56:42 2017 From: pguyot@REDACTED (Paul Guyot) Date: Sun, 25 Jun 2017 18:56:42 +0200 Subject: [erlang-questions] Tricking dialyzer with an opaque type Message-ID: Hello, I do have a parse transform that replaces the body of a 0-arity function with its result, as evaluated at compile time. I am looking for a way to avoid an opaque violation warning from dialyzer when this function returns, say, a gb_sets:set(). The spec is properly copied into the parsed tree, but dialyzer just ignores it. Typically, such a function would load data from a file and create a gb_sets:set() from this data. -spec f() -> gb_sets:set(unicode:unicode_binary()). f() -> {ok, Content} = file:read_file(?FILENAME), List0 = binary:split(Content, <<"\n">>, [global]), List1 = lists:filter(fun(W) -> W =/= <<>> end, List0), gb_sets:from_list(List1). With the parse_transform, dialyzer complains on usage, e.g. : [warning] some_module.erl:123 the call gb_sets:add(,Var::{1..1114111,{_,_,_}}) does not have an opaque term of type gb_sets:set(_) as 2nd argument Yet, of course, some_module.erl does not violate the opacity of gb_sets:set() itself. I can trick dialyzer with an expensive identity function: gb_sets:add(Value, binary_to_term(term_to_binary(Var))) Any better idea? Paul From 7stud@REDACTED Sun Jun 25 22:02:36 2017 From: 7stud@REDACTED (7stud) Date: Sun, 25 Jun 2017 16:02:36 -0400 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets Message-ID: <20170625160236.31040@web006.roc2.bluetie.com> I'm having trouble running the demos for the ezwebframe. I installed the old rebar (v. rebar3), but I'm getting the error: {badmatch,{error,{not_started,ssl}} I'm on Mac OSX 10.10.5. Here is my output: =========== ../ezwebframe-master$ gmake ... .... Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] a simple_demo of websockets.... Load the page http://localhost:1456/ in your browser Starting:{ok,"/Users/7stud/erlang_programs/ezwebframe/ezwebframe-master/demos"} Eshell V8.2 (abort with ^G) 1> {"init terminating in do_boot",{{badmatch,{error,{not_started,ssl}}},[{ezwebframe,start_link,2,[{file,"src/ezwebframe.erl"},{line,22}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}} init terminating in do_boot () Crash dump is being written to: erl_crash.dump...done make[1]: *** [all] Error 1 gmake: *** [Makefile:4: all] Error 2 =========== Thanks for any help is solving this problem! From jesper.louis.andersen@REDACTED Sun Jun 25 22:12:32 2017 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Sun, 25 Jun 2017 20:12:32 +0000 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets In-Reply-To: <20170625160236.31040@web006.roc2.bluetie.com> References: <20170625160236.31040@web006.roc2.bluetie.com> Message-ID: The error suggest the `ssl` application has not been started by something depends on it. My bet is that a dependency was updated somewhere between that code was written and your Erlang release, so things goes awry. If you look at the line {"init terminating in do_boot",{{badmatch,{error,{no t_started,ssl}}},[{ezwebframe,start_link,2,[{file,"src/ ezwebframe.erl"},{line,22}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}} You have the stack of where the error occurred. The topmost frame is in ezwebframe:start_link/2 (src/ezwebframe.erl:22). To fix the problem, this is probably where you should look. On Sun, Jun 25, 2017 at 10:02 PM 7stud <7stud@REDACTED> wrote: > I'm having trouble running the demos for the ezwebframe. I installed the > old rebar (v. rebar3), but I'm getting the error: > > {badmatch,{error,{not_started,ssl}} > > I'm on Mac OSX 10.10.5. Here is my output: > > =========== > ../ezwebframe-master$ gmake > ... > .... > Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] [async-threads:10] > [hipe] [kernel-poll:false] > > a simple_demo of websockets.... > Load the page http://localhost:1456/ in your browser > > Starting:{ok,"/Users/7stud/erlang_programs/ezwebframe/ezwebframe-master/demos"} > Eshell V8.2 (abort with ^G) > 1> {"init terminating in > do_boot",{{badmatch,{error,{not_started,ssl}}},[{ezwebframe,start_link,2,[{file,"src/ezwebframe.erl"},{line,22}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}} > init terminating in do_boot () > > Crash dump is being written to: erl_crash.dump...done > make[1]: *** [all] Error 1 > gmake: *** [Makefile:4: all] Error 2 > =========== > > Thanks for any help is solving this problem! > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Sun Jun 25 23:00:50 2017 From: erlang@REDACTED (Joe Armstrong) Date: Sun, 25 Jun 2017 23:00:50 +0200 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets In-Reply-To: <20170625160236.31040@web006.roc2.bluetie.com> References: <20170625160236.31040@web006.roc2.bluetie.com> Message-ID: Unfortunately cowboy (which I used) and the websockets standard have changed since I wrote the book. I also used make and not rebar. You've now run into what is one of the biggest problems in the computer world - code that used to work no longer works despite the fact the code itself has not been changed. One way around this is to use zero dependencies - in fact several programs I wrote 30 years ago in Erlang still work fine with no changes because there are no external dependencies. (as an aside: this is why I like code with zero external dependencies - it takes a lot longer to write - but you don't have to support it into the future when they things you depend upon change in a manner that is incompatible manner) In this example the underlying websockets protocol changed - websockets its is a crazy mess - websockets should have provided raw socket transport instead they chose to scramble the data in a weird manner to avoid problems with badly written proxies. The idea of "write once run anywhere" is a great goal - but we can't even do this - "write once run forever with no changes to your code" would be even better and things like NixOS are a step in the right direction. Welcome to the world of broken software. In my opinion this (making sure software evolution does not break existing functioning software) is one of the biggest remaining software problems - my guess is that this problem is getting worse (due to the explosion in the numbers of programming languages, libraries and frameworks and build systems) and will be even worse in the IoT world. Lots for you guys to work on :-) Cheers /Joe On Sun, Jun 25, 2017 at 10:02 PM, 7stud <7stud@REDACTED> wrote: > I'm having trouble running the demos for the ezwebframe. I installed the old rebar (v. rebar3), but I'm getting the error: > > {badmatch,{error,{not_started,ssl}} > > I'm on Mac OSX 10.10.5. Here is my output: > > =========== > ../ezwebframe-master$ gmake > ... > .... > Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] > > a simple_demo of websockets.... > Load the page http://localhost:1456/ in your browser > Starting:{ok,"/Users/7stud/erlang_programs/ezwebframe/ezwebframe-master/demos"} > Eshell V8.2 (abort with ^G) > 1> {"init terminating in do_boot",{{badmatch,{error,{not_started,ssl}}},[{ezwebframe,start_link,2,[{file,"src/ezwebframe.erl"},{line,22}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}} > init terminating in do_boot () > > Crash dump is being written to: erl_crash.dump...done > make[1]: *** [all] Error 1 > gmake: *** [Makefile:4: all] Error 2 > =========== > > Thanks for any help is solving this problem! > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From t@REDACTED Sun Jun 25 23:14:40 2017 From: t@REDACTED (Tristan Sloughter) Date: Sun, 25 Jun 2017 14:14:40 -0700 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets In-Reply-To: References: <20170625160236.31040@web006.roc2.bluetie.com> Message-ID: <1498425280.498801.1020848480.44DF132A@webmail.messagingengine.com> The main issue here looks to be that the dep is tied to the master branch of a git repo. So the dependency is defined as one that will continually change over time. The version of ranch used when the code was written probably didn't list `ssl` as a dependency, now that it does `application:start(ranch)` will fail. So the quick fix is to add `application:start(asn1), application:start(public_key), application:start(ssl),` before the start of ranch. Or just `application:ensure_all_started(ranch)`. Moral of the story: lock your dependencies (even better if on a package and not just a git reference) and use a release or `application:ensure_all_started` for running a project :) -- Tristan Sloughter "I am not a crackpot" - Abe Simpson t@REDACTED On Sun, Jun 25, 2017, at 02:00 PM, Joe Armstrong wrote: > Unfortunately cowboy (which I used) and the websockets standard have > changed since I wrote the book. I also used make and not rebar. > > You've now run into what is one of the biggest problems in the > computer world - code that used to work no longer works despite the > fact the code itself has not been changed. > > One way around this is to use zero dependencies - in fact several > programs I wrote 30 years ago in Erlang still work fine with no > changes because there are no external dependencies. (as an aside: this > is why I like code with zero external dependencies - it takes a lot > longer to write - but you don't have to support it into the future > when they things you depend upon change in a manner that is > incompatible manner) > > In this example the underlying websockets protocol changed - > websockets its is a crazy mess - websockets should have provided raw > socket transport instead they chose to scramble the data in a weird > manner to avoid problems with badly written proxies. > > The idea of "write once run anywhere" is a great goal - but we can't > even do this - "write once run forever with no changes to your code" > would be even better and things like NixOS are a step in the right > direction. > > Welcome to the world of broken software. > > In my opinion this (making sure software evolution does not break > existing functioning software) is one of the biggest remaining > software problems - my guess is that this problem is getting worse > (due to the explosion in the numbers of programming languages, > libraries and frameworks and build systems) and will be even worse in > the IoT world. > > Lots for you guys to work on :-) > > Cheers > > /Joe > > > On Sun, Jun 25, 2017 at 10:02 PM, 7stud <7stud@REDACTED> wrote: > > I'm having trouble running the demos for the ezwebframe. I installed the old rebar (v. rebar3), but I'm getting the error: > > > > {badmatch,{error,{not_started,ssl}} > > > > I'm on Mac OSX 10.10.5. Here is my output: > > > > =========== > > ../ezwebframe-master$ gmake > > ... > > .... > > Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] > > > > a simple_demo of websockets.... > > Load the page http://localhost:1456/ in your browser > > Starting:{ok,"/Users/7stud/erlang_programs/ezwebframe/ezwebframe-master/demos"} > > Eshell V8.2 (abort with ^G) > > 1> {"init terminating in do_boot",{{badmatch,{error,{not_started,ssl}}},[{ezwebframe,start_link,2,[{file,"src/ezwebframe.erl"},{line,22}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}} > > init terminating in do_boot () > > > > Crash dump is being written to: erl_crash.dump...done > > make[1]: *** [all] Error 1 > > gmake: *** [Makefile:4: all] Error 2 > > =========== > > > > Thanks for any help is solving this problem! > > _______________________________________________ > > 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 ok@REDACTED Mon Jun 26 01:55:56 2017 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 26 Jun 2017 11:55:56 +1200 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets In-Reply-To: References: <20170625160236.31040@web006.roc2.bluetie.com> Message-ID: <4B93FA78-1AE6-4C13-AC63-9C05E6AA66E3@cs.otago.ac.nz> > On 26/06/2017, at 9:00 AM, Joe Armstrong wrote: > You've now run into what is one of the biggest problems in the > computer world - code that used to work no longer works despite the > fact the code itself has not been changed. One of my colleagues has an explicit "no third party libraries" policy for this very reason. Sadly, it does not protect against operating system or compiler changes. It is notoriously the case that in pursuit of "optimisation", C compilers are taking ever more advantage of the strict letter of the C standard, so that code that used to work may stop working. For example, there's a compiler from a historic programming language to C. It used to work on my Mac. After an Xcode upgrade, it didn't compile any more. Turned out that the "C" it generated as GNU C with nested functions, and clang supports *some* GNU C extensions but not that one. Basically, there is NO way to protect yourself from changes to your infrastructure. You can try to stick close to documented standards, but things still change. And Erlang itself has dropped a number of library modules over the years. From 7stud@REDACTED Mon Jun 26 02:33:20 2017 From: 7stud@REDACTED (7stud) Date: Sun, 25 Jun 2017 20:33:20 -0400 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets Message-ID: <20170625203320.22351@web005.roc2.bluetie.com> > So the quick fix is to add `application:start(asn1), application:start(public_key), application:start(ssl),` before the start of ranch. Or just `application:ensure_all_started(ranch)`.< I tried some combination of those already, but maybe not that exact combination. Here is what I get when I try application:ensure_all_started(ranch) Source code: ---------- start_link(Dispatch, Port) -> io:format("Starting:~p~n",[file:get_cwd()]), ok = application:start(crypto), %%ok = application:start(ranch), % Line #22 application:ensure_all_started(ranch), ok = application:start(cowlib), ok = application:start(cowboy), ok = web_server_start(Port, Dispatch). ---------- Output: ========== ../ezwebframe-master$ gmake ... ... Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] a simple_demo of websockets.... Load the page http://localhost:1456/ in your browser Starting:{ok,"/Users/7stud/erlang_programs/ezwebframe/ezwebframe-master/demos"} Eshell V8.2 (abort with ^G) 1> {"init terminating in do_boot",{undef,[{cowboy,start_http,[ezwebframe,100,[{port,1456}],[{env,[{dispatch,[{'_',[],[{'_',[],ezwebframe,{env,#Fun}}]}]}]}]],[]},{ezwebframe,web_server_start,2,[{file,"src/ezwebframe.erl"},{line,37}]},{ezwebframe,start_link,2,[{file,"src/ezwebframe.erl"},{line,29}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}} init terminating in do_boot () Crash dump is being written to: erl_crash.dump...done make[1]: *** [all] Error 1 gmake: *** [Makefile:4: all] Error 2 ============= -----Original Message----- From: "Tristan Sloughter" [t@REDACTED] Date: 06/25/2017 05:14 PM To: erlang-questions@REDACTED Subject: Re: [erlang-questions] Programming Erlang: Chap 18, Websockets The main issue here looks to be that the dep is tied to the master branch of a git repo. So the dependency is defined as one that will continually change over time. The version of ranch used when the code was written probably didn't list `ssl` as a dependency, now that it does `application:start(ranch)` will fail. So the quick fix is to add `application:start(asn1), application:start(public_key), application:start(ssl),` before the start of ranch. Or just `application:ensure_all_started(ranch)`. Moral of the story: lock your dependencies (even better if on a package and not just a git reference) and use a release or `application:ensure_all_started` for running a project :) -- Tristan Sloughter "I am not a crackpot" - Abe Simpson t@REDACTED On Sun, Jun 25, 2017, at 02:00 PM, Joe Armstrong wrote: > Unfortunately cowboy (which I used) and the websockets standard have > changed since I wrote the book. I also used make and not rebar. > > You've now run into what is one of the biggest problems in the > computer world - code that used to work no longer works despite the > fact the code itself has not been changed. > > One way around this is to use zero dependencies - in fact several > programs I wrote 30 years ago in Erlang still work fine with no > changes because there are no external dependencies. (as an aside: this > is why I like code with zero external dependencies - it takes a lot > longer to write - but you don't have to support it into the future > when they things you depend upon change in a manner that is > incompatible manner) > > In this example the underlying websockets protocol changed - > websockets its is a crazy mess - websockets should have provided raw > socket transport instead they chose to scramble the data in a weird > manner to avoid problems with badly written proxies. > > The idea of "write once run anywhere" is a great goal - but we can't > even do this - "write once run forever with no changes to your code" > would be even better and things like NixOS are a step in the right > direction. > > Welcome to the world of broken software. > > In my opinion this (making sure software evolution does not break > existing functioning software) is one of the biggest remaining > software problems - my guess is that this problem is getting worse > (due to the explosion in the numbers of programming languages, > libraries and frameworks and build systems) and will be even worse in > the IoT world. > > Lots for you guys to work on :-) > > Cheers > > /Joe > > > On Sun, Jun 25, 2017 at 10:02 PM, 7stud <7stud@REDACTED> wrote: > > I'm having trouble running the demos for the ezwebframe. I installed the old rebar (v. rebar3), but I'm getting the error: > > > > {badmatch,{error,{not_started,ssl}} > > > > I'm on Mac OSX 10.10.5. Here is my output: > > > > =========== > > ../ezwebframe-master$ gmake > > ... > > .... > > Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] > > > > a simple_demo of websockets.... > > Load the page http://localhost:1456/ in your browser > > Starting:{ok,"/Users/7stud/erlang_programs/ezwebframe/ezwebframe-master/demos"} > > Eshell V8.2 (abort with ^G) > > 1> {"init terminating in do_boot",{{badmatch,{error,{not_started,ssl}}},[{ezwebframe,start_link,2,[{file,"src/ezwebframe.erl"},{line,22}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}} > > init terminating in do_boot () > > > > Crash dump is being written to: erl_crash.dump...done > > make[1]: *** [all] Error 1 > > gmake: *** [Makefile:4: all] Error 2 > > =========== > > > > Thanks for any help is solving this problem! > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From 7stud@REDACTED Mon Jun 26 03:08:48 2017 From: 7stud@REDACTED (7stud) Date: Sun, 25 Jun 2017 21:08:48 -0400 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets Message-ID: <20170625210848.26481@web002.roc2.bluetie.com> Here's the source code that the new error: {undef,[{cowboy,start_http, points to: web_server_start(Port, Dispatcher) -> E0 = #env{dispatch=Dispatcher}, Dispatch = cowboy_router:compile([{'_',[{'_', ?MODULE, E0}]}]), %% server is the name of this module NumberOfAcceptors = 100, Status = cowboy:start_http(ezwebframe, NumberOfAcceptors, [{port, Port}], [{env, [{dispatch, Dispatch}]}]), ... ... -----Original Message----- From: "7stud" [7stud@REDACTED] Date: 06/25/2017 08:33 PM To: erlang-questions@REDACTED Subject: Re: [erlang-questions] Programming Erlang: Chap 18, Websockets > So the quick fix is to add `application:start(asn1), application:start(public_key), application:start(ssl),` before the start of ranch. Or just `application:ensure_all_started(ranch)`.< I tried some combination of those already, but maybe not that exact combination. Here is what I get when I try application:ensure_all_started(ranch) Source code: ---------- start_link(Dispatch, Port) -> io:format("Starting:~p~n",[file:get_cwd()]), ok = application:start(crypto), %%ok = application:start(ranch), % Line #22 application:ensure_all_started(ranch), ok = application:start(cowlib), ok = application:start(cowboy), ok = web_server_start(Port, Dispatch). ---------- Output: ========== ../ezwebframe-master$ gmake ... ... Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] a simple_demo of websockets.... Load the page http://localhost:1456/ in your browser Starting:{ok,"/Users/7stud/erlang_programs/ezwebframe/ezwebframe-master/demos"} Eshell V8.2 (abort with ^G) 1> {"init terminating in do_boot",{undef,[{cowboy,start_http,[ezwebframe,100,[{port,1456}],[{env,[{dispatch,[{'_',[],[{'_',[],ezwebframe,{env,#Fun}}]}]}]}]],[]},{ezwebframe,web_server_start,2,[{file,"src/ezwebframe.erl"},{line,37}]},{ezwebframe,start_link,2,[{file,"src/ezwebframe.erl"},{line,29}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}} init terminating in do_boot () Crash dump is being written to: erl_crash.dump...done make[1]: *** [all] Error 1 gmake: *** [Makefile:4: all] Error 2 ============= -----Original Message----- From: "Tristan Sloughter" [t@REDACTED] Date: 06/25/2017 05:14 PM To: erlang-questions@REDACTED Subject: Re: [erlang-questions] Programming Erlang: Chap 18, Websockets The main issue here looks to be that the dep is tied to the master branch of a git repo. So the dependency is defined as one that will continually change over time. The version of ranch used when the code was written probably didn't list `ssl` as a dependency, now that it does `application:start(ranch)` will fail. So the quick fix is to add `application:start(asn1), application:start(public_key), application:start(ssl),` before the start of ranch. Or just `application:ensure_all_started(ranch)`. Moral of the story: lock your dependencies (even better if on a package and not just a git reference) and use a release or `application:ensure_all_started` for running a project :) -- Tristan Sloughter "I am not a crackpot" - Abe Simpson t@REDACTED On Sun, Jun 25, 2017, at 02:00 PM, Joe Armstrong wrote: > Unfortunately cowboy (which I used) and the websockets standard have > changed since I wrote the book. I also used make and not rebar. > > You've now run into what is one of the biggest problems in the > computer world - code that used to work no longer works despite the > fact the code itself has not been changed. > > One way around this is to use zero dependencies - in fact several > programs I wrote 30 years ago in Erlang still work fine with no > changes because there are no external dependencies. (as an aside: this > is why I like code with zero external dependencies - it takes a lot > longer to write - but you don't have to support it into the future > when they things you depend upon change in a manner that is > incompatible manner) > > In this example the underlying websockets protocol changed - > websockets its is a crazy mess - websockets should have provided raw > socket transport instead they chose to scramble the data in a weird > manner to avoid problems with badly written proxies. > > The idea of "write once run anywhere" is a great goal - but we can't > even do this - "write once run forever with no changes to your code" > would be even better and things like NixOS are a step in the right > direction. > > Welcome to the world of broken software. > > In my opinion this (making sure software evolution does not break > existing functioning software) is one of the biggest remaining > software problems - my guess is that this problem is getting worse > (due to the explosion in the numbers of programming languages, > libraries and frameworks and build systems) and will be even worse in > the IoT world. > > Lots for you guys to work on :-) > > Cheers > > /Joe > > > On Sun, Jun 25, 2017 at 10:02 PM, 7stud <7stud@REDACTED> wrote: > > I'm having trouble running the demos for the ezwebframe. I installed the old rebar (v. rebar3), but I'm getting the error: > > > > {badmatch,{error,{not_started,ssl}} > > > > I'm on Mac OSX 10.10.5. Here is my output: > > > > =========== > > ../ezwebframe-master$ gmake > > ... > > .... > > Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] > > > > a simple_demo of websockets.... > > Load the page http://localhost:1456/ in your browser > > Starting:{ok,"/Users/7stud/erlang_programs/ezwebframe/ezwebframe-master/demos"} > > Eshell V8.2 (abort with ^G) > > 1> {"init terminating in do_boot",{{badmatch,{error,{not_started,ssl}}},[{ezwebframe,start_link,2,[{file,"src/ezwebframe.erl"},{line,22}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}} > > init terminating in do_boot () > > > > Crash dump is being written to: erl_crash.dump...done > > make[1]: *** [all] Error 1 > > gmake: *** [Makefile:4: all] Error 2 > > =========== > > > > Thanks for any help is solving this problem! > > _______________________________________________ > > 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 From t@REDACTED Mon Jun 26 03:02:54 2017 From: t@REDACTED (Tristan Sloughter) Date: Sun, 25 Jun 2017 18:02:54 -0700 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets In-Reply-To: <20170625203320.22351@web005.roc2.bluetie.com> References: <20170625203320.22351@web005.roc2.bluetie.com> Message-ID: <1498438974.1426675.1020973944.2C7A03B2@webmail.messagingengine.com> Right, it fixed your original issue, which was ssl not being started. Now it is broken because of the other issue I mentioned, the copy of cowboy it is fetching is from github master and the API changed since the code was written. You'll either need to update the project's code or find what cowboy version it worked with and update the dependencies to use that version. -- Tristan Sloughter "I am not a crackpot" - Abe Simpson t@REDACTED On Sun, Jun 25, 2017, at 05:33 PM, 7stud wrote: > > So the quick fix is to add `application:start(asn1), > application:start(public_key), application:start(ssl),` before the start > of ranch. Or just `application:ensure_all_started(ranch)`.< > > I tried some combination of those already, but maybe not that exact > combination. Here is what I get when I try > > application:ensure_all_started(ranch) > > > Source code: > ---------- > start_link(Dispatch, Port) -> > io:format("Starting:~p~n",[file:get_cwd()]), > ok = application:start(crypto), > %%ok = application:start(ranch), % Line #22 > application:ensure_all_started(ranch), > ok = application:start(cowlib), > ok = application:start(cowboy), > ok = web_server_start(Port, Dispatch). > ---------- > > Output: > ========== > ../ezwebframe-master$ gmake > ... > ... > Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] [async-threads:10] > [hipe] [kernel-poll:false] > > a simple_demo of websockets.... > Load the page http://localhost:1456/ in your browser > Starting:{ok,"/Users/7stud/erlang_programs/ezwebframe/ezwebframe-master/demos"} > Eshell V8.2 (abort with ^G) > 1> {"init terminating in > do_boot",{undef,[{cowboy,start_http,[ezwebframe,100,[{port,1456}],[{env,[{dispatch,[{'_',[],[{'_',[],ezwebframe,{env,#Fun}}]}]}]}]],[]},{ezwebframe,web_server_start,2,[{file,"src/ezwebframe.erl"},{line,37}]},{ezwebframe,start_link,2,[{file,"src/ezwebframe.erl"},{line,29}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}} > init terminating in do_boot () > > Crash dump is being written to: erl_crash.dump...done > make[1]: *** [all] Error 1 > gmake: *** [Makefile:4: all] Error 2 > ============= > > > -----Original Message----- > From: "Tristan Sloughter" [t@REDACTED] > Date: 06/25/2017 05:14 PM > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Programming Erlang: Chap 18, Websockets > > The main issue here looks to be that the dep is tied to the master > branch of a git repo. So the dependency is defined as one that will > continually change over time. > > The version of ranch used when the code was written probably didn't list > `ssl` as a dependency, now that it does `application:start(ranch)` will > fail. So the quick fix is to add `application:start(asn1), > application:start(public_key), application:start(ssl),` before the start > of ranch. Or just `application:ensure_all_started(ranch)`. > > Moral of the story: lock your dependencies (even better if on a package > and not just a git reference) and use a release or > `application:ensure_all_started` for running a project :) > > -- > Tristan Sloughter > "I am not a crackpot" - Abe Simpson > t@REDACTED > > On Sun, Jun 25, 2017, at 02:00 PM, Joe Armstrong wrote: > > Unfortunately cowboy (which I used) and the websockets standard have > > changed since I wrote the book. I also used make and not rebar. > > > > You've now run into what is one of the biggest problems in the > > computer world - code that used to work no longer works despite the > > fact the code itself has not been changed. > > > > One way around this is to use zero dependencies - in fact several > > programs I wrote 30 years ago in Erlang still work fine with no > > changes because there are no external dependencies. (as an aside: this > > is why I like code with zero external dependencies - it takes a lot > > longer to write - but you don't have to support it into the future > > when they things you depend upon change in a manner that is > > incompatible manner) > > > > In this example the underlying websockets protocol changed - > > websockets its is a crazy mess - websockets should have provided raw > > socket transport instead they chose to scramble the data in a weird > > manner to avoid problems with badly written proxies. > > > > The idea of "write once run anywhere" is a great goal - but we can't > > even do this - "write once run forever with no changes to your code" > > would be even better and things like NixOS are a step in the right > > direction. > > > > Welcome to the world of broken software. > > > > In my opinion this (making sure software evolution does not break > > existing functioning software) is one of the biggest remaining > > software problems - my guess is that this problem is getting worse > > (due to the explosion in the numbers of programming languages, > > libraries and frameworks and build systems) and will be even worse in > > the IoT world. > > > > Lots for you guys to work on :-) > > > > Cheers > > > > /Joe > > > > > > On Sun, Jun 25, 2017 at 10:02 PM, 7stud <7stud@REDACTED> wrote: > > > I'm having trouble running the demos for the ezwebframe. I installed the old rebar (v. rebar3), but I'm getting the error: > > > > > > {badmatch,{error,{not_started,ssl}} > > > > > > I'm on Mac OSX 10.10.5. Here is my output: > > > > > > =========== > > > ../ezwebframe-master$ gmake > > > ... > > > .... > > > Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] > > > > > > a simple_demo of websockets.... > > > Load the page http://localhost:1456/ in your browser > > > Starting:{ok,"/Users/7stud/erlang_programs/ezwebframe/ezwebframe-master/demos"} > > > Eshell V8.2 (abort with ^G) > > > 1> {"init terminating in do_boot",{{badmatch,{error,{not_started,ssl}}},[{ezwebframe,start_link,2,[{file,"src/ezwebframe.erl"},{line,22}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}} > > > init terminating in do_boot () > > > > > > Crash dump is being written to: erl_crash.dump...done > > > make[1]: *** [all] Error 1 > > > gmake: *** [Makefile:4: all] Error 2 > > > =========== > > > > > > Thanks for any help is solving this problem! > > > _______________________________________________ > > > 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 From 7stud@REDACTED Mon Jun 26 04:06:27 2017 From: 7stud@REDACTED (7stud) Date: Sun, 25 Jun 2017 22:06:27 -0400 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets Message-ID: <20170625220627.11085@web002.roc2.bluetie.com> > Now it is broken because of the other issue I mentioned, the copy of > cowboy it is fetching is from github master and the API changed since > the code was written. > You'll either need to update the project's code or find what cowboy > version it worked with and update the dependencies to use that version. I can't figure out how to specify an earlier version of cowboy: rebar.config: ======== {deps, [ {cowboy, "1.0.*", {git, "https://github.com/ninenines/cowboy/tree", "1.0.x"}} ]}. ======== original rebar.config: ========= {deps, [ {cowboy, ".*", {git, "git://github.com/extend/cowboy.git", "master"}} ]}. ======== -----Original Message----- From: "Tristan Sloughter" [t@REDACTED] Date: 06/25/2017 09:16 PM To: erlang-questions@REDACTED Subject: Re: [erlang-questions] Programming Erlang: Chap 18, Websockets Right, it fixed your original issue, which was ssl not being started. Now it is broken because of the other issue I mentioned, the copy of cowboy it is fetching is from github master and the API changed since the code was written. You'll either need to update the project's code or find what cowboy version it worked with and update the dependencies to use that version. -- Tristan Sloughter "I am not a crackpot" - Abe Simpson t@REDACTED On Sun, Jun 25, 2017, at 05:33 PM, 7stud wrote: > > So the quick fix is to add `application:start(asn1), > application:start(public_key), application:start(ssl),` before the start > of ranch. Or just `application:ensure_all_started(ranch)`.< > > I tried some combination of those already, but maybe not that exact > combination. Here is what I get when I try > > application:ensure_all_started(ranch) > > > Source code: > ---------- > start_link(Dispatch, Port) -> > io:format("Starting:~p~n",[file:get_cwd()]), > ok = application:start(crypto), > %%ok = application:start(ranch), % Line #22 > application:ensure_all_started(ranch), > ok = application:start(cowlib), > ok = application:start(cowboy), > ok = web_server_start(Port, Dispatch). > ---------- > > Output: > ========== > ../ezwebframe-master$ gmake > ... > ... > Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] [async-threads:10] > [hipe] [kernel-poll:false] > > a simple_demo of websockets.... > Load the page http://localhost:1456/ in your browser > Starting:{ok,"/Users/7stud/erlang_programs/ezwebframe/ezwebframe-master/demos"} > Eshell V8.2 (abort with ^G) > 1> {"init terminating in > do_boot",{undef,[{cowboy,start_http,[ezwebframe,100,[{port,1456}],[{env,[{dispatch,[{'_',[],[{'_',[],ezwebframe,{env,#Fun}}]}]}]}]],[]},{ezwebframe,web_server_start,2,[{file,"src/ezwebframe.erl"},{line,37}]},{ezwebframe,start_link,2,[{file,"src/ezwebframe.erl"},{line,29}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}} > init terminating in do_boot () > > Crash dump is being written to: erl_crash.dump...done > make[1]: *** [all] Error 1 > gmake: *** [Makefile:4: all] Error 2 > ============= > > > -----Original Message----- > From: "Tristan Sloughter" [t@REDACTED] > Date: 06/25/2017 05:14 PM > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Programming Erlang: Chap 18, Websockets > > The main issue here looks to be that the dep is tied to the master > branch of a git repo. So the dependency is defined as one that will > continually change over time. > > The version of ranch used when the code was written probably didn't list > `ssl` as a dependency, now that it does `application:start(ranch)` will > fail. So the quick fix is to add `application:start(asn1), > application:start(public_key), application:start(ssl),` before the start > of ranch. Or just `application:ensure_all_started(ranch)`. > > Moral of the story: lock your dependencies (even better if on a package > and not just a git reference) and use a release or > `application:ensure_all_started` for running a project :) > > -- > Tristan Sloughter > "I am not a crackpot" - Abe Simpson > t@REDACTED > > On Sun, Jun 25, 2017, at 02:00 PM, Joe Armstrong wrote: > > Unfortunately cowboy (which I used) and the websockets standard have > > changed since I wrote the book. I also used make and not rebar. > > > > You've now run into what is one of the biggest problems in the > > computer world - code that used to work no longer works despite the > > fact the code itself has not been changed. > > > > One way around this is to use zero dependencies - in fact several > > programs I wrote 30 years ago in Erlang still work fine with no > > changes because there are no external dependencies. (as an aside: this > > is why I like code with zero external dependencies - it takes a lot > > longer to write - but you don't have to support it into the future > > when they things you depend upon change in a manner that is > > incompatible manner) > > > > In this example the underlying websockets protocol changed - > > websockets its is a crazy mess - websockets should have provided raw > > socket transport instead they chose to scramble the data in a weird > > manner to avoid problems with badly written proxies. > > > > The idea of "write once run anywhere" is a great goal - but we can't > > even do this - "write once run forever with no changes to your code" > > would be even better and things like NixOS are a step in the right > > direction. > > > > Welcome to the world of broken software. > > > > In my opinion this (making sure software evolution does not break > > existing functioning software) is one of the biggest remaining > > software problems - my guess is that this problem is getting worse > > (due to the explosion in the numbers of programming languages, > > libraries and frameworks and build systems) and will be even worse in > > the IoT world. > > > > Lots for you guys to work on :-) > > > > Cheers > > > > /Joe > > > > > > On Sun, Jun 25, 2017 at 10:02 PM, 7stud <7stud@REDACTED> wrote: > > > I'm having trouble running the demos for the ezwebframe. I installed the old rebar (v. rebar3), but I'm getting the error: > > > > > > {badmatch,{error,{not_started,ssl}} > > > > > > I'm on Mac OSX 10.10.5. Here is my output: > > > > > > =========== > > > ../ezwebframe-master$ gmake > > > ... > > > .... > > > Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] > > > > > > a simple_demo of websockets.... > > > Load the page http://localhost:1456/ in your browser > > > Starting:{ok,"/Users/7stud/erlang_programs/ezwebframe/ezwebframe-master/demos"} > > > Eshell V8.2 (abort with ^G) > > > 1> {"init terminating in do_boot",{{badmatch,{error,{not_started,ssl}}},[{ezwebframe,start_link,2,[{file,"src/ezwebframe.erl"},{line,22}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}} > > > init terminating in do_boot () > > > > > > Crash dump is being written to: erl_crash.dump...done > > > make[1]: *** [all] Error 1 > > > gmake: *** [Makefile:4: all] Error 2 > > > =========== > > > > > > Thanks for any help is solving this problem! > > > _______________________________________________ > > > 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 _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From nayibor@REDACTED Mon Jun 26 09:35:40 2017 From: nayibor@REDACTED (Nuku Ameyibor) Date: Mon, 26 Jun 2017 07:35:40 +0000 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets In-Reply-To: <20170625220627.11085@web002.roc2.bluetie.com> References: <20170625220627.11085@web002.roc2.bluetie.com> Message-ID: find a few examples below {deps, [ {cowboy, {git, "git://*https://github.com/ninenines/cowboy.git *", {ref, "b7210d6"}}}, {cowboy, {git, "git://*https://github.com/ninenines/cowboy.git *", {branch, "master"}}}, {cowboy, {git, "git://*https://github.com/ninenines/cowboy.git *", {tag, "1.1.2"}}}, ]}. more ways of doing it can be found at http://www.rebar3.org/docs/dependencies On Mon, Jun 26, 2017 at 2:06 AM, 7stud <7stud@REDACTED> wrote: > > Now it is broken because of the other issue I mentioned, the copy of > > cowboy it is fetching is from github master and the API changed since > > the code was written. > > > You'll either need to update the project's code or find what cowboy > > version it worked with and update the dependencies to use that version. > > I can't figure out how to specify an earlier version of cowboy: > > rebar.config: > ======== > {deps, [ > {cowboy, "1.0.*", {git, "https://github.com/ninenines/cowboy/tree", > "1.0.x"}} > ]}. > ======== > > original rebar.config: > ========= > {deps, [ > {cowboy, ".*", {git, "git://github.com/extend/cowboy.git", "master"}} > ]}. > ======== > > > -----Original Message----- > From: "Tristan Sloughter" [t@REDACTED] > Date: 06/25/2017 09:16 PM > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Programming Erlang: Chap 18, Websockets > > Right, it fixed your original issue, which was ssl not being started. > > Now it is broken because of the other issue I mentioned, the copy of > cowboy it is fetching is from github master and the API changed since > the code was written. > > You'll either need to update the project's code or find what cowboy > version it worked with and update the dependencies to use that version. > > -- > Tristan Sloughter > "I am not a crackpot" - Abe Simpson > t@REDACTED > > On Sun, Jun 25, 2017, at 05:33 PM, 7stud wrote: > > > So the quick fix is to add `application:start(asn1), > > application:start(public_key), application:start(ssl),` before the start > > of ranch. Or just `application:ensure_all_started(ranch)`.< > > > > I tried some combination of those already, but maybe not that exact > > combination. Here is what I get when I try > > > > application:ensure_all_started(ranch) > > > > > > Source code: > > ---------- > > start_link(Dispatch, Port) -> > > io:format("Starting:~p~n",[file:get_cwd()]), > > ok = application:start(crypto), > > %%ok = application:start(ranch), % Line #22 > > application:ensure_all_started(ranch), > > ok = application:start(cowlib), > > ok = application:start(cowboy), > > ok = web_server_start(Port, Dispatch). > > ---------- > > > > Output: > > ========== > > ../ezwebframe-master$ gmake > > ... > > ... > > Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] [async-threads:10] > > [hipe] [kernel-poll:false] > > > > a simple_demo of websockets.... > > Load the page http://localhost:1456/ in your browser > > Starting:{ok,"/Users/7stud/erlang_programs/ezwebframe/ > ezwebframe-master/demos"} > > Eshell V8.2 (abort with ^G) > > 1> {"init terminating in > > do_boot",{undef,[{cowboy,start_http,[ezwebframe,100,[{ > port,1456}],[{env,[{dispatch,[{'_',[],[{'_',[],ezwebframe,{ > env,#Fun}}]}]}]}]],[]},{ > ezwebframe,web_server_start,2,[{file,"src/ezwebframe.erl"},{ > line,37}]},{ezwebframe,start_link,2,[{file,"src/ezwebframe. > erl"},{line,29}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}} > > init terminating in do_boot () > > > > Crash dump is being written to: erl_crash.dump...done > > make[1]: *** [all] Error 1 > > gmake: *** [Makefile:4: all] Error 2 > > ============= > > > > > > -----Original Message----- > > From: "Tristan Sloughter" [t@REDACTED] > > Date: 06/25/2017 05:14 PM > > To: erlang-questions@REDACTED > > Subject: Re: [erlang-questions] Programming Erlang: Chap 18, Websockets > > > > The main issue here looks to be that the dep is tied to the master > > branch of a git repo. So the dependency is defined as one that will > > continually change over time. > > > > The version of ranch used when the code was written probably didn't list > > `ssl` as a dependency, now that it does `application:start(ranch)` will > > fail. So the quick fix is to add `application:start(asn1), > > application:start(public_key), application:start(ssl),` before the start > > of ranch. Or just `application:ensure_all_started(ranch)`. > > > > Moral of the story: lock your dependencies (even better if on a package > > and not just a git reference) and use a release or > > `application:ensure_all_started` for running a project :) > > > > -- > > Tristan Sloughter > > "I am not a crackpot" - Abe Simpson > > t@REDACTED > > > > On Sun, Jun 25, 2017, at 02:00 PM, Joe Armstrong wrote: > > > Unfortunately cowboy (which I used) and the websockets standard have > > > changed since I wrote the book. I also used make and not rebar. > > > > > > You've now run into what is one of the biggest problems in the > > > computer world - code that used to work no longer works despite the > > > fact the code itself has not been changed. > > > > > > One way around this is to use zero dependencies - in fact several > > > programs I wrote 30 years ago in Erlang still work fine with no > > > changes because there are no external dependencies. (as an aside: this > > > is why I like code with zero external dependencies - it takes a lot > > > longer to write - but you don't have to support it into the future > > > when they things you depend upon change in a manner that is > > > incompatible manner) > > > > > > In this example the underlying websockets protocol changed - > > > websockets its is a crazy mess - websockets should have provided raw > > > socket transport instead they chose to scramble the data in a weird > > > manner to avoid problems with badly written proxies. > > > > > > The idea of "write once run anywhere" is a great goal - but we can't > > > even do this - "write once run forever with no changes to your code" > > > would be even better and things like NixOS are a step in the right > > > direction. > > > > > > Welcome to the world of broken software. > > > > > > In my opinion this (making sure software evolution does not break > > > existing functioning software) is one of the biggest remaining > > > software problems - my guess is that this problem is getting worse > > > (due to the explosion in the numbers of programming languages, > > > libraries and frameworks and build systems) and will be even worse in > > > the IoT world. > > > > > > Lots for you guys to work on :-) > > > > > > Cheers > > > > > > /Joe > > > > > > > > > On Sun, Jun 25, 2017 at 10:02 PM, 7stud <7stud@REDACTED> wrote: > > > > I'm having trouble running the demos for the ezwebframe. I > installed the old rebar (v. rebar3), but I'm getting the error: > > > > > > > > {badmatch,{error,{not_started,ssl}} > > > > > > > > I'm on Mac OSX 10.10.5. Here is my output: > > > > > > > > =========== > > > > ../ezwebframe-master$ gmake > > > > ... > > > > .... > > > > Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] > [async-threads:10] [hipe] [kernel-poll:false] > > > > > > > > a simple_demo of websockets.... > > > > Load the page http://localhost:1456/ in your browser > > > > Starting:{ok,"/Users/7stud/erlang_programs/ezwebframe/ > ezwebframe-master/demos"} > > > > Eshell V8.2 (abort with ^G) > > > > 1> {"init terminating in do_boot",{{badmatch,{error,{ > not_started,ssl}}},[{ezwebframe,start_link,2,[{ > file,"src/ezwebframe.erl"},{line,22}]},{init,start_em,1,[] > },{init,do_boot,3,[]}]}} > > > > init terminating in do_boot () > > > > > > > > Crash dump is being written to: erl_crash.dump...done > > > > make[1]: *** [all] Error 1 > > > > gmake: *** [Makefile:4: all] Error 2 > > > > =========== > > > > > > > > Thanks for any help is solving this problem! > > > > _______________________________________________ > > > > 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 > _______________________________________________ > 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 erlang@REDACTED Mon Jun 26 12:28:09 2017 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 26 Jun 2017 12:28:09 +0200 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets In-Reply-To: <1498425280.498801.1020848480.44DF132A@webmail.messagingengine.com> References: <20170625160236.31040@web006.roc2.bluetie.com> <1498425280.498801.1020848480.44DF132A@webmail.messagingengine.com> Message-ID: On Sun, Jun 25, 2017 at 11:14 PM, Tristan Sloughter wrote: > The main issue here looks to be that the dep is tied to the master > branch of a git repo. So the dependency is defined as one that will > continually change over time. But there is a deeper issue - the websockets standard *changed* so even if I pointed to a version of cowboy/ranch (whatever) that I tested against in 2013 it still would not work - to get it to work you'd have to get a browser from 2013 and pray that the OS hasn't changed that much. This is only 4 years ago - now consider the problems people will have in 200 years time trying to make programs written hundreds of years ago work. - or in 10,000 years time. > > The version of ranch used when the code was written probably didn't list > `ssl` as a dependency, now that it does `application:start(ranch)` will > fail. So the quick fix is to add `application:start(asn1), > application:start(public_key), application:start(ssl),` before the start > of ranch. Or just `application:ensure_all_started(ranch)`. > > Moral of the story: lock your dependencies (even better if on a package > and not just a git reference) and use a release or > `application:ensure_all_started` for running a project :) Trouble is you don't know what your dependencies are - in (say) smalltalk you could at least state that the SHA checksum of your image was XYZ and the behaviour might be reproducible. Given that my machine has 500GB of state 2 ^ (500 * 10^9 * 8) - is an incredibly large number (exercise: compare to #atoms in Universe) Did my program work when I tested it? and if it did work did it work because my machine was in some weird state? Will it work on another machine? The answer is "who knows" - a decent guess is that if my program works on my machine it should work on a similar machine. Horror story: Once I and Anders Danne bought "identical" machines (at work) - we wanted the same software on both machines. We did the following: 1) I installed on my machine, when the SW worked 2) He installed on his machine After about 20 minutes an install that worked on my machine failed on his machine. Why? my attempts to install failed occasionally - he only repeated the steps that worked so our machines were in a different states OR The chipsets / BIOS (whatever) of the two machines were different We'll never know. When people say "my program does not work" the obvious question is "in what state was your machine" - but the latter question has no answer, so instead we say "have you tried doing X" then we vary X until until the program works or we give up trying. And if it does work we do not know if the last thing we did caused it to work, or all or of all the things that we did before (which did not work) were also needed in order to make it work. The study of programs goes by the quaint name of "computer science" - "computer alchemy" might be a better name since we don't really know why our magic spells sometimes work and sometimes don't. Cheers /Joe > > -- > Tristan Sloughter > "I am not a crackpot" - Abe Simpson > t@REDACTED > > On Sun, Jun 25, 2017, at 02:00 PM, Joe Armstrong wrote: >> Unfortunately cowboy (which I used) and the websockets standard have >> changed since I wrote the book. I also used make and not rebar. >> >> You've now run into what is one of the biggest problems in the >> computer world - code that used to work no longer works despite the >> fact the code itself has not been changed. >> >> One way around this is to use zero dependencies - in fact several >> programs I wrote 30 years ago in Erlang still work fine with no >> changes because there are no external dependencies. (as an aside: this >> is why I like code with zero external dependencies - it takes a lot >> longer to write - but you don't have to support it into the future >> when they things you depend upon change in a manner that is >> incompatible manner) >> >> In this example the underlying websockets protocol changed - >> websockets its is a crazy mess - websockets should have provided raw >> socket transport instead they chose to scramble the data in a weird >> manner to avoid problems with badly written proxies. >> >> The idea of "write once run anywhere" is a great goal - but we can't >> even do this - "write once run forever with no changes to your code" >> would be even better and things like NixOS are a step in the right >> direction. >> >> Welcome to the world of broken software. >> >> In my opinion this (making sure software evolution does not break >> existing functioning software) is one of the biggest remaining >> software problems - my guess is that this problem is getting worse >> (due to the explosion in the numbers of programming languages, >> libraries and frameworks and build systems) and will be even worse in >> the IoT world. >> >> Lots for you guys to work on :-) >> >> Cheers >> >> /Joe >> >> >> On Sun, Jun 25, 2017 at 10:02 PM, 7stud <7stud@REDACTED> wrote: >> > I'm having trouble running the demos for the ezwebframe. I installed the old rebar (v. rebar3), but I'm getting the error: >> > >> > {badmatch,{error,{not_started,ssl}} >> > >> > I'm on Mac OSX 10.10.5. Here is my output: >> > >> > =========== >> > ../ezwebframe-master$ gmake >> > ... >> > .... >> > Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] >> > >> > a simple_demo of websockets.... >> > Load the page http://localhost:1456/ in your browser >> > Starting:{ok,"/Users/7stud/erlang_programs/ezwebframe/ezwebframe-master/demos"} >> > Eshell V8.2 (abort with ^G) >> > 1> {"init terminating in do_boot",{{badmatch,{error,{not_started,ssl}}},[{ezwebframe,start_link,2,[{file,"src/ezwebframe.erl"},{line,22}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}} >> > init terminating in do_boot () >> > >> > Crash dump is being written to: erl_crash.dump...done >> > make[1]: *** [all] Error 1 >> > gmake: *** [Makefile:4: all] Error 2 >> > =========== >> > >> > Thanks for any help is solving this problem! >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From erlang@REDACTED Mon Jun 26 12:33:30 2017 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 26 Jun 2017 12:33:30 +0200 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets In-Reply-To: <4B93FA78-1AE6-4C13-AC63-9C05E6AA66E3@cs.otago.ac.nz> References: <20170625160236.31040@web006.roc2.bluetie.com> <4B93FA78-1AE6-4C13-AC63-9C05E6AA66E3@cs.otago.ac.nz> Message-ID: On Mon, Jun 26, 2017 at 1:55 AM, Richard A. O'Keefe wrote: > >> On 26/06/2017, at 9:00 AM, Joe Armstrong wrote: >> You've now run into what is one of the biggest problems in the >> computer world - code that used to work no longer works despite the >> fact the code itself has not been changed. > > One of my colleagues has an explicit "no third party libraries" > policy for this very reason. Sadly, it does not protect against > operating system or compiler changes. It's even more horrible - I have bought "identical" machines with "identical" OS and libraries - but the chipsets were different which lead to strange failures. Debugging was extremely difficult and tooks weeks because I falsely assumed that the machines were the same and would fail in the same way. > It is notoriously the > case that in pursuit of "optimisation", C compilers are taking > ever more advantage of the strict letter of the C standard, so > that code that used to work may stop working. > > For example, there's a compiler from a historic programming language > to C. It used to work on my Mac. After an Xcode upgrade, it didn't > compile any more. Turned out that the "C" it generated as GNU C > with nested functions, and clang supports *some* GNU C extensions > but not that one. > > Basically, there is NO way to protect yourself from changes to your > infrastructure. You can try to stick close to documented standards, > but things still change. And Erlang itself has dropped a number of > library modules over the years. > > From erlang@REDACTED Mon Jun 26 13:01:50 2017 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 26 Jun 2017 13:01:50 +0200 Subject: [erlang-questions] simple cross platform graphics component Message-ID: Any ideas here. I want a cross platform graphics widget. When started it should pop up a window and listen for messages on port P I should be able to connect to port P using UDP or TCP I send the widget messages encoded in something (JSON, XML, OSC) The messages contain descriptions of graphics objects (preferably SVG) The only program I have been able to find that does this is inscore (http://inscore.sourceforge.net/) This uses OSC messages over UDP What I'd really like is an SVG over OSC over UDP widget (even JSON over TCP would be OK - though less elegant) My view of architectures is that components should be separated by communications channels, and be controlled by messages. They should do one thing and do it well. My personal favorite is OSC over UDP for ease of programming and simplicity. OSC over TCP is also a possibility. Cheers /Joe From dmkolesnikov@REDACTED Mon Jun 26 13:05:14 2017 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Mon, 26 Jun 2017 14:05:14 +0300 Subject: [erlang-questions] simple cross platform graphics component In-Reply-To: References: Message-ID: <1DBB2ED3-5151-4139-B43D-DAB911035CEF@gmail.com> Hello, > On Jun 26, 2017, at 2:01 PM, Joe Armstrong wrote: > > Any ideas here. > > I want a cross platform graphics widget. I am afraid that HTML+CSS is only truth cross platform graphics widget. WebSocket + JSON / Server-Side-Events / HTTP2 is the way to push data into your widget. - Dmitry From jesper.louis.andersen@REDACTED Mon Jun 26 14:48:21 2017 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Mon, 26 Jun 2017 12:48:21 +0000 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets In-Reply-To: References: <20170625160236.31040@web006.roc2.bluetie.com> Message-ID: On Sun, Jun 25, 2017 at 11:00 PM Joe Armstrong wrote: > Welcome to the world of broken software. > > In my opinion this (making sure software evolution does not break > existing functioning software) is one of the biggest remaining > software problems - my guess is that this problem is getting worse > (due to the explosion in the numbers of programming languages, > libraries and frameworks and build systems) and will be even worse in > the IoT world. > > Lots for you guys to work on :-) > > I think a viable source of inspiration is biology. A cell will have situations in which it will have to adapt to the "new interface." (whatever that is). Obviously, cells manage to do this, partly because the "API" is simple enough you can apply fixes. Currently, code needs continuous maintenance to survive. If you don't, then the code will eventually rot and become unusable. As Richard and you observe, the more dependencies, the less your adaptability. This is a darwinistic approach, but the fitness function is obviously wrong. Effort applied as half a billion Javascript programmers make code survive, but that doesn't mean the code is good, elegant or adaptable. The hard part is that we'd like some code to be ephemeral. Perry Metzger observes that hardware is ephemeral: it naturally breaks down, and so does the errors in the hardware as a result. Software has the ability to survive hardware generations which means that it is far more persistent. This is dangerous from a security perspective. It is dangerous from a correctness perspective as well. We need to kill the right kind of code by making it not work anymore. I'm a big fan of something like Golang's `fix` tool. Before 1.0, you could run `go fix` and have your code rewritten to match the new spec automatically. Wrangler in the Erlang world by Simon Thompson can do the same for when things are altered. In the C world, semantic patches as in Coccinelle is highly useful for the same thing since you can apply a fix all over a code base easily. I'd really like a set of "fixups" which applies globally to code. If we look at the ezwebframe problems 7stud encountered, they are all fairly trivial rewrites. We even have a coherent hivemind (e.g., Tristan :) who knows what the problems are and how to fix them. With a bit of luck, we can take fixes in one project and apply them to other projects. Projects where the fixups are not easy are probably fit for a black hole. I'd also like a repository of formally proven algorithms which can be extracted from e.g. Coq into different programming languages. This would allow us to reuse components which have a high level of assurance all over the place. To get this to work, however, we would need political support. You have to outright demand that level of assurance, or companies will gravitate toward the simplest solution which works. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Mon Jun 26 19:51:44 2017 From: mononcqc@REDACTED (Fred Hebert) Date: Mon, 26 Jun 2017 13:51:44 -0400 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets In-Reply-To: References: <20170625160236.31040@web006.roc2.bluetie.com> <1498425280.498801.1020848480.44DF132A@webmail.messagingengine.com> Message-ID: On Mon, Jun 26, 2017 at 6:28 AM, Joe Armstrong wrote: > > But there is a deeper issue - the websockets standard *changed* so > even if I pointed to a version of cowboy/ranch (whatever) that I > tested against in 2013 it still would not work - to get it to work > you'd have to get a browser from 2013 and pray that the OS hasn't > changed that much. > > This is only 4 years ago - now consider the problems people will have > in 200 years time trying to make programs written hundreds of years > ago work. > - or in 10,000 years time. > > Ah, but Joe! It is not just the software that changed; the world also changed. I'd like to refer to *Programs, Life Cycles, and Laws of Software Evolution*, a paper by MM. Lehman from 1980. For the vast majority of software (i.e. not programs implementing a formal specification nor those for a limited game, like chess), five laws of program evolution are proposed: ---- I. Continuing change A program that is used and that as an implementation of its specification reflects some other reality, undergoes continual change or becomes progressively less useful. The change or decay process continues until it is judged more cost effective to replace the system with a recreated version. II. Increasing Complexity As an evolving program is continually changed, its complexity, reflecting deteriorating structure, increases unless work is done to maintain or reduce it. III. The Fundamental Law of Program Evolution The work output of a project is independent of the amount of resources employed -- the ability to be productive when maintaining a program is a function of the program?s environment. How you begin your project, how you build the code, refraction to change by programmers who feel changes are making the platform unstable and whatnot will lead the project to have a stable, predictable rate of change. IV. Conservation of Organizational Stability The world the program evolves in and/or its complexity tend to limit how useful the program can remain through change V. Conservation of Familiarity Similar to the fourth law, but based on the understanding of developers. If the system becomes too complex, developers slow down. Managing complexity and actively maintaining software is essential to help with this. ---- The idea that you can freeze software in time is a difficult one. Google, for example, vendors not only their own code and its dependencies, but also the compilers that were used to produce them. Of course, the compilers as they are may require specific operating systems, configurations, environments, or hardware to run. Maybe they keep enough of those around just in case. Rebar3, even if we wanted to keep it as backwards compatible as we could, can no longer be useful on Erlang/OTP R15, because the SSL libraries coming with that version are no longer are considered secure enough to even talk to the package index it uses. It's interesting that even if the program compiles and behaves right, it cannot inter-operate safely with the real world anymore. The problem of course being that even if the standards for the crypto it uses are still supported, the package index evolves with the rest of the world, and the attackers for such a product in the rest of the world keep improving. The ecosystem in which the system runs makes it impractical to maintain old versions because *pretty much nobody else* runs older software along with you. They'd have to go through the effort of making and maintaining their own index to avoid upgrading software for which updates are available, while increasing their risks when it comes to security. That's a losing proposition! We cannot reasonably decouple the program from the environment that contains it for a very long time: the environment is what likely defined what the best solution to a problem was in the first place; it likely even defined the problem itself. And if the program is good enough, it will impact the environment itself. MS Paint was real cool until everyone imagined making fancier drawings and then someone *wanted *Photoshop. As the environment changes, so the programs become irrelevant or impossible to run. You can delay the inevitable, but you can't isolate software forever and keep it useful, *unless it is able to remain useful when running in isolation already. * If not maintained, it will at best remain a curiosity for future generations. Some people are too young to have ever seen a floppy disk in person, much less used one. They'll be more likely to think an actual 3.5" floppy is a 3D-printed rendition of the 'save icon' than a storage device. So the true question is maybe: if I want to write a book that will be useful in 4 years, 200 years, or 10,000 years time, what should the book contain? The exercises and solutions will have to adapt themselves to changing contexts and environments. What do you assume is going to be around in 200 years? What will need to adapt? If that's not useful for the book you have in mind, then maybe a shorter time expectation is warranted. Maybe a more flexible medium is warranted. Who knows, it depends on what your objectives are. -------------- next part -------------- An HTML attachment was scrubbed... URL: From anthonym@REDACTED Mon Jun 26 20:44:45 2017 From: anthonym@REDACTED (anthonym@REDACTED) Date: Mon, 26 Jun 2017 11:44:45 -0700 Subject: [erlang-questions] Building source, html and man .tar.gz files from github? Message-ID: <1d55cd20724f8cd009504978090f8661.squirrel@mail.alumni.caltech.edu> Hi, I've been building RPMs from the tar balls released on the erlang.org/downloads page for sometime, and the process has been working fine. I tweak a couple lines of my .spec file, type make and about 5 minutes later get an rpm. However, I'd like to be able to get minor releases for which the .tar.gz files are not placed on the website. Ideally, I'd like to do something like % git clone git@REDACTED:erlang/otp.git % cd otp % ./otp_build autoconf % ./configure % make dist but that does not seem to be supported (which was a little confusing because normally you get all those targets for free when using GNU autotools, but I think that might be added by automake which does not appear to be used). I looked through the documents to see if there was any instructions for making those .tar.gz files, but did not see any. I'll probably just try to modify my scripts and .spec files to skip the extract from tarball step, but was wondering if there is a way to get those .tar.gz files for the source, html and man pages via the current build system? Thanks, -Anthony From halturin@REDACTED Mon Jun 26 20:51:37 2017 From: halturin@REDACTED (Taras Halturin) Date: Mon, 26 Jun 2017 21:51:37 +0300 Subject: [erlang-questions] Building source, html and man .tar.gz files from github? In-Reply-To: <1d55cd20724f8cd009504978090f8661.squirrel@mail.alumni.caltech.edu> References: <1d55cd20724f8cd009504978090f8661.squirrel@mail.alumni.caltech.edu> Message-ID: Hi Anthony! There is useful tool to build Erlang from source - https://github.com/kerl/kerl On Mon, Jun 26, 2017 at 9:44 PM, wrote: > Hi, > > I've been building RPMs from the tar balls released on the > erlang.org/downloads page for sometime, and the process has been working > fine. I tweak a couple lines of my .spec file, type make and about 5 > minutes later get an rpm. > > However, I'd like to be able to get minor releases for which the .tar.gz > files are not placed on the website. Ideally, I'd like to do something > like > > % git clone git@REDACTED:erlang/otp.git > % cd otp > % ./otp_build autoconf > % ./configure > % make dist > > but that does not seem to be supported (which was a little confusing > because normally you get all those targets for free when using GNU > autotools, but I think that might be added by automake which does not > appear to be used). > > I looked through the documents to see if there was any instructions for > making those .tar.gz files, but did not see any. > > I'll probably just try to modify my scripts and .spec files to skip the > extract from tarball step, but was wondering if there is a way to get > those .tar.gz files for the source, html and man pages via the current > build system? > > Thanks, > > -Anthony > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Best Regards. Taras Halturin -------------- next part -------------- An HTML attachment was scrubbed... URL: From list1@REDACTED Mon Jun 26 21:41:51 2017 From: list1@REDACTED (Grzegorz Junka) Date: Mon, 26 Jun 2017 19:41:51 +0000 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets In-Reply-To: References: <20170625160236.31040@web006.roc2.bluetie.com> Message-ID: <18a83cbf-5915-3340-b0b9-f9aba47b2680@gjunka.com> On 25/06/2017 21:00, Joe Armstrong wrote: > Unfortunately cowboy (which I used) and the websockets standard have > changed since I wrote the book. I also used make and not rebar. > > You've now run into what is one of the biggest problems in the > computer world - code that used to work no longer works despite the > fact the code itself has not been changed. > > One way around this is to use zero dependencies - in fact several > programs I wrote 30 years ago in Erlang still work fine with no > changes because there are no external dependencies. (as an aside: this > is why I like code with zero external dependencies - it takes a lot > longer to write - but you don't have to support it into the future > when they things you depend upon change in a manner that is > incompatible manner) Joe, I hope you've heard about freezing the code or its dependencies? :-) Old applications will still work as long as they run on the same version of Erlang and use the same versions of dependencies as the example code. But then, even a zere-dependency code isn't guaranteed to run on a never version of Erlang as it already had some braking changes between releases. Grzegorz From karolis.velicka@REDACTED Mon Jun 26 23:06:43 2017 From: karolis.velicka@REDACTED (Karl Velicka) Date: Mon, 26 Jun 2017 22:06:43 +0100 Subject: [erlang-questions] dialyzer: building PLT problem In-Reply-To: <20170624155856.24e7afcc@arcor.com> References: <20170624155856.24e7afcc@arcor.com> Message-ID: Hi Manfred, I would suggest trying using dialyzer with the --no_native option and seeing if that fixes it. I had a different problem also related to native code compilation which also resulted in dialyzer hanging. Of course this doesn't exactly solve the problem - there are downsides to using --no_native [1] but perhaps this will at least help for the time being. [1] http://www1.erlang.org/doc/man/dialyzer.html All the best, Karl On 24 June 2017 at 14:58, Manfred Lotz wrote: > Hi there, > My system is GNU/Linux Fedora 25, erlang 19.3.4-1 (rpm packages from > Fedora). > > When trying to build the PLT using the suggested: > dialyzer --build_plt --apps erts kernel stdlib mnesia > > First dialyzer outputs: > Compiling some key modules to native code... > then I get 26 times a 'Native loading ... failed' each followed by a > {{badmatch,ok},... > line. > > Here dialyzer is hanging. I don't want to post all output here as there > are some 1720 lines. > > > Any ideas appreciated. > > > -- > Manfred > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From ok@REDACTED Tue Jun 27 09:00:30 2017 From: ok@REDACTED (ok@REDACTED) Date: Tue, 27 Jun 2017 19:00:30 +1200 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets In-Reply-To: References: <20170625160236.31040@web006.roc2.bluetie.com> <1498425280.498801.1020848480.44DF132A@webmail.messagingengine.com> Message-ID: <00e3a6b07f9699efd772f3f7ed6b0d86.squirrel@chasm.otago.ac.nz> Joe Armstrong wrote feelingly about the problems of the "same" software not working in (very subtly) different environments. As I understand it, this is one of the driving forces behind the application = VM approach using Docker and the like: make a VM containing the things your application needs and as little else as you can manage, and then never change it. If you want a new version of the application, make a new VM. From mbike2000ru@REDACTED Tue Jun 27 10:24:36 2017 From: mbike2000ru@REDACTED (Dmitry) Date: Tue, 27 Jun 2017 08:24:36 +0000 (UTC) Subject: [erlang-questions] How to install recon References: <415793089.3022383.1498551876840.ref@mail.yahoo.com> Message-ID: <415793089.3022383.1498551876840@mail.yahoo.com> Hello I included recon as a dependency in rebar.config, After compilation and release generating (rebar compile and rebar generate) I attached to the node and I see that all recon functions are undefined. What am I missing? -------------- next part -------------- An HTML attachment was scrubbed... URL: From luis.rascao@REDACTED Tue Jun 27 10:34:48 2017 From: luis.rascao@REDACTED (=?UTF-8?B?THVpcyBSYXNjw6Nv?=) Date: Tue, 27 Jun 2017 09:34:48 +0100 Subject: [erlang-questions] How to install recon In-Reply-To: <415793089.3022383.1498551876840@mail.yahoo.com> References: <415793089.3022383.1498551876840.ref@mail.yahoo.com> <415793089.3022383.1498551876840@mail.yahoo.com> Message-ID: Maybe you didn't add it to .app.src? On Tue, Jun 27, 2017 at 9:24 AM, Dmitry wrote: > Hello > > > I included recon as a dependency in rebar.config, > > After compilation and release generating (rebar compile and rebar > generate) I attached to the node and I see that all recon functions are > undefined. > > What am I missing? > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- PGP fingerprint: F708 E141 AE8D 2D38 E1BC DF3D 1719 3EA0 647D 7260 -------------- next part -------------- An HTML attachment was scrubbed... URL: From roger@REDACTED Tue Jun 27 10:40:53 2017 From: roger@REDACTED (Roger Lipscombe) Date: Tue, 27 Jun 2017 09:40:53 +0100 Subject: [erlang-questions] How to install recon In-Reply-To: References: <415793089.3022383.1498551876840.ref@mail.yahoo.com> <415793089.3022383.1498551876840@mail.yahoo.com> Message-ID: Also: is it added to the list of applications in your *release*? I don't know how to do that with "rebar generate", but using relx, via rebar3, it looks like this: {relx, [ {release, {foo, "1"}, [ foo, bar, baz, {runtime_tools, load}, {recon, load} ]}, 'load' means "include it, but don't attempt to start it". We also specify 'runtime_tools' so we can get 'dbg', etc. On 27 June 2017 at 09:34, Luis Rasc?o wrote: > Maybe you didn't add it to .app.src? > > On Tue, Jun 27, 2017 at 9:24 AM, Dmitry wrote: >> >> Hello >> >> >> I included recon as a dependency in rebar.config, >> >> After compilation and release generating (rebar compile and rebar >> generate) I attached to the node and I see that all recon functions are >> undefined. >> >> What am I missing? >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > PGP fingerprint: F708 E141 AE8D 2D38 E1BC DF3D 1719 3EA0 647D 7260 > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From russell@REDACTED Tue Jun 27 11:32:15 2017 From: russell@REDACTED (Russell Brown) Date: Tue, 27 Jun 2017 10:32:15 +0100 Subject: [erlang-questions] refactoring tools, state of play? Message-ID: <1B17F8C3-37A1-4612-9800-872F5594BD11@wombat.me> Hi, What?s the state of play with refactoring tools for erlang, especially for those using emacs? I tried wrangler a few years back but never really got it to work (paths and rebar project structure issues I think.) Is it still being developed? What else is there out there, or do erlang programmers tend not to need tools for refactoring? Cheers Russell From mbike2000ru@REDACTED Tue Jun 27 11:35:41 2017 From: mbike2000ru@REDACTED (Dmitry) Date: Tue, 27 Jun 2017 09:35:41 +0000 (UTC) Subject: [erlang-questions] How to install recon In-Reply-To: References: <415793089.3022383.1498551876840.ref@mail.yahoo.com> <415793089.3022383.1498551876840@mail.yahoo.com> Message-ID: <893811395.3069810.1498556141862@mail.yahoo.com> I added recon to app.src file but still no luck Here is my app.src file: {application, acceptor, [ ??{description, ""}, ??{vsn, "1"}, ??{registered, []}, ??{applications, [ ??????????????????kernel, ??????????????????stdlib, ??????????????????ranch, ??????????????????recon ???????????????? ]}, ??{mod, { acceptor_app, []}}, ??{env, []} ]}.? On Tuesday, June 27, 2017, 1:40:55 PM GMT+5, Roger Lipscombe wrote: Also: is it added to the list of applications in your *release*? I don't know how to do that with "rebar generate", but using relx, via rebar3, it looks like this: {relx, [ ? ? {release, {foo, "1"}, [ ? ? ? ? foo, bar, baz, ? ? ? ? {runtime_tools, load}, ? ? ? ? {recon, load} ? ? ]}, 'load' means "include it, but don't attempt to start it". We also specify 'runtime_tools' so we can get 'dbg', etc. On 27 June 2017 at 09:34, Luis Rasc?o wrote: > Maybe you didn't add it to .app.src? > > On Tue, Jun 27, 2017 at 9:24 AM, Dmitry wrote: >> >> Hello >> >> >> I included recon as a dependency in rebar.config, >> >> After compilation and release generating (rebar compile and rebar >> generate) I attached to the node and I see that all recon functions are >> undefined. >> >> What am I missing? >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > PGP fingerprint: F708 E141 AE8D 2D38 E1BC? DF3D 1719 3EA0 647D 7260 > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mbike2000ru@REDACTED Tue Jun 27 14:07:09 2017 From: mbike2000ru@REDACTED (Dmitry) Date: Tue, 27 Jun 2017 12:07:09 +0000 (UTC) Subject: [erlang-questions] How to install recon In-Reply-To: <893811395.3069810.1498556141862@mail.yahoo.com> References: <415793089.3022383.1498551876840.ref@mail.yahoo.com> <415793089.3022383.1498551876840@mail.yahoo.com> <893811395.3069810.1498556141862@mail.yahoo.com> Message-ID: <1049669228.3106347.1498565229636@mail.yahoo.com> when I do: application:ensure_all_started(recon). {error,{recon,{"no such file or directory","recon.app"}}}? On Tuesday, June 27, 2017, 2:35:41 PM GMT+5, Dmitry wrote: I added recon to app.src file but still no luck Here is my app.src file: {application, acceptor, [ ??{description, ""}, ??{vsn, "1"}, ??{registered, []}, ??{applications, [ ??????????????????kernel, ??????????????????stdlib, ??????????????????ranch, ??????????????????recon ???????????????? ]}, ??{mod, { acceptor_app, []}}, ??{env, []} ]}.? On Tuesday, June 27, 2017, 1:40:55 PM GMT+5, Roger Lipscombe wrote: Also: is it added to the list of applications in your *release*? I don't know how to do that with "rebar generate", but using relx, via rebar3, it looks like this: {relx, [ ? ? {release, {foo, "1"}, [ ? ? ? ? foo, bar, baz, ? ? ? ? {runtime_tools, load}, ? ? ? ? {recon, load} ? ? ]}, 'load' means "include it, but don't attempt to start it". We also specify 'runtime_tools' so we can get 'dbg', etc. On 27 June 2017 at 09:34, Luis Rasc?o wrote: > Maybe you didn't add it to .app.src? > > On Tue, Jun 27, 2017 at 9:24 AM, Dmitry wrote: >> >> Hello >> >> >> I included recon as a dependency in rebar.config, >> >> After compilation and release generating (rebar compile and rebar >> generate) I attached to the node and I see that all recon functions are >> undefined. >> >> What am I missing? >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > PGP fingerprint: F708 E141 AE8D 2D38 E1BC? DF3D 1719 3EA0 647D 7260 > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From S.J.Thompson@REDACTED Tue Jun 27 14:15:39 2017 From: S.J.Thompson@REDACTED (Simon Thompson) Date: Tue, 27 Jun 2017 13:15:39 +0100 Subject: [erlang-questions] refactoring tools, state of play? In-Reply-To: <1B17F8C3-37A1-4612-9800-872F5594BD11@wombat.me> References: <1B17F8C3-37A1-4612-9800-872F5594BD11@wombat.me> Message-ID: <7AE658C5-4B9B-44D9-9A1D-F43635748BCF@kent.ac.uk> Hi Russell, Wrangler is still going, and you can get it here: https://github.com/RefactoringTools/wrangler We?ll be happy to try to help out with getting started. Simon > On 27 Jun 2017, at 10:32, Russell Brown wrote: > > Hi, > What?s the state of play with refactoring tools for erlang, especially for those using emacs? > > I tried wrangler a few years back but never really got it to work (paths and rebar project structure issues I think.) Is it still being developed? > > What else is there out there, or do erlang programmers tend not to need tools for refactoring? > > Cheers > > Russell > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson@REDACTED | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt From marco.molteni@REDACTED Tue Jun 27 20:25:19 2017 From: marco.molteni@REDACTED (Marco Molteni) Date: Tue, 27 Jun 2017 20:25:19 +0200 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets In-Reply-To: <00e3a6b07f9699efd772f3f7ed6b0d86.squirrel@chasm.otago.ac.nz> References: <20170625160236.31040@web006.roc2.bluetie.com> <1498425280.498801.1020848480.44DF132A@webmail.messagingengine.com> <00e3a6b07f9699efd772f3f7ed6b0d86.squirrel@chasm.otago.ac.nz> Message-ID: <41D1C126-EF69-4F32-B259-F3AD41C1F13F@laposte.net> On 27 Jun 2017, at 09:00, wrote: > As I understand it, this is one of the driving forces behind > the application = VM approach using Docker and the like: > make a VM containing the things your application needs and > as little else as you can manage, and then never change it. > If you want a new version of the application, make a new VM. This sounds good on the surface (the charm of Docker). Then one realises that the container is exposed to a network, and so open to attack. Then one understand that the less worse approach is to keep updating everything and fixing what breaks. marco From rpettit@REDACTED Tue Jun 27 20:48:49 2017 From: rpettit@REDACTED (Rick Pettit) Date: Tue, 27 Jun 2017 13:48:49 -0500 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets In-Reply-To: <41D1C126-EF69-4F32-B259-F3AD41C1F13F@laposte.net> References: <20170625160236.31040@web006.roc2.bluetie.com> <1498425280.498801.1020848480.44DF132A@webmail.messagingengine.com> <00e3a6b07f9699efd772f3f7ed6b0d86.squirrel@chasm.otago.ac.nz> <41D1C126-EF69-4F32-B259-F3AD41C1F13F@laposte.net> Message-ID: Marco, I?m not sure I follow. Aren?t you forced to expose your Erlang application to a network, thus "opening it up to attack", regardless of whether or not docker or some VM is in the picture? In what ways does adding Docker make that problem ?worse?, in your opinion? -Rick > On Jun 27, 2017, at 1:25 PM, Marco Molteni wrote: > > On 27 Jun 2017, at 09:00, wrote: > >> As I understand it, this is one of the driving forces behind >> the application = VM approach using Docker and the like: >> make a VM containing the things your application needs and >> as little else as you can manage, and then never change it. >> If you want a new version of the application, make a new VM. > > This sounds good on the surface (the charm of Docker). > > Then one realises that the container is exposed to a network, and so open to attack. > > Then one understand that the less worse approach is to keep updating everything and fixing what breaks. > > marco > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From ml_news@REDACTED Tue Jun 27 21:40:30 2017 From: ml_news@REDACTED (Manfred Lotz) Date: Tue, 27 Jun 2017 21:40:30 +0200 Subject: [erlang-questions] dialyzer: building PLT problem In-Reply-To: References: <20170624155856.24e7afcc@arcor.com> Message-ID: <20170627214030.6ed2af2e@hogwart.bsdlocal.net> Hi Karl, On Mon, 26 Jun 2017 22:06:43 +0100 Karl Velicka wrote: > Hi Manfred, > > I would suggest trying using dialyzer with the --no_native option and > seeing if that fixes it. I had a different problem also related to > native code compilation which also resulted in dialyzer hanging. > Yes, that indeed did help. > Of course this doesn't exactly solve the problem - there are downsides > to using --no_native [1] but perhaps this will at least help for the > time being. > > [1] http://www1.erlang.org/doc/man/dialyzer.html > Yep, although not solving the problem for the time being this is a good workaround for me. > All the best, > Karl > Thanks again. Best, Manfred > On 24 June 2017 at 14:58, Manfred Lotz wrote: > > Hi there, > > My system is GNU/Linux Fedora 25, erlang 19.3.4-1 (rpm packages from > > Fedora). > > > > When trying to build the PLT using the suggested: > > dialyzer --build_plt --apps erts kernel stdlib mnesia > > > > First dialyzer outputs: > > Compiling some key modules to native code... > > then I get 26 times a 'Native loading ... failed' each followed by a > > {{badmatch,ok},... > > line. > > > > Here dialyzer is hanging. I don't want to post all output here as > > there are some 1720 lines. > > > > > > Any ideas appreciated. > > > > > > -- > > Manfred > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions From marco.molteni@REDACTED Tue Jun 27 22:20:31 2017 From: marco.molteni@REDACTED (Marco Molteni) Date: Tue, 27 Jun 2017 22:20:31 +0200 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets In-Reply-To: References: <20170625160236.31040@web006.roc2.bluetie.com> <1498425280.498801.1020848480.44DF132A@webmail.messagingengine.com> <00e3a6b07f9699efd772f3f7ed6b0d86.squirrel@chasm.otago.ac.nz> <41D1C126-EF69-4F32-B259-F3AD41C1F13F@laposte.net> Message-ID: <8C8376E0-813B-4861-B493-F02BB373889A@laposte.net> Hello Rick, re-reading what I wrote I have to admit I was not very clear. Let me try again: I start from the assumption that the main problem today is resisting to attacks (or to be more realistic: to resist as much as possible to attacks). In order to resist to attacks, besides clearly doing a proper threat modeling, mitigation and defence in depth, the accepted best practice is to keep updating the operating system you are using, also if updating might break your own application due to a dependency that breaks backward compatibility. Now comes Docker. Docker has been mentioned as a way to "freeze" the dependencies (OS and libraries) needed to deploy an application, in order to be assured that said application will run today (the date it has been released) and, say, in one year time frame. My point was that yes, if you use Docker in that way the application will keep working, and each day that passes it will become more vulnerable (either the app or any of the dependencies or OS onboard the container). Does this mean that Docker is bad from a security point of view? No, but it means that Docker by itself is not enough and is even worse than a VM or an OS on bare metal, because it will not receive OS security updates, while at least a VM or a bare metal OS _can_ be configured to receive automatic security updates. Using Docker securely requires an infrastructure that automatically builds an new Docker image each time a security update is available, automatically tests it and automatically deploys this new image in place of the old one. Clearly if a VM or bare metal is, for fear of breaking the application, configured _not_ to receive automatic security updates, then the situation is the same (as today's Petya ransomware shows, for example). Hope this explains better what I meant :-) marco > On 27 Jun 2017, at 20:48, Rick Pettit wrote: > > Marco, I?m not sure I follow. > > Aren?t you forced to expose your Erlang application to a network, thus "opening it up to attack", regardless of whether or not docker or some VM is in the picture? > > In what ways does adding Docker make that problem ?worse?, in your opinion? > > -Rick > >> On Jun 27, 2017, at 1:25 PM, Marco Molteni wrote: >> >> On 27 Jun 2017, at 09:00, wrote: >> >>> As I understand it, this is one of the driving forces behind >>> the application = VM approach using Docker and the like: >>> make a VM containing the things your application needs and >>> as little else as you can manage, and then never change it. >>> If you want a new version of the application, make a new VM. >> >> This sounds good on the surface (the charm of Docker). >> >> Then one realises that the container is exposed to a network, and so open to attack. >> >> Then one understand that the less worse approach is to keep updating everything and fixing what breaks. >> >> marco >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > From rpettit@REDACTED Tue Jun 27 22:31:23 2017 From: rpettit@REDACTED (Rick Pettit) Date: Tue, 27 Jun 2017 15:31:23 -0500 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets In-Reply-To: <8C8376E0-813B-4861-B493-F02BB373889A@laposte.net> References: <20170625160236.31040@web006.roc2.bluetie.com> <1498425280.498801.1020848480.44DF132A@webmail.messagingengine.com> <00e3a6b07f9699efd772f3f7ed6b0d86.squirrel@chasm.otago.ac.nz> <41D1C126-EF69-4F32-B259-F3AD41C1F13F@laposte.net> <8C8376E0-813B-4861-B493-F02BB373889A@laposte.net> Message-ID: <5D8CB79C-64BF-4335-A845-E5C16509482C@vailsys.com> Marco, I follow you now, and agree with the following: > Using Docker securely requires an infrastructure that automatically builds an new Docker image each time a security update is available, automatically tests it and automatically deploys this new image in place of the old one. > > Clearly if a VM or bare metal is, for fear of breaking the application, configured _not_ to receive automatic security updates, then the situation is the same (as today's Petya ransomware shows, for example). Thanks for clarifying, -Rick > On Jun 27, 2017, at 3:20 PM, Marco Molteni wrote: > > Hello Rick, > > re-reading what I wrote I have to admit I was not very clear. Let me try again: > > I start from the assumption that the main problem today is resisting to attacks (or to be more realistic: to resist as much as possible to attacks). > > In order to resist to attacks, besides clearly doing a proper threat modeling, mitigation and defence in depth, the accepted best practice is to keep updating the operating system you are using, also if updating might break your own application due to a dependency that breaks backward compatibility. > > Now comes Docker. Docker has been mentioned as a way to "freeze" the dependencies (OS and libraries) needed to deploy an application, in order to be assured that said application will run today (the date it has been released) and, say, in one year time frame. > > My point was that yes, if you use Docker in that way the application will keep working, and each day that passes it will become more vulnerable (either the app or any of the dependencies or OS onboard the container). > > Does this mean that Docker is bad from a security point of view? No, but it means that Docker by itself is not enough and is even worse than a VM or an OS on bare metal, because it will not receive OS security updates, while at least a VM or a bare metal OS _can_ be configured to receive automatic security updates. > > Using Docker securely requires an infrastructure that automatically builds an new Docker image each time a security update is available, automatically tests it and automatically deploys this new image in place of the old one. > > Clearly if a VM or bare metal is, for fear of breaking the application, configured _not_ to receive automatic security updates, then the situation is the same (as today's Petya ransomware shows, for example). > > Hope this explains better what I meant :-) > > marco > > >> On 27 Jun 2017, at 20:48, Rick Pettit wrote: >> >> Marco, I?m not sure I follow. >> >> Aren?t you forced to expose your Erlang application to a network, thus "opening it up to attack", regardless of whether or not docker or some VM is in the picture? >> >> In what ways does adding Docker make that problem ?worse?, in your opinion? >> >> -Rick >> >>> On Jun 27, 2017, at 1:25 PM, Marco Molteni wrote: >>> >>> On 27 Jun 2017, at 09:00, wrote: >>> >>>> As I understand it, this is one of the driving forces behind >>>> the application = VM approach using Docker and the like: >>>> make a VM containing the things your application needs and >>>> as little else as you can manage, and then never change it. >>>> If you want a new version of the application, make a new VM. >>> >>> This sounds good on the surface (the charm of Docker). >>> >>> Then one realises that the container is exposed to a network, and so open to attack. >>> >>> Then one understand that the less worse approach is to keep updating everything and fixing what breaks. >>> >>> marco >>> _______________________________________________ >>> 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 ok@REDACTED Wed Jun 28 00:22:53 2017 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 28 Jun 2017 10:22:53 +1200 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets In-Reply-To: <8C8376E0-813B-4861-B493-F02BB373889A@laposte.net> References: <20170625160236.31040@web006.roc2.bluetie.com> <1498425280.498801.1020848480.44DF132A@webmail.messagingengine.com> <00e3a6b07f9699efd772f3f7ed6b0d86.squirrel@chasm.otago.ac.nz> <41D1C126-EF69-4F32-B259-F3AD41C1F13F@laposte.net> <8C8376E0-813B-4861-B493-F02BB373889A@laposte.net> Message-ID: <5A1F75FE-48EA-4290-9BE6-6E9B13F7F7D1@cs.otago.ac.nz> > On 28/06/2017, at 8:20 AM, Marco Molteni wrote: ... > > I start from the assumption that the main problem today is resisting to attacks (or to be more realistic: to resist as much as possible to attacks). ... > > My point was that yes, if you use Docker in that way the application will keep working, and each day that passes it will become more vulnerable (either the app or any of the dependencies or OS onboard the container). There is a missing word in your argument, and the word is "directly". If any application, implemented and deployed by any means whatsoever, is exposed *directly* to the network, then yes, it is exposed to all attacks that flow over that network. The context in which I became aware of Docker is a radio astronomy one -- don't ask me about radio astronomy, I am on the very fringes of the project. I can spell "AIPS" and have it on my machine but that is all I know about the subject -- where the intention is to do vast amounts of computation on a cluster which will have no *direct* network connection. Instead all connection with the outside world will go through a gateway machine. THAT machine has to be kept up to date. But as long as the protocols between the cluster and the gateway are are as limited as possible and do not change, the cluster software will not need to change. Of course, in such a context there are *still* changes that force changes to software. Amongst other things - mistakes in the code will be detected and corrected - the hardware will change (ARM? intel? EPYC? Power?) over time as computational needs grow - new applications will be developed as astronomers' needs grow But there will still be a need to be able to reproduce old work, for *decades*. From ahe.sanath@REDACTED Wed Jun 28 12:16:24 2017 From: ahe.sanath@REDACTED (Sanath Prasanna) Date: Wed, 28 Jun 2017 15:46:24 +0530 Subject: [erlang-questions] beam is crashed due to out of memory & it is not started automatically after that even used heart Message-ID: Hi all, My system is going down due to out of memory & it is not auto started even set -heart command in starting. What is the reason for this ? Can someone explain how to overcome this problem. (not starting system automatically using heart) Br, Robert /var/log/message aa_hub kernel: [60952995.574233] Out of memory: Kill process 2480 (beam.smp) score 498 or sacrifice child Jun 27 13:31:07 aa_hub kernel: [60952995.577670] Killed process 2565 (heart) total-vm:8408kB, anon-rss:92kB, file-rss:0kB Jun 27 13:31:07 aa_hub kernel: [60952995.584754] epmd invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0 Jun 27 13:31:07 aa_hub kernel: [60952995.587996] epmd cpuset=/ mems_allowed=0 startup command /system/bin/run_erl -daemon /system/test/pipe/ /tmp "/system/bin/start_erl /system /system /system/bin/start_erl -smp auto* -heart -*sname test +64 +P10000 +B i -setcookie test" -------------- next part -------------- An HTML attachment was scrubbed... URL: From magnus@REDACTED Wed Jun 28 12:57:46 2017 From: magnus@REDACTED (Magnus Henoch) Date: Wed, 28 Jun 2017 11:57:46 +0100 Subject: [erlang-questions] beam is crashed due to out of memory & it is not started automatically after that even used heart In-Reply-To: Sanath Prasanna's message of "Wed\, 28 Jun 2017 15\:46\:24 +0530 \(33 minutes\, 40 seconds ago\)" Message-ID: Sanath Prasanna writes: > Hi all, My system is going down due to out of memory & it is not > auto started even set -heart command in starting. What is the > reason for this ? Can someone explain how to overcome this > problem. (not starting system automatically using heart) Br, > Robert > > /var/log/message > > aa_hub kernel: [60952995.574233] Out of memory: Kill process > 2480 (beam.smp) score 498 or sacrifice child Jun 27 13:31:07 > aa_hub kernel: [60952995.577670] Killed process 2565 (heart) > total-vm:8408kB, anon-rss:92kB, file-rss:0kB Jun 27 13:31:07 > aa_hub kernel: [60952995.584754] epmd invoked oom-killer: > gfp_mask=0x201da, order=0, oom_score_adj=0 Jun 27 13:31:07 > aa_hub kernel: [60952995.587996] epmd cpuset=/ mems_allowed=0 > > startup command > > /system/bin/run_erl -daemon /system/test/pipe/ /tmp > "/system/bin/start_erl /system /system /system/bin/start_erl > -smp auto* -heart -*sname test +64 +P10000 +B i -setcookie test" I've seen the same issue. The problem is that the OOM killer identifies a process to kill, and then kills all its child processes before killing the chosen process itself. Since heart is a child process of the beam process, it doesn't have a chance to restart the Erlang VM. I tried to fix it with the patch below, but it didn't work for some reason - I don't remember the details. I ended up solving the problem by addressing the memory usage itself. https://github.com/legoscia/otp/commit/bc19687664697dcff9d5472e14da231cf830abe5 Regards, Magnus From dszoboszlay@REDACTED Wed Jun 28 14:54:27 2017 From: dszoboszlay@REDACTED (=?UTF-8?Q?D=C3=A1niel_Szoboszlay?=) Date: Wed, 28 Jun 2017 12:54:27 +0000 Subject: [erlang-questions] Tricking dialyzer with an opaque type In-Reply-To: References: Message-ID: Why don't you simply run Dialyzer on a build made without your parse transform? It could even verify the internals of f(). Daniel On Sun, 25 Jun 2017, 18:56 Paul Guyot, wrote: > Hello, > > I do have a parse transform that replaces the body of a 0-arity function > with its result, as evaluated at compile time. > I am looking for a way to avoid an opaque violation warning from dialyzer > when this function returns, say, a gb_sets:set(). The spec is properly > copied into the parsed tree, but dialyzer just ignores it. > > Typically, such a function would load data from a file and create a > gb_sets:set() from this data. > > -spec f() -> gb_sets:set(unicode:unicode_binary()). > f() -> > {ok, Content} = file:read_file(?FILENAME), > List0 = binary:split(Content, <<"\n">>, [global]), > List1 = lists:filter(fun(W) -> W =/= <<>> end, List0), > gb_sets:from_list(List1). > > With the parse_transform, dialyzer complains on usage, e.g. : > > [warning] some_module.erl:123 the call > gb_sets:add(,Var::{1..1114111,{_,_,_}}) does not have an opaque term > of type gb_sets:set(_) as 2nd argument > > Yet, of course, some_module.erl does not violate the opacity of > gb_sets:set() itself. > I can trick dialyzer with an expensive identity function: > > gb_sets:add(Value, binary_to_term(term_to_binary(Var))) > > Any better idea? > > Paul > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eric.pailleau@REDACTED Wed Jun 28 16:50:35 2017 From: eric.pailleau@REDACTED (Eric PAILLEAU) Date: Wed, 28 Jun 2017 16:50:35 +0200 (CEST) Subject: [erlang-questions] beam is crashed due to out of memory & it is not started automatically after that even used heart In-Reply-To: References: Sanath Prasanna's message of "Wed\, 28 Jun 2017 15\:46\:24 +0530 \(33 minutes\, 40 seconds ago\)" Message-ID: <728544617.11717.1498661435368.JavaMail.www@wwinf1f31> Hi, you can tell OOM to not kill some process . for heart, somewhere in your start script do : ? pgrep -f "heart -pid" | while read PID; do echo -17 > /proc/$PID/oom_adj; done ? -17 is the value to let OOM ignore the process. ? regards ? ? ? ? ? > Message du 28/06/17 12:58 > De : "Magnus Henoch" > A : "Sanath Prasanna" > Copie ? : "erlang-questions" > Objet : Re: [erlang-questions] beam is crashed due to out of memory & it is not started automatically after that even used heart > > Sanath Prasanna writes: > > > Hi all, My system is going down due to out of memory & it is not > > auto started even set -heart command in starting. What is the > > reason for this ? Can someone explain how to overcome this > > problem. (not starting system automatically using heart) Br, > > Robert > > > > /var/log/message > > > > aa_hub kernel: [60952995.574233] Out of memory: Kill process > > 2480 (beam.smp) score 498 or sacrifice child Jun 27 13:31:07 > > aa_hub kernel: [60952995.577670] Killed process 2565 (heart) > > total-vm:8408kB, anon-rss:92kB, file-rss:0kB Jun 27 13:31:07 > > aa_hub kernel: [60952995.584754] epmd invoked oom-killer: > > gfp_mask=0x201da, order=0, oom_score_adj=0 Jun 27 13:31:07 > > aa_hub kernel: [60952995.587996] epmd cpuset=/ mems_allowed=0 > > > > startup command > > > > /system/bin/run_erl -daemon /system/test/pipe/ /tmp > > "/system/bin/start_erl /system /system /system/bin/start_erl > > -smp auto* -heart -*sname test +64 +P10000 +B i -setcookie test" > > I've seen the same issue. The problem is that the OOM killer > identifies a process to kill, and then kills all its child > processes before killing the chosen process itself. Since heart > is a child process of the beam process, it doesn't have a chance > to restart the Erlang VM. > > I tried to fix it with the patch below, but it didn't work for > some reason - I don't remember the details. I ended up solving > the problem by addressing the memory usage itself. > > https://github.com/legoscia/otp/commit/bc19687664697dcff9d5472e14da231cf830abe5 > > Regards, > Magnus > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dm.klionsky@REDACTED Wed Jun 28 17:21:20 2017 From: dm.klionsky@REDACTED (Dmitry Klionsky) Date: Wed, 28 Jun 2017 18:21:20 +0300 Subject: [erlang-questions] cpu_sup steal Message-ID: <5953C970.8000008@gmail.com> Hi, 'steal' is implemented in cpu_sup at least since R13B01, but still is not documented. There was even a patch proposed some time ago, but not accepted because of a bad message (my guess). http://erlang.org/pipermail/erlang-patches/2013-December/004441.html Is it safe to assume that 'steal', 'hard_irq' and 'soft_irq' will be documented at all? Thank you From n.oxyde@REDACTED Thu Jun 29 14:37:11 2017 From: n.oxyde@REDACTED (Anthony Ramine) Date: Thu, 29 Jun 2017 14:37:11 +0200 Subject: [erlang-questions] Programming Erlang: Chap 18, Websockets In-Reply-To: References: <20170625160236.31040@web006.roc2.bluetie.com> <1498425280.498801.1020848480.44DF132A@webmail.messagingengine.com> Message-ID: <1A9D4260-0613-46C8-A510-02DC4FD167DF@gmail.com> > Le 26 juin 2017 ? 12:28, Joe Armstrong a ?crit : > > But there is a deeper issue - the websockets standard *changed* so > even if I pointed to a version of cowboy/ranch (whatever) that I > tested against in 2013 it still would not work - to get it to work > you'd have to get a browser from 2013 and pray that the OS hasn't > changed that much. > > This is only 4 years ago - now consider the problems people will have > in 200 years time trying to make programs written hundreds of years > ago work. > - or in 10,000 years time. Just a friendly reminder that Web standards don't change "just because", but because they were broken in some sort or didn't reflect real world usage in the first place. That's why now DOM and HTML are Living Standards, for example. From erlang@REDACTED Thu Jun 29 15:22:25 2017 From: erlang@REDACTED (Stefan Marr) Date: Thu, 29 Jun 2017 15:22:25 +0200 Subject: [erlang-questions] [CfP][Meta'17] Workshop on Meta-Programming Techniques and Reflection Message-ID: Call for Papers: Meta?17 ======================== Workshop on Meta-Programming Techniques and Reflection Co-located with SPLASH 2017 October 22, 2017, Vancouver, Canada Twitter @MetaAtSPLASH http://2017.splashcon.org/track/meta-2017 The heterogeneity of mobile computing, cloud applications, multicore architectures, and other systems leads to increasing complexity of software and requires new approaches to programming languages and software engineering tools. To manage the complexity, we require generic solutions that can be adapted to specific application domains or use cases, making metaprogramming an important topic of research once more. However, the challenges with metaprogramming are still manifold. They start with fundamental issues such as typing of reflective programs, continue with practical concerns such as performance and tooling, and reach into the empirical field to understand how metaprogramming is used and how it affects software maintainability. Thus, while industry accepted metaprogramming on a wide scale with Ruby, Scala, JavaScript and others, academia still needs to answer a wide range of questions to bring it to the same level of convenience, tooling, and programming styles to cope with the increasing complexity of software systems. This workshop aims to explore meta-level technologies that help tackling the heterogeneity, scalability and openness requirements of emerging computations platforms. ### Topics of Interest The workshop is a venue for all approaches that embrace metaprogramming: - from static to dynamic techniques - reflection, meta-level architectures, staging, open language runtimes applications to middleware, frameworks, and DSLs - optimization techniques to minimize runtime overhead - contract systems, or typing of reflective programs reflection and metaobject protocols to enable tooling - case studies and evaluation of such techniques, e.g., to build applications, language extensions, or tools - empirical evaluation of metaprogramming solutions - security in reflective systems and capability-based designs - meta-level architectures and reflective middleware for modern runtime platforms (e.g. IoT, cyber-physical systems, mobile/cloud/grid computing, etc) - surveys, conceptualization, and taxonomization of existing approaches In short, we invite contributions to the workshop on a wide range of topics related to design, implementation, and application of reflective APIs and meta-programming techniques, as well as empirical studies and typing for such systems and languages. ### Workshop Format and Submissions This workshop welcomes the presentation of new ideas and emerging problems as well as mature work as part of a mini-conference format. Furthermore, we plan interactive brainstorming and demonstration sessions between the formal presentations to enable an active exchange of ideas. The workshop papers will be published in the ACM DL, if not requested otherwise by the authors. Thus, they will be part of SPLASH workshop proceedings. Therefore, papers are to be submitted using the SIGPLAN acmart style: http://www.sigplan.org/Resources/Author/. Please use the provided double-column templates for Latex http://www.sigplan.org/sites/default/files/acmart/current/acmart-sigplanproc-template.tex) or Word http://www.acm.org/publications/proceedings-template. - technical paper: max. 8 pages, excluding references - position and work-in-progress paper: 1-4 pages, excluding references - technology demos or a posters: 1-page abstract Demos, posters, position and work-in-progress papers can be submitted on a second, later deadline to discuss the latest results and current work. For the submission, please use the submission system at: https://meta17.hotcrp.com/ ### Important Dates Abstract Submission: 07 August 2017 Paper Submission: 14 August 2017 Author Notification: 06 September 2017 Position/WIP Paper Deadline: 08 September 2017 Camera Ready Deadline: 18 September 2017 Position/WIP Notification: 21 September 2017 ### Program Committee The program committee consists of the organizers and the following reviewers: Anya Helen Bagge, University of Bergen, Norway Daniele Bonetta, Oracle Labs, Austria Nicolas Cardozo, Universidad de los Andes, Colombia Sebastian Erdweg, TU Delf, The Nederlands Robert Hirschfeld, HPI, Germany Roberto Ierusalimschy, PUC-Rio, Brazil Pablo Inostroza, CWI, The Nederlands Kim Mens, Universite Catholique de Louvain, Belgium Cyrus Omar, Carnegie Mellon University, USA Guillermo Polito, CNRS, France Tiark Rompf, Purdue University, USA Tom Van Cutsem, Nokia Bell Labs, Belgium Takuo Watanabe, Tokyo Institute of Technology, Japan ### Workshop Organizers Shigeru Chiba, University of Tokyo Elisa Gonzalez Boix, Vrije Universiteit Brussel Stefan Marr, Johannes Kepler University Linz From lloyd@REDACTED Thu Jun 29 17:09:05 2017 From: lloyd@REDACTED (lloyd@REDACTED) Date: Thu, 29 Jun 2017 11:09:05 -0400 (EDT) Subject: [erlang-questions] Deployment of Erlang web app Message-ID: <1498748945.97696169@apps.rackspace.com> Hello, As an army of one and a limited budget, I've been climbing the Erlang learning curve for nearly three years now. The goal: an ambitious Nitrogen-based web app. Now I'm ready to start thinking seriously about how to deploy. But I find little guidance in either my library of Erlang programming books or on the web. At this point it's increasingly evident that I need experienced advice/guidance/mentoring/consulting help through late stages of development and up through a smooth, successful launch. I have more questions than I can reasonably ask here. But I'll limit to the two clouding my mind at the moment. Background: I chose Erlang based on the promise of reliability. My prospective users cannot afford to lose data. So, redundancy is essential. I'm currently using mnesia on the back end. Some folks have recommended that I switch to Postgres, but I had a disastrous experience at the beginning of my journey while working with Zotonic, so I'm leery. I've even thought about Riak. Two questions: 1. What minimal cloud hosting plan would experienced folks recommend to assure maximum data security and accessibility while minimizing overhead costs through start-up phase? 2. What would folks recommend re: back-up and recover? Many thanks, LRP ********************************************* My books: THE GOSPEL OF ASHES http://thegospelofashes.com Strength is not enough. Do they have the courage and the cunning? Can they survive long enough to save the lives of millions? FREEIN' PANCHO http://freeinpancho.com A community of misfits help a troubled boy find his way AYA TAKEO http://ayatakeo.com Star-crossed love, war and power in an alternative universe Available through Amazon or by request from your favorite bookstore ********************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Thu Jun 29 19:44:31 2017 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 29 Jun 2017 17:44:31 +0000 Subject: [erlang-questions] Spacemacs EDTS layer or something w/ symbol lookup Message-ID: Folks, Does anyone have a Spacemacs layer for EDTS? Alternatively, is there something with go-to-symbol functionality, for either Emacs, VS Code or Sublime? Thanks, Joel -- __ http://linkedin.com/in/joelreymont Go, Rust hacker. Blockchain, Bitcoin, Ethereum and cryptocurrency geek. Can write compilers and VMs for your smart contracts. Hire me! -------------- next part -------------- An HTML attachment was scrubbed... URL: From list1@REDACTED Fri Jun 30 00:48:48 2017 From: list1@REDACTED (Grzegorz Junka) Date: Thu, 29 Jun 2017 22:48:48 +0000 Subject: [erlang-questions] Size of a map key in words Message-ID: <8d44731c-7db3-2959-cbc8-193b47fdfad6@gjunka.com> What's the size of a single key in an Erlang map in words? Is there any information how the hash function works? Grzegorz From mjtruog@REDACTED Fri Jun 30 02:23:21 2017 From: mjtruog@REDACTED (Michael Truog) Date: Thu, 29 Jun 2017 17:23:21 -0700 Subject: [erlang-questions] Size of a map key in words In-Reply-To: <8d44731c-7db3-2959-cbc8-193b47fdfad6@gjunka.com> References: <8d44731c-7db3-2959-cbc8-193b47fdfad6@gjunka.com> Message-ID: <595599F9.2020209@gmail.com> On 06/29/2017 03:48 PM, Grzegorz Junka wrote: > What's the size of a single key in an Erlang map in words? Is there any information how the hash function works? > > Grzegorz > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > http://erlang.org/doc/efficiency_guide/advanced.html#id68923 has the memory information and https://github.com/okeuday/erlang_term shows how to get this size during runtime. From ok@REDACTED Fri Jun 30 03:13:30 2017 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 30 Jun 2017 13:13:30 +1200 Subject: [erlang-questions] Size of a map key in words In-Reply-To: <595599F9.2020209@gmail.com> References: <8d44731c-7db3-2959-cbc8-193b47fdfad6@gjunka.com> <595599F9.2020209@gmail.com> Message-ID: > On 30/06/2017, at 12:23 PM, Michael Truog wrote: >> >> > http://erlang.org/doc/efficiency_guide/advanced.html#id68923 has the memory information and https://github.com/okeuday/erlang_term shows how to get this size during runtime. Those two disagree. For example, erlang_term says Small Map (N =< 32): 4 words + 2 words per key/value pair + the size of each pair whereas advanced.html says Small Map 5 words + the size of all keys and values. The latter just *has* to be wrong, the former is at least believable. From mjtruog@REDACTED Fri Jun 30 04:59:05 2017 From: mjtruog@REDACTED (Michael Truog) Date: Thu, 29 Jun 2017 19:59:05 -0700 Subject: [erlang-questions] Size of a map key in words In-Reply-To: References: <8d44731c-7db3-2959-cbc8-193b47fdfad6@gjunka.com> <595599F9.2020209@gmail.com> Message-ID: <5955BE79.9090602@gmail.com> On 06/29/2017 06:13 PM, Richard A. O'Keefe wrote: >> On 30/06/2017, at 12:23 PM, Michael Truog wrote: >>> >> http://erlang.org/doc/efficiency_guide/advanced.html#id68923 has the memory information and https://github.com/okeuday/erlang_term shows how to get this size during runtime. > Those two disagree. For example, erlang_term says > Small Map (N =< 32): > 4 words + 2 words per key/value pair + the size of each pair > whereas advanced.html says > Small Map > 5 words + the size of all keys and values. > > The latter just *has* to be wrong, the former is at least believable. > The erlang_term README information is based on an older version of the Erlang Efficiency guide html docs and the newer content is different. It is possible an error was inserted into the new html docs, but it would be best for the Erlang/OTP team to check this. From dangud@REDACTED Fri Jun 30 08:44:52 2017 From: dangud@REDACTED (Dan Gudmundsson) Date: Fri, 30 Jun 2017 06:44:52 +0000 Subject: [erlang-questions] Spacemacs EDTS layer or something w/ symbol lookup In-Reply-To: References: Message-ID: tags works for me in normal emacs. On Thu, Jun 29, 2017 at 7:52 PM Joel Reymont wrote: > Folks, > > Does anyone have a Spacemacs layer for EDTS? > > Alternatively, is there something with go-to-symbol functionality, for > either Emacs, VS Code or Sublime? > > Thanks, Joel > > -- > __ > http://linkedin.com/in/joelreymont > Go, Rust hacker. Blockchain, Bitcoin, Ethereum > and cryptocurrency geek. Can write compilers > and VMs for your smart contracts. Hire me! > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rick@REDACTED Fri Jun 30 09:21:42 2017 From: rick@REDACTED (Rick van Rein) Date: Fri, 30 Jun 2017 09:21:42 +0200 Subject: [erlang-questions] The "ei" API and passing *shared* binaries / parts In-Reply-To: References: <594B668B.4090505@openfortress.nl> <594B684A.8050605@openfortress.nl> Message-ID: <5955FC06.7030005@openfortress.nl> Ah, Vance Shipley wrote: > You want to use a linked in driver: > http://erlang.org/doc/tutorial/c_portdriver.html Yes, that helps! (Didn't see your response before somehow.) Plus, following up on my own question, what seems to be needed to share blobs would apparently be 0. Have a blob uint8_t ptr [siz] 1. Create an ETERM for it with erl_mk_binary (ptr, siz) 2. Send with ei_encode_term 3. Update refctr / free if needed (docs are not clear) Sounds like a plan I to try and test. Thanks, -Rick From lukas@REDACTED Fri Jun 30 10:13:54 2017 From: lukas@REDACTED (Lukas Larsson) Date: Fri, 30 Jun 2017 10:13:54 +0200 Subject: [erlang-questions] Size of a map key in words In-Reply-To: <5955BE79.9090602@gmail.com> References: <8d44731c-7db3-2959-cbc8-193b47fdfad6@gjunka.com> <595599F9.2020209@gmail.com> <5955BE79.9090602@gmail.com> Message-ID: On Fri, Jun 30, 2017 at 4:59 AM, Michael Truog wrote: > On 06/29/2017 06:13 PM, Richard A. O'Keefe wrote: > >> On 30/06/2017, at 12:23 PM, Michael Truog wrote: >>> >>>> >>>> http://erlang.org/doc/efficiency_guide/advanced.html#id68923 has the >>> memory information and https://github.com/okeuday/erlang_term shows how >>> to get this size during runtime. >>> >> Those two disagree. For example, erlang_term says >> Small Map (N =< 32): >> 4 words + 2 words per key/value pair + the size of each pair >> whereas advanced.html says >> Small Map >> 5 words + the size of all keys and values. >> >> The latter just *has* to be wrong, the former is at least believable. >> >> The erlang_term README information is based on an older version of the > Erlang Efficiency guide html docs and the newer content is different. It > is possible an error was inserted into the new html docs, but it would be > best for the Erlang/OTP team to check this. > > The latter is the correct value. The documentation for both small and large map sizes was incorrect and fixed in OTP-19.3 (I think). Small map size = boxed ptr + header + size + key ptr + key header = 5 words. The old incorrect version did not count the boxed ptr as part of the term size. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Fri Jun 30 12:18:25 2017 From: vances@REDACTED (Vance Shipley) Date: Fri, 30 Jun 2017 15:48:25 +0530 Subject: [erlang-questions] The "ei" API and passing *shared* binaries / parts In-Reply-To: <5955FC06.7030005@openfortress.nl> References: <594B668B.4090505@openfortress.nl> <594B684A.8050605@openfortress.nl> <5955FC06.7030005@openfortress.nl> Message-ID: On Fri, Jun 30, 2017 at 12:51 PM, Rick van Rein wrote: > what seems to be needed to share blobs would apparently be > > 0. Have a blob uint8_t ptr [siz] > 1. Create an ETERM for it with erl_mk_binary (ptr, siz) > 2. Send with ei_encode_term > 3. Update refctr / free if needed (docs are not clear) The most efficient and flexible way to integrate C libraries with Erlang is to write a linked in driver which allows sharing processing between C and Erlang, passing the data back and forth as required. I've written a bunch of drivers over the years. If you need help figuring any of this out just ask but the following should get you on the right track. The erl_driver C library API is described here: http://erlang.org/doc/man/erl_driver.html http://erlang.org/doc/man/driver_entry.html A driver creates a binary erlang term with driver_alloc_binary(): http://erlang.org/doc/man/erl_driver.html#driver_alloc_binary A driver may send a binary to an erlang port with driver_output_binary(): http://erlang.org/doc/man/erl_driver.html#driver_output_binary A driver should use erl_drv_output_term() to send erlang terms to the port owner: http://erlang.org/doc/man/erl_driver.html#erl_drv_output_term An erlang process may use port_command/2 to send iodata() which a driver receives in it's outputv() calback: http://erlang.org/doc/man/erlang.html#port_command-2 http://erlang.org/doc/man/driver_entry.html#outputv The data received in outputv() is an ErlIOVec structure: http://erlang.org/doc/man/erl_driver.html#ErlIOVec An erlang process may use port_call/3 to send arbitrary terms which a driver receives in it's call() callback: http://erlang.org/doc/man/erlang.html#port_call-3 http://erlang.org/doc/man/driver_entry.html#call The data received in call() is Erlang external term format which can be decoded with a series of calls to ei_decode_*(): http://erlang.org/doc/man/ei.html If you only need to call C library functions from Erlang and get an immediate result you may write a NIF instead of a full linked in driver: http://erlang.org/doc/tutorial/nif.html http://erlang.org/doc/man/erl_nif.html -- -Vance From rickard@REDACTED Fri Jun 30 12:32:06 2017 From: rickard@REDACTED (Rickard Green) Date: Fri, 30 Jun 2017 12:32:06 +0200 Subject: [erlang-questions] Patch Package 19.3.6.1 Released Message-ID: <470ede1e-36a3-ddb3-9694-915c87e85961@erlang.org> Patch Package: OTP 19.3.6.1 Git Tag: OTP-19.3.6.1 Date: 2017-06-27 Trouble Report Id: OTP-13939, OTP-14481, OTP-14484 Seq num: ERL-193 System: OTP Release: 19 Application: erts-8.3.5.1 Predecessor: OTP 19.3.6 Check out the git tag OTP-19.3.6.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-8.3.5.1 ---------------------------------------------------- --------------------------------------------------------------------- Note! The erts-8.3.5.1 application can *not* be applied independently of other applications on an arbitrary OTP 19 installation. On a full OTP 19 installation, also the following runtime dependency has to be satisfied: -- sasl-3.0.1 (first satisfied in OTP 19.1) --- Fixed Bugs and Malfunctions --- OTP-13939 Application(s): erts, kernel Related Id(s): ERL-193 Fixed a bug in gen_tcp:send where it never returned when repeatedly called on a remotely closed TCP socket. OTP-14481 Application(s): erts Fixed segfault that could happen during cleanup of aborted erlang:port_command/3 calls. A port_command is aborted if the port is closed at the same time as the port_command was issued. This bug was introduced in erts-8.0. OTP-14484 Application(s): erts Fixed implementation of statistics(wall_clock) and statistics(runtime) so that values do not unnecessarily wrap due to the emulator. Note that the values returned by statistics(runtime) may still wrap due to limitations in the underlying functionality provided by the operating system. Full runtime dependencies of erts-8.3.5.1: kernel-5.0, sasl-3.0.1, stdlib-3.0 --------------------------------------------------------------------- --------------------------------------------------------------------- --------------------------------------------------------------------- From tobias.lindahl@REDACTED Fri Jun 30 13:27:13 2017 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Fri, 30 Jun 2017 13:27:13 +0200 Subject: [erlang-questions] Tricking dialyzer with an opaque type In-Reply-To: References: Message-ID: It seems to me that the gb_sets:from_list/1 should give the correct type for your function even if the spec is not taken into account. In that case, the value you are getting warnings for comes from somewhere else. Could it be that you are deconstructing the opaque type somewhere? 2017-06-25 18:56 GMT+02:00 Paul Guyot : > Hello, > > I do have a parse transform that replaces the body of a 0-arity function > with its result, as evaluated at compile time. > I am looking for a way to avoid an opaque violation warning from dialyzer > when this function returns, say, a gb_sets:set(). The spec is properly > copied into the parsed tree, but dialyzer just ignores it. > > Typically, such a function would load data from a file and create a > gb_sets:set() from this data. > > -spec f() -> gb_sets:set(unicode:unicode_binary()). > f() -> > {ok, Content} = file:read_file(?FILENAME), > List0 = binary:split(Content, <<"\n">>, [global]), > List1 = lists:filter(fun(W) -> W =/= <<>> end, List0), > gb_sets:from_list(List1). > > With the parse_transform, dialyzer complains on usage, e.g. : > > [warning] some_module.erl:123 the call gb_sets:add(,Var::{1..1114111,{_,_,_}}) > does not have an opaque term of type gb_sets:set(_) as 2nd argument > > Yet, of course, some_module.erl does not violate the opacity of > gb_sets:set() itself. > I can trick dialyzer with an expensive identity function: > > gb_sets:add(Value, binary_to_term(term_to_binary(Var))) > > Any better idea? > > Paul > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex0player@REDACTED Fri Jun 30 15:29:55 2017 From: alex0player@REDACTED (Alex S.) Date: Fri, 30 Jun 2017 16:29:55 +0300 Subject: [erlang-questions] Tricking dialyzer with an opaque type In-Reply-To: References: Message-ID: <90E97C86-D51F-4A93-9100-14DCEDAA381B@gmail.com> he is constructing it, after parse transform takes place. > 30 ???? 2017 ?., ? 14:27, Tobias Lindahl ???????(?): > > It seems to me that the gb_sets:from_list/1 should give the correct type for your function even if the spec is not taken into account. > > In that case, the value you are getting warnings for comes from somewhere else. Could it be that you are deconstructing the opaque type somewhere? > > > 2017-06-25 18:56 GMT+02:00 Paul Guyot >: > Hello, > > I do have a parse transform that replaces the body of a 0-arity function with its result, as evaluated at compile time. > I am looking for a way to avoid an opaque violation warning from dialyzer when this function returns, say, a gb_sets:set(). The spec is properly copied into the parsed tree, but dialyzer just ignores it. > > Typically, such a function would load data from a file and create a gb_sets:set() from this data. > > -spec f() -> gb_sets:set(unicode:unicode_binary()). > f() -> > {ok, Content} = file:read_file(?FILENAME), > List0 = binary:split(Content, <<"\n">>, [global]), > List1 = lists:filter(fun(W) -> W =/= <<>> end, List0), > gb_sets:from_list(List1). > > With the parse_transform, dialyzer complains on usage, e.g. : > > [warning] some_module.erl:123 the call gb_sets:add(,Var::{1..1114111,{_,_,_}}) does not have an opaque term of type gb_sets:set(_) as 2nd argument > > Yet, of course, some_module.erl does not violate the opacity of gb_sets:set() itself. > I can trick dialyzer with an expensive identity function: > > gb_sets:add(Value, binary_to_term(term_to_binary(Var))) > > Any better idea? > > Paul > _______________________________________________ > 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 pguyot@REDACTED Fri Jun 30 15:44:47 2017 From: pguyot@REDACTED (Paul Guyot) Date: Fri, 30 Jun 2017 15:44:47 +0200 Subject: [erlang-questions] Tricking dialyzer with an opaque type In-Reply-To: References: Message-ID: <0B03CA1A-E838-450C-A3F0-F0FE64BE5439@kallisys.net> D?niel, Thank you for your reply. Indeed, the drawback of my approach is that the internals of f() are not checked, although this could be done by keeping (and exporting) the function under another name. dialyzer is ran as part of the integration process and the code is only meant to be executed at compile time. Paul > On 28 Jun 2017, at 14:54, D?niel Szoboszlay wrote: > > Why don't you simply run Dialyzer on a build made without your parse transform? It could even verify the internals of f(). > > Daniel > > > On Sun, 25 Jun 2017, 18:56 Paul Guyot, > wrote: > Hello, > > I do have a parse transform that replaces the body of a 0-arity function with its result, as evaluated at compile time. > I am looking for a way to avoid an opaque violation warning from dialyzer when this function returns, say, a gb_sets:set(). The spec is properly copied into the parsed tree, but dialyzer just ignores it. > > Typically, such a function would load data from a file and create a gb_sets:set() from this data. > > -spec f() -> gb_sets:set(unicode:unicode_binary()). > f() -> > {ok, Content} = file:read_file(?FILENAME), > List0 = binary:split(Content, <<"\n">>, [global]), > List1 = lists:filter(fun(W) -> W =/= <<>> end, List0), > gb_sets:from_list(List1). > > With the parse_transform, dialyzer complains on usage, e.g. : > > [warning] some_module.erl:123 the call gb_sets:add(,Var::{1..1114111,{_,_,_}}) does not have an opaque term of type gb_sets:set(_) as 2nd argument > > Yet, of course, some_module.erl does not violate the opacity of gb_sets:set() itself. > I can trick dialyzer with an expensive identity function: > > gb_sets:add(Value, binary_to_term(term_to_binary(Var))) > > Any better idea? > > Paul > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From pguyot@REDACTED Fri Jun 30 15:50:31 2017 From: pguyot@REDACTED (Paul Guyot) Date: Fri, 30 Jun 2017 15:50:31 +0200 Subject: [erlang-questions] Tricking dialyzer with an opaque type In-Reply-To: <90E97C86-D51F-4A93-9100-14DCEDAA381B@gmail.com> References: <90E97C86-D51F-4A93-9100-14DCEDAA381B@gmail.com> Message-ID: <5F791844-BA87-48E9-81BE-6ADC7D54231D@kallisys.net> Alex, Tobias, Indeed, the function constructs the set using gb_sets API and then the result is embedded in the module with erl_parse:abstract/1. The current solution consists in adding a call to an identity/1 function in the generated replacement code. This function is exported from the parse transform module of type fun(any()) -> any(). Since the parse transform is in another application, dialyzer seems to take its specification for granted (?). It's a cheaper equivalent of binary_to_term(term_to_binary(V)), although not free (it's still a remote call). Paul > On 30 Jun 2017, at 15:29, Alex S. wrote: > > he is constructing it, after parse transform takes place. >> 30 ???? 2017 ?., ? 14:27, Tobias Lindahl > ???????(?): >> >> It seems to me that the gb_sets:from_list/1 should give the correct type for your function even if the spec is not taken into account. >> >> In that case, the value you are getting warnings for comes from somewhere else. Could it be that you are deconstructing the opaque type somewhere? >> >> >> 2017-06-25 18:56 GMT+02:00 Paul Guyot >: >> Hello, >> >> I do have a parse transform that replaces the body of a 0-arity function with its result, as evaluated at compile time. >> I am looking for a way to avoid an opaque violation warning from dialyzer when this function returns, say, a gb_sets:set(). The spec is properly copied into the parsed tree, but dialyzer just ignores it. >> >> Typically, such a function would load data from a file and create a gb_sets:set() from this data. >> >> -spec f() -> gb_sets:set(unicode:unicode_binary()). >> f() -> >> {ok, Content} = file:read_file(?FILENAME), >> List0 = binary:split(Content, <<"\n">>, [global]), >> List1 = lists:filter(fun(W) -> W =/= <<>> end, List0), >> gb_sets:from_list(List1). >> >> With the parse_transform, dialyzer complains on usage, e.g. : >> >> [warning] some_module.erl:123 the call gb_sets:add(,Var::{1..1114111,{_,_,_}}) does not have an opaque term of type gb_sets:set(_) as 2nd argument >> >> Yet, of course, some_module.erl does not violate the opacity of gb_sets:set() itself. >> I can trick dialyzer with an expensive identity function: >> >> gb_sets:add(Value, binary_to_term(term_to_binary(Var))) >> >> Any better idea? >> >> Paul >> _______________________________________________ >> 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 sverker.eriksson@REDACTED Fri Jun 30 18:49:03 2017 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Fri, 30 Jun 2017 18:49:03 +0200 Subject: [erlang-questions] Size of a map key in words In-Reply-To: <8d44731c-7db3-2959-cbc8-193b47fdfad6@gjunka.com> References: <8d44731c-7db3-2959-cbc8-193b47fdfad6@gjunka.com> Message-ID: On 06/30/2017 12:48 AM, Grzegorz Junka wrote: > Is there any information how the hash function works? > Hashing is only used for maps with more than 32 keys. It's implemented in C here: https://github.com/erlang/otp/blob/OTP-20.0/erts/emulator/beam/utils.c#L1581 /Sverker