I have an interesting/annoying problem with some VBScripts running on Windows 2003 Server (they run fine on XP).
The scripts basically periodically call WMI objects to extract performance information and write it to a log file. It's started by Scheduled Tasks at 12:05 each morning and runs until midnight (or would if it didn't keep crashing). It's owned by Administrator and the task is "cscript xx.vbs blah blah blah".
Sometimes it runs for hours, sometimes only a few minutes. The calls are of the form:
set objWMI = getObject("winmgmts:\\.\root\cimv2")
: : :
do lots of times:
set itemCpu = wmi.get("Win32_PerfRawData_PerfOS_Processor.Name='_Total'")
The error it comes back with is a dialog box stating that the remote procedure call failed to execute but no extra information (it does give a 32-bit hex number and I'll update this question with it next time it happens but my Google searches turned up very generic pages so I'm not sure the code will help).
It also used to crash out (same error) with the following line but I haven't seen a problem with this one since I changed it to use Win32_Perf Raw Data_PerfOS_Memory.
set colMem = wmi.execQuery("select AvailableKBytes" & _
" from Win32_PerfFormattedData_PerfOS_Memory",,48)
I gather it's not network-related since it's on the same machine.
I've also tried to set objWMI to nothing and do another getObject every time through the loop but that didn't help.
One other possible problem, it's actually running inside VMWare Workstation (but so is the XP) - next week I'll get a physical-PC setup of Win2k3 running to test it there.
The strange thin is, it sometimes runs for hours without problems, collecting the data and sending it to the log file. Other times, it crashes in ten minutes.
Any ideas from the Windows gurus out there among us?
UPDATE:
Okay, it finally failed again. Here's my little effort at screen capture:
+-------------------------------------------------+
| Windows Script Host |X|
+-------------------------------------------------+
| / Script: C:\Program Files\blah\blah.vbs |
| /\ Line: 271 |
| Char: 2 |
| Error: The remote procedure call |
| failed and did not execute. |
| Code: 800706BF |
| Source: SWbemServicesEx |
+-------------------------------------------------+
Line 271 is:
set itemCpu = wmi.get("Win32_PerfRawData_PerfOS_Processor.Name='_Total'")
with wmi having been previously set with:
set wmi = getObject("winmgmts:\\.\root\cimv2")
(this one is continuously being re-created inside the loop, so I don't think it's an issue with the RPC connection going stale).
The error 1722(0x6BF) is : The RPC server is unavailable.
One suggestions : free all objects explicitly in your script
To perform best diagnose try to sniff your network using Microsoft Network Monitor 3.2 and search for issue.(view this help How to capture network traffic with Network Monitor)
Good look.
If your script is checking any user accounts when it runs take a look at this hotfix. It only a problem on 2003 which may explain why it works fine on your XP system.
http://support.microsoft.com/kb/933593
It was causing some random problems for us at work that didn't entirely fit the description in the article but the hotfix did fix our problems.
Related
I'm trying to get the user's last logon in some Windows machines using WMI, but for some reason, this information is different for different commands when I think they should be the same.
The first command that I'm using is : PATH Win32_NetworkLoginProfile WHERE "Name='DOMAIN\\fakeuser'" GET LastLogon. The result for it is like below:
LastLogon
20181206093540.000000-480
The second command is: PATH Win32_NTLogEvent WHERE "(EventIdentifier =4648 OR EventIdentifier = 4647 OR EventIdentifier = 4634)" GET CategoryString, TimeGenerated, InsertionStrings
The result is like below (after some processing to find the last entry of category "Logon" linked to the "fakeuser", since the command returns a lot of information):
CategoryString
Logon
InsertionStrings
{"S-1-5-21-3457937927-2839227994-823803824-1104","DOMAIN$","DOMAIN","0x3e6","{00000000-0000-0000-0000-000000000000}","fakeuser","DOMAIN","{00000000-0000-0000-0000-000000000000}","localhost","localhost","0x64c","C:\Windows\System32\svchost.exe","999.999.99.999","0"}
TimeGenerated
20181206173540.580545-000
For what I understand for these two commands, the LastLogon in the first result should be the same of TimeGenerated in the second one. Am I misunderstood something?
In my preliminary research, I found a possible bug in the WMI Timestamps, but I don't know if it is the same problem.
Some additional information:
These commands are executed using a script that make a remote connection using WinRM connection (ports 5985 and 5986) and then executes the commands to get the info, but I also tried to connect in the machine using RDP and execute it in Powershell with wmic PATH.... The result is the same.
I tested it in Windows 10 and also in Windows Server 2012, but the scripted will be used in some other Windows versions.
To get the Event numbers for the log class, I used this link
After first comment, I noticed that the problem is in time zones. Are there any way to set timezone direct in these commands or convert timezones between them?
I have a problem that's been plaguing me about a year now. I have Oracle 12.1.x.x installed on my machine. After a day or two the listener stops responding and the listener.log contains a bunch of TNS-12531 messages. If I reboot, the problem goes away and I'm fine for another day or two. I'm lazy and I hate rebooting, so I decided to finally track this down, but I'm having no luck. Since the alternative is to do work that I really don't want to do, I'm going to spend all my time researching this.
Some notes:
Windows 10 Pro
64-Bit
32 GB RAM
Generally, about 20GB free when the error occurs
I have several databases and it doesn't matter which DB is running
Restarting the DB doesn't help
Restarting the listener doesn't help
Only rebooting clears the problem
When I set TRACE_LEVEL_LISTENER = 16, I don't get much more info. Trace files are not written to
I can connect to the DB if I bypass the listener (ie, set ORACLE_SID=xxx and connect without a DB identifier)
All other network interactions seem to work fine after the listener stops
lsnrctl status hangs and adds another TNS-12531 to the listener.log
I have roughly the same config at home and this does not happen
Below is an example of a listener.log file:
Fri Jul 28 14:21:47 2017
System parameter file is D:\app\user\product\12.1.0\dbhome_1\network\admin\listener.ora
Log messages written to D:\app\user\diag\tnslsnr\LJ-Quad\listener\alert\log.xml
Trace information written to D:\app\user\diag\tnslsnr\LJ-Quad\listener\trace\ora_24288_14976.trc
Trace level is currently 16
Started with pid=24288
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=LJ-Quad)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
Listener completed notification to CRS on start
TIMESTAMP * CONNECT DATA [* PROTOCOL INFO] * EVENT [* SID] * RETURN CODE
28-JUL-2017 14:22:06 * 12531
TNS-12531: TNS:cannot allocate memory
28-JUL-2017 14:22:47 * 12531
TNS-12531: TNS:cannot allocate memory
28-JUL-2017 14:26:24 * 12531
TNS-12531: TNS:cannot allocate memory
Thanks a bunch for any help you can provide!
Issue 1
This error can occur approximately after 2048 connections have been made via the listener when running on a non-English Windows installation.
Fix for Issue 1
Create a Windows User Group named Administrators on the computer where the listener.exe resides. This can fix the issue of the listener dying.
Reference: I'll post the link for the first issue as soon as I find it again
Issue 2
This error can also occur on Windows 64-Bit systems where the Desktop Application Heap is too small.
Fix for Issue 2
Try to Increase the Desktop Application Heap Registry in windows its located in
HKLM\System\CurrentControlSet\Control\Session Manager\SubSystems\Windows
Just as note don't add this Value by yourself, you have to depend on document.
Basically search for the registry entry and alter the third value for the key SharedSection=1024,20480,1024. This is a trial and error approach, but seems to improve listener's stability and memory issues.
Reference: TNS:cannot allocate memory - is there limit to the num databases on one box (Oracle Developer Community)
Our application builds an Access database (.mdb) and then starts a different application with the Shell command which needs Read/Write Access to this very database. The problem is that on some systems our application seems erratically to retain an exclusive lock on the database, preventing the other application from accessing it. Only after closing down the first application can the other application proceed.
The specific Error that is raised is Error 3028, which seems to be specific for DAO 3.51 (Access '97) which we indeed employ. I cannot understand why some systems are affected (and then not consistently) and others never. I thought that it might be a timing issue and built in a Sleep period between building the database and launching the other application, but that does not help.
What is going on?
EDIT:
I now created a workaround by creating the database in a separate file and then copying it. Now the second program should always be able to access it and any remaining lock problems will surface in the first program, which I maintain. I will follow up later when our users have been able to test this.
Are you closing the connection to the DB before passing control to another EXE?
I had a similar issue previously which wasn't quite the same but from what you have described this is the approach I would try:
Before lauching the secondary application with the shell command.
Alongside the sleep period you have already employed you will also need to close the original program which generated the .mdb file.
I achieved this by shelling a windows batch file, and then immediately exiting the original program.
Batch file makeup as follows:
ping -n 5 localhost >NUL
start MSAccess.exe "C:\DB.mdb"
exit
This allows 5 seconds for the mdb file to be freed-up before launching, you could replace my Ms Access call with your secondary program.
I am trying to run unmodified reports using batch processing in Microsoft Dynamics AX 2009. I have set up my configuration, and set up an AOS printer to run the report on. When I send a report to the batch queue, it immediately has an error when it begins execution.
The error is as follows:
Error executing code: SysGlobalCache object not initialized.
(S)\Classes\SysGlobalCache\get (S)\Classes\ClassFactory\reportRunClass
- line 14 (S)\Classes\RunBaseReport\makeReportRun - line 19 (S)\Classes\RunBaseReport\unpack - line 31
(S)\Classes\RunbaseReportStd\unpack - line 26
(S)\Classes\BatchRun\runJobStatic - line 27
I have tried running three different reports: Customer, Vendor, and Purchase Lines. I get the same error every time.
Any suggestions?
We faced a similar problem at my work, but didn't want to rely on having to set up the legacy batch processing method, suggested previously. Luckily in our case, it wasn't a requirement that the report actually be printed to hard-copy. So rather than try to send the report to a printer, you can run it to a file (ASCII, PDF, etc).
The batch server can process these, but since you'll need to specify a place to save the file, watch out for the following:
Be sure to use a UNC file path the path you wish to save to, otherwise you may get the following error: "Target file must be in UNC format."
Also be sure the necessary permissions have been applied to allow writing to that location, otherwise you'd get an error such as: "Unable to open file "
I believe the issue is that the batches are trying to process server code, and the reports are meant to run client side. Try the work around at this URL:
http://blogs.msdn.com/b/emeadaxsupport/archive/2009/06/16/how-to-run-client-batches-on-ax-2009.aspx
The gist is this, you create a batch group called "Client" or whatever, assign it to a batch server, then you run the legacy batch processor on the group. This might work for you.
Another option is to change the report to run on the server.
You'll need to check the menu item and make sure it's set to run on server.
It's a property on the menu item.
When you add a report to the batch, take a look at the batch inquiry screen.
Select the batch job - then click 'tasks'. If the task shows 'Run Location' = client, it won't run in the server-based batch framework.
Rob.
I was getting similar error. I restarted AOS and SQL reporting service and it worked all fine. Hope this helps.
I have a line of code that I can run locally as part of a service that works perfectly fine.
sReportPath = objCrystalUtils.ExportReportToPDF("Report Name", iReportInfoID)
This code is run as a part of a service, and when I unit test it by feeding it data, it ultimately builds the report and prints it.
When I run the exact same piece of code inside an .ashx from an ajax call. The reports are generated (I can see the pdf files being created on disk) but the printing is not happening.
oRpt.PrintToPrinter(objReport.DefaultAutoPrint, True, 0, 0)
In both scenarios the same code is used to print the report. (objReport.DefaultAutoPrint = 0 in both cases)
My only thought is that the location of the code that is calling this method is in a different spot relative to the location of the bills themselves.
The printer that I'm trying to print to is a network printer intalled on my machine, and I'm running Windows 7 IIS 6.1
Any thoughts?
Edit:
Here is a thought... if I'm running one as a unit test locally and im running the other through a web app that is running via IIS, is there a difference in user id and user access to the default printer?
Edit:
So I added my local ASP, IUSR and SYSTEM users to the printer security and allowed them to print... no dice. So I checked the EVERYONE user and it is set to access and NO users are denied... so I think that kinda kills that line of reasoning.
Edit:
I changed the name of this post since I no longer think that the issue is ajax related since If I try to do the same process in code bebehind from a post back instead of running it from an ajax call i still get the same problem.
Patrick, for me it is a known issue of crystal reports, printing a certain report from a running application via IIS.
I got the same issue before, and upon our search for that issue, we got the following;
Report to be generated, exported, and then to be downloaded to client machine,
so user can print it locally (say, report will be exported as PDf file,
user can use print option of PDF reader).
It's not Crystal Reports or other third party app's problem. It's usually the IIS_IUSER's permission problem because it has no access to any network printers. A possible solution is in Process.Start doesn't work in IIS