You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is observed when running the SLE bridge and sending a CLTU:
Exception in thread "Thread-2" java.lang.IllegalArgumentException: nanosecond timeout value out of range
at java.lang.Thread.sleep(Thread.java:332)
at org.yamcs.sle.udpslebridge.UdpCltuUplinker.uplink(UdpCltuUplinker.java:54)
at org.yamcs.sle.provider.CltuServiceProvider.uplinkCltu(CltuServiceProvider.java:438)
at org.yamcs.sle.provider.CltuServiceProvider.runUplinkQueue(CltuServiceProvider.java:426)
at org.yamcs.sle.provider.CltuServiceProvider.lambda$processStartInvocation$0(CltuServiceProvider.java:152)
at java.lang.Thread.run(Thread.java:748)
This appears to be caused by insufficient precision in the sleep duration calculation:
long durationNs = cltuData.length * 8 * 1000_000_000 / bitrate;
int millis = (int) (durationNs / 1000_000);
int nanos = (int) (durationNs % 1000_000);
The problem is that cltuData.length is of type int, as are all the operands: two constants 8 and 1000_000_000, and the bitrate. This causes the multiplication and division on the right-hand side to use int precision, which can overflow and generate a negative value for durationNs.
The easiest way to fix this is to change the constants to long type:
long durationNs = cltuData.length * 8L * 1000_000_000L / bitrate;
int millis = (int) (durationNs / 1000_000);
int nanos = (int) (durationNs % 1000_000);
The text was updated successfully, but these errors were encountered:
What is observed when running the SLE bridge and sending a CLTU:
This appears to be caused by insufficient precision in the sleep duration calculation:
The problem is that
cltuData.length
is of typeint
, as are all the operands: two constants8
and1000_000_000
, and thebitrate
. This causes the multiplication and division on the right-hand side to useint
precision, which can overflow and generate a negative value fordurationNs
.The easiest way to fix this is to change the constants to
long
type:The text was updated successfully, but these errors were encountered: