Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consumer can not invoke the producer function after terminating the provider process and restart again #34

Open
feifrank opened this issue Sep 7, 2018 · 10 comments

Comments

@feifrank
Copy link

feifrank commented Sep 7, 2018

Hi Joynr guys,
I success to make the joynr consumer invoke the provider method every time I totally restart the whole environment(including joynr infra, consumer application, provider application& cluster controller). but after that, when I terminate the provider application without unregister it. and then restart provider application, my consumer application could not invoke the provider method successfully, even I try to restart the cluster controller located with the provider application. I would like to ask that is it a acceptable way to restart the provider application? or is there a official or workable way to restart the provider application?
Thanks.

@manuel-schiller
Copy link
Contributor

hard to analyse without any details (logs, code, ...).
But I suspect you are not using persistency in your provider application (or at least not using it correctly). If persistency is not used, this will lead to assigning a new participantID to your provider after every restart. Since the consumer is not aware of this ID change, he will try to contact the old ID and this will not work.

Please share more details (logs, programming language used, some code) for further inspection.

@feifrank
Copy link
Author

feifrank commented Sep 7, 2018

sorry for not clear clarification,
here is the log find in clustercontroller-standalone:
2018-08-10 09:19:00,828 [WARN ] AbstractMessageRouter: PROBLEM SENDING, will retry. messageId: 50147964-2beb-4838-b794-73e2afdaec70_545. Error: io.joynr.exceptions.JoynrIllegalStateException Message: Unable to find address for recipient with participant ID 488de4e6-53b8-4be5-bdb2-799465621a95
2018-08-10 09:19:00,828 [ERROR] AbstractMessageRouter: Rescheduling messageId: 50147964-2beb-4838-b794-73e2afdaec70_545 with delay 30222 ms, TTL is: 10/08/2019 15:18:07:007 UTC
2018-08-10 09:19:07,471 [ERROR] AbstractMessageRouter$MessageWorker: error in scheduled message router thread: Unable to find address for recipient with participant ID 488de4e6-53b8-4be5-bdb2-799465621a95

and the provider application's language I use is nodejs,
here is the code:
`
joynr.load(provisioning).then(loadedJoynr => {
console.log("loaded!");
joynr = loadedJoynr;

  xxxxxxProvider = joynr.providerBuilder.build(xxxxxxProvider, xxxxxxProviderImpl);

  xxxxxxProviderImpl.init()
    .then(joynr.registration.registerProvider(
        "xxx.xxx",
        xxxxxxProvider,
        new joynr.types.ProviderQos({
          customParameters: [],
          priority: Date.now(),
          scope: joynr.types.ProviderScope.GLOBAL,
          supportsOnChangeSubscriptions: true
        }))
        .then(() => {
         console.log("registration successful!");

          if (typeof process === "object" && typeof process.on === "function") {
           process.on("exit", () => {
              joynr.registration.unregisterProvider(
                "xxx.xxx",
                xxxxxxProvider).then(() => {
                  console.log("unregister successful!");
                  try {
                    joynr.shutdown();
                  } catch (error) {
                    // ignore
                  }
                }).catch(
                function (error) {
                  console.log("unregister fail. Reason: " + error);
                });
            });
          }
        })
        .catch(error => console.log("register fail. Reason: " + error.toString()))
    )
    .catch(error => {
      if (error) {
        throw error;
      }
    })
  })`

if anything more you want to check, please feel free to ask me.
Thanks.

@manuel-schiller
Copy link
Contributor

you wrote above "without unregister it", but in your code you call unregisterProvider?

can you please attach logs of the whole scenario (first startup of provider, stopping it, restarting provider) of all processes (provider app, consumer app, cluster-controller)?

@feifrank
Copy link
Author

feifrank commented Sep 7, 2018

actually I use kill -9 to terminate it , so the code unregisterProvider was not called

@feifrank
Copy link
Author

feifrank commented Sep 7, 2018

the scenario is

  1. deploy and start joynr infrastrucutre.
  2. start the provider's cluster controller and the provider application.
    3.start the consumer's cluster controller and the consumer application.
    4.consumer could invoke the provider.
    5.then I kill -9 the provider application.
    6.start the provider application again
    7.also restart the consumer application then invoke the provider application but failed.

@feifrank
Copy link
Author

feifrank commented Sep 7, 2018

meanwhile I try another scenario:
1.deploy and start joynr infrastrucutre.
2.start the provider's cluster controller and the provider application.
3.start the consumer's cluster controller and the consumer application.
4.consumer could invoke the provider.
5.then I kill -9 the provider application and his cluster controller
6.start the provider application and his cluster controller again
7.also restart the consumer application then invoke the provider application but also failed.

@feifrank
Copy link
Author

Hi manuel-schiller,
Anything update?
Thanks.

@ghost
Copy link

ghost commented Sep 10, 2018

hi @feifrank, for the scenario to work you need to make sure persistency is activated and that clearPersistency is not set to true. A JSON.stringify of provisioning.persistency should tell you more...the javascript tutorial also mention this detail: https://github.com/bmwcarit/joynr/blob/master/wiki/JavaScriptTutorial.md

@feifrank
Copy link
Author

Hi @donsciarra and @manuel-schiller
Thanks for answering, let me have a try.
Thanks.
BRs//Teng Fei

@manuel-schiller
Copy link
Contributor

is this still relevant?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants