erlang

Erlang: binary_to_atom filling up atom table space security issue

倾然丶 夕夏残阳落幕 提交于 2019-12-07 10:01:09
问题 I heard that an atom table can fill up in Erlang, leaving the system open for DDoS unless you increase the number of atoms that can be created. It looks like binary_to_existing_atom/2 is the solution to this. Can anyone explain exactly how binary_to_atom/2 is a security implication and how binary_to_existing_atom/2 solves this problem? 回答1: When an atom is first used it is given an internal number and put in an array in the VM. This array is allocated statically and can fill up if enough

Problem with starting supervisor through script - Erlang

爱⌒轻易说出口 提交于 2019-12-07 09:28:11
问题 I have made an OTP compliant application where i have a gen_server and a supervisor. Also i have a script to start them. My script contains something like this. erl -pa module_name/ebin -name abc@hostname -setcookie test -s module_sup start_link() This does not start the supervisor. But when i do module_sup:start_link() inside the shell, it works. Also when i do erl -pa module_name/ebin -name abc@hostname -setcookie test -s module_srv start_link() i.e the server alone without the supervisor,

Erlang - Starting a child from the supervisor module

白昼怎懂夜的黑 提交于 2019-12-07 08:17:15
问题 I'm trying to create a supervisor which handles adding dynamic gen_servers. for a reason something is failing and I'm not really sure what. -module(supervisor_mod). -behaviour(supervisor). -export([start_link/0, add_child/1]). -export([init/1]). start_link() -> Pid=supervisor:start_link({local, ?MODULE} , ?MODULE, []), {ok,Pid}. init(_Args) -> {ok, {{simple_one_for_one, 10, 60}, [{example_proc, {example_proc, start_link, []}, permanent, brutal_kill, worker, [example_proc]}]}}. add_child(Name)

How Erlang processes access mailbox concurrently

*爱你&永不变心* 提交于 2019-12-07 07:32:49
问题 There are lots of info regarding how to use erlang mailbox, but seldom to find a paper or document describe how erlang actual access mailbox concurrently internally within the VM. To my understanding, Erlang VM must have to do locking or CAS action to secure message integrity. Is there any sophisticate way of method behind erlang's curtain 回答1: By mailbox I'm assuming you mean the process mailbox, the one messages are inserted into. Fun question! There's some conversation here about the

RabbitMQ RPM installation failed on Red Hat Enterprise Linux 7.2 (even with erlang installed)

限于喜欢 提交于 2019-12-07 07:26:25
In the homepage of RabbitMQ it says First install erlang Then install RabbitMQ by rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc yum install rabbitmq-server-3.6.3-1.noarch.rpm I installed erlang but when install RabbitMQ it failed, the error says Requires: erlang>=R16B-03 But I have already installed erlang 19.0 , what's the problem? Someone in other article suggested RabbitMQ doesn't support erlang 19.0 right now, then what should I do? I have already installed erlang 19.0 and tried installing erlang 18.3 without deleting erlang 19.0 , because I don't know how to

Lager calls failing during Common Test test runs

雨燕双飞 提交于 2019-12-07 07:23:37
问题 I decided to setup lager in my Erlang project. I am using erlang.mk, so I added ERLC_OPTS = +'{parse_transform, lager_transform}' to my Makefile. I can run make all and compile the modules without errors. I can also start an erl console and run the application containing the modules using lager. No errors are generated and lager logs messages during the console session. It seems as though everything is fine (this is the first time I have used lager). But, when I run Common Test, the lager

Using fully qualified function calls in Erlang?

本秂侑毒 提交于 2019-12-07 07:21:04
问题 I have just learnt how to upgrade a module in Erlang and I know that only the function calls that use the fully qualified names (eg. module:function() ) gets "relinked" to the current version loaded into the VM, but the function calls that do not specify the module's name do not get "relinked" to the current version, but keep using the older one. Is there a rule of thumb on when to use a fully qualified function call and when it's OK to call a function just by its name? Is it a bad idea to

How to maintain state in Erlang?

非 Y 不嫁゛ 提交于 2019-12-07 06:49:35
问题 I have seen people use dict,ordict,record for maintaining state in many blogs that i have read.I find it as very vital concept. Generally I understand the meaning of mantaining state,recursions but when it comes to erlang..I am a little vague about how it is handled . Any help? 回答1: State is the present arrangement of data. It is sometimes hard to remember this for two reasons: State means both the data in the program and the program's current point of execution and "mode". We build this up

Erlang serialization library

。_饼干妹妹 提交于 2019-12-07 06:19:22
问题 Does anybody know good and production ready serialization library for Erlang? I have tried erlang_protobuffs - but it fails on its tests. I don't need to expose methods or anything like this, all I need is to encode/decode messages. Is there anything else worth trying? 回答1: As @Alexey Romanov said, try term_to_binary and binary_to_term . If you are talking between Erlang nodes, you don't even need this, because the Erlang runtime can do this for you transparently. There are also libraries for

How to read all the records of mnesia database in erlang?

时间秒杀一切 提交于 2019-12-07 06:18:04
问题 I ma new in erlang and I need to do some operations for all records I get from mnesia database. Result = mnesia:dirty_read(mydatabase, {key1, key2}), case Result of [] -> ?DEBUG("No such record found", []); [#mydatabase{key3 = Key3}] -> %% some operations end How can I add a loop to my code that execute some operations for all records? I am not even sure if the code above does it or not? 回答1: You could use mnesia:foldl/3 for that. It iterates over all records in a table, passing along an