xBase now unstable, slow, error Status_Lock_Not_Granted

User avatar
José
Posts: 19
Joined: Sat Dec 10, 2016 8:58 pm

xBase now unstable, slow, error Status_Lock_Not_Granted

Post by José »

(sorry for my English)

Good afternoon, First of all I would like to thank for all the help provided to the less expert members. By suggestion of Antonio Linares straight to explain my situation, clarifying that I have read Microsoft forums and others related to the subject.

I have a Software developed with FiveWin + xHarbour, which use a xBase Database. The software have been working fine for more than 20 years. Now with newer windows versions (7, 8 and 10) with a server with Debian 8 and later using SMB2 (because Win 10 no longer support SMB1) The software became more and more slow, and I receive errors of "status_lock_not_granted" from the Samba server what causes the system to crash. The only solution in this situation is to restart the Samba server, and sometimes this damage de indexes, so is pretty unstable.

By now it seems random. However, it looks like is related to high system load or reaching the maximum users working. Also monitoring the server the system Interrupt raise to 4 thousand by hours sometimes.

We have tried several solutions, making sure cables and switches are in optimal conditions, optimize the code to avoid block the same record twice, use commit more often and change this parameters to zero on the windows machines:

FileInfoCacheLifetime
FileNotFoundCacheLifetime
DirectoryCacheLifetime

and this on the server

Blocking Locks (NO)
Strict Bloking (NO)
OpLoc Nivel 2 (default, SI)

After a lot of testing, some with terrible results

We run out of options to make the xBase work as it should work

Is there any suggestion for me to try? If you have been through the same experience how do you resolved it maintaining the xBase (DBF/CDX)?

Thanks for your help.

José
Chile
José Concha Leiva - Chile
"Querer, saber y hacer, es poder"
HB 3.2 + FWH 20.07 + Borland C++ 7.0 + Pelles C 9.0 + MariaDB 10.3 > 32 bit
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xBase now unstable, slow, error Status_Lock_Not_Granted

Post by Rick Lipkin »

José

Windows 10 pro ( ver 1803 and 1809 ) does not install SMB 1.0 by default .. You can however turn SMB1.0 back on manually ..

Control Panel
Programs and Features
Turn Windows Features On or Off

Scroll down and check Smb 1.0 ... the machine will ask to reboot .. your file sharing should be back to normal.

Image

Rick Lipkin
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: xBase now unstable, slow, error Status_Lock_Not_Granted

Post by Otto »

Thank you Rick, very interesting.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
Diego Decandia
Posts: 39
Joined: Fri Aug 22, 2014 6:21 am

Re: xBase now unstable, slow, error Status_Lock_Not_Granted

Post by Diego Decandia »

José,

I think you're using a recent version of Fivewin.

I suggest you try with a previous version, (17.04 or earlier), to check whether the problem is in Fivewin.
MOISES
Posts: 824
Joined: Wed Aug 22, 2007 10:09 am

Re: xBase now unstable, slow, error Status_Lock_Not_Granted

Post by MOISES »

The problem happens since Windows 8 onwards.
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
User avatar
José
Posts: 19
Joined: Sat Dec 10, 2016 8:58 pm

Re: xBase now unstable, slow, error Status_Lock_Not_Granted

Post by José »

Rick, Diego y Moisés. Thanks for your answers!

I wonder if Windows in upcoming updates will erase the changes we made or delete support to SMB1 disconnecting the machines from the server.Any experience with windows updates or any suggestion?

Regards
José Concha Leiva - Chile
"Querer, saber y hacer, es poder"
HB 3.2 + FWH 20.07 + Borland C++ 7.0 + Pelles C 9.0 + MariaDB 10.3 > 32 bit
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Re: xBase now unstable, slow, error Status_Lock_Not_Granted

Post by vilian »

Have you already tried ADS(Advantage Database Server) ? Its also work with DBFCDX format and demands almost zero modification to use.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
MOISES
Posts: 824
Joined: Wed Aug 22, 2007 10:09 am

Re: xBase now unstable, slow, error Status_Lock_Not_Granted

Post by MOISES »

José,

If smb 1.0 does not work, either you install ADS server (ADS local driver does not solve the issue), or you use ADORDD, to use access files instead of .dbf but mantaning CLIPPER commands.

Hope it helps.
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: xBase now unstable, slow, error Status_Lock_Not_Granted

Post by Otto »

Hello,
I found following in my notes:
Notizen

Abfragen per Directory() sind wieder so schnell - auf alle Rechner im Netzwerk verteilen

HKLM\SYSTEM\CurrentControllSet\Services\LanmanWorkstation\Parameters
Neu hinzufügen als DWORD:
DirectoryCacheLifetime = 0
FileInfoCacheLifetime = 0
FileNotFoundCacheLifetime = 0

Zur Behebung des Problems ist ausreichend, wenn an den Arbeitsplatz-Rechnern die Caching-Einstellungen deaktiviert werden,
die in Zusammenhang mit neueren SMB Versionen eingeführt wurden.

SMB-Caching ausschalten

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanWorkstation\Parameters]
"FileInfoCacheLifetime"=dword:00000000
"FileNotFoundCacheLifetime"=dword:00000000
"DirectoryCacheLifetime"=dword:00000000

SMB-Caching einschalten

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters]
"FileInfoCacheLifetime"=dword:00000010
"FileNotFoundCacheLifetime"=dword:00000005
"DirectoryCacheLifetime"=dword:00000010
Die Code-Schnipsel als REG-Datei speichern und als Admin im Explorer anklicken zum Eintragen in der Registry.

-------

HKLM\SYSTEM\CurrentControllSet\Services\LanmanWorkstation\Parameters
Neu hinzufügen als DWORD:
DirectoryCacheLifetime = 0
FileInfoCacheLifetime = 0
FileNotFoundCacheLifetime = 0

Klappt sofort, auch ohne Reboot.
Best regards
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
MOISES
Posts: 824
Joined: Wed Aug 22, 2007 10:09 am

Re: xBase now unstable, slow, error Status_Lock_Not_Granted

Post by MOISES »

Otto,

I tested in the past such changes with no luck.
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
User avatar
José
Posts: 19
Joined: Sat Dec 10, 2016 8:58 pm

Re: xBase now unstable, slow, error Status_Lock_Not_Granted

Post by José »

Thanks Otto. We have done this. and we think it helps a little, but it does not solve the problem.

José, Chile
José Concha Leiva - Chile
"Querer, saber y hacer, es poder"
HB 3.2 + FWH 20.07 + Borland C++ 7.0 + Pelles C 9.0 + MariaDB 10.3 > 32 bit
User avatar
José
Posts: 19
Joined: Sat Dec 10, 2016 8:58 pm

Re: xBase now unstable, slow, error Status_Lock_Not_Granted

Post by José »

We have made the change to SMB1, and I believe speed has increased a little bit and the errors seem to be less. This is a conversation between a "frozen" machine (Windows machine where the software stays frozen for a couple of minutes and then return to normal) and the Linux server running Debian 9. One packet each.

Will there be something of interest? Or maybe is there something that can help the change to SMB1?

Query of Client

Frame 641510: 129 bytes on wire (1032 bits), 129 bytes captured (1032 bits)
Ethernet II, Src: AsustekC_8d:a2:7b (34:97:f6:8d:a2:7b), Dst: HewlettP_b1:c0:64 (9c:b6:54:b1:c0:64)
Internet Protocol Version 4, Src: <IP>, Dst: <IP>
Transmission Control Protocol, Src Port: 50004, Dst Port: 445, Seq: 14081476, Ack: 7322407, Len: 75
Source Port: 50004
Destination Port: 445
[Stream index: 0]
[TCP Segment Len: 75]
Sequence number: 14081476 (relative sequence number)
[Next sequence number: 14081551 (relative sequence number)]
Acknowledgment number: 7322407 (relative ack number)
0101 .... = Header Length: 20 bytes (5)
Flags: 0x018 (PSH, ACK)
000. .... .... = Reserved: Not set
...0 .... .... = Nonce: Not set
.... 0... .... = Congestion Window Reduced (CWR): Not set
.... .0.. .... = ECN-Echo: Not set
.... ..0. .... = Urgent: Not set
.... ...1 .... = Acknowledgment: Set
.... .... 1... = Push: Set
.... .... .0.. = Reset: Not set
.... .... ..0. = Syn: Not set
.... .... ...0 = Fin: Not set
[TCP Flags: ·······AP···]
Window size value: 27609
[Calculated window size: 27609]
[Window size scaling factor: -1 (unknown)]
Checksum: 0x28ea [unverified]
[Checksum Status: Unverified]
Urgent pointer: 0
[SEQ/ACK analysis]
[This is an ACK to the segment in frame: 641509]
[The RTT to ACK the segment was: 0.000155000 seconds]
[Bytes in flight: 75]
[Bytes sent since last PSH flag: 75]
[Timestamps]
[Time since first frame in this TCP stream: 38.717737000 seconds]
[Time since previous frame in this TCP stream: 0.000155000 seconds]
TCP payload (75 bytes)
NetBIOS Session Service
Message Type: Session message (0x00)
Length: 71
SMB (Server Message Block Protocol)
SMB Header
Server Component: SMB
[Response in: 641511]
SMB Command: Locking AndX (0x24)
NT Status: STATUS_SUCCESS (0x00000000)
Flags: 0x18, Canonicalized Pathnames, Case Sensitivity
0... .... = Request/Response: Message is a request to the server
.0.. .... = Notify: Notify client only on open
..0. .... = Oplocks: OpLock not requested/granted
...1 .... = Canonicalized Pathnames: Pathnames are canonicalized
.... 1... = Case Sensitivity: Path names are caseless
.... ..0. = Receive Buffer Posted: Receive buffer has not been posted
.... ...0 = Lock and Read: Lock&Read, Write&Unlock are not supported
Flags2: 0xc807, Unicode Strings, Error Code Type, Extended Security Negotiation, Security Signatures, Extended Attributes, Long Names Allowed
1... .... .... .... = Unicode Strings: Strings are Unicode
.1.. .... .... .... = Error Code Type: Error codes are NT error codes
..0. .... .... .... = Execute-only Reads: Don't permit reads if execute-only
...0 .... .... .... = Dfs: Don't resolve pathnames with Dfs
.... 1... .... .... = Extended Security Negotiation: Extended security negotiation is supported
.... .0.. .... .... = Reparse Path: The request does not use a @GMT reparse path
.... .... .0.. .... = Long Names Used: Path names in request are not long file names
.... .... ...0 .... = Security Signatures Required: Security signatures are not required
.... .... .... 0... = Compressed: Compression is not requested
.... .... .... .1.. = Security Signatures: Security signatures are supported
.... .... .... ..1. = Extended Attributes: Extended attributes are supported
.... .... .... ...1 = Long Names Allowed: Long file names are allowed in the response
Process ID High: 0
Signature: 0000000000000000
Reserved: 0000
Tree ID: 10348
Process ID: 65279
User ID: 59639
Multiplex ID: 43073
Locking AndX Request (0x24)
Word Count (WCT): 8
AndXCommand: No further commands (0xff)
Reserved: 00
AndXOffset: 57054
FID: 0x7405
Lock Type: 0x10, Large Files
...1 .... = Large Files: Large file locking format requested
.... 0... = Cancel: Don't cancel outstanding lock request
.... .0.. = Change: Don't change lock type
.... ..0. = Oplock Break: This is not an oplock break notification/response
.... ...0 = Shared: This is an exclusive lock
Oplock Level: Client is not holding oplock on this file (0)
Timeout: Wait indefinitely (-1)
Number of Unlocks: 0
Number of Locks: 1
Byte Count (BCC): 20
Locks
Lock
Process ID: 65279
Reserved: 0000
Offset: 2147483646
Length: 1


Server response

Transmission Control Protocol, Src Port: 445, Dst Port: 50004, Seq: 7322407, Ack: 14081551, Len: 39
Source Port: 445
Destination Port: 50004
[Stream index: 0]
[TCP Segment Len: 39]
Sequence number: 7322407 (relative sequence number)
[Next sequence number: 7322446 (relative sequence number)]
Acknowledgment number: 14081551 (relative ack number)
0101 .... = Header Length: 20 bytes (5)
Flags: 0x018 (PSH, ACK)
000. .... .... = Reserved: Not set
...0 .... .... = Nonce: Not set
.... 0... .... = Congestion Window Reduced (CWR): Not set
.... .0.. .... = ECN-Echo: Not set
.... ..0. .... = Urgent: Not set
.... ...1 .... = Acknowledgment: Set
.... .... 1... = Push: Set
.... .... .0.. = Reset: Not set
.... .... ..0. = Syn: Not set
.... .... ...0 = Fin: Not set
[TCP Flags: ·······AP···]
Window size value: 9713
[Calculated window size: 9713]
[Window size scaling factor: -1 (unknown)]
Checksum: 0x9733 [unverified]
[Checksum Status: Unverified]
Urgent pointer: 0
[SEQ/ACK analysis]
[This is an ACK to the segment in frame: 641510]
[The RTT to ACK the segment was: 0.000041000 seconds]
[Bytes in flight: 39]
[Bytes sent since last PSH flag: 39]
[Timestamps]
[Time since first frame in this TCP stream: 38.717778000 seconds]
[Time since previous frame in this TCP stream: 0.000041000 seconds]
TCP payload (39 bytes)
NetBIOS Session Service
Message Type: Session message (0x00)
Length: 35
SMB (Server Message Block Protocol)
SMB Header
Server Component: SMB
[Response to: 641510]
[Time from request: 0.000041000 seconds]
SMB Command: Locking AndX (0x24)
NT Status: STATUS_FILE_LOCK_CONFLICT (0xc0000054)
Flags: 0x88, Request/Response, Case Sensitivity
1... .... = Request/Response: Message is a response to the client/redirector
.0.. .... = Notify: Notify client only on open
..0. .... = Oplocks: OpLock not requested/granted
...0 .... = Canonicalized Pathnames: Pathnames are not canonicalized
.... 1... = Case Sensitivity: Path names are caseless
.... ..0. = Receive Buffer Posted: Receive buffer has not been posted
.... ...0 = Lock and Read: Lock&Read, Write&Unlock are not supported
Flags2: 0xc807, Unicode Strings, Error Code Type, Extended Security Negotiation, Security Signatures, Extended Attributes, Long Names Allowed
1... .... .... .... = Unicode Strings: Strings are Unicode
.1.. .... .... .... = Error Code Type: Error codes are NT error codes
..0. .... .... .... = Execute-only Reads: Don't permit reads if execute-only
...0 .... .... .... = Dfs: Don't resolve pathnames with Dfs
.... 1... .... .... = Extended Security Negotiation: Extended security negotiation is supported
.... .0.. .... .... = Reparse Path: The request does not use a @GMT reparse path
.... .... .0.. .... = Long Names Used: Path names in request are not long file names
.... .... ...0 .... = Security Signatures Required: Security signatures are not required
.... .... .... 0... = Compressed: Compression is not requested
.... .... .... .1.. = Security Signatures: Security signatures are supported
.... .... .... ..1. = Extended Attributes: Extended attributes are supported
.... .... .... ...1 = Long Names Allowed: Long file names are allowed in the response
Process ID High: 0
Signature: 0000000000000000
Reserved: 0000
Tree ID: 10348
Process ID: 65279
User ID: 59639
Multiplex ID: 43073
Locking AndX Response (0x24)
[Expert Info (Error/Malformed): Trying to fetch an unsigned integer with length 0]
[Trying to fetch an unsigned integer with length 0]
[Severity level: Error]
[Group: Malformed]
[Malformed Packet: SMB]
[Expert Info (Error/Malformed): Malformed Packet (Exception occurred)]
[Malformed Packet (Exception occurred)]
[Severity level: Error]
[Group: Malformed]

Thanks

José, Chile
José Concha Leiva - Chile
"Querer, saber y hacer, es poder"
HB 3.2 + FWH 20.07 + Borland C++ 7.0 + Pelles C 9.0 + MariaDB 10.3 > 32 bit
User avatar
José
Posts: 19
Joined: Sat Dec 10, 2016 8:58 pm

Re: xBase now unstable, slow, error Status_Lock_Not_Granted

Post by José »

Friends, and as a temporary solution, dividing the company into groups, and putting users on Windows Server computers (we have 2012) with the ddbb xBase on the same computer, would it no longer require the SMB service? And if so, is it an option, someone has done that? In my case I have always tried to control the locks and unlocks of registers and the recording in the software, in case it is relevant for this.

Thank you very much to all.

José, Chile
José Concha Leiva - Chile
"Querer, saber y hacer, es poder"
HB 3.2 + FWH 20.07 + Borland C++ 7.0 + Pelles C 9.0 + MariaDB 10.3 > 32 bit
User avatar
José
Posts: 19
Joined: Sat Dec 10, 2016 8:58 pm

Re: xBase now unstable, slow, error Status_Lock_Not_Granted

Post by José »

Friends, hello

One more question, did going back to SMB1 really work? because we (with Windows 7 and 10 workstations and with Linux Debian 9 serviudor) have noticed some improvement but we have not been able to really solve it.

José, Chile
José Concha Leiva - Chile
"Querer, saber y hacer, es poder"
HB 3.2 + FWH 20.07 + Borland C++ 7.0 + Pelles C 9.0 + MariaDB 10.3 > 32 bit
User avatar
Jimmy
Posts: 165
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: xBase now unstable, slow, error Status_Lock_Not_Granted

Post by Jimmy »

hi,

did you still have Problem with DBF Locking :?:

i just can talk about Windows Client / Server.
M$ have a Reason (WannCry & Co) to close UDP Port 135-139 so it is not recommend to open it for SMB1.

---

until XP / Srv2003 we have Drive Letter via Lanmanager with SMB1
since Vista / Win 7 / Srv 2008 UNC-Path is used with SMB2

i guess you using Drive-Letter via Lanmanager to MAP \\Server\ShareName.

this is what i have change in my NET_USE.PRG

Code: Select all

    IF OS() < WIN_VISTA
      USE (Driveletter+Path+cDBF) ...
   ELSE
      USE (UNC-Path+cDBF) ...
   ENDIF
 
so get rid of Drive-Letter in your Code and use UNC-Path instead

p.s. Registry Tip from Otto are for LanmanWorkstation, that is the Client.
greeting,
Jimmy
Post Reply