You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/03/26 06:47:16 UTC

[GitHub] [pulsar] zyllt edited a comment on issue #6589: Can not use Context#Counter in function

zyllt edited a comment on issue #6589: Can not use Context#Counter in function 
URL: https://github.com/apache/pulsar/issues/6589#issuecomment-604259667
 
 
   @sijie thanks for your reply.
   I deploy the pulsar cluster on bare metal.my cluster has five machines.Two of them have brokers and three have bookies.local-zk and configuration-store deployed on all machines.I started `functions-woker` within `brokers` use `Thread Runtime`.  
   At the beginning I started a demo-function named `WordCountFunction`,then i trigger it and broker log outputs  a exception.
   ![image](https://user-images.githubusercontent.com/8822016/77616262-2ff5a400-6f6c-11ea-95ea-2e19bfd252de.png)
   According to the exception messages, I looked at the source code and found that using the `Function# Context#stateContext` requires starting a `StreamStorage` component.
   I first started this component in a single  bookie use `extraServerComponents=org.apache.bookkeeper.stream.server.StreamStorageLifecycleComponent`.
   The Booki Log shows a successful start.And I use `netstat -ant | grep -i listen | grep 4181` command to see that port 4181 is already listening at `0.0.0.0`.  
   In the configuration file `functions_worker.yml ` I set the `stateStorageServiceUrl` configuration to ` bk://10.1.0.112:4181`.that is IP of bookie.
   After restarting the broker I deleted the demo-function `WordCountFunction` I created earlier and recreated it again.But when I check the logs, I find that the startup of the demo-function is parked.  
   I use command  of `pulsar-admin functions trigger`,prompt me function does not exist.
   ```
   19:27:11.455 [test/test-namespace/WordCountFunction-0] INFO  org.apache.pulsar.functions.instance.JavaInstanceRunnable - Load JAR: /usr/local/pulsar-2.5.0/download/pulsar_functions/test/test-namespace/WordCountFunction/0/pulsar-functions-api-examples.jar
   19:27:11.467 [test/test-namespace/WordCountFunction-0] INFO  org.apache.pulsar.functions.instance.JavaInstanceRunnable - Initialize function class loader for function WordCountFunction at function cache manager
   19:27:11.920 [client-scheduler-OrderedScheduler-0-0] INFO  org.apache.bookkeeper.clients.impl.channel.StorageServerChannelManager - Added range server (hostname: "127.0.0.1"
   port: 4181
   ) into the channel manager.
   ```
   I suspect it may be a problem with this `Added range server (hostname: "127.0.0.1" port: 4181) `, because `StreamStorageServer` is on another machine, but I have configured the correct `stateStorageServiceUrl` in `functions_worker.yml `.  
    I think that the hostname should be obtained in zk according to the source code, and then I connected to local-zk to check `ls /stream/servers/available` path found that the output is `[127.0.0.1:4181]`.
   I think it may be that the real IP address cannot be obtained when registering for zk,but I cannot confirm whether this problem is caused.  
   Then I started an independent functions-worker on the bookie machine, and then started the demo-function and trigger it,then i found that everything was normal. 
   I tested other cases,you can see here.  https://github.com/apache/bookkeeper/issues/2216#issuecomment-602995573
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services