Page 1 of 1
The thread attempted to read from or write to a virtual address for which it does not have access.
Posted: Tue Nov 12, 2019 11:14 pm
by wayne w
Exception raised:
[pxclib40].PXC_Choice_AddItem
[pxclib40].DS_PXCLib::UrlVector::~UrlVector
[gdi32full].EnumEnhMetaFile
[GDI32].EnumEnhMetaFile
[pxclib40].DS_PXCLib::UrlVector::~UrlVector
[pxclib40].DVector<DS_PXCLib::tagUrlVariant *,-2>::pop_back
[GDI32].EnumFontFamiliesExA
[ucrtbase].chmod
[GDI32].gW32PID
This happens on some of the machines. Normally a reboot of Windows will fix the problem for a little while, but it will happen again. In some cases, a reboot will only stop the exception for 49 minutes.
Re: The thread attempted to read from or write to a virtual address for which it does not have access.
Posted: Fri Nov 15, 2019 3:02 pm
by Stefan - PDF-XChange
Hello Wayne,
Can you please check and let us know which build of the dlls is currently used?
Have you tried with the latest available?
Also - is this happening on a machine where e.g. you are trying to process multiple files at a time (could you be reaching some memory limits)?
Regards,
Stefan
Re: The thread attempted to read from or write to a virtual address for which it does not have access.
Posted: Mon Nov 18, 2019 12:10 am
by wayne w
Thanks Stefan for the reply. The version we are using is 4.0.211.0. The library is used to convert HMETAFILE to PDF. There could be multiple pages in the WMF meta file, but it's only a single task at a time and the files are small in size ( a few Mega Bytes).
Are there any known issues around the memory leak fixes in this area in a later release? This happens a lot in the production environment. We haven't been able to reproduce in development and haven't tried with the later release builds.
Re: The thread attempted to read from or write to a virtual address for which it does not have access.
Posted: Mon Nov 18, 2019 9:28 am
by Stefan - PDF-XChange
Hello Wayne,
Build 211 is quite old - some 6 years now.
Are you just starting working with the SDK, or have you been using it for years and only recently it started causing those issues?
The last V4 build of the Tools SDK is 4.0.315:
https://www.pdf-xchange.com/downloads/PDFT4SDK.zip
So please try using these DLLs and see if that helps!
Regards,
Stefan
Re: The thread attempted to read from or write to a virtual address for which it does not have access.
Posted: Tue Nov 19, 2019 2:49 am
by wayne w
Thanks Stefan, we'll update to the later build. It will take some time to find out if it will make a difference, will update once we have the feedback.
Re: The thread attempted to read from or write to a virtual address for which it does not have access.
Posted: Tue Nov 19, 2019 6:44 am
by John - Tracker Supp
(y) Thanks Wayne.
Re: The thread attempted to read from or write to a virtual address for which it does not have access.
Posted: Tue Nov 26, 2019 11:56 pm
by wayne w
Unfortunately the later build on 4.0.315 still has the issue. Now I've figured out it's because of leaks of GDI resources. We use the PDF-Tools to convert from meta data WMF to a PDF file. The code looks pretty much like this:
_PXCDocument* pdf = NULL;
HRESULT hr = PXC_NewDocument(&pdf, TRACKER_SERIAL_NUMBER, TRACKER_DEVELOPMENT_CODE);
if(IS_DS_SUCCESSFUL(hr))
{
_PXCImage *image = NULL;
hr = PXC_AddStdMetafile(pdf, hmf, &image);
if(IS_DS_SUCCESSFUL(hr))
{
_PXCPage* page;
hr = PXC_AddPage(pdf, TENTH_MILLIMETER_TO_POINT(m_PageWidth), TENTH_MILLIMETER_TO_POINT(m_PageHeight), &page);
if(IS_DS_SUCCESSFUL(hr))
{
hr = PXC_GetImageDimension(pdf, image, &imageWidth, &imageHeight);
if(IS_DS_SUCCESSFUL(hr))
{
hr = PXC_PlaceImage(page, image, x, y, imageWidth, imageHeight);
}
PXC_EndPage(page);
}
PXC_CloseImage(pdf, image);
}
}
PXC_ReleaseDocument(pdf);
Depending on the contents in the meta file, each run will leak 200-300 GDI objects. By time it will reach the default limit of 10,000 in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\GDIProcessHandleQuota. From there we get the problems.
Re: The thread attempted to read from or write to a virtual address for which it does not have access.
Posted: Thu Nov 28, 2019 5:24 pm
by Stefan - PDF-XChange
Hello Wayne,
A colleague in the dev team asked if you could provide us with sample EMFs which cause the issue?
We won't be able to fix the issue in build 315.
The current PDF Tools build is 4.0.0321.0 so we can make a new 4.0.0321.1 with the fix included.
Regards,
Stefan
Re: The thread attempted to read from or write to a virtual address for which it does not have access.
Posted: Fri Nov 29, 2019 2:02 am
by wayne w
Thanks Stefan, it's false alarm. We have now identified the cause of the leak. It was actually from when the meta file was generated, and the PDF converter just doubled on the leaked handles. Once the leak is stopped at the time of creating the meta file, the converter works perfect.
Thanks a lot for the help. Tracker tools is really great product.
Re: The thread attempted to read from or write to a virtual address for which it does not have access.
Posted: Fri Nov 29, 2019 10:37 am
by Stefan - PDF-XChange
Hello wayne w,
Glad to hear you've figured it out and many thanks for the kind words!
Cheers,
Stefan