okeuday / cpg Goto Github PK
View Code? Open in Web Editor NEWCloudI Process Groups
License: MIT License
CloudI Process Groups
License: MIT License
When cpg is already released and running with distributed erlang, upgrading between versions and doing a rolling release doesn't work as it should since the internal state has changed between versions.
Upgrading from v1.3.1 to master (v1.5.1) exhibits this issue.
Perhaps consider these situations when modifying internal state?
After I updated cpg to get Erlang 19 support, it complains that quickrand does not support Erlang 19. cd311e5 changed rebar.config to add Erlang 19 support. mix.exs didn't change and still depends on 1.5.1 versions of trie, reltool_util, and quickrand. Shouldn't mix.exs also have changed?
With cpg v.1.5.0;
==> reltool_util (compile)
==> quickrand (compile)
==> trie (compile)
==> cpg (compile)
Compiled src/cpg_sup.erl
Compiled src/cpg_callbacks.erl
Compiled src/cpg_data.erl
Compiled src/cpg_app.erl
Compiled src/supervisor_cpg.erl
Compiled src/supervisor_cpg_sup.erl
Compiling src/supervisor_cpg_spawn.erl failed:
src/supervisor_cpg_spawn.erl:349: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
ERROR: compile failed while processing /home/havvy/workspace/gald_umbrella/deps/cpg: rebar_abort
*\* (Mix) Could not compile dependency :cpg, "/home/havvy/.mix/rebar" command failed. You can recompile this dependency with "mix deps.compile cpg", update it with "mix deps.update cpg" or clean it with "mix deps.clean cpg"
I am looking for process groups lib and was experimenting with cpg. When I register processes via cpg and kill any but he last process in the group the VM crashes. This is with erlang VM 18.1.
I created a little github project to demo the problem:
https://github.com/ashneyderman/cpg_issue.git
The README.md - https://github.com/ashneyderman/cpg_issue/blob/master/README.md - has the shell output and a bit more details on what works and what does not.
Is this a known cpg issue?
Any suggestions on what to do to avoid VM crash?
It would be handy in some circumstances to have a registered callback for all voluntary join/leave events. That is, if a process identified by pid P joins group G, I would like some statically configured handle_join(Pid :: pid(), Group :: string()) -> ok
to be called as handle_join(P, G)
, the idea here being you could 'bootstrap' newly joined processes to their group. Similarly a handle_leave/2
for leaves.
I say voluntary above, implying that processes which crash after joining a group will not result in such a call. Perhaps an additional callback to handle this case would be desirable?
$ elixir -v
Erlang/OTP 21 [erts-10.0.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]
Elixir 1.7.1 (compiled with Erlang/OTP 21)
cpg
is at version 1.7.3.
Running env DEBUG=1 mix deps.compile cpg
yields the following result:
===> Expanded command sequence to be run: []
===> Provider: {default,do}
===> Expanded command sequence to be run: [{default,app_discovery},
{bare,compile}]
===> Provider: {default,app_discovery}
===> Provider: {bare,compile}
===> Compiling cpg
===> run_hooks("/Users/daniel/Documents/Work/foobar/project/deps/cpg", pre_hooks, compile) -> no hooks defined
===> run_hooks("/Users/daniel/Documents/Work/foobar/project/deps/cpg", pre_hooks, erlc_compile) -> no hooks defined
===> erlopts [debug_info,
{d,'ERLANG_OTP_VERSION_21'},
warnings_as_errors,strict_validation,warn_bif_clash,
warn_deprecated_function,warn_export_all,warn_export_vars,
warn_exported_vars,warn_obsolete_guard,warn_shadow_vars,
warn_unused_import,warn_unused_function,warn_unused_record,
warn_unused_vars]
===> files to compile ["/Users/daniel/Documents/Work/foobar/project/deps/cpg/src/cpg_data.erl",
"/Users/daniel/Documents/Work/foobar/project/deps/cpg/src/cpg_node_monitor.erl",
"/Users/daniel/Documents/Work/foobar/project/deps/cpg/src/cpg.erl",
"/Users/daniel/Documents/Work/foobar/project/deps/cpg/src/supervisor_cpg_sup.erl",
"/Users/daniel/Documents/Work/foobar/project/deps/cpg/src/cpg_callbacks.erl",
"/Users/daniel/Documents/Work/foobar/project/deps/cpg/src/cpg_app.erl",
"/Users/daniel/Documents/Work/foobar/project/deps/cpg/src/cpg_sup.erl",
"/Users/daniel/Documents/Work/foobar/project/deps/cpg/src/supervisor_cpg_spawn.erl",
"/Users/daniel/Documents/Work/foobar/project/deps/cpg/src/supervisor_cpg.erl"]
===> Compiled cpg_data.erl
===> Compiled cpg_node_monitor.erl
===> Compiled cpg.erl
===> Compiled supervisor_cpg_sup.erl
===> Compiling src/cpg_callbacks.erl failed
src/cpg_callbacks.erl:186: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
===> Compilation failed: {error,[],
[["src/cpg_callbacks.erl:186: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace\n"]]}
** (Mix) Could not compile dependency :cpg, "/Users/daniel/.asdf/installs/elixir/1.7.1-otp-21/.mix/rebar3 bare compile --paths "/Users/daniel/Documents/Work/foobar/project/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile cpg", update it with "mix deps.update cpg" or clean it with "mix deps.clean cpg"
I think this is happening because ERLANG_OTP_VERSION_21_FEATURES
isn't being defined correctly, which is weird because it looks like ERLANG_OTP_VERSION_21
is being set correctly.
move the pid to the 2nd parameter to be like the other functions
Programmatically determine the data structure used for storing group key/value pairs within the cpg source code, but have this driven by the app env setting for cpg, instead of the current macros here https://github.com/okeuday/cpg/blob/master/src/cpg_constants.hrl#L9-L18
Using elixir I added :cpg to applications in the mix. Tried both with just calling :reltool_util.application_start(:cpg), and having it in applications and calling.
:application.which_applications()
[...
{:cpg, 'CloudI Process Groups', '1.5.1'}
]
I then try
iex(dev@1.1.1.1)4> :cpg.which_groups
** (exit) exited in: :gen_server.call(:cpg_default_scope, :which_groups)
** (EXIT) no process
(stdlib) gen_server.erl:204: :gen_server.call/2
Should subscribing to the same group callbacks with the same function twice be not allowed?
cpg:add_join_callback("group", fun test_cpg_app:join_callback/2).
cpg:add_join_callback("group", fun test_cpg_app:join_callback/2).
cpg:join("group", self()).
% join_callback procs twice
Its easy to subscribe twice to the same callback if a subscribing process gets restarted by a supervisor.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.