we use standard java JPS (java print system) functionality to print to devices from WebSphere Application Server 9.0 on AIX.
Implementation of JPS on AIX uses native AIX commands which finally end up in calling rembak command which has a default timeout of 90seconds (no influence on this from JPS and even when calling directly 60seconds would be the minimum).
This happens already while looking up a printerqueue from JPS which is absolutly unneccesary. The remote device can be switched off or temporaryly unavailable on the network - to get a queue defined on AIX the printerstate is absolutely unneccesary. But even thought further: when actually printing to a queue I would assume the document is sent to the (local) queue and the request returns immediatly even when the remote printer is remporyrily unavailable.
In May 2019 I already did some research based on code available on github. Below are my findings and suggestions on that. Sadly the links don't work anymore as something in the repo changed - they may help you either to find what I mean...:
In the meantime I tried to figure out what is performed in
https://github.com/ibmruntimes/openj9-openjdk-jdk8/blob/openj9/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
https://github.com/ibmruntimes/openj9-openjdk-jdk8/blob/openj9/jdk/src/solaris/classes/sun/print/UnixPrintService.java
(I assume that are the relevant classes involved when using JPS on AIX, see my code example in the last mail below).
In UnixPrintServiceLookup.java line 848ff e.g. I found the private method named “getNamedPrinterNameAIX”. There the command “/usr/bin/lpstat -W –v” is used. If I execute this on the commandline of AIX with queue pointing to a remote printer which has some trouble or just is switched off, then it takes 90seconds for the command to return. In the output you can see an error from underlying rembak:
bash-4.3$ /usr/bin/lpstat -W -vITAE_2_P
Queue Dev Status Job Files User PP % Blks Cp Rnk
-------------------- -------------- --------- ------ ------------------ ---------- ---- --- ----- --- ---
ITAE_2_P @192 READY
: (WARNING) Connection to server failed.
rembak: errno = 4: Interrupted system call
ITAE_2_P raw HOST_DOWN
This seems to be “as designed” as the feedback from AIX-team and the manpage of lpstat says: “When a status command communicates with a remote host, the display occasionally appears to hang while the command waits for a response from the remote machine. The command eventually times out if no connection is established between the two machines.”
The result of this command is further passed on to “UnixPrintService.filterPrinterNamesAIX()” which aims on filtering out the headers and the “bogus entries added by remote printers”.
Finally the name is simply used as a parameter when calling the constructor of UnixPrintService.
To summarize: lpstat command is executet with all the underlying remote printer communication which may take lot's of time just to filter the remote entries out in the next step and validate the name is an existing printerqueue (local one).
I would suggest to use “enq -sW -P ” instead (important is parameter “s”). With this command the remote communication seems not to be done. The command returns immediately even when a remote device behind a queue is switched off at the moment!
bash-4.3$ enq -sW -P ITAE_2_P
Queue Dev Status Job Files User PP % Blks Cp Rnk
-------------------- -------------- --------- ------ ------------------ ---------- ---- --- ----- --- ---
ITAE_2_P @192 READY
As a sideeffect of this in the output the “bogus entries added by remote printers” are already omitted so there is less to filter out…
To list all available queues “enq -sWA” could be a suitable replacement.
Maybe adding option “L” would make it even simpler to parse the output in Java as it generates a semicolon separated format without unnecessary whitespaces.
As mentioned I don't have very deep knowledge of AIX and am more a java programmer pointing out what I experienced while fiddling around with this.
But from my point of view my suggested changes probably should work and even more important: I guess they would solve our problems as rembak isn't needed/used anymore for looking up one/all printers.
We believe this capability requires an update from the AIX team, which they have declined to deliver. We are therefore closing this request as we are unable to deliver it without this support.
Hi Ralf,
The java release version used to build this debug fix is
Java(TM) SE Runtime Environment (build 8.0.6.0 - pap3280sr6-20181112_01(SR6))
The debug module is ready to be shipped, working with L2 on how to get it shipped. Instructions to backup the existing and install
this module will be updated along with the debug module shipment.
Please keep us posted with the updates through L2 for the same.
thanks
-syed.
Hi Syed,
thank you for this good news :-) Great to have a date for planning.
I guess the final change will be available through a SDK release 8.0.5.4x as usual.
Regarding the mentioned test-module end of Nov.: In which way will this be provided for tests? Do we need a particular fixpack-version of WAS or the previous installed java SDK? This would help us to prepare our testmachine accordingly for beeing able to provide you prompt feedback.
Thanks, Ralf
Hi Ralf and others,
Apologies for the delay. Actually my update is missing here which went around Oct 20, 2019. The update is,
This RFE is targeted for Jan 2020 end release and a test module will be shared by end of Nov 2019.
Please let us know if you have any other clarification on the same.
thanks, syed
I've changed the status internally to "In Backlog", we'll see if that gets reflected here.
Hi Syed,
you mentioned this RFE has been accepted - I would have expected this RFE status changing to "Planned for Future Release" or something like that...?
As there seem to be other customers with same problem like Karin Rausch pointed out hopefully the priority rises as well :-)
Looking forward on this.
Thanks, Ralf
Dear colleagues,
I have also heard from business partner about this problem in customer situations.
Please help to fix this problem soon.
Kind Regards, Karin Rausch
Hi Ralf,
This RFE has been accepted and will be added to our product backlog. As your is the only request for this enhancement, it is tagged with low priority for now. Hence the ETA of the same is not available at this moment. We also can not guarantee a delivery before end of this year. We will let you know when it moves to a release backlog and targeted for a release.
Implementation will be covered through a flag option. We can provide a debug module to validate the resolution at customer end once the backlog item is targeted for a release. We will appreciate if you can test it and provide feedback, before we release it.
thanks, syed.
Hi Syed,
sorry, I wrote my last post before seeing your feedback :-)
Sounds like good news for us, thank you.
So just one question about the timeline: Can you roughly estimate how this could proceed? I don't expect a guaranteed releasedate but maybe some information when the earliest possible release might be possible if everything goes on straight forward. Would that be a ting of about a month, three months, half a year,...?
Best regards
Ralf
Did you have the time to check if the source for the IBM Java 8 builds differs from my referenced openJ9-source? I guess it might be the same or at least really similar: when analyzing our problem we found a native callstack on aix containing "lpstat -W -d" and "cut -f1 -d" which are the same commands seen in openJ9 source as well.
I know my question may be somehow impatiently but this is a showstopper for us which is becoming realy urgent.
Is there any timeline for this? I will probably have to decide shortly if we can wait for this RFE being accepted or if we need to find a completely other solution (actually, at the moment I don't know what this alternative solution could be but probably somehow avoiding JPS completely...)
Thanks
Ralf
Hi Ralf,
Thanks for your inputs, JDK team is working with AIX team on the same, Will keep you posted on the same.
thanks, syed.
Thank you for clarification.
Then of course you have to check if the source for IBM Java is different at this part. None the less - as the usecases are the same my suggestions maybe apply anyhow..?
Looking forward to see how this going on.
Note that https://github.com/ibmruntimes/openj9-openjdk-jdk8 is not used for IBM Java 8 builds. The "openjdk" portion of the source for IBM Java isn't publicly visible. This github source is used for OpenJDK + OpenJ9 builds available from https://adoptopenjdk.net/?variant=openjdk8&jvmVariant=openj9 . Referring to branch master, this is the same as http://hg.openjdk.java.net/jdk8u/jdk8u . The openj9 branch, which is used for the OpenJDK + OpenJ9 builds, is mostly the same as http://hg.openjdk.java.net/jdk8u/jdk8u but with some patches applied so it can work with OpenJ9, support the OpenJ9 shared classes cache, and a few other patches for better performance with OpenJ9.
Hi,
we use an "shell-menu" (script written by our AIX admins) to check the state of the queues manually in case there is anything wrong with the queues. In this script our admins used enq -s instead of lpstat or similiar commands because they faced the same problems with remote-printers beeing (temporarily) offline.
From this side I can tell this works for us as expected.
Of course I don't have a really deep insight into what JDK does when looking up printqueues (and further when actually printing).
From the described code in the RFE text there was a little refactoring on the github-repo. So now I refer to https://github.com/ibmruntimes/openj9-openjdk-jdk8/blob/467bd9a90a42b9cd6db1c7b8b9faf818769c64b0/jdk/src/solaris/classes/sun/print/PrintServiceLookupProvider.java#L82
Is this the correct sourcecode to talk about? Or am I completly wrong with that?
I assume this is correct for the following. The commands from String[] lpNameComAix are used three times: getDefaultPrinterNameAIX(), getNamedPrinterNameAIX(String name), getAllPrinterNamesAIX()
- for getDefaultPrinterNameAIX() only the name of the defaultprinter is grabbed. The following command should be a good replacement: "enq -qsW|expand|cut -f1 -d' '"
- for getNamedPrinterNameAIX(String name) the PrintService for exactly a given name is searched and returned. The status doesn't matter - not for the local queue nor for the remote one. So "enq -sW -P %s|expand|cut -f1 -d' '" should do just fine (with inserting 'name' by String.format())
- for getAllPrinterNamesAIX() just grabs the names of all printers as well. The following command should be a good replacement: "enq -sWA|expand|cut -f1 -d' '"
From my point of view theese three commands could be a sideeffect free replacement but without the timeconsuming rembak calls to the remote printer as none of that informtion is needed. There is already a systemproperty used in PrintServiceLookupProvider to switch the default printer enumeration - if there are any doubts in removing the old commands then just adding the new ones to be used by a similar property might be an option, but from my point of view the new ones should become the default :-).
This could be sufficient for our usecase. Maybe there is even more to optimize (in UnixPrintService.java). Here I have to admit I only had a quick look at it. Seems there are to methods using lpstat ("getPrinterIsAcceptingJobsAIX()" and "getQueuedJobCountAIX()"). The first one of theese might be an option to be replaced by some "enq -s" as well (if local queue contains READY or RUNNING should be enough?), for the second it might be difficult as "enq -s" omits the queued files/jobs.
Disclaimer: All my suggestions are based on commandline tests on our current AIX. I don't know if there has something changed in some AIX releases which is incompatible with it.
What do you think?
Best regards
Ralf
The understanding on the enq -S option based on the discussion with AIX team is, it won't query the remote printer queues.
"enq:
-s
Obtains the status of print queues without listing any files. Doesn't query remote printer queues"
As Java team is not clear if the remote printer is active then what would be the behaviour of enq -S option. This is under discussion with AIX team from our side at this stage.
Also, Is it possible to confirm the behavior of enq -S with active (switched on)/inactive (switched off) remote printer scenarios clearly from customer ? And this exactly matches their requirement in both scenarios.
The above will help us to decide on the next steps.
Please let us know if you have any other clarification on the same.
thanks, syed