Why am I getting intermittent DELETE PENDING errors in Dyalog APL? - winapi

I'm getting DELETE PENDING errors intermittently when my program deletes a file and then quickly thereafter creates a new file with the same path as the deleted file. In the Dyalog APL session window, it's reported as FILE ACCESS ERROR. I can re-create the error with Dyalog APL 16.0.35389.0 32 Classic on Windows Server 2012 R2 running on VMWare, but not on a bare-metal Windows 10 install. Here's a minimal code example that triggers the error:
:Namespace DeletePending
∇ main nTimes;filename;i
:For i :In ⍳nTimes
filename←'c:\tmp\delete_pending_dummy.txt'
(⊂'one' 'two')⎕NPUT filename 1
filename ⎕NERASE filename ⎕NTIE 0
:EndFor
∇
:EndNamespace
Attached is a screenshot showing the DELETE PENDING error in procmon (Sysinterals).
On my VMWare Windows install, I need to run at least 100 iterations of the loop in the main function (see the DeletePending namespace script above) to trigger the error. As far as I can tell, I'm using ⎕NPUT and ⎕NERASE correctly -- can someone tell me what's wrong?
What I've tried already (summary): creating and erasing a file in a loop, single thread; did not expect intermittent FILE ACCESS ERROR.

This seems to be a known issue C++/Win32: How to wait for a pending delete to complete. I am not sure there is much we (Dyalog) can do about it.

Related

Git error: unable to create temprary file & error building trees with no further info?

I'm trying to commit new changes to my repo, but it fails with the following errors:
error: unable to create temporary file: Invalid argument
error: unable to create temporary file: Invalid argument
error: Error building trees
When others faced similar issues, the error would point to a specific file/object which was causing the issue, however here there is no additional info to go on.
(Windows 10, tried through Terminal and cmd)
I found the issue - the project folder was being synced with OneDrive, which corrupted (The tag present in the reparse point buffer is invalid) one of the files in the objects folder inside .git. Figuring out where the issue lies could be done either visually (for me it was the only folder with blue OneDrive sync arrows instead of the green tick and the folder couldn't be opened). Another way is to clone the problematic branch into a new folder, make a small change (I created a test.txt with "test" written inside), push it to git, then go back to the problematic project folder and try to pull new changes from git. This operation failed and pointed to the corrupted object.
To solve this I looked into how to deal with files which OneDrive corrupted, and the most common suggestion was to run chkdsk c: /r /f in Command Prompt (as admin), which starts when the computer is rebooted. Beware it can take several hours to complete.
General Windows Solution (tested on Windows 10 and 11):
I'm getting the error because it appears that windows put the folder in read only mode
Deselect read only, then click apply and ok
Git really ought to print the path here, yes. The error seems to come from object-file.c:write_loose_object(), which is going to be creating a temporary file within .git/objects in the normal case.
The EINVAL error case should never occur, as the object path itself is necessarily valid (otherwise how did it come into existence?) and the generated temporary file name uses entirely "safe" characters. So the missing filename.buf in the error message should never comes out in the first place. In your case, the error does come out, and the missing %s for filename.buf means we can't see what path it is that your OS is objecting to.
You could build a debug or private version of Git (that adds the missing path) to find out, or use whatever system-call tracing facilities you have to observe the failing system call some other way. Find out why the OS is rejecting the attempt to create the loose object temporary file, and correct whatever the underlying problem may be. Meanwhile you might want to report this to the Git mailing list.

ld.exe cannot open output file

i've used CodeBlocks for 8 months and now begins give me problems.
When I compile a file I happen to receive an error that is not given by the compilation itself, but from codeblock.
The error is:ld.exe cannot open output file Permission Denied.
Then I changed the folder thinking it was a problem with the fact that I do not have administrator access so I could not save in certain parts
Then I tried to rebuild and for a while it worked, and the error would not show up,
now she has returned as before because it keeps giving me the same error.Someone has already received this errorand he resolved?
Thanks :)
Your program is probably still running in background, or another process is using that file like anti-virus.
Check in task manager, if the program process is still running you get this message.

DB2 SQLSTATE = 57014 error

I am using Microsoft Visual Studio 2010. I am running code that includes several large queries accessing large amounts of data. On Friday when I debugged my code it was working properly with no errors. Upon returning today when I run the code 9 out of 10 times I get this error:
[DB2/NT64] SQL0952N Processing was cancelled due to an interrupt. SQLSTATE=57014
After doing some research into I have seen that QUERYTIMEOUTINTERVAL=0 can be added to the [Common] section in the db2cli.ini file. This will cause the CLI driver to wait for the execution of the query without timing out before returning to the application. This should resolve the problem I believe. Only problem is I cannot locate the db2cli.ini file. I am using a windows 7 operating system so I believe the file should be along this path:
C:\Program Files\IBM\SQLLIB\cfg
Only problem is when I enter the cfg file I do not see the db2cli.ini file. Any help would be greatly appreciated. Either on how to find this file and insert the querytimeoutinterval code or another way to resolve my issue. Thanks.
db2cli.ini may not exist unless you have created it previously. There is a sample file to get you started, which should be in C:\ProgramData\IBM\DB2\driver_copy_name\cfg, as indicated in the manual.
You can also avoid editing the file manually -- open the DB2 command line and issue db2 update cli cfg for section common using QueryTimeoutInterval 0 (note that the keyword QueryTimeoutInterval is case-sensitive).

