Bug #2485
Invalid THIS-PROCEDURE in AdminClient
0%
History
#1 Updated by Stanislav Lomany over 9 years ago
I think all of the issues have the same cause. Reproduction:
1. Log into admin client.
2. MAJIC -> Printer Maintenance
3. Select a printer and press "Edit Printer".
4. Press "Save".
From server log:
java.lang.NullPointerException at com.goldencode.p2j.util.ProcedureManager$ProcedureData.access$400(ProcedureManager.java:2556) at com.goldencode.p2j.util.ProcedureManager.thisProcedure(ProcedureManager.java:198) at com.goldencode.p2j.persist.BufferManager.scopeFinished(BufferManager.java:693) at com.goldencode.p2j.util.TransactionManager.processScopeNotifications(TransactionManager.java:5091) at com.goldencode.p2j.util.TransactionManager.popScope(TransactionManager.java:2248) at com.goldencode.p2j.main.StandardServer.invoke(StandardServer.java:1396) at aero.timco.majic.admin.server.MajicAccounts.printerDbHelper(MajicAccounts.java:2247) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.goldencode.p2j.util.MethodInvoker.invoke(MethodInvoker.java:76) at com.goldencode.p2j.net.Dispatcher.processInbound(Dispatcher.java:693) at com.goldencode.p2j.net.Conversation.block(Conversation.java:319) at com.goldencode.p2j.net.Conversation.run(Conversation.java:163) at java.lang.Thread.run(Thread.java:744)
The problem is at ProcedureManager:2177
. _thisProcedure()
and ProcedureData
are null
.
ProcedureData pdata = locateProcedure(_thisProcedure());
So we probably need to extend the list of blocks that can be referenced as THIS-PROCEDURE (and create proper CalleeInfo
). Or we should skip this kind of processing in admin client. Or create some extra block. Here is the current code that processes THIS-PROCEDURE handle:
public void scopeStart() { BlockType bt = TransactionManager.getBlockType(); if (bt.equals(BlockType.EXTERNAL_PROC) || bt.equals(BlockType.INTERNAL_PROC) || bt.equals(BlockType.FUNCTION) || bt.equals(BlockType.TRIGGER)) { // push always before pushing new THIS-PROCEDURE CalleeInfoImpl info = calleeInfo.peek(); info.push();
Top scope for admin client is defined at StandardServer:1253
(standard clients use the same entry point):
// add the topmost scope to the TransactionManager TransactionManager.pushScope("startup", TransactionManager.NO_TRANSACTION, true, true, false, false);
#2 Updated by Constantin Asofiei over 9 years ago
Stanislav,
Your stacktrace is hiding another NPE, when the scope is initially pushed:
java.lang.NullPointerException at com.goldencode.p2j.util.ProcedureManager$ProcedureData.access$900(ProcedureManager.java:2556) at com.goldencode.p2j.util.ProcedureManager$WorkArea.scopeStart(ProcedureManager.java:2189) at com.goldencode.p2j.util.TransactionManager.processScopeNotifications(TransactionManager.java:5077) at com.goldencode.p2j.util.TransactionManager.pushScope(TransactionManager.java:2115) at com.goldencode.p2j.util.BlockManager.coreLoop(BlockManager.java:8252) at com.goldencode.p2j.util.BlockManager.repeatWorker(BlockManager.java:8183) at com.goldencode.p2j.util.BlockManager.repeat(BlockManager.java:1445) at aero.timco.majic.admin.server.MajicAccounts.printerDbHelperWorker(MajicAccounts.java:2311) at aero.timco.majic.admin.server.MajicAccounts.access$200(MajicAccounts.java:127) at aero.timco.majic.admin.server.MajicAccounts$5.execute(MajicAccounts.java:2250) at com.goldencode.p2j.main.StandardServer.invoke(StandardServer.java:1272) at aero.timco.majic.admin.server.MajicAccounts.printerDbHelper(MajicAccounts.java:2246) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.goldencode.p2j.util.MethodInvoker.invoke(MethodInvoker.java:76) at com.goldencode.p2j.net.Dispatcher.processInbound(Dispatcher.java:693) at com.goldencode.p2j.net.Conversation.block(Conversation.java:319) at com.goldencode.p2j.net.Conversation.run(Conversation.java:163) at java.lang.Thread.run(Thread.java:744)
Try enclosing the body for printerDbHelperWorker
(and all other cases, if this works) in a BlockManager.externalProcedure
call - this should ensure all the state is pushed properly.
I think all the cases which have this problem are:
checkXtNotes(integer, character, boolean, boolean) printerDbHelperWorker(TaggedName, int) functionDbHelperWorker(TaggedName, int) menuDbHelperWorker(MenuDef, int, String[])
#3 Updated by Stanislav Lomany over 9 years ago
- Status changed from New to WIP
- Assignee set to Stanislav Lomany
Constantin, thanks, that helped.
Guys, there is one more issue: if we connect to a fresh server - no standards clients were connected to it yet - then connecting with admin client produces this error:
java.lang.RuntimeException: Unresolvable remote export public abstract java.lang.String com.goldencode.p2j.util.OperatingSystemInspector.getOperatingSystem(). at com.goldencode.p2j.net.RemoteObject$RemoteAccess.obtainRoutingKey(RemoteObject.java:1531) at com.goldencode.p2j.net.RemoteObject$RemoteAccess.invokeCore(RemoteObject.java:1415) at com.goldencode.p2j.net.InvocationStub.invoke(InvocationStub.java:97) at com.sun.proxy.$Proxy14.getOperatingSystem(Unknown Source) at com.goldencode.p2j.util.EnvironmentOps.getOperatingSystem(EnvironmentOps.java:335) at com.goldencode.p2j.util.EnvironmentOps.isUnderWindowsFamily(EnvironmentOps.java:400) at com.goldencode.p2j.util.EnvironmentOps.getLegacyCaseSensitive(EnvironmentOps.java:896) at com.goldencode.p2j.util.SourceNameMapper.initMappingData(SourceNameMapper.java:913) at com.goldencode.p2j.util.SourceNameMapper.convertJavaProg(SourceNameMapper.java:193) at com.goldencode.p2j.util.SourceNameMapper.convertJavaProgSafe(SourceNameMapper.java:209) at com.goldencode.p2j.util.BlockManager.checkJavaCall(BlockManager.java:7014) at com.goldencode.p2j.util.BlockManager.topLevelBlock(BlockManager.java:6856) at com.goldencode.p2j.util.BlockManager.externalProcedure(BlockManager.java:229) at com.goldencode.p2j.util.BlockManager.externalProcedure(BlockManager.java:211) at aero.timco.majic.admin.server.MajicAccounts.printerDbHelperWorker(MajicAccounts.java:2318) at aero.timco.majic.admin.server.MajicAccounts.access$200(MajicAccounts.java:128) at aero.timco.majic.admin.server.MajicAccounts$5.execute(MajicAccounts.java:2257) at com.goldencode.p2j.main.StandardServer.invoke(StandardServer.java:1272) at aero.timco.majic.admin.server.MajicAccounts.printerDbHelper(MajicAccounts.java:2253) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.goldencode.p2j.util.MethodInvoker.invoke(MethodInvoker.java:76) at com.goldencode.p2j.net.Dispatcher.processInbound(Dispatcher.java:693) at com.goldencode.p2j.net.Conversation.block(Conversation.java:319) at com.goldencode.p2j.net.Conversation.run(Conversation.java:163) at java.lang.Thread.run(Thread.java:744) Caused by: java.lang.RuntimeException: No export or no access to com.goldencode.p2j.util.OperatingSystemInspector:public abstract java.lang.String com.goldencode.p2j.util.OperatingSystemInspector.getOperatingSystem() at com.goldencode.p2j.net.HighLevelObject.getKey(HighLevelObject.java:121) at com.goldencode.p2j.net.RemoteObject$RemoteAccess.obtainRoutingKey(RemoteObject.java:1503) ... 27 more [01/13/2015 23:35:42 FET] (StandardServer.invoke:SEVERE) {00000001:00000020:admin} Abnormal end! java.lang.RuntimeException: Unable to load name mapping data. at com.goldencode.p2j.util.SourceNameMapper.initMappingData(SourceNameMapper.java:1006) at com.goldencode.p2j.util.SourceNameMapper.convertJavaProg(SourceNameMapper.java:193) at com.goldencode.p2j.util.SourceNameMapper.convertJavaProgSafe(SourceNameMapper.java:209) at com.goldencode.p2j.util.BlockManager.checkJavaCall(BlockManager.java:7014) at com.goldencode.p2j.util.BlockManager.topLevelBlock(BlockManager.java:6856) at com.goldencode.p2j.util.BlockManager.externalProcedure(BlockManager.java:229) at com.goldencode.p2j.util.BlockManager.externalProcedure(BlockManager.java:211) at aero.timco.majic.admin.server.MajicAccounts.printerDbHelperWorker(MajicAccounts.java:2318) at aero.timco.majic.admin.server.MajicAccounts.access$200(MajicAccounts.java:128) at aero.timco.majic.admin.server.MajicAccounts$5.execute(MajicAccounts.java:2257) at com.goldencode.p2j.main.StandardServer.invoke(StandardServer.java:1272) at aero.timco.majic.admin.server.MajicAccounts.printerDbHelper(MajicAccounts.java:2253) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.goldencode.p2j.util.MethodInvoker.invoke(MethodInvoker.java:76) at com.goldencode.p2j.net.Dispatcher.processInbound(Dispatcher.java:693) at com.goldencode.p2j.net.Conversation.block(Conversation.java:319) at com.goldencode.p2j.net.Conversation.run(Conversation.java:163) at java.lang.Thread.run(Thread.java:744)
The point is that when mappings are initiated, servers tries to get OS version from the admin client. And this kind of client has no OsPropertiesDaemon
instantiated. On the server side we get an invalid proxy using RemoteObject.obtainInstance(OperatingSystemInspector.class, true)
. How do you think it will be best to fix it?
#4 Updated by Constantin Asofiei over 9 years ago
Greg, can we assume that if we are in headless mode (TransactionManager.isHeadless()
returns true), we are under linux? This should be OK, as JRE internally uses linux-style paths, and in headless mode there already is no physical terminal, so the OS can't be accessed.
#5 Updated by Greg Shah over 9 years ago
Yes, I think that is fine. We just need to put some clear comments into there to explain why this is being done.
#6 Updated by Stanislav Lomany over 9 years ago
- File svl_upd20150114b.zip added
- File svl_upd20150114a.zip added
Updates for review.
#7 Updated by Greg Shah over 9 years ago
Code Review svl_upd20150114a.zip
I'm fine with this.
#8 Updated by Greg Shah over 9 years ago
Code Review svl_upd20150114b.zip
I'm fine with the external procedure wrapping parts of this.
Eric: please review the query changes.
#9 Updated by Stanislav Lomany over 9 years ago
The query changes are the same that were sent to Scott.
#10 Updated by Stanislav Lomany over 9 years ago
Heh, there is a problem with TransactionManager.isHeadless
: normal clients do not start.
java.lang.NullPointerException: Could not resolve the configuration def for 1: class com.goldencode.p2j.ui.WindowConfig at com.goldencode.p2j.ui.ConfigManager.duplicate(ConfigManager.java:682) at com.goldencode.p2j.ui.ConfigManager.addWidgetConfig(ConfigManager.java:436) at com.goldencode.p2j.ui.ConfigManager.addWidgetConfig(ConfigManager.java:406) at com.goldencode.p2j.ui.LogicalTerminal.init(LogicalTerminal.java:876) at com.goldencode.p2j.security.ContextLocal.initializeValue(ContextLocal.java:551) at com.goldencode.p2j.security.ContextLocal.get(ContextLocal.java:394) at com.goldencode.p2j.security.ContextLocal.get(ContextLocal.java:352) at com.goldencode.p2j.ui.LogicalTerminal.locate(LogicalTerminal.java:8728) at com.goldencode.p2j.ui.LogicalTerminal.access$100(LogicalTerminal.java:645) at com.goldencode.p2j.ui.LogicalTerminal$3.createScopeable(LogicalTerminal.java:9486) at com.goldencode.p2j.util.TransactionManager$ContextContainer.obtain(TransactionManager.java:5753) at com.goldencode.p2j.util.TransactionManager.isHeadless(TransactionManager.java:3557) at com.goldencode.p2j.util.EnvironmentOps.getOperatingSystem(EnvironmentOps.java:336) at com.goldencode.p2j.util.EnvironmentOps.isUnderWindowsFamily(EnvironmentOps.java:403) at com.goldencode.p2j.util.ServerPropertiesDaemon.isUnderWindowsFamily(ServerPropertiesDaemon.java:64) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.goldencode.p2j.util.MethodInvoker.invoke(MethodInvoker.java:76) at com.goldencode.p2j.net.Dispatcher.processInbound(Dispatcher.java:693) at com.goldencode.p2j.net.Conversation.block(Conversation.java:319) at com.goldencode.p2j.net.Conversation.run(Conversation.java:163) at java.lang.Thread.run(Thread.java:744)
Looks like with this call is disturbing natural order of loading TransactionManager
and LogicalTerminal
. Any ideas?
#11 Updated by Constantin Asofiei over 9 years ago
Stanislav Lomany wrote:
Looks like with this call is disturbing natural order of loading
TransactionManager
andLogicalTerminal
. Any ideas?
At the point when the client-side interrogates the server-side via the ServerPropertiesDaemon.isUnderWindowsFamily
API call, is too early to initiate the scopeables (TM, LT, etc). Try extracting the code from TM$ContextContainer.obtain
which determines the headless
state into a worker (TM._isHeadless
, package-private) and invoke this from the EnvironmentOps.getOperatingSystem
. Idea is, avoid the context-local access.
The TM$ContextContainer.obtain
will just call the TM._isHeadless
to set the WorkArea.headless
field.
#12 Updated by Stanislav Lomany over 9 years ago
- File svl_upd20150115a.zip added
Fixed getting "headless" attribute.
#13 Updated by Constantin Asofiei over 9 years ago
Stanislav Lomany wrote:
Fixed getting "headless" attribute.
If this solves the admin client problem without regressions, I'm OK with the changes.
#14 Updated by Stanislav Lomany over 9 years ago
So, should I distribute the P2J update without regression testing and check in MAJIC part into staging branch on devsrv01?
#15 Updated by Constantin Asofiei over 9 years ago
Stanislav Lomany wrote:
So, should I distribute the P2J update without regression testing
Run only the CTRL-C part, to be on the safe-side.
and check in MAJIC part into staging branch on devsrv01?
Yes, these need to be checked into the staging branch on devsrv01.
#16 Updated by Stanislav Lomany over 9 years ago
svl_upd20150115a.zip was committed into bzr rev 10710.
svl_upd20150114b.zip was committed to staging on devsrv01.
#17 Updated by Stanislav Lomany over 9 years ago
- Status changed from WIP to Review
#18 Updated by Greg Shah over 9 years ago
- Status changed from Review to Closed
#19 Updated by Stanislav Lomany over 9 years ago
- File svl_upd20150116a.zip added
Fixed conversion. MAJIC conversion is running.
#20 Updated by Stanislav Lomany over 9 years ago
MAJIC converted OK. Please review the update so I can distribute it.
#21 Updated by Constantin Asofiei over 9 years ago
Stanislav Lomany wrote:
MAJIC converted OK. Please review the update so I can distribute it.
I'm OK with the change, but you need to add a history entry.
#22 Updated by Stanislav Lomany over 9 years ago
- File svl_upd20150116a.zip added
Committed to bzr rev 10711.