Coder Social home page Coder Social logo

cloudi / cloudi Goto Github PK

View Code? Open in Web Editor NEW
403.0 38.0 51.0 59.67 MB

A Cloud at the lowest level!

Home Page: https://cloudi.org/

License: MIT License

Erlang 81.27% Shell 0.06% Makefile 0.33% C++ 1.78% C 0.32% Java 1.97% JavaScript 0.60% Perl 0.42% PHP 0.47% Python 1.11% Ruby 0.42% HTML 8.88% CSS 0.16% M4 0.35% Go 0.46% OCaml 0.50% Haskell 0.45% Elixir 0.05% SWIG 0.01% ATS 0.41%
cloud microservices fault-tolerance soa cloudi distributed-systems actor-model distributed-actors cloud-computing scalability

cloudi's Introduction

Build Status Project Status RSS Mastodon X (formerly Twitter) IRC Email

LICENSE

MIT License

ABOUT

What is CloudI?

(short answer) "A distributed application server that provides efficient messaging for many programming languages within a single service abstraction that is both scalable and fault-tolerant."

(shorter answer) "A rock-solid transaction processing system for flexible software development."

(shortest answer) "A Cloud at the lowest level."

Who would use CloudI?

Software developers that do not want to get locked into corporate vendors or frameworks that push for perpetual commercial support or licenses.

Why should CloudI be used?

CloudI makes software fault-tolerant and scalable, utilizing Erlang, even if the software is legacy source code. CloudI mitigates software development risk (delays or failures) when making software scale in non-Erlang programming languages, or during a conversion of a software system (fully or partially) to the Erlang programming language.

How should CloudI be used?

The CloudI API provides a simple set of functions for Service-Oriented Architecture (SOA) development in any supported language (currently ATS, C/C++, Erlang/Elixir, Go, Haskell, Java, JavaScript, OCaml, Perl, PHP, Python, Ruby and Rust):

  • subscribe, unsubscribe, subscribe_count
  • send_async, send_sync, mcast_async (mcast_async == publish)
  • recv_async
  • return, forward

External communication that needs to scale (beyond 10,000 connections) can use an existing internal CloudI service (implemented in Erlang or Elixir) which may do processing for one or more external CloudI services (implemented in ATS, C/C++, Go, Haskell, Java, JavaScript, OCaml, Perl, PHP, Python, Ruby and/or Rust)

Even if external communication doesn't need to scale, private cloud computing tasks (number crunching) can gain fault-tolerance and internal system scalability within CloudI.

Where should I find more information?

Please see the FAQ for more details.

INSTALLATION

Requirements

  • Erlang >= 22.0 (erlang /Ubuntu, erlang /Alpine)
  • C/C++ (C++98 compliant, improved error information with C++11 support)
    • GCC >= 4.9 (g++ /Ubuntu, g++ /Alpine) or clang >= 3.3 (clang /Ubuntu, clang /Alpine)
  • boost >= 1.40.0 (libboost-system-dev libboost-thread-dev libboost-dev /Ubuntu, boost-system boost-thread boost-dev /Alpine)

Optional (default="yes"):

  • C
    • Use the "--enable-c-support=no" configure flag to disable
  • C++
    • CloudI::API::backtrace() function
      • backtrace with backward-cpp (Linux)
        • backtrace symbols options:
          • (binutils-dev /Ubuntu, binutils-dev /Alpine)
          • (libdw-dev /Ubuntu, elfutils-dev /Alpine)
          • libdwarf version < 20210528 (libdwarf-dev libelf-dev /Ubuntu, libdwarf libdwarf-dev elfutils-dev /Alpine)
        • backtrace data options:
          • compiler unwind.h
          • (libexecinfo-dev /Alpine)
      • backtrace with boost::stacktrace (boost >= 1.71)
        • (libboost-stacktrace-dev /Ubuntu, boost-stacktrace_basic /Alpine)
      • Use the "--with-cxx-backtrace=no" configure flag to disable
    • Use the "--enable-cxx-support=no" configure flag to disable
  • Java >= 1.5 JDK
    • (default-jdk /Ubuntu, openjdk8 /Alpine)
    • Use the "--enable-java-support=no" configure flag to disable
    • Java CloudI API is available as a Maven package
  • JavaScript >= 0.12.18
    • (nodejs /Ubuntu, nodejs /Alpine)
    • Use the "--enable-javascript-support=no" configure flag to disable
    • JavaScript CloudI API is available as a npm package
  • Perl >= 5.10 (with Compress::Zlib)
    • (perl perl-modules /Ubuntu, perl /Alpine)
    • Use the "--enable-perl-support=no" configure flag to disable
  • PHP >= 7.0
    • (php /Ubuntu, php7 /Alpine)
    • Use the "--enable-php-support=no" configure flag to disable
  • Python >= 2.7.0
    • (python3 python3-dev /Ubuntu, python3 python3-dev /Alpine)
    • Use the "--enable-python-support=no" and "--enable-python-c-support=no" configure flag to disable
    • Python and Python/C CloudI API is available as a PyPI package
  • Ruby >= 1.9.0
    • (ruby /Ubuntu, ruby /Alpine)
    • Use the "--enable-ruby-support=no" configure flag to disable
    • Ruby CloudI API is available as a Ruby gem
  • syscall_lock service configuration option
    • syscall_lock with pledge (OpenBSD)
      • libc unistd.h
    • syscall_lock with libseccomp (Linux)
      • (libseccomp-dev /Ubuntu, libseccomp-dev /Alpine)
  • GNU MP library
    • (libgmp-dev /Ubuntu, gmp-dev /Alpine)
    • Used in the hexpi (C++) integration test only ("--with-integration-tests=no" configure flag to disable)

