Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-2528

Thrift Erlang Library: Multiple thrift applications in one bundle

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.9.2
    • Component/s: Erlang - Library
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      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:

      gen_server:start_link({local, ?SERVER}, ?MODULE, {Port, Service, HandlerModule}, []).
      

      and i got already_started exception:

      =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
      

      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.

        Attachments

        1. thrift-appreg.patch
          0.7 kB
          Alexey Radkov

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              lyokha Alexey Radkov
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: