Solved

error 75 in vb6

Posted on 2011-03-09
15
933 Views
Last Modified: 2012-05-11
How do you handle an error 75 path file access error. The file is causing my application to hang when I try to kill the file from a shared nfs windows directory.

This is a messenger program that uses winsock control to forward messages to individual users. The system captures the users ip address and forwards the message based on the ip address. The program that handles the movement of the message is a windows based program. The program that verifies that a user is available is a sun based program using the universe programming language. Once it finds the correct user it rights a file to a windows share that the windows program picks up and sends to the user. Once the message is sent then the program deletes the record from the file and listens for the next record and repeats the process.

On occassion I get an error 75 and it will not let me kill it through the normal process in the program. I have to shutdown the nfs shared server to get rid of the file. This has become a major head ache and any help will be greatly appreciated. I cna provide source code if need be of the windows portion but not from the Sun system.
0
Comment
Question by:samiam41
  • 6
  • 3
  • 2
  • +2
15 Comments
 
LVL 28

Expert Comment

by:Bill Bach
ID: 35095093
Sounds like the file is being held open by a process.  Can you access the file system data to find out who has the file open?  It's unclear from your post if this file is stored on a Windows OS, on a Sun box, or some other external storage.  However, I suspect that when you get the Status 75, you can either loop back and retry later (allowing the other process time to close the file).  If that doesn't work, then you'll need to find out which process has the file open and why.
0
 
LVL 14

Expert Comment

by:VBClassicGuy
ID: 35095554
Expanding upon BillBach's suggestion, here is a routine that will try to kill the file within two seconds. You can adjust the timeout to suit your needs. Just call the function and feed it the file name. A return value of zero indicates success, a value of one means it timed out.

Public Function KillFile(fn As String) As Integer
   Dim dt As Date, stat as Integer
   
   dt = Now + (2000 / 86400000)   'add 2000ms (2 sec.) to "now"
   
   On Local Error Resume Next
   
   Do
      If dt > Now Then
         Kill fn
      Else
         stat = 1
         Exit Do
      End If
   Loop
   
   KillFile = stat

End Function
0
 
LVL 10

Expert Comment

by:cool12399
ID: 35095667
A couple things:

a) Include an 'on error resume next', so you program doesn't crash. I.e.,

on error resume next
kill 'item'
on error goto 0

b) If it 'doesn't' kill it right away (because another process is using it, etc) -- you could dump/'save' files that don't get killed to say a log file, and then do a separate program that say runs every day to 'cleanup' files.

ie..,

on error goto errhandler
kill 'item'
exit sub

errhandler:
  'save the file here, since it didn't get killed
  open "c:\filelog.txt" for append as #1
   print #1, filename
  close #1

etc.
0
 
LVL 14

Expert Comment

by:VBClassicGuy
ID: 35095990
The "On Error Resume Next" is already in my posted code. The "On Error Goto 0" is implied and will be executed when the end of the function is reached.

As for the log, good idea, but I would implement it by placing this code between the end of the loop and the "KillFile = stat" statement:

If stat Then
   Dim h As Integer
   h = FreeFile
   Open "C:\filelog.txt" For Append As #h
   Print #h, Format(Now, "mm-dd-yyyy hh:mm:ss") & " " & fn
   Close #h
End If
0
 
LVL 5

Expert Comment

by:BrianVSoft
ID: 35107288
I have found that several types of file manipulation can hang the process if there is any problem with "connection".. I always try a benign action on the "resource" before I try to Kill or Overwrite a remote file.
Eg. Perform a Dir( on a known file on the "resource"
Eg.
 xName = ""
 On Error Resume Next ' otherwise the next line will error if there is a connection problem.
 xName = Dir(SomeKnownFile)..... ' This line will 'hang' for a while if there is a connection problem.
 If  xName = "" Then ' MsgBox -> "Server Not Found bla bla : Exit sub
Else.. Ok to Kill the file..
0
 
LVL 9

Author Comment

by:samiam41
ID: 35155730
Sorry experts but neither solution helps with this problem. The file that I am trying to delete does not have a security or summary tab in its property settings. It is as if there is no owner of the file. When I try to delete manually I get Cannot delete "filename": Access is denied  Make sure the disk is not full or write-protected and that the file is not currently in use.

As far as I can tell there is nothing else using this file and the disk is not full nor write protected.

The mesage is getting sent to the user but when I go to delete it is when the problem occurs. This is not happening on every record and there does not appear to be any visible pattern. Some of the messages go through and then I get this bad file that prevents other messages from going through. Even with the resume next I still have the same problem.
0
 
LVL 5

Expert Comment

by:BrianVSoft
ID: 35155894
Maybe try different logic and change the file type to a "Random Len" data file - Then you could you leave the file in place and just open and close it..
Eg. Open PathFileName For Random Shared As #X Len = 900 ' (900 = max message length)
Databases were originally built on Random files - they are very stable.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 28

Expert Comment

by:Bill Bach
ID: 35156030
Where is this file being stored?  On a Windows box?  On a Sun box?  Somewhere else?

I ask because there is a known issue with SMB2 (Used by Win2008/Win7, etc.) where this is a common problem -- files are not always closed when they should be, making a delay necessary.  Disabling SMB2 usually resolves it.

If your file is stored on a non-Windows system (bnut is not using SMB2), then perhaps the SMB implementation on that file system is not quite up to par.  Try moving the files to a different device to see if that helps.
0
 
LVL 9

Author Comment

by:samiam41
ID: 35344850
When the programmer gets back, I will ask him to work on this question.  Thanks.
0
 
LVL 9

Author Comment

by:samiam41
ID: 35434479
The file that I am sending from the Sun box to the windows nfs share starts out as IP ADDRESS.txt. When this particular file goes to the windows share the file name gets changed to DB0000001527AB

I can not find where this file name change is taking olace or why. The process running on the Sun server is a UniVerse process using Pick Basic programming language. Not sure if that should matter because it is doing exactly what it should that is send the file to the windows share. Something along the way is changing that file. It doesn't happen all the time and sometimes when it does happen the visual basic program that picks up the text file for m the windows share is able to delete it. I can type in any type of file name with any type of extension. If the vb program does not know where to send that file it simply deletes it from the windows share. On occassion the vb program can not delete the file and I can not manually delete the file the only thing to do is restart the server.

What could possible be creating a file with no ownership and I as administrator can't manually delete.
0
 
LVL 28

Expert Comment

by:Bill Bach
ID: 35434544
There could be control characters or some other garbage in the file name.  I would recommend watching the process with a network analyzer, and trapping the exchange when the error occurs.  Then, go back & see what happened when the file was created.
0
 
LVL 9

Author Comment

by:samiam41
ID: 35706831
I mentioned to the mods that the programmer may not be back for 2-3 weeks which means this question will be dormant until then.  I appreciate everyone's assistance with the question and would ask that you please stick with it as the programmer will return and be ready to pick up where this left off.  Thank you.
0
 
LVL 9

Accepted Solution

by:
samiam41 earned 0 total points
ID: 35749606
The problem Ifound was with the way I was opening and closing the socket and the address to the server. I changed the address from host name to ip address:port number and problem solved.
0
 
LVL 9

Author Closing Comment

by:samiam41
ID: 35775511
After further research I found that the way I was referrencing the server is what was causing my problem. after I changed the referrence then I was able to bypass the file all together.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now