Project

General

Profile

Bug #10004

NativeInvoker fails if an argument is of type integerConstant

Added by Alexandru Lungu about 1 year ago. Updated 6 months ago.

Status:
WIP
Priority:
High
Target version:
-
Start date:
Due date:
% Done:

80%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
production:
No
env_name:
topics:

Related issues

Related to Base Language - Bug #9060: Cache oftenly used values that are immutable Internal Test

History

#1 Updated by Alexandru Lungu about 1 year ago

  • Related to Bug #9060: Cache oftenly used values that are immutable added

#2 Updated by Alexandru Lungu about 1 year ago

  • Assignee set to Artur Școlnic
  • Priority changed from Normal to High

There is an issue when NativeInvoker.checkModeAndType is called with an argument that is of type integerConstant. It results in Mismatch in the parameter datatypes in DLL procedure %s %s.
This happens in 7156e - didn't test with trunk, but I presume there is a problem there as well.

I added it as a check next to integer.class (i.e. integer.integerConstant.class) and it worked, but I wonder if:
  • #9060 already fixes this
  • there are other places with such issue

#3 Updated by Constantin Asofiei about 1 year ago

NativeInvoker has lots of cases like cls.equals(decimal.class) - if not solved by #9060, the entire class needs to be reviewed, and at least the signature needs to be normalized in inboundProcessing; is not just that BaseDataTypeConstant, also anon types of the BDT - see ControlFlowOps.calculateType.

#4 Updated by Artur Școlnic about 1 year ago

Alexandru Lungu wrote:

I added it as a check next to integer.class (i.e. integer.integerConstant.class) and it worked, but I wonder if:
  • #9060 already fixes this

9060b does not fix this particular issue.

  • there are other places with such issue

Class checking is highly used in the entire project, a lot of places were completed with checking against the constant types, but surely there are more cases like this that will pop up from time to time.

A simple check against constant types should be fine here.

#5 Updated by Greg Shah about 1 year ago

The library_calls/ tests in Testcases should be executed. These are not yet reworked as ABLUnit tests. See the library_calls/readme.txt.

#6 Updated by Artur Școlnic about 1 year ago

  • Status changed from New to WIP
  • reviewer Constantin Asofiei added

I added the missing type checks, the changes are in 10004a.
I did not try to normalize the type because we are dealing with Class types, normalizing would mean getting the string representation, trimming and using reflections to get back the class, this has negative performance implications.
Constantin, do you agree? If so, please review.

#7 Updated by Artur Școlnic about 1 year ago

  • Status changed from WIP to Review

#8 Updated by Constantin Asofiei about 1 year ago

Artur, that is not what I had in mind. This class uses lots of .equals(Class<BDT>), and the solution needs to be agnostic of the actual type.

See ControlFlowOps.getSignature - this is the source of signInput, from which signature is calculated.

#9 Updated by Artur Școlnic about 1 year ago

  • Status changed from Review to WIP

#10 Updated by Artur Școlnic about 1 year ago

  • Status changed from WIP to Review

I committed a new solution to 10004a/15917. Constantin, please review.

#11 Updated by Constantin Asofiei about 1 year ago

Artur Școlnic wrote:

I committed a new solution to 10004a/15917. Constantin, please review.

Why not do this in ControlFlowOps.getSignature ? A Java array AFAIK we decided that the elements can never be constants.

#12 Updated by Artur Școlnic about 1 year ago

You mean storing the super class for anonymous classes and constants in the signature?
If getSignature is the only source for the input classes in NativeInvoker, the yes, this is better.

#13 Updated by Constantin Asofiei about 1 year ago

Artur Școlnic wrote:

You mean storing the super class for anonymous classes and constants in the signature?
If getSignature is the only source for the input classes in NativeInvoker, the yes, this is better.

Yes, but look also at Call.invoke:1692, there also calculates the signInput array, but it does not resolve anon or constant types of args. Or you can just prepare signInput in the two NativeInvoker.invoke methods.

#14 Updated by Artur Școlnic about 1 year ago

  • Status changed from Review to WIP

#15 Updated by Artur Școlnic about 1 year ago

  • Status changed from WIP to Review

I committed the new approach to rev 15918, please review.

#16 Updated by Constantin Asofiei about 1 year ago

review for 10004a rev 15918:
  • type.equals(BaseDataTypeConstant.class) needs to be BaseDataTypeConstant.class.isAssignableFrom(type)

Otherwise, please do run #10004-5 tests.

#17 Updated by Constantin Asofiei about 1 year ago

  • Status changed from Review to Internal Test

Please update %done.

#18 Updated by Artur Școlnic about 1 year ago

I have some issues running library_calls tests, is there a customer test suite that would be appropriate for testing?

#19 Updated by Constantin Asofiei about 1 year ago

Artur Școlnic wrote:

I have some issues running library_calls tests,

We need to run those. What problems do you have?

#20 Updated by Artur Școlnic about 1 year ago

./junit.sh -c library_calls.TestRunner

Could not find interface for group com.goldencode.p2j.util.osresource.EnvironmentAccessor
Could not find interface for group com.goldencode.p2j.util.osresource.EnvironmentAccessor
UI Theme successfully changed to 'windows10'
Could not find interface for group com.goldencode.p2j.ui.ClientExports
Could not find interface for group com.goldencode.p2j.ui.ClientExports
Could not find interface for group com.goldencode.p2j.ui.ClientExports
Could not find interface for group com.goldencode.p2j.ui.ClientExports
Could not find interface for group com.goldencode.p2j.ui.ClientExports
Could not find interface for group com.goldencode.p2j.ui.ClientExports
Could not find interface for group com.goldencode.p2j.ui.ClientExports
Could not find interface for group com.goldencode.p2j.ui.ClientExports
Could not find interface for group com.goldencode.p2j.ui.ClientExports
Could not find interface for group com.goldencode.p2j.ui.ClientExports
Could not find interface for group com.goldencode.p2j.ui.ClientExports
Could not find interface for group com.goldencode.p2j.ui.ClientExports
Could not find interface for group com.goldencode.p2j.util.osresource.EnvironmentAccessor
Could not find interface for group com.goldencode.p2j.util.osresource.EnvironmentAccessor
Could not find interface for group com.goldencode.p2j.ui.ClientExports
Could not find interface for group com.goldencode.p2j.ui.ClientExports
Could not find interface for group com.goldencode.p2j.util.LegacyLogManagerClientService
Could not find interface for group com.goldencode.p2j.util.LegacyLogManagerClientService
Could not find interface for group com.goldencode.p2j.util.LegacyLogManagerClientService
Could not find interface for group com.goldencode.p2j.util.LegacyLogManagerClientService
Could not find interface for group com.goldencode.p2j.util.LegacyLogManagerClientService
Could not find interface for group com.goldencode.p2j.util.LegacyLogManagerClientService

#21 Updated by Constantin Asofiei about 1 year ago

Do you have some other p2j.jar somewhere? This should not happen.

#22 Updated by Artur Școlnic about 1 year ago

Constantin Asofiei wrote:

Do you have some other p2j.jar somewhere?

Just one in the deploy\lib

#23 Updated by Greg Shah about 1 year ago

Artur Școlnic wrote:

I have some issues running library_calls tests, is there a customer test suite that would be appropriate for testing?

No, this test suite needs to pass.

#24 Updated by Artur Școlnic about 1 year ago

Greg Shah wrote:

The library_calls/ tests in Testcases should be executed. These are not yet reworked as ABLUnit tests. See the library_calls/readme.txt.

I see that there is an extra step of building and installing a shared library using testapi directory (which I did), is there something else that needs to be done in order to run the converted tests with junit?

#25 Updated by Greg Shah about 1 year ago

They are not migrated with JUnit/ABLUnit yet. You have to manually run a ChUI client to execute the test "driver" program. Then you have to compare the output log to the baseline output log to confirm that it is OK.

In the future, we will migrate the test suite to ABLUnit.

#26 Updated by Artur Școlnic about 1 year ago

This explains my issues running the tests as junit :)
I compared the output binary files from trunk and 10004a, they are the same.

#27 Updated by Greg Shah about 1 year ago

Please compare it with the captured baseline. We might not hold up the branch for any regressions but we should know about them if they exist.

What is the % Done?

#28 Updated by Artur Școlnic about 1 year ago

There are 153 more files in the baseline and 3 files differ compared to 10004a, which is the same as trunk. I suspect that the missing files are due to a configuration issue on my part. Do we expect the output to be exactly the same as in linux_64bit_p2j_library_calls_output_20140212.zip?

#29 Updated by Artur Școlnic about 1 year ago

  • % Done changed from 0 to 100

#31 Updated by Greg Shah about 1 year ago

Please see #10193-17 for an related update.

#32 Updated by Alexandru Lungu 12 months ago

Given that 10193a reached trunk, can we proceed with testing with this?

#33 Updated by Artur Școlnic 11 months ago

I tested library_calls and harness+webUI navigation, all passed.

#34 Updated by Alexandru Lungu 11 months ago

  • Status changed from Internal Test to Merge Pending

Please merge 10004a to trunk after 10309b

#35 Updated by Artur Școlnic 11 months ago

10004a was merged as rev 16105.