Other causes for VB6 trappable error Path/File access error (Error 75)?

Apart from those listed by microsoft here.
10 DBEngine.CompactDatabase Dbpath, DbTempPath, "", dbEncrypt
20 Kill Dbpath
30 Name DbTempPath As DbPath
The above code operates day in day out in a lot of installations but then extremely rarely line 30 fails and I get a call that the database is missing.
Today for the first time I saw it happen myself and the error that was thrown:
Path/File access error (Error 75)
However I don't think that any of the listed causes apply in this situation.
When this happened at an installation today and I renamed the temp file and ran the code again and the error occurred again.
(I think it just might have something to do with a hardware issue as making a copy of the file took a very long time.)
There's not really enough information here to say, but my guess would be that the problem is with your KILL statement not finishing before the NAME statement runs. Its never been clear to me, but it seems that the Windows NT File System has the option of implementing some file operations (especially for large files) asynchronously, so that the KILL may not be completed by NTFS, even though VB6 thinks that it is and has moved on to the NAME statement.
Probably the best thing would be to put some check after the KILL to make sure that the file is actually gone, before starting the rename with NAME.
I'm not sure why the problem occurs but you could add a workaround using a DoEvents call or writing a small procedure to wait for a second or three (or longer) to allow time for the disk to complete the deletion or Access to release the file.
A more advanced workaround would be to write a function to check if the file is available before calling the rename.

"cannot open file" compiletime error

Problem Description:
Occassionally when debugging, I get the following error. I'm using visual studio 2010:
1>------ Build started: Project: projectName, Configuration: Debug Win32 ------
1>LINK : fatal error LNK1104: cannot open file 'C:\Projects\projectName\Debug\projectName.exe'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Note that projectName is the name of my project. The error occurs when I debug, make changes, and debug again (after doing all of that, the above error shows up instead of running the program a second time).
Steps to replicate:
Create a new empty c++ project, and add a file called "main.cpp" to the sources folder
Copy the following code into main.cpp:
int main(){
return 0;
}
Click the green debug arrow button, and note the successful run of the program. Ensure it is closed and that the debugging session is over. Open the process explorer and ensure the exe for the project is no longer running (if it is, wait until it closes).
Erase the contents of main.cpp and replace it with this code (or any other code that will compile properly which is different than the code used above):
#include<iostream>
int main(){
std::cout<<"hello\n";
return 0;
}
Click the green debug arrow button. Instead of running the program, the IDE will show the fatal LNK1104 error. You've now replicated the problem.
Any ideas on how to fix this?
Additional Details:
If I try to change the permissions or delete projectName.exe after the error has occured, an error popup shows up which says:
You need permission to perform this action
You require permission from the computer's administrator to make changes to this file
I am using windows 7.
The account I'm using is an admin account, but this issue also occurs exactly the same when I use a non-admin account.
For 2-3 minutes after the error occurs, I cannot rebuild or debug the project, but after approximately that amount of time, I am able to start at the beginning of the repro steps again.
UPDATE: BOUNTY
Anyone who can offer a solution that fixes the problem gets 100 rep :)
I've tried stopping all services, processes and applications that could be interfering with VC++ accessing the file, and the issue is still occuring. Also, running vc++ as an admin does not help.
This is most likely a bugfeature of the Windows Explorer.
Make sure that the .exe file is NOT selected/focused in the Windows explorer. On Vista i often get LNK1104-errors, when the executable file is selected in the Windows Explorer during linking.
If that does not help, check that no other program has "selected" the file.
EDIT:
This program can show you which process has locked your file (the pages contains some links to other "unlock" tools aswell)
I had this problem with a new program I was writing that seemed to compile once but gave your error at the end of compilation and on subsequent builds. My Antiviral program, BitDefender, had locked the exe file. My exe was in the list of viruses found. I turned off Bitdefender for 5 minutes, recompiled and the program was not locked when Bitdefender restarted or thereafter.
You can use Process Explorer to see if any process has a handle open to that file, even if the executable itself isn't running. Go to Find -> Find Handle or DLL... and type in projectName.exe, and it will give you a list of all processes that have it open.
My guess would be that something has a lock on the file. For whatever reason, VS cannot open the file to write the output of compilation. As SnOrfus suggests, make sure some sort of profiling or testing tools aren't open. I would also try to wait a few seconds between finishing an execution of the program (debug or otherwise) before attempting to rebuild. It's possible that you're building so fast that the debugger still has a lock on the file when VS attempts to access it.
I've never seen that happen when there wasn't a lock on the file. Do you have any profiling or testing tools that might still be holding on to it?
note: I wasn't able to repro that.
edit> Have you tried opening process explorer while the program is running (as opposed to task manager)? It'll show you if your exe is running in any other processes.
Have you checked for malware? I recently had a case where some malware that would bootstrap every process that ran on a machine, and task manager wasn't very informative.

Resources