otp

Adding nodes dynamically and global_groups in Erlang

Erlang support to partition its nodes into groups using the global_group module. Further, Erlang supports adding nodes on the fly to the node-network. Are these two features usable with each other? As far as I understand, you have to name every node on startup to use the global groups. ...

Accessing Erlang business layer via REST

For a college project i'm thinking of implementing the business layer in Erlang and then accessing it via multiple front-ends using REST. I would like to avail of OTP features like distributed applications, etc. My question is how do I expose gen_server calls/casts to other applications? Obviously I could make RPC calls via language spe...

Erlang : Disallowed Nodes / Maybe Cookie question.

Trying to get two erlang nodes talking to each other : one on a Ubuntu machine and one on Windows XP. We're getting a "Connection attempt from disallowed node" message which prevents one node receiving messages from the other. They're both using 5.XXX versions of Erlang OTP. Both nodes have the same cookie ( .erlang.cookie) We are s...

gen_server named timer_server caused timer module functions to not return

I created a supervisor that spawned a gen_server I called timer_server. One of the tasks of this timer_server is to manage registration and call timer:send_interval to send a message to a pid on a certain interval. However, in the init of the gen_server, where I call timer:send_interval I was getting a lockup. The documentation said t...

Process balancing in Erlang

Does anybody knows if there is a sort of 'load-balancer' in the erlang standard library? I mean, if I have some really simple operations on a really large set of data, the overhead of constructing a process for every item will be larger than perform the operation sequentially. But if I can balance the work in the 'right number' of proces...

What's the best way to do something periodically in Erlang?

I have a process that needs to do some work every fifteen seconds. I'm currently doing it like this: -behavior(gen_server). interval_milliseconds ()-> 15000. init()-> {ok, _State = FascinatingStateData, _TimeoutInterval = interval_milliseconds () }. %% This gets called automatically...

Erlang Takeover failing after successful Failover

I have an application distributed over 2 nodes. When I halt() the first node the failover works perfectly, but ( sometimes ? ) when I restart the first node the takeover fails and the application crashes since start_link returns already started. SUPERVISOR REPORT <0.60.0> 2009-05-20 12:12:01 ============...

In erlang/OTP how do I start appmon to monitor an existing node?

Hi. I have a running erlang application, launched with this command line erl -boot start_sasl -config config/cfg_qa -detached -name peasy -cookie peasy -pa ./ebin -pa ./ebin/mochiweb -s peasy start If I start a new node and run appmon:start(), the 'peasy' node won't show up, even if using the same cookie. The same happens with webtoo...

When to use gen_server in Erlang/OTP applications

Having read Joe Armstrong's book and watched Kevin Smith screencasts I've built a simple OTP application comprised of a single gen_server and single supervisor, bundled together as an OTP application. Now I'm looking at mochiweb and have created a sample project [helloworld] using the new_mochiweb.erl script. Browsing the source code I ...

Make a process end before timeout

It seems that an erlang process will stay alive until the 5 sec default timeout even if it has finished it's work. I have gen_server call that issues a command to the window CLI which can be completed in less than 1 sec but the process waits 5 sec before I see the result of the operation. What's going on? is it soemthing to do with the...

Using gen_server to encapsulate an mnesia table?

I have a server application made in Erlang. In it I have an mnesia table that store some information on photos. In the spirit of "everything is a process" I decided to wrap that table in a gen_server module, so that the gen_server module is the only one that directly accesses the table. Querying and adding information to that table is ...

How build non-blocking TCP server with ssl encryption

Non-blocking TCP server on trapexit.org explains how to build server based on tcp_gen, but i want to modify this example and make it work with ssl. For now i have completely no idea how to replace {ok, Ref} = prim_inet:async_accept(Listen_socket, -1) ...

Erlang gen_server vs stateless module

Hi, I've recently finished Joe's book and quite enjoyed it. I'm since then started coding a soft realtime application with erlang and I have to say I am a bit confused at the use of gen_server. When should I use gen_server instead of a simple stateless module? I define a stateless module as follow: - A module that takes it's state as a ...

Event manager process in erlang. Named processes or Pids?

I have event manager process that dispatches events to subscribers (e.g. http_session_created, http_sesssion_destroyed). If Pid is used instead of named process, I must put it into functions to operate with event manager but if Named process is used, code will be more clear. Which variant is right? Thank you! ...

erlang otp download

what is the different download from http://code.google.com/p/otp-base/ and http://www.erlware.org/? ...

Example of use of unregistered, dynamically created gen_server's?

Tutorials are abound for working with gen_servers that are named in an OTP application. However, I've been unable to find a good example of dynamically spawning servers that are not registered (not named). Can someone point to a good, simple example? Not ejabberd, for example, where there is a lot to confuse the core idea I'm trying to g...

Allowing a gen_fsm to timeout if it receives no messages

Normally if I'd like to have an Erlang process timeout I would use the following construct: receive Msg -> ok; %% handle message after 60000 -> %% Handle timeout and exit end. Is there a similar mechanism in the OTP servers such as gen_fsm? I will be spawning gen_fsm's for each active session with my application, and would li...

Are there third party GUIs to manage OTP applications?

Is there anything like the weblogic console, but for administrating an OTP application (written in Erlang)? ...

bad_application error starting erlang gen_server application

I have written a simple erlang app using gen_server. When starting it with application:start(myapp), I get the following tuple... {error,{bad_application,{appliction,myapp ... (rest of my application config). There are no other error or warning messages. I have also tried to google examples of how to configure gen_server and also the...

Supervising multiple gen_servers with same module / different arguments

Hi, I have a OTP application comprising a single supervisor supervising a small number of gen_servers. A typical child specification is as follows: {my_server, {my_server, start_link, [123]}, permanent, 5000, worker, [my_server]} No problems so far. I now want to an add extra gen_server to the supervisor structure, usi...