I am working on a sample to get the list of printer connected to machine. For that I am using EnumPrinters() API to get the printers. Randomly it gives the error RPC_S_SERVER_UNAVAILABLE (1722). I tried to search in the net, but I could not get the solution.
Please help me to fix this issue.
How are you calling EnumPrinters (hint - post the code)?
For some modes of API invocation, the local system will RPC to the target servers in turn - this uses RPC, so you can get RPC errors back. You may be able to get the info you need via a less heavyweight call that uses different parameters to EnumPrinters.
From the docs:
when EnumPrinters is called with a
level 2 (PRINTER_INFO_2) data
structure, it performs an OpenPrinter
call on each remote connection. If a
remote connection is down, or the
remote server no longer exists, or the
remote printer no longer exists, the
function must wait for RPC to time out
and consequently fail the OpenPrinter
call. This can take a while.
I had this problem recently with my Windows 10 PC. I spent a lot of time with debugging of EnumPrinters, with all different sorts of levels, but nothing worked and I always got the error RPC_S_SERVER_UNAVAILABLE (1722). It turned out that something has stopped the Spooler service and even after a reboot it was disabled. After enabling the Spooler service, everything worked. You can notice the Spooler service failure by looking at the Win10 printer settings: All printers would show "not connected", even Print to PDF.
Related
It appears that in some very rare cases GetComputerName() Windows API returns 'TENTATIVE' as a computer name. Based on information from our customers we suspect that this sometimes happens on laptops when they 'awaken' from a sleep. The odd thing is that this happens after our app is already running and able to connect to a back-end server and retrieve some information from it - i.e. the computer name is written into a log file at the time.
We are considering putting a slight delay during 'awakaning' but would like confirm that the cause is what we suspect.
We could not find anything on-line that would confirm the source of the issue.
Update: We are using AIX environment.
We have been facing some random issues with our queues (cluster queues), like:
2189 Cluster resolution error (Most frequent one)
2270 MQRC_NO_DESTINATIONS_AVAILABLE
2053 Queue full error(Weirdest) : Post one message, it will be successfully posted, post some 3-4 messages, it will throw this error
for the rest of the messages.
All these issues get resolved once we do a cluster refresh. But, I want to know the root cause, why we get these errors. What goes wrong?
How cluster refresh resolve these errors?
Could be a socket issue. You can monitor sockets according to your OS - like on windows can do
netstat -a -b -o >/newfile.txt
You could also use TCP Viewer on windows (one exe from Microsoft/ sysinternals) http://technet.microsoft.com/en-us/sysinternals/bb897437.aspx actually all the sys internal toos should be in your prod box if windows.
For sockets in linux/Un* there are other tools, some just ls commands into the RAM, depending on the version. Maybe a google will help.
Also if using windows consider moving some stuff to linux, you will have some pain in the beggining but will get better.
If this did not help you should post yor environment on your quesiton and give any other details. And if you get a jprofiler into production and use it when the issue happens.
At the very least you can do a jstack and jmap
What is version/ name of OS and of java, websphere?
If it is a socket issue can try increasing sockets (registry) and then profiling your code to see who is making too many sockets, what needs to be throttled or re-written.
Remember every page, every db connection, external cache hit (if you use) or any other URL work/ remote connection is usually a socket.
I'm using the WNetEnumResource to enumerate all network share connections and WNetCancelConnection2 to close them. Then I am using WNetUseConnection to connect to a share using discrete credentials. This process happens multiple times throughout the day.
The problem that I'm running into is that after the first flow through the process I'm getting:
System Error 1219 has occurred.
Multiple connections to a server or shared resource by the same user,
using more than one user name, are not allowed. Disconnect all
previous connections to the server or shared resource and try again.
This happens even when the enumeration says there are no current connections.
My question is: why? Why am I getting this error? Is the authenticated connection to the server still cached? Can I enumerate these authentication tokens? Kerberos? LSA?
I haven't been able to find the smallest foothold of information to progress forward on this project. Any help is appreciated!
I'm trying to remember the solution we used when we came across this problem for a network backup program a few years ago.
I'm certain the solution involves using either WNetAddConnection2 or WNetAddConnection3 instead of WNetUseConnection. I think that passing the flag CONNECT_CRED_RESET should take care of this, but I'm not absolutely certain.
Note that CONNECT_CRED_RESET is only documented for WNetAddConnection2 and not WNetAddConnection3, though MSDN says the only difference between the two is the hWnd parameter for owner of dialog windows - I'd try with WNetAddConnection2 and only if it works, experiment with WNetAddConnection3. You may even get it to work with WNetUseConnection!
Make sure to note the dependencies CONNECT_CRED_RESET has on other flags.
I have a program that runs on Windows and scans shares on a Netapp filer over CIFS. When the scanner runs on W2K3 and exits, running "cifs sessions -c " on the Netapp filer shows that the session is gone. When the same scanner runs on W2K8 and exits, the above Netapp command shows the session to be still alive. The scanner application has already exited so there should be no traffic on the session anymore.
What I have done so far:
1) waited for (more than) cifs.idle_timeout number of seconds to see if the session goes away. It does not.
2) analyzed packet-traces for the communication between W2K3->Netapp and W2K8->Netapp. W2K3 trace shows TREE_CONNECT and TREE_DISCONNECT but W2K8 trace shows only the TREE_CONNECT request. I will verify this but I think the TREE_DISCONNECT on W2K3 is followed by a LOGOFF request (which causes the session to end I would believe?).
3) To see how things would look when Netapp is not in the picture -- from the W2K8-client machine, I accessed via windows-explorer \\C$. This causes a TREE_CONNECT request on the wire. Now I closed the explorer window and the W2K3-server machine closed the session even though there was no TREE_DISCONNECT on the wire generated by the W2K8-client.
So seems like Netapp is expecting something that W2K8 is not sending.
Question : Is there a specific API I can use in my scanner application to
i) send an explicit LOGOFF SMB request when I am done scanning?
ii) or, re-use an existing session b/w the W2K8-client and the Netapp filer for a new scan?
ii) anyone face this or similar scenarios?
Thanks in advance.
For the API - look at NetUseEnum and NetUseDel.
The disconnect you see is due to idle session (session with no open handles). I'm not sure if this is done by the server (which would indicate a difference between Netapp and Windows) or by the client (your scanner holds an open handle, maybe the current directory, while Explorer closes the handle when you close the window).
I'm not sure what you are trying to accomplish, but it might be easier using NetApp tools/APIs. For a lot of administration tasks the Data ONTAP PowerShell Toolkit can really simplify things:
PS C:\> Connect-NaController fas2040rre1
PS C:\> Get-NaCifsShare
MountPoint ShareName Description
---------- --------- -----------
/etc ETC$ Remote Administration
/vol/vol0/home HOME Default Share
... snip ...
/vol/cifs/backups backups
And if PowerShell isn't your thing, you can take a look at the Manageability SDK for a Web Services API to C/C++, Java, Perl and .Net. In that case you'd want to look at the cifs-share-list API's (slightly different between 7.x/8.x).
We have a fairly standard client/server application built using MS RPC. Both client and server are implemented in C++. The client establishes a session to the server, then makes repeated calls to it over a period of time before finally closing the session.
Periodically, however, especially under heavy load conditions, we are seeing an RPC exception show up with code 1754: RPC_S_NOTHING_TO_EXPORT.
It appears that this happens in the middle of a session. The user is logged on for a while, making successful calls, then one of the calls inexplicably returns this error. As far as we can tell, the server receives no indication that anything went wrong - and it definitely doesn't see the call the client made.
The error code appears to have permanent implications, as well. Having the client retry the connection doesn't work, either. However, if the user has multiple user sessions active simultaneously between the same client and server, the other connections are unaffected.
In essence, I have two questions:
Does anyone know what RPC_S_NOTHING_TO_EXPORT means? The MSDN documentation simply says: "No interfaces have been exported." ... Huh? The session was working fine for numerous instances of the same call up until this point...
Does anyone have any ideas as to how to identify the real problem? Note: Capturing network traffic is something we would rather avoid, if possible, as the problem is sporadic enough that we would likely go through multiple gigabytes of traffic before running into an occurrence.
Capturing network traffic would be one of the best ways to tackle this issue. If you can't do that, could you dump the client process and debug with WinDBG or Visual Studio? Perhaps compare a dump when operating normally versus in the error state?