Optional (default="no"):

  • ATS2/Postiats >= 0.3.13
    • (ats2-lang /Ubuntu)
    • Use the "--enable-ats2-support" configure flag to enable
  • Go >= 1.11
    • (golang /Ubuntu, go /Alpine)
    • Use the "--enable-go-support" configure flag to enable
    • Go CloudI API is available as a remote import
  • Haskell (GHC >= 8.6.0)
    • (ghc zlib1g-dev /Ubuntu, ghc zlib-dev /Alpine)
    • Use the "--enable-haskell-support" configure flag to enable
    • Haskell CloudI API is available as a Hackage package for GHC >= 7.10.3
  • OCaml >= 4.08.0
    • (ocaml /Ubuntu, ocaml /Alpine)
    • Use the "--enable-ocaml-support" configure flag to enable
    • OCaml CloudI API is available as an opam package
  • Rust >= 1.66.1
    • (rustc /Ubuntu, rust /Alpine)
    • Use the "--enable-rust-support" configure flag to enable
    • Rust CloudI API is available as a published crate

Building

For configuration options, see FAQ: 3.2 - Installation Options.

cd src
./configure
make
sudo make install

Running

Within the installation directory the cloudi script controls CloudI.

To start CloudI:

sudo cloudi start

To stop CloudI:

sudo cloudi stop

INTEGRATION

See the Quick Start Guide or the API documentation

Integration points:

Dynamic Configuration and Monitoring:

Routing:

Maintained Services Excluded from this Repository:

Unmaintained Services Excluded from this Repository:

The default CloudI configuration will run the included integration tests if all the programming languages enabled by default are detected at configure time and the --with-integration-tests-ran configuration argument is used (to choose the src/cloudi_tests.conf.in configuration file).

If the --with-integration-tests=no configuration argument is used, the more minimal CloudI configuration will be used instead (in the src/cloudi_minimal.conf.in configuration file) to support basic things like the Quick Start Guide, the Dashboard and any tutorials or examples.

CONTACT

Michael Truog (mjtruog at protonmail dot com)

cloudi's People

Contributors

brucekissinger avatar c-rack avatar dieswaytoofast avatar dmzmk avatar garazdawi avatar getong avatar iguberman-ubnt avatar jcomellas avatar joneshf avatar ncopa avatar okeuday avatar sanmiguel avatar varnerac avatar varnerac-ubnt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloudi's Issues

lazy destination refresh method for cloudi module interface

This requires the user of the cloudi module to handle an incoming message, that then calls a cloudi module function to update the context data with the lazy lookup data (cpg_data), so the documentation needs to clearly show this as a requirement. An error, when the lookup data is missing can help to show the requirement.

reltool_util scope script gets confused with unmodified files present

After the scope script has processed all source files, and source files are updated and pulled, they do not get processed... instead errors are produced when processing the app file. This is only a problem when a git pull occurs within a built repo... so this doesn't relate to a clean build. This may specifically relate to changing the version of an Erlang application (since this occurred with the jsx Erlang application update, and the actual source code changes were limited).

Use a proplist as the format used to define services in the configuration

Currently, to define/configure a service in CloudI we have to provide a tuple with 13 (for internal services) or 17 (for external services) fields. This makes the service definition difficult to understand when looking at the code.

I would suggest allowing the use of a proplist when defining the services to improve readability. For the key names, we could use the same field names that are currently used in the internal and external records.

An internal service could be defined by a proplist with the following format:

[{prefix,           cloudi:service_name_pattern()},
 {module,           atom() | file:filename()},
 {args,             list()},
 {dest_refresh,     cloudi_service_api:dest_refresh()},
 {timeout_init,     cloudi_service_api:timeout_milliseconds()},
 {timeout_async,    cloudi_service_api:timeout_milliseconds()},
 {timeout_sync,     cloudi_service_api:timeout_milliseconds()},
 {dest_list_deny,   cloudi_service_api:dest_list()},
 {dest_list_allow,  cloudi_service_api:dest_list()},
 {count_process,    pos_integer()},
 {max_r,            non_neg_integer()},
 {max_t,            cloudi_service_api:seconds()},
 {options,          cloudi_service_api:service_options_internal()}]

Whereas an external service could be defined in this way:

[{prefix,           cloudi:service_name_pattern()},
 {file_path,        file:filename()},
 {args,             string()},
 {env,              list({string(), string()})},
 {dest_refresh,     cloudi_service_api:dest_refresh()},
 {protocol,         'default' | 'local' | 'tcp' | 'udp'},
 {buffer_size,      'default' | pos_integer()},
 {timeout_init,     cloudi_service_api:timeout_milliseconds()},
 {timeout_async,    cloudi_service_api:timeout_milliseconds()},
 {timeout_sync,     cloudi_service_api:timeout_milliseconds()},
 {dest_list_deny,   cloudi_service_api:dest_list()},
 {dest_list_allow,  cloudi_service_api:dest_list()},
 {count_process,    pos_integer()},
 {count_thread,     pos_integer()},
 {max_r,            non_neg_integer()},
 {max_t,            cloudi_service_api:seconds()},
 {options,          cloudi_service_api:service_options_external()}]

The added benefit of using a proplist is that we could have sane defaults for most of the non-essential fields, thus reducing the number of required fields.

internal service init exception still causes terminate function call

** Reason for termination ==
** {function_clause,
[{cloudi_service_db_pgsql,cloudi_service_terminate,
[<<"3D000">>,undefined],
[{file,"src/cloudi_service_db_pgsql.erl"},{line,214}]},
{cloudi_services_internal,terminate,2,
[{file,"src/cloudi_services_internal.erl"},{line,1022}]},
{gen_server,terminate,6,[{file,"gen_server.erl"},{line,722}]},
{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}

need to avoid the terminate function if the init function exception occurred

Various build errors when building CloudI

Hi,

When building CloudI I've ran into a couple of issues:

  • cpg_app seems to either:
    • throw an exception when trying to do scope transform due to:
escript: exception error: no function clause matching 
                 orddict:fetch(cpg_app,
                          [....])
  • Before the above error is thrown a clean make will lock and then throw an exception with: {error, eloop}

Any ideas?

My environment:

  • ArchLinux/x86_64

The versions of Erlang I've tried this with:

  • R16B
  • R16B_01
  • R16B_02

Let me know if there are any pertinent version numbers you need to know.

Full traces on demand.

Thanks in advance,
Aaron

Cloudi website white on black text

Hi there, sorry this is not a bug report, but I could not find the proper channel for passing this feedback. First, let me state I find Cloudi a very interesting project. Now, my problem. You have chosen to punish my eyes by designing the website text to be white on black. This makes a terribly painful read in my opinion. Last time I downloaded a copy of the page and adapted the CSS in order to be able to read it. That information is now outdated and I don't feel like having to do the same every time I want to read the latest info on the project.
May I suggest you use standard black on white text?

Thank you,

Rudi Angela

Add missing cloudi module types

Some cloudi_service types would be simpler to reference from the cloudi module. These types include:

cloudi_service:request_type()
cloudi_service:dispatcher()

Check to see if there is other overlap to add, to shorten the type prefix. See if there is missing types.

java http_req test has an error when a value is not specified

2013-05-28T19:51:03.378057Z ERROR (cloudi_os_spawn:156:<0.105.0>:cloudi@mc1)
stderr (pid 25692):
java.lang.NullPointerException
at org.cloudi.tests.http_req.Task.request(Task.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.cloudi.Function9.invoke(Function9.java:82)
at org.cloudi.API.callback(API.java:695)
at org.cloudi.API.poll_request(API.java:911)
at org.cloudi.API.poll(API.java:979)
at org.cloudi.tests.http_req.Task.run(Task.java:97)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:615)
at java.lang.Thread.run(Thread.java:679)
2013-05-28T19:51:03.379402Z WARN (cloudi_http_cowboy_handler:259:<0.332.0>:clou
di@mc1)
504 GET /tests/http_req/java.xml 8.336 ms: timeout

build failed in cloudi

Hi,
When I build cloudi follow the instruction, I occur error when I make it.

Error:
/bin/sh ../../../libtool --tag=CXX --mode=link g++ -I/usr/local/include -L../../../api/c/ -L/usr/local/lib -L/usr/local/lib -o hexpi hexpi-assert.o hexpi-main.o hexpi-timer.o hexpi-piqpr8_gmp.o hexpi-piqpr8_gmp_verify.o -lcloudi -lboost_thread-mt -lgmp
libtool: link: g++ -I/usr/local/include -o hexpi hexpi-assert.o hexpi-main.o hexpi-timer.o hexpi-piqpr8_gmp.o hexpi-piqpr8_gmp_verify.o -Wl,-bind_at_load -L/Users/zhangbo/work/cloudi-1.0.0/src/api/c -L/usr/local/lib /Users/zhangbo/work/cloudi-1.0.0/src/api/c/.libs/libcloudi.a -L/usr/local/lib/erlang/lib/erl_interface-3.7.7/lib/ -lei -lboost_thread-mt /usr/local/lib/libgmp.dylib
Undefined symbols for architecture x86_64:
"boost::assertion_failed_msg(char const_, char const_, char const_, char const_, long)", referenced from:
boost::mutex::try_lock() in hexpi-main.o
"boost::system::system_category()", referenced from:
static_initialization_and_destruction_0(int, int)in hexpi-main.o
boost::thread_exception::thread_exception(int, char const
)in hexpi-main.o
boost::condition_error::condition_error(int, char const
)in hexpi-main.o
"boost::system::generic_category()", referenced from:
__static_initialization_and_destruction_0(int, int)in hexpi-main.o
ld: symbol(s) not found for architecture x86_64

configure is OK

My OS:
Mac mountain lion 10.8.1 x86_64

Software:
boost: brew install boost version 1.5.0
/usr/local/lib/libboost_thread-mt.dylib: Mach-O 64-bit dynamically linked shared library x86_64
ruby: brew install ruby version 1.9.3
jdk:1.6.0_35
erlang: R15B01 x86_64
i686-apple-darwin11-llvm-g++-4.2

OSX zeromq check fails on zmq_init function check

AC_LANG_CALL is considered bad since it doesn't care about types, and it seems to be broken on OSX. On OSX, the zmq_init function is actually shown as _zmq_init, so there is linking specific name mangling in-place. It is considered better to check with source code that includes function arguments, to also test with type information. The offending macro is on line 142 of src/m4/ax_zeromq.m4

cloudi_core included_application dependencies must be started by cloudi_core

To simplify usage of cloudi_core, and avoid problems with testing and releases, cloudi_core needs to start the cloudi_services_internal, cloudi_services_databases, and cloudi_services_messaging Erlang applications, internally, after the top-level startup is ready and cloudi_core is configured. Eventually, these various internal service Erlang applications can be split up into separate Erlang applications for each service, to make everything more granular, and based on the CloudI Service API, but this is the best first step.

Build fails on OSX Mountain Lion

I have an up-to-date brew installation and get the follow on make:

libtool: link: sed -e 's,^,_,' < .libs/libcloudi_socket_drv.exp > .libs/libcloudi_socket_drv-symbols.expsym
libtool: link: g++ -o .libs/libcloudi_socket_drv.so -bundle .libs/libcloudi_socket_drv_la-cloudi_socket_drv.o .libs/libcloudi_socket_drv_la-assert.o -O2 -Wl,-exported_symbols_list,.libs/libcloudi_socket_drv-symbols.expsym
Undefined symbols for architecture x86_64:
"_enif_get_int", referenced from:
_libcloudi_socket_drv_local_listen in libcloudi_socket_drv_la-cloudi_socket_drv.o
_libcloudi_socket_drv_local_accept in libcloudi_socket_drv_la-cloudi_socket_drv.o
"_enif_get_string", referenced from:
_libcloudi_socket_drv_local_listen in libcloudi_socket_drv_la-cloudi_socket_drv.o
_libcloudi_socket_drv_local_accept in libcloudi_socket_drv_la-cloudi_socket_drv.o
"_enif_make_atom", referenced from:
_libcloudi_socket_drv_local_listen in libcloudi_socket_drv_la-cloudi_socket_drv.o
_libcloudi_socket_drv_local_accept in libcloudi_socket_drv_la-cloudi_socket_drv.o
"_enif_make_badarg", referenced from:
_libcloudi_socket_drv_local_listen in libcloudi_socket_drv_la-cloudi_socket_drv.o
_libcloudi_socket_drv_local_accept in libcloudi_socket_drv_la-cloudi_socket_drv.o
"_enif_make_tuple", referenced from:
_libcloudi_socket_drv_local_listen in libcloudi_socket_drv_la-cloudi_socket_drv.o
_libcloudi_socket_drv_local_accept in libcloudi_socket_drv_la-cloudi_socket_drv.o
"_enif_mutex_create", referenced from:
_on_load in libcloudi_socket_drv_la-cloudi_socket_drv.o
"_enif_mutex_destroy", referenced from:
_on_unload in libcloudi_socket_drv_la-cloudi_socket_drv.o
"_enif_mutex_lock", referenced from:
_libcloudi_socket_drv_local_listen in libcloudi_socket_drv_la-cloudi_socket_drv.o
_libcloudi_socket_drv_local_accept in libcloudi_socket_drv_la-cloudi_socket_drv.o
"_enif_mutex_unlock", referenced from:
_libcloudi_socket_drv_local_listen in libcloudi_socket_drv_la-cloudi_socket_drv.o
_libcloudi_socket_drv_local_accept in libcloudi_socket_drv_la-cloudi_socket_drv.o
"_erl_errno_id", referenced from:
_libcloudi_socket_drv_local_listen in libcloudi_socket_drv_la-cloudi_socket_drv.o
_libcloudi_socket_drv_local_accept in libcloudi_socket_drv_la-cloudi_socket_drv.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[5]: *** [libcloudi_socket_drv.la] Error 1
make[4]: *** [all] Error 2
make[3]: *** [all-recursive] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

erlzmq2 build can fail silently

Currently, rebar isn't providing success/fail from an erlzmq2 build... a proper zeromq install is assumed to provide a working erlzmq2 build. Need to change the configure script to fail if erlzmq2 compilation fails. This may be easiest with autoconf/automake inserting erlzmq2 to be built with the other Erlang dependencies (currently it is built separately).

internal service init process death causes database driver death

Changes to the internal service init function to avoid dead-lock and provide the full CloudI API cause the database drivers to have a premature death due to their implicit process link. This problem impacts at least all usage of the PostgreSQL and MySQL drivers, so it is a serious problem.

1.2.2 requires Erlang >= R16

reltool in R15 assumes the directory name == application name. Not sure yet if there is a way around this problem, but it blocks the release creation for R15 (travis didn't error properly on the install).

OpenShift has "deprecated" localhost

Supposedly, OpenShift claims localhost is "deprecated" with their virtualization because it is shared with all users on the physical machine. This also can help users depend on the OpenShift framework more-so. To avoid this problem, add a new external service protocol configuration option (current options are tcp and udp, where udp is experimental) called "pipe" so that sockets on localhost are not used. This was planned previously as a test case, but this issue provides justification for providing it as a feature.

Internal service process count dynamically changing

Need to provide a min/max process count, and allow the process count to change based on the rate. An internal service is only ramped-down by stopping idle service instances. The check to ramp-down (or ramp-up) occurs on a timer.

Add hello_world4 example for relx usage

Need erlware/relx#57 resolved, so that included_applications usage is ok. The alternative is to remove cloudi_core from the dependencies of cloudi_services_database, cloudi_services_internal, and cloudi_services_messaging, but that can cause issues with rebar compilation (probably only warnings).

make a separate repo for cloudi_core

Only internal services would be supported, due to the API compilation requirements and what rebar can support. The C++ dependencies (nif/port) wouldn't be required.

Database Services Need Regression Tests

Proper regression tests have been something that keeps getting pushed out. However, problems within the 1.2.1 release demonstrated their absence is causing development/release problems.

prevent send_sync from blocking within the init function of an internal service

bug reported by Alex Demidenko:

Hi, Michael!

I found strange behavoiur (tested at cloudi 1.2.2)
If I make a send request from cloudi_service_init(), the answer will not be returned.
I'll try to show by example:

-module(cloudi_ping_pong).
-include_lib("cloudi_core/include/cloudi_logger.hrl").
-export([cloudi_service_init/3, cloudi_service_handle_request/11, cloudi_service_handle_info/3, cloudi_service_terminate/2]).
%%%%
cloudi_service_init([ponger], _Prefix, Dispatcher) ->
?LOG_INFO("init ponger", []),
ok = cloudi_service:subscribe(Dispatcher, "ponger"),
{ok, ponger};
cloudi_service_init([pinger], Prefix, Dispatcher) ->
?LOG_INFO("init pinger", []),
Result = cloudi_service:send_sync(Dispatcher, Prefix++"ponger", ping), %Unsuccessfull sync request
?LOG_INFO("ping responce: ~p", [Result]), % This report never work
{ok, pinger}.
%%%%
cloudi_service_handle_request(_Type, _Name, _Pattern, _RequestInfo, ping, _Timeout, _Priority, _TransId, _Pid, ponger = State, _Dispatcher) ->
?LOG_INFO("pong request", []),
{reply, pong, State}.
%%%%
cloudi_service_handle_info(_Request, State, _Dispatcher) ->
{noreply, State}.
%%%%
cloudi_service_terminate(_Reason, _State) ->
ok.

For example I used follow sections inside cloudi.conf
{internal,
"/test/",
cloudi_ping_pong,
[ponger], % First service entity
immediate_local,
10000, 10000, 10000, undefined, undefined, 1, 1, 300,
[]},
{internal,
"/test/",
cloudi_ping_pong,
[pinger], % Second service entity
immediate_local,
10000, 10000, 10000, undefined, undefined, 1, 1, 300,
[]}

Request has been successfully delivered, but the response is lost.
After some time, the sender dies by timeout

I <0.278.0> [cloudi_services_monitor:130]: start_internal [0,cloudi_ping_pong,
[ponger],
10000,"/test/",10000,10000,immediate_local,undefined,
undefined,
{config_service_options,0,undefined,500,300000,false,false,1,
[link],
infinity,
[link],
false},
<<114,181,69,216,211,192,17,226,179,1,44,188,0,0,1,18>>] -> <0.788.0>
I <0.788.0> [cloudi_ping_pong:12]: init ponger
I <0.278.0> [cloudi_services_monitor:130]: start_internal [0,cloudi_ping_pong,
[pinger],
10000,"/test/",10000,10000,immediate_local,undefined,
undefined,
{config_service_options,0,undefined,500,300000,false,false,1,
[link],
infinity,
[link],
false},
<<114,181,69,246,211,192,17,226,179,1,44,188,0,0,1,18>>] -> <0.790.0>
I <0.790.0> [cloudi_ping_pong:16]: init pinger
I <0.792.0> [cloudi_ping_pong:22]: pong request
......
(cc@insider)1> W <0.278.0> [cloudi_services_monitor:216]: Service pid <0.790.0> error: timeout
cloudi_spawn:start_internal[0,cloudi_ping_pong,
[pinger],
10000,"/test/",10000,10000,immediate_local,
undefined,undefined,
{config_service_options,0,undefined,500,300000,
false,false,1,
[link],
infinity,
[link],
false},
<<114,181,69,246,211,192,17,226,179,1,44,188,0,0,
1,18>>]

But if I try send request from cloudi_service_handle_request() - everything ok.
Do you have idea, whats wrong?

Thank you.

ZeroMQ check does not check for the presence of a static library

The autoconf m4 macro that checks for a system installation does test the ZeroMQ installation to make sure the proper version exists and is working, but it does not check if the static libraries were installed. The problem occurs on OSX with homebrew. OSX with macports does not have this problem. Need a cross-platform solution to either force a static link for the ZeroMQ library check, or a cross-platform solution for checking that a ZeroMQ static library is present on the filesystem after the ZeroMQ library link/compile check.

cloudi script stop can cause service shutdowns that attempt a restart

sometimes when the cloudi script stop occurs, services exit with reason normal, instead of shutdown, causing a restart to occur while attempting to stop. An example is:

2013-10-18T23:56:07.432254Z WARN  (cloudi_services_monitor:246:<0.1059.0>:cloudi@mc1)
 Service pid <0.1076.0> error: normal
  cloudi_spawn:start_external[13,"tests/hexpi/priv/hexpi",[],
                              [{"LD_LIBRARY_PATH","api/c/lib/"},
                               {"DYLD_LIBRARY_PATH","api/c/lib/"}],
                              tcp,16384,5000,"/tests/",5000,5000,none,
                              ["/cloudi/api/*"],
                              undefined,
                              {config_service_options,0,undefined,500,300000,
                                  true,false,cpg_default_scope,false,false,
                                  undefined,1,[],infinity,[],false,false,false},
                              <<207,239,129,222,56,59,17,227,170,49,165,222,0,
                                0,4,24>>]
2013-10-18T23:56:07.455628Z ERROR (cloudi_services_monitor:349:<0.1059.0>:cloudi@mc1)
 failed {error,{{nodedown,shutdown},
                {gen_server,call,
                            [{error,shutdown},
                             {call,1,
                                   [<<1,0>>,
                                    <<"t">>,
                                    <<53,0,0,0,47,116,109,112,47,99,108,111,117,
                                      100,105,95,115,111,99,107,101,116,95,99,
                                      102,101,102,56,49,100,101,51,56,51,98,49,
                                      49,101,51,97,97,51,49,97,53,100,101,48,48,
                                      48,48,48,52,49,56,95,0>>,
                                    <<13,0,0,0,214,111,0,0,86,120,0,0,160,113,0,
                                      0,177,101,0,0,32,229,0,0,56,119,0,0,54,37,
                                      0,0,92,211,0,0,236,71,0,0,9,193,0,0,127,
                                      40,0,0,124,12,0,0,116,161,0,0>>,
                                    <<23,0,0,0,116,101,115,116,115,47,104,101,
                                      120,112,105,47,112,114,105,118,47,104,101,
                                      120,112,105,0>>,
                                    <<1,0,0,0,0>>,
                                    <<151,0,0,0,76,68,95,76,73,66,82,65,
                                      82,89,95,80,65,84,72,61,97,112,105,
                                      47,99,47,108,105,98,47,0,68,89,76,
                                      68,95,76,73,66,82,65,82,89,95,80,65,
                                      84,72,61,97,112,105,47,99,47,108,
                                      105,98,47,0,67,76,79,85,68,73,95,65,
                                      80,73,95,73,78,73,84,95,84,72,82,69,
                                      65,68,95,67,79,85,78,84,61,49,51,0,
                                      67,76,79,85,68,73,95,65,80,73,95,73,
                                      78,73,84,95,80,82,79,84,79,67,79,76,
                                      61,116,99,112,0,67,76,79,85,68,73,
                                      95,65,80,73,95,73,78,73,84,95,66,85,
                                      70,70,69,82,95,83,73,90,69,61,49,54,
                                      51,56,52,0>>]}]}}} restart
  cloudi_spawn:start_external[13,"tests/hexpi/priv/hexpi",[],
                              [{"LD_LIBRARY_PATH","api/c/lib/"},
                               {"DYLD_LIBRARY_PATH","api/c/lib/"}],
                              tcp,16384,5000,"/tests/",5000,5000,none,
                              ["/cloudi/api/*"],
                              undefined,
                              {config_service_options,0,undefined,500,300000,
                                  true,false,cpg_default_scope,false,false,
                                  undefined,1,[],infinity,[],false,false,false},
                              <<207,239,129,222,56,59,17,227,170,49,165,222,0,
                                0,4,24>>]
2013-10-18T23:56:07.456502Z WARN  (cloudi_services_monitor:246:<0.1059.0>:cloudi@mc1)
 Service pid <0.1436.0> error: normal
  cloudi_spawn:start_external[4,"/usr/bin/ruby1.9.1",
                              "tests/http/service/service.rb",[],tcp,16384,
                              5000,"/tests/http/",5000,5000,none,
                              ["/cloudi/api/*"],
                              undefined,
                              {config_service_options,0,undefined,500,300000,
                                  false,false,cpg_default_scope,false,false,
                                  undefined,1,[],infinity,[],false,false,false},
                              <<207,239,132,4,56,59,17,227,170,49,165,222,0,0,
                                4,24>>]
2013-10-18T23:56:07.461473Z ERROR (cloudi_services_monitor:349:<0.1059.0>:cloudi@mc1)
 failed {error,{{nodedown,noproc},
                {gen_server,call,
                            [{error,noproc},
                             {call,1,
                                   [<<1,0>>,
                                    <<"t">>,
                                    <<53,0,0,0,47,116,109,112,47,99,108,111,117,
                                      100,105,95,115,111,99,107,101,116,95,99,
                                      102,101,102,56,52,48,52,51,56,51,98,49,49,
                                      101,51,97,97,51,49,97,53,100,101,48,48,48,
                                      48,48,52,49,56,95,0>>,
                                    <<4,0,0,0,26,103,0,0,237,41,0,0,120,25,0,0,
                                      192,155,0,0>>,
                                    <<19,0,0,0,47,117,115,114,47,98,105,110,47,
                                      114,117,98,121,49,46,57,46,49,0>>,
                                    <<30,0,0,0,116,101,115,116,115,47,104,116,
                                      116,112,47,115,101,114,118,105,99,101,47,
                                      115,101,114,118,105,99,101,46,114,98,0>>,
                                    <<94,0,0,0,67,76,79,85,68,73,95,65,80,
                                      73,95,73,78,73,84,95,84,72,82,69,65,
                                      68,95,67,79,85,78,84,61,52,0,67,76,
                                      79,85,68,73,95,65,80,73,95,73,78,73,
                                      84,95,80,82,79,84,79,67,79,76,61,
                                      116,99,112,0,67,76,79,85,68,73,95,
                                      65,80,73,95,73,78,73,84,95,66,85,70,
                                      70,69,82,95,83,73,90,69,61,49,54,51,
                                      56,52,0>>]}]}}} restart
  cloudi_spawn:start_external[4,"/usr/bin/ruby1.9.1",
                              "tests/http/service/service.rb",[],tcp,16384,
                              5000,"/tests/http/",5000,5000,none,
                              ["/cloudi/api/*"],
                              undefined,
                              {config_service_options,0,undefined,500,300000,
                                  false,false,cpg_default_scope,false,false,
                                  undefined,1,[],infinity,[],false,false,false},
                              <<207,239,132,4,56,59,17,227,170,49,165,222,0,0,
                                4,24>>]
2013-10-18T23:56:07.462184Z WARN  (cloudi_services_monitor:246:<0.1059.0>:cloudi@mc1)
 Service pid <0.1324.0> error: normal
  cloudi_spawn:start_external[4,"/usr/bin/python2",
                              "tests/http/service/service.py",[],tcp,16384,
                              5000,"/tests/http/",5000,5000,none,
                              ["/cloudi/api/*"],
                              undefined,
                              {config_service_options,0,undefined,500,300000,
                                  false,false,cpg_default_scope,false,false,
                                  undefined,1,[],infinity,[],false,false,false},
                              <<207,239,131,170,56,59,17,227,170,49,165,222,0,
                                0,4,24>>]
2013-10-18T23:56:07.467657Z ERROR (cloudi_services_monitor:349:<0.1059.0>:cloudi@mc1)
 failed {error,{{nodedown,noproc},
                {gen_server,call,
                            [{error,noproc},
                             {call,1,
                                   [<<1,0>>,
                                    <<"t">>,
                                    <<53,0,0,0,47,116,109,112,47,99,108,111,117,
                                      100,105,95,115,111,99,107,101,116,95,99,
                                      102,101,102,56,51,97,97,51,56,51,98,49,49,
                                      101,51,97,97,51,49,97,53,100,101,48,48,48,
                                      48,48,52,49,56,95,0>>,
                                    <<4,0,0,0,30,72,0,0,238,65,0,0,181,82,0,0,
                                      140,130,0,0>>,
                                    <<17,0,0,0,47,117,115,114,47,98,105,110,47,
                                      112,121,116,104,111,110,50,0>>,
                                    <<30,0,0,0,116,101,115,116,115,47,104,116,
                                      116,112,47,115,101,114,118,105,99,101,47,
                                      115,101,114,118,105,99,101,46,112,121,0>>,
                                    <<94,0,0,0,67,76,79,85,68,73,95,65,80,
                                      73,95,73,78,73,84,95,84,72,82,69,65,
                                      68,95,67,79,85,78,84,61,52,0,67,76,
                                      79,85,68,73,95,65,80,73,95,73,78,73,
                                      84,95,80,82,79,84,79,67,79,76,61,
                                      116,99,112,0,67,76,79,85,68,73,95,
                                      65,80,73,95,73,78,73,84,95,66,85,70,
                                      70,69,82,95,83,73,90,69,61,49,54,51,
                                      56,52,0>>]}]}}} restart
  cloudi_spawn:start_external[4,"/usr/bin/python2",
                              "tests/http/service/service.py",[],tcp,16384,
                              5000,"/tests/http/",5000,5000,none,
                              ["/cloudi/api/*"],
                              undefined,
                              {config_service_options,0,undefined,500,300000,
                                  false,false,cpg_default_scope,false,false,
                                  undefined,1,[],infinity,[],false,false,false},
                              <<207,239,131,170,56,59,17,227,170,49,165,222,0,
                                0,4,24>>]
2013-10-18T23:56:07.468187Z WARN  (cloudi_services_monitor:246:<0.1059.0>:cloudi@mc1)
 Service pid <0.1328.0> error: normal
  cloudi_spawn:start_external[4,"/usr/bin/java",
                              "-jar tests/http/service/jar/service.jar",[],tcp,
                              16384,5000,"/tests/http/",5000,5000,none,
                              ["/cloudi/api/*"],
                              undefined,
                              {config_service_options,0,undefined,500,300000,
                                  false,false,cpg_default_scope,false,false,
                                  undefined,1,[],infinity,[],false,false,false},
                              <<207,239,131,220,56,59,17,227,170,49,165,222,0,
                                0,4,24>>]
2013-10-18T23:56:07.471067Z ERROR (cloudi_services_monitor:349:<0.1059.0>:cloudi@mc1)
 failed {error,{{nodedown,noproc},
                {gen_server,call,
                            [{error,noproc},
                             {call,1,
                                   [<<1,0>>,
                                    <<"t">>,
                                    <<53,0,0,0,47,116,109,112,47,99,108,111,117,
                                      100,105,95,115,111,99,107,101,116,95,99,
                                      102,101,102,56,51,100,99,51,56,51,98,49,
                                      49,101,51,97,97,51,49,97,53,100,101,48,48,
                                      48,48,48,52,49,56,95,0>>,
                                    <<4,0,0,0,166,167,0,0,78,91,0,0,76,228,0,0,
                                      147,167,0,0>>,
                                    <<14,0,0,0,47,117,115,114,47,98,105,110,47,
                                      106,97,118,97,0>>,
                                    <<40,0,0,0,45,106,97,114,0,116,101,115,116,
                                      115,47,104,116,116,112,47,115,101,114,118,
                                      105,99,101,47,106,97,114,47,115,101,114,
                                      118,105,99,101,46,106,97,114,0>>,
                                    <<94,0,0,0,67,76,79,85,68,73,95,65,80,
                                      73,95,73,78,73,84,95,84,72,82,69,65,
                                      68,95,67,79,85,78,84,61,52,0,67,76,
                                      79,85,68,73,95,65,80,73,95,73,78,73,
                                      84,95,80,82,79,84,79,67,79,76,61,
                                      116,99,112,0,67,76,79,85,68,73,95,
                                      65,80,73,95,73,78,73,84,95,66,85,70,
                                      70,69,82,95,83,73,90,69,61,49,54,51,
                                      56,52,0>>]}]}}} restart
  cloudi_spawn:start_external[4,"/usr/bin/java",
                              "-jar tests/http/service/jar/service.jar",[],tcp,
                              16384,5000,"/tests/http/",5000,5000,none,
                              ["/cloudi/api/*"],
                              undefined,
                              {config_service_options,0,undefined,500,300000,
                                  false,false,cpg_default_scope,false,false,
                                  undefined,1,[],infinity,[],false,false,false},
                              <<207,239,131,220,56,59,17,227,170,49,165,222,0,
                                0,4,24>>]
2013-10-18T23:56:07.481546Z WARN  (cloudi_services_monitor:246:<0.1059.0>:cloudi@mc1)
 Service pid <0.1471.0> error: normal
  cloudi_spawn:start_external[4,"/usr/bin/python2",
                              "tests/messaging/messaging_c.py",[],tcp,16384,
                              5000,"/tests/messaging/python_c/",10000,10000,
                              immediate_local,
                              ["/cloudi/api/*"],
                              undefined,
                              {config_service_options,0,undefined,500,300000,
                                  false,false,cpg_default_scope,false,false,
                                  undefined,1,[],infinity,[],false,false,false},
                              <<207,239,136,150,56,59,17,227,170,49,165,222,0,
                                0,4,24>>]

A simple patch for this issue is:

 diff --git a/src/lib/cloudi_core/src/cloudi_services_monitor.erl b/src/lib/cloud
 index bced7e7..f3e1da4 100644
 --- a/src/lib/cloudi_core/src/cloudi_services_monitor.erl
 +++ b/src/lib/cloudi_core/src/cloudi_services_monitor.erl
 @@ -220,8 +220,9 @@ handle_cast(Request, State) ->
      ?LOG_WARN("Unknown cast \"~p\"", [Request]),
      {noreply, State}.

-handle_info({'DOWN', _MonitorRef, 'process', Pid, shutdown},
-            #state{services = Services} = State) ->
+handle_info({'DOWN', _MonitorRef, 'process', Pid, Info},
+            #state{services = Services} = State)
+    when Info =:= shutdown; Info =:= normal ->
     case cloudi_x_key2value:find2(Pid, Services) of
         {ok, {[ServiceId], #service{service_m = M,
                                     service_f = F,

However, the impact should be checked.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.