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

Perl script used to generate props file generates invalid java.extended.property #357

Open
mmussett opened this issue Jul 23, 2024 · 3 comments
Assignees

Comments

@mmussett
Copy link

mmussett commented Jul 23, 2024

Version Information

Software Version(s)
BusinessEvents 6.2.2
OS Type? GKE
OS Version? GKE
Docker
Kubernetes Yes
Helm Yes

What is the expected behavior?

IA starts without NPE when configured with Open Telemetry OTLP type

What is the actual behavior?

NPE thrown and IA fails

Please provide a unit test that demonstrates the bug.

Other notes on how to reproduce the issue?

When tra.java.extended.property is set via environment through Helm chart and it contains hard coded path to the cep-base.jar rather than %BE_HOME% then the perl script generates incorrect value for tra.java.extended.properties with the value of the javaagent property missing.

Please provide log files.

2024 Jul 23 11:49:01:691 GMT +02 ia1 FATAL [main] - [container.standalone] null
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.tibco.cep.runtime.session.impl.RuleServiceProviderImpl.initOpenTelemetry(RuleServiceProviderImpl.java:1180)
at com.tibco.cep.runtime.session.impl.RuleServiceProviderImpl.initCluster(RuleServiceProviderImpl.java:829)
at com.tibco.cep.runtime.session.impl.RuleServiceProviderImpl.configure(RuleServiceProviderImpl.java:299)
at com.tibco.cep.container.standalone.BEMain.jumpStart(SourceFile:169)
at com.tibco.cep.container.standalone.BEMain.main(SourceFile:71)
Caused by: java.lang.NullPointerException
at net.bytebuddy.agent.builder.AgentBuilder$Default.doInstall(AgentBuilder.java:10254)
at net.bytebuddy.agent.builder.AgentBuilder$Default.installOn(AgentBuilder.java:10156)
at net.bytebuddy.agent.builder.AgentBuilder$Default$Delegator.installOn(AgentBuilder.java:11790)
at com.tibco.cep.telemetry.trace.DefaultIntrumentLoader.load(DefaultIntrumentLoader.java:39)
at com.tibco.cep.telemetry.TelemetryService.lambda$instrument$1(TelemetryService.java:90)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at com.tibco.cep.telemetry.TelemetryService.instrument(TelemetryService.java:90)
at com.tibco.cep.telemetry.TelemetryService.init(TelemetryService.java:52)
... 9 more

Any possible solutions?

Can you identify the location in the source code where the problem exists?

If the bug is confirmed, would you be willing to submit a PR?

Yes / No (Help can be provided if you need assistance submitting a PR)

@mmussett
Copy link
Author

Defect validated with Ulf from support.

@rameshpolishetti rameshpolishetti self-assigned this Jul 23, 2024
@umueller-de
Copy link

Some more details to the issue:
Perl script "be_docker_run.pm" that extracts tra.java.extended.properties corrupts the value when a full path added as a reference for the java agent.

e.g.,
Input:
tra.java.extended.properties=-Xms1024m -Xmx1024m -javaagent:/opt/tibco/be/6.2/lib/cep-base.jar

Output:

grep tra.java.extended.properties beprops_all.props 
tra.java.extended.properties=/opt/tibco/be/6.2/lib/cep-base.jar -XX:MaxMetaspaceSize=256m

cat /opt/tibco/be/6.2/bin/be-engine.tra
...
tra.java.extended.properties=/opt/tibco/be/6.2/lib/cep-base.jar -XX:MaxMetaspaceSize=256m

Test (same operations as done in /home/tibco/be/run script):
- Connect to running pod

cd /home/tibco/be
CURRENT_DIR=$(pwd)
BE_PROPS_FILE=beprops_all.props
APP_HOME=/opt/tibco/be/application
# set tra.java.extended.properties if not set already
env tra.java.extended.properties="-Xms1024m -Xmx1024m -Xss2m -javaagent:/opt/tibco/be/6.2/lib/cep-base.jar -XX:MaxMetaspaceSize=256m" bash

export PERL5LIB="/home/tibco/be"
perl -Mbe_docker_run -e "be_docker_run::makeBeProps('testSupport.prop','$APP_HOME','$BE_HOME/')"

Result (extracted only values after "-javaagent:")

grep tra.java.extended.properties testSupport.prop
tra.java.extended.properties=/opt/tibco/be/6.2/lib/cep-base.jar -XX:MaxMetaspaceSize=256m

Note:
The property set correctly using %BE_HOME% instead of the full path for cep-base.jar
env tra.java.extended.properties="-Xms1024m -Xmx1024m -Xss2m -javaagent:%BE_HOME%/lib/cep-base.jar -XX:MaxMetaspaceSize=256m" bash

With above settings you able to start an agent when Telemetry not enabled, if enabled the CacheAgent will not start (NullPointer exception).

2024 Jul 23 11:42:26:720 GMT +02 cache1-fd FATAL [main] - [container.standalone] null
java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.tibco.cep.runtime.session.impl.RuleServiceProviderImpl.initOpenTelemetry(RuleServiceProviderImpl.java:1180)
	at com.tibco.cep.runtime.session.impl.RuleServiceProviderImpl.initCluster(RuleServiceProviderImpl.java:829)
	at com.tibco.cep.runtime.session.impl.RuleServiceProviderImpl.configure(RuleServiceProviderImpl.java:306)
	at com.tibco.cep.container.standalone.BEMain.jumpStart(SourceFile:167)
	at com.tibco.cep.container.standalone.BEMain.main(SourceFile:71)
Caused by: java.lang.NullPointerException
	at net.bytebuddy.agent.builder.AgentBuilder$Default.doInstall(AgentBuilder.java:10254)
	at net.bytebuddy.agent.builder.AgentBuilder$Default.installOn(AgentBuilder.java:10156)
	at net.bytebuddy.agent.builder.AgentBuilder$Default$Delegator.installOn(AgentBuilder.java:11790)
	at com.tibco.cep.telemetry.trace.DefaultIntrumentLoader.load(DefaultIntrumentLoader.java:39)
	at com.tibco.cep.telemetry.TelemetryService.lambda$instrument$1(TelemetryService.java:90)
	at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
	at com.tibco.cep.telemetry.TelemetryService.instrument(TelemetryService.java:90)
	at com.tibco.cep.telemetry.TelemetryService.init(TelemetryService.java:52)
	... 9 more

@mmussett
Copy link
Author

;tldr

Setting this:

tra.java.extended.properties="-Xms1024m -Xmx1024m -Xss2m -javaagent:/opt/tibco/be/6.2/lib/cep-base.jar -XX:MaxMetaspaceSize=256m"

Results in this being written to the props file:

tra.java.extended.properties=/opt/tibco/be/6.2/lib/cep-base.jar -XX:MaxMetaspaceSize=256m

Whereas, setting:

tra.java.extended.properties="-Xms1024m -Xmx1024m -Xss2m -javaagent:%BE_HOME%/lib/cep-base.jar -XX:MaxMetaspaceSize=256m

Results in this being written to the props file:

tra.java.extended.properties=-Xms1024m -Xmx1024m -javaagent:/opt/tibco/be/6.2/lib/cep-base.jar

@mmussett mmussett changed the title Perl script used to generate props file contains invalid java.extended.property Perl script used to generate props file gemerates invalid java.extended.property Jul 24, 2024
@mmussett mmussett changed the title Perl script used to generate props file gemerates invalid java.extended.property Perl script used to generate props file generates invalid java.extended.property Jul 24, 2024
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

3 participants