bug in Harbour Error description: (DOS Error 32) DBFCDX/1006 Create error: C:\harbour\TEST\DATA\CUSTOMER.cdx

1,224 views
Skip to first unread message

John Salazar

unread,
Feb 12, 2012, 7:36:51 AM2/12/12
to Harbour Developers
Hello,

I use Harbour 3.1.0dev (Rev. 17114), BCC 5.82 and Windows 7 64 bits.

I very often get reports from my customer about such error in local
enviroment since I upgraded Harbour 3.1.

As my app has many dbfs and indexes, I wrote a sample code to
reproduce the error.

It may be downloaded at:
http://oron.com/8otfjgsek4zq

Note that I open dbf in exlusive mode with no index.

Sometimes I get the error, NOT always.

Please download and unzip to desktop. Thanks so much.



I have this code:
#define CRLF Chr(13)+Chr(10)

STATIC pPath

//--------------------------------------------------------------
FUNCTION MAIN()
//--------------------------------------------------------------


LOCAL i := 0

pPath := hb_dirbase()+"DATA"




REQUEST DBFCDX, DBFFPT
RDDSETDEFAULT( "DBFCDX")


SET EPOCH TO 1990
SET CENTURY ON
SET DATE ITALIAN
SET DELETED ON
SetCancel( .F. )
SetHandleCount( 150 )

SET EXCLUSIVE ON




SELECT 1
USE (pPath+"\CUST") EXCLUSIVE NEW ALIAS "CUSTOMER"



for i:= 1 to 100
reindex()
next

alert(str(i)+CRLF+CRLF+PPATH)
dbcloseall()
quit

RETURN NIL
//--------------------------------------------------------------



//--------------------------------------------------------------
FUNCTION REINDEX()
//--------------------------------------------------------------


SELECT ("CUSTOMER")
FERASE (pPath+"\CUSTOMER.CDX") // It´s not opened and it has
a different name than dbf
PACK

INDEX ON FIELD->LAST TO (pPath+"\CUSTOMER")
dbCommit()


return nil
//--------------------------------------------------------------


Klas Engwall

unread,
Feb 12, 2012, 9:17:52 AM2/12/12
to harbou...@googlegroups.com
Hi John

When you reported this error in the harbour-users group you mentioned a
sharing violation error (DOS Error 32), which is an error on the OS
level meaning that the file is already open. Is it still 32? Have you
investigated why the file might be open? Could it, for example, be a
problem with the CachedOpenLimit registry setting keeping the file open
from a previous use? I could not download your 801 KB zip file for some
reason (no reaction at all except a new page that suggested that I
should open an account), but what is the difference between the download
and the example below? Does the sample included here exhibit the DOS
error 32 problem in your environment?

Regards,
Klas

John Salazar

unread,
Feb 12, 2012, 9:38:11 AM2/12/12
to Harbour Developers
Hi Klas,

Thanks for helping me.

Yes, I am also getting the same error.

The file is not open and the folder is not shared.

Just download the .zip and unzip in the desktop.

I provide a new download url:
http://demo.ovh.com/es/5a0f7902749392cdc7d498d584111b9f/

The sample shows the problem.

Please, indicate if the link does not work.

Thanks again.

Regards,

John
> > //--------------------------------------------------------------- Ocultar texto de la cita -
>
> - Mostrar texto de la cita -

vszakats

unread,
Feb 12, 2012, 10:40:39 AM2/12/12
to harbou...@googlegroups.com
Please supply self-contained source code.

With your posted sample source, I got this:
---
Error BASE/6101  Unknown or unregistered symbol: SETHANDLECOUNT
Called from HB_HRBRUN(0)
Called from _APPMAIN(0)
---

After fixing it, I got this:
---
Error DBFCDX/1001  Open error: DATA\CUSTOMER.dbf (DOS Error 3)
Called from DBUSEAREA(0)
Called from MAIN(31)
Called from HB_HRBRUN(0)
Called from _APPMAIN(0)
---

Viktor

Klas Engwall

unread,
Feb 12, 2012, 11:28:11 AM2/12/12
to harbou...@googlegroups.com
Hi John,

> Thanks for helping me.
> Yes, I am also getting the same error.
> The file is not open and the folder is not shared.
> Just download the .zip and unzip in the desktop.
> I provide a new download url:
> http://demo.ovh.com/es/5a0f7902749392cdc7d498d584111b9f/
> The sample shows the problem.
> Please, indicate if the link does not work.

I cannot test under Win7, but I ran about 100 iterations under XP
without problems. BTW, if you report what you suspect is a Harbour bug,
do not include any FiveWin or other 3rd party stuff, just plain Harbour.

I still suspect the CachedOpenLimit setting in your registry. The NT
family of operating systems is designed to not close files that the
application closes until after a while. And as long as the file is open
it cannot be erased or replaced. Below is what Microsoft says about it
in an old KB article (http://support.microsoft.com/kb/124916) that
refers to the original NT version, but the optimization is still there
in newer Windows versions. It can be optimized for file sharing database
systems (like Clipper and Harbour) by setting it to zero. That is what I
always do on systems where my applications run - including my own,
which probably explains my results.

"There is an optimization in Windows NT version 3.5 which controls
whether or not a file is actually closed on the server when requested to
do so by the client. This optimization is controlled by the Registry
parameter, CachedOpenLimit. If the server owns an oplock on a file when
the client closes it, although the server will return the Close Server
Message Block (SMB) response indicating that the file has been closed,
it will keep the file open locally (that is, it removes the RFCB, but
maintains the LFCB and does not issue the local NtClose() request), on
the assumption that the client may soon reopen the file. If the client
does reopen the file, this greatly reduces the time required to respond
to the request."

Also see the link I provided in the other thread for further info.

Regards,
Klas

Mindaugas Kavaliauskas

unread,
Feb 12, 2012, 12:58:23 PM2/12/12
to harbou...@googlegroups.com
Hi,


On 2012.02.12 14:36, John Salazar wrote:
> It may be downloaded at:
> http://oron.com/8otfjgsek4zq

Sorry, it offered to download a large .zip, so, I skipped this.


> FERASE (pPath+"\CUSTOMER.CDX") // It�s not opened and it has
> a different name than dbf

It is not opened on the first call to reindex() only, later you create
index and leave it open. So, I would expect FERASE() to fail on some OS
and on next call to get access/sharing violation error on:

> INDEX ON FIELD->LAST TO (pPath+"\CUSTOMER")


What is your problem, that you get an error, or that you do not get (not
always get) an error?


Regards,
Mindaugas

John Salazar

unread,
Feb 13, 2012, 10:14:23 AM2/13/12
to Harbour Developers
Hi Mindaugas,

I get the error sometimes.

I modified the sample as follows:
http://demo.ovh.com/en/5f778b0a078d64d9431f5b7153f675ff/

And now I get sometimes:
Error description: (DOS Error 5) DBFCDX/1006 Create error: C:\Users
\John\Desktop\harbour\DATA\CUSTOMER.cdx

This is the code. I also compiled in pure DOS withour Fivewin and the
error also arrises:

#define CRLF Chr(13)+Chr(10)

STATIC pPath

//--------------------------------------------------------------
FUNCTION MAIN()
//--------------------------------------------------------------


LOCAL i := 0

pPath := hb_dirbase()+"DATA"




REQUEST DBFCDX, DBFFPT
RDDSETDEFAULT( "DBFCDX")


SET EPOCH TO 1990
SET CENTURY ON
SET DATE ITALIAN
SET DELETED ON


SET EXCLUSIVE ON
SET AUTOPEN OFF




for i:= 1 to 1000
reindex()
next

alert(str(i)+CRLF+CRLF+"Path: "+PPATH+CRLF+CRLF+"Alias in use:
"+Alias())
dbcloseall()
quit

RETURN NIL
//--------------------------------------------------------------



//--------------------------------------------------------------
FUNCTION REINDEX()
//--------------------------------------------------------------


FERASE (pPath+"\CUSTOMER.CDX") // It´s not opened and it has
a different name than dbf

SELECT 1
USE (pPath+"\CUST") EXCLUSIVE NEW ALIAS "CUSTOMER"

PACK

INDEX ON FIELD->LAST TO (pPath+"\CUSTOMER") // This line
causes error
dbcloseall()


return nil
//--------------------------------------------------------------


It´s quite strange.

Thank you very much for all help and support.

Massimo Belgrano

unread,
Feb 13, 2012, 10:29:52 AM2/13/12
to harbou...@googlegroups.com

 set PATH TO pPath  
 SET DEFA TO pPath  // specifies the default drive and directory for an Harbour application
 USE CUST  EXCLUSIVE NEW  ALIAS "CUSTOMER" 
  SET PATH TO 
  SET DEFA TO 
--
Massimo Belgrano


John Salazar

unread,
Feb 13, 2012, 11:19:57 AM2/13/12
to Harbour Developers
Hello Massimo,

set PATH TO pPath and SET DEFA TO pPath are mandatory?.

In Clipper were not.

My code works fine many times but sometimes shows that error.

In fact, with my last modifications, the (DOS Error 5) DBFCDX/1006)
happens less times than previous DOS Error 32.

I don´t understand this behaviour.

Thanks very much for helping me.

On 13 feb, 16:29, Massimo Belgrano <mbelgr...@deltain.it> wrote:
>  set PATH TO pPath
>  SET DEFA TO pPath  // specifies the default drive and directory for an
> Harbour application
>  USE CUST  EXCLUSIVE NEW  ALIAS "CUSTOMER"
>   SET PATH TO
>   SET DEFA TO
>
> Il giorno 13 febbraio 2012 16:14, John Salazar <ukservice.softw...@gmail.com
> Massimo Belgrano- Ocultar texto de la cita -

Mindaugas Kavaliauskas

unread,
Feb 13, 2012, 11:44:19 AM2/13/12
to harbou...@googlegroups.com
Hi,


On 2012.02.13 17:14, John Salazar wrote:
> I get the error sometimes.
>
> I modified the sample as follows:
> http://demo.ovh.com/en/5f778b0a078d64d9431f5b7153f675ff/

It looks like you ignore messages (and possible help) from other user. I
think most people do not care about the links. You also ignored Viktor's
message about bugs in your sample and your sample is not self contained.


> And now I get sometimes:
> Error description: (DOS Error 5) DBFCDX/1006 Create error: C:\Users
> \John\Desktop\harbour\DATA\CUSTOMER.cdx
>
> This is the code. I also compiled in pure DOS withour Fivewin and the
> error also arrises:

It's good you've compiled code without FW, but I do not get error (DOS
error 5) on my Win7 box (after I modified your sample to avoid Invalid
path error). It just prints: 1001.


Regards,
Mindaugas

John Salazar

unread,
Feb 13, 2012, 4:06:45 PM2/13/12
to Harbour Developers
Hi,

I though providing a link was the easy way to test. Also, it provides
exactly the same exe I use.

I did not ignore Viktor's message. In fact, I correct and I followed
his advice in latest prg.

My sample works fine most of the time. I usually get the alert box.
Also, the error happens more often in a folder created at Desktop.

Finally, I was asking about what´s wrong about the path. I repeat, the
sample works fine most of times. I think it´s quite strange.

I am afraid not all Harbour programmers are genious or gurus. In fact,
a wise man provides light into darkness, not just says try to find a
light yourself.

Thanks again for help and support and making a great tool.

vszakats

unread,
Feb 13, 2012, 4:28:54 PM2/13/12
to harbou...@googlegroups.com
Hi,

> I though providing a link was the easy way to test. Also, it provides
> exactly the same exe I use. 

It's not proof of anything, until the problem is reproducible 
by pure source code. See TROUBLESHOOTING section 
in INSTALL.

The other problem with binaries is that they require certain 
operating system to run them, plus I'm sure not everyone is 
comfortable with running .exes downloaded from the internet.
I'd never run such .exe on my Win7 VM.

> I did not ignore Viktor's message. In fact, I correct and I followed
> his advice in latest prg. 

The program still doesn't run by itself. The .dbf is missing and 
is referenced in a directory that doesn't exist. Self-contained 
example means that the example can be run on any system 
by compiling the source and running it, or running the source 
by: 'hbrun <source.prg>' command


> My sample works fine most of the time. I usually get the alert box.
> Also, the error happens more often in a folder created at Desktop.

I think this thread has not much to do with Harbour development 
list, it's operating system level problem, what is clearly signaled 
by OS error level shown by Harbour, and it might be caused either 
by the OS, it's settings or some 3rd party software (f.e. antivirus)
running on it.

> I am afraid not all Harbour programmers are genious or gurus. In fact,
> a wise man provides light into darkness, not just says try to find a
> light yourself. 

Which is okay, but this list it not to discuss such Harbour usage 
related problem. For this, we created the Harbour user's list.

Viktor

Massimo Belgrano

unread,
Feb 13, 2012, 5:27:53 PM2/13/12
to harbou...@googlegroups.com
Hi John Salazar
i have created in your prg a new cust.dbf  using dbcreate 
need add hbct  because not rember harbour way of create a directory
but All seem running fine so problem will be in your dbf


hbmk2 bug3 -lhbct

   REQUEST DBFCDX, DBFFPT
   RDDSETDEFAULT( "DBFCDX")

FUNCTION MAIN()
   LOCAL i := 0
   LOCAL pPath := hb_dirbase()+"DATA"
   SET EXCLUSIVE ON
   SET AUTOPEN OFF
   DBCREATE(pPath+"\CUST", {{"FIRST", "C", 20, 0}, {"LAST", "C", 20, 0}},, .T.)
   DBAPPEND();  FIRST := "A" ;LAST="Aa"
   DBAPPEND();  FISRT := "B";LAST="Aa"
   DBCLOSEALL()
   for i:= 1 to 1000
        FERASE  (pPath+"\CUSTOMER.CDX")  // It´s not opened and it has a different name than dbf
        SELECT 1
        USE (pPath+"\CUST") EXCLUSIVE NEW  ALIAS "CUSTOMER"
        PACK
        INDEX ON FIELD->LAST TO (pPath+"\CUSTOMER")    // This line causes error
        dbcloseall()
   next
   dbcloseall()
   quit
--
Massimo Belgrano

Mindaugas Kavaliauskas

unread,
Feb 13, 2012, 5:36:32 PM2/13/12
to harbou...@googlegroups.com
Hi,


On 2012.02.13 23:06, John Salazar wrote:
> I did not ignore Viktor's message. In fact, I correct and I followed
> his advice in latest prg.

Your code still generates error indicated by Viktor:

> After fixing it, I got this:
> ---
> Error DBFCDX/1001 Open error: DATA\CUSTOMER.dbf (DOS Error 3)
> Called from DBUSEAREA(0)
> Called from MAIN(31)
> Called from HB_HRBRUN(0)
> Called from _APPMAIN(0)
> ---

> Finally, I was asking about what�s wrong about the path. I repeat, the
> sample works fine most of times. I think it�s quite strange.

pPath is unnecessary. You can work in current path. DATA\ subpath is not
created by app. Justy like .dbf itself. I understand, that sometimes you
need to upload .dbf file to show some corrupted .dbf files, you can not
reproduce by short sample, but in current situation, just include .dbf
creation code and do not hardcode any paths.

Regards,
Mindaugas

Massimo Belgrano

unread,
Feb 13, 2012, 5:42:29 PM2/13/12
to harbou...@googlegroups.com
After running
 Directory di c:\hb31\bin\data

13/02/2012  23:21    <DIR>          .
13/02/2012  23:21    <DIR>          ..
13/02/2012  23:21               181 CUST.dbf
13/02/2012  23:22             2.048 CUSTOMER.ntx
--
Massimo Belgrano

Delta Informatica S.r.l. (http://www.deltain.it/) (+39 0321 455962)
Analisi e sviluppo software per Lan e Web -  Consulenza informatica - Formazione

Gmail

unread,
Feb 13, 2012, 6:54:41 PM2/13/12
to harbou...@googlegroups.com
Hello,

Just in case it helps you to figure out what is wrong... I had very
little experience with Win7 but what I experienced is that you can not put
your program anywhere because it may not work as expected. I do not know yet
why but it seems that it has something to do with UAC or other type of OS
requirement / registry fix / oplocks issue / SMB2 data corruption / etc...
I do not belive it is Harbour's bug.
Sorry for not helping more. I just saw the topic and had some vague
ideas of what it could be but I would search the OS requirements first.
Regards,

Qatan

Reply all
Reply to author
Forward
0 new messages