Alexey Radkov created THRIFT-2528:
-------------------------------------
Summary: Thrift Erlang Library: Multiple thrift applications in
one bundle
Key: THRIFT-2528
URL: https://issues.apache.org/jira/browse/THRIFT-2528
Project: Thrift
Issue Type: Bug
Components: Erlang - Library
Reporter: Alexey Radkov
Priority: Minor
Attachments: thrift-appreg.patch
Probably this is rather a wish than a bug. Also i found the multiplex task for
Erlang [https://issues.apache.org/jira/browse/THRIFT-2110] that relates to this
but seems to be slightly different.
I need two thrift applications running in one bundle: a library API, say
_rsappapi_ and a test API _rstestapi_: the former is needed to set up the
library API configuration via thrift calls. Currently it is not feasible
because thrift application registers in {{start_link()}} with predefined name
in {{lib/erl/src/thrift_server.erl}}:
{code}
gen_server:start_link({local, ?SERVER}, ?MODULE, {Port, Service,
HandlerModule}, []).
{code}
and i got {{already_started}} exception:
{noformat}
=PROGRESS REPORT==== 11-May-2014::12:26:32 ===
application: rsappapi
started_at: rstestapi@desktop
=SUPERVISOR REPORT==== 11-May-2014::12:26:32 ===
Supervisor: {local,rstestapi_sup}
Context: start_error
Reason: {already_started,<0.53.0>}
Offender: [{pid,undefined},
{name,rstestapi_service},
{mfargs,{rstestapi_service,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
=CRASH REPORT==== 11-May-2014::12:26:32 ===
crasher:
initial call: application_master:init/4
pid: <0.55.0>
registered_name: []
exception exit: {{shutdown,
{failed_to_start_child,rstestapi_service,
{already_started,<0.53.0>}}},
{rstestapi_app,start,[normal,[]]}}
in function application_master:init/4 (application_master.erl, line 133)
ancestors: [<0.54.0>]
messages: [{'EXIT',<0.56.0>,normal}]
links: [<0.54.0>,<0.7.0>]
dictionary: []
trap_exit: true
status: running
heap_size: 610
stack_size: 27
reductions: 130
neighbours:
=INFO REPORT==== 11-May-2014::12:26:33 ===
application: rstestapi
exited: {{shutdown,
{failed_to_start_child,rstestapi_service,
{already_started,<0.53.0>}}},
{rstestapi_app,start,[normal,[]]}}
type: temporary
{noformat}
I attached a patch that fixes this issue for me. It just replaces constant
{{?SERVER}} with the variable {{Service}} which normally has well-distinguished
name like _tSomeService_thrift_ and should not mess in Erlang applications
names.
--
This message was sent by Atlassian JIRA
(v6.2#6252)