#36 Updated by Alexandru Lungu 11 months ago

  • Status changed from Merge Pending to Test

#37 Updated by Alexandru Lungu 8 months ago

  • Status changed from Test to WIP
  • % Done changed from 100 to 90

I tested the application that triggered #10004-1 and the error still occurs. I am looking at the latest trunk and there is no guard for integerConstant in NativeInvoker.checkModeAndType.

#38 Updated by Alexandru Lungu 8 months ago

Even if I fix this, I get another error. I think it hints that there is something broken in library_calls test-suite.
I try to run EVP_sha256 from libcrypto with an output parameter of type memptr which I expect to be loaded.
However, there is an null/empty pointer returned. This makes the program fail once the memptr that is expected to be loaded is used, resulting in DLL procedure H... using an uninitialised MEMPTR.
Artur, can you rerun the library_calls suite?

I think this is related to #7254

#39 Updated by Alexandru Lungu 8 months ago

PS: I wonder if #10193 was actually negating the changes in #7254, so we are back with the problem from #7254.

#41 Updated by Artur Școlnic 8 months ago

Alexandru Lungu wrote:

Artur, can you rerun the library_calls suite?

I recall having some issues running this suite, but with the latest trunk the issues are much greater, the output files are not generated at all.
The errors in the server.log:

25/12/08 16:25:36.623+0200 |  SEVERE | com.goldencode.p2j.util.ErrorManager | ThreadName:Conversation [00000001:bogus], Session:00000001, ThreadId:00000005, User:bogus | ** Could not open Dynamic Library: library_calls/testapi/libtestapi.so (8013)
25/12/08 16:25:36.651+0200 |  SEVERE | com.goldencode.p2j.util.ErrorManager | ThreadName:Conversation [00000001:bogus], Session:00000001, ThreadId:00000005, User:bogus | ** DLL Error : library_calls/testapi/libtestapi.so: cannot open shared object file: No such file or directory (8014)
25/12/08 16:25:36.665+0200 |  SEVERE | com.goldencode.p2j.util.ErrorManager | ThreadName:Conversation [00000001:bogus], Session:00000001, ThreadId:00000005, User:bogus | ** Could not load DLL procedure library_calls/testapi/libtestapi.so. (3258)
25/12/08 16:25:39.194+0200 |  SEVERE | com.goldencode.p2j.util.ErrorManager | ThreadName:Conversation [00000001:bogus], Session:00000001, ThreadId:00000005, User:bogus | Put/Get functions not allowed on uninitialized memory. (2914)
25/12/08 16:25:39.211+0200 |  SEVERE | com.goldencode.p2j.util.ErrorManager | ThreadName:Conversation [00000001:bogus], Session:00000001, ThreadId:00000005, User:bogus | Put/Get functions not allowed on uninitialized memory. (2914)
25/12/08 16:25:40.669+0200 |  SEVERE | com.goldencode.p2j.util.ErrorManager | ThreadName:Conversation [00000001:bogus], Session:00000001, ThreadId:00000005, User:bogus | Indeterminate extent dimension 0 is out of range 1 to 28000. (11385)
25/12/08 16:25:40.679+0200 |  SEVERE | com.goldencode.p2j.util.ErrorManager | ThreadName:Conversation [00000001:bogus], Session:00000001, ThreadId:00000005, User:bogus | Indeterminate extent dimension 0 is out of range 1 to 28000. (11385)
25/12/08 16:25:41.133+0200 |  SEVERE | com.goldencode.p2j.util.ErrorManager | ThreadName:Conversation [00000001:bogus], Session:00000001, ThreadId:00000005, User:bogus | Indeterminate extent dimension 0 is out of range 1 to 28000. (11385)
25/12/08 16:25:41.145+0200 |  SEVERE | com.goldencode.p2j.util.ErrorManager | ThreadName:Conversation [00000001:bogus], Session:00000001, ThreadId:00000005, User:bogus | Indeterminate extent dimension 0 is out of range 1 to 28000. (11385)

I ran again with trunk/16105 and all the files are generated, although there are 3 files that differ compared to baseline, I don't recall if that is expected or not.

#42 Updated by Alexandru Lungu 6 months ago

  • Assignee changed from Artur Școlnic to Alexandru Lungu
  • Status changed from WIP to Review
  • % Done changed from 90 to 100

Created and committed 10004b/16340. Please review.

#43 Updated by Alexandru Lungu 6 months ago

  • Status changed from Review to WIP
  • % Done changed from 100 to 80

Hmm, in fact, now I read #10004-8 suggestion. I guess this should be fixed upstream. Let me debug and see why 10004a wasn't enough.

Also available in: Atom PDF