Validation Error morphed to value "*** null *** in v9.1.1

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

Validation Error morphed to value "*** null *** in v9.1.1

Post by FredS » Fri 10 Dec 2021 17:36

Morphed to this, and a bonus.. now in Win64 as well as Win32..

Code: Select all

12/10/2021 9:03:08 AM 0.000 Start:  Complete
  12/10/2021 9:03:08 AM 0.000 Transaction ID = 1474  Complete
  12/10/2021 9:03:08 AM 0.016 SQL Execute: insert into trusteddomains (netbiosname, domainid, dnsdomainname, domainsid, dc, dsdomainkinds, trusttype) values (:netbiosname, :domainid, :dnsdomainname, :domainsid, :dc, :dsdomainkinds, :trusttype)
:netbiosname(WideString[5])='SMB03' 
:domainid(LargeInt)=1 
:dnsdomainname(WideString[11])='smb03.local' 
:domainsid(WideString[40])='S-1-5-21-3188387342-845300696-3033364349' 
:dc(WideString[22])='Offline or Unavailable' 
:dsdomainkinds(LongWord)=34 
:trusttype(LongWord)=2Error: validation error for column "TRUSTEDDOMAINS"."DSDOMAINKINDS", value "*** null ***"
Validation error still in Overnight build 9.0.1 (19-Nov-2021)

FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

Re: Validation Error morphed to value "*** null *** in v9.1.1

Post by FredS » Fri 10 Dec 2021 18:25

If there ever was a scary bug this is it.. Imagine values altered between the advertised Monitor Status and the db itself..

Data integrity my Asterisk..

See Also: UniDAC change values of TUniQuery.Params

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Validation Error morphed to value "*** null *** in v9.1.1

Post by ViktorV » Fri 17 Dec 2021 17:10

Hey Fred,

Thanks for the reply.

As we told you before, we were unable to reproduce this error in our environment. Bugs that we were able to reproduce – they were fixed.
Please send us the complete trusteddomains table script and specify the exact code you are using to set the value with which this behavior occurs.

Regards,
Viktor

FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

Re: EDIT-Validation Error morphed to value "*** null *** in v9.1.1

Post by FredS » Fri 17 Dec 2021 23:42

Monitor doesn’t log the Connection Address nor its relationships. Only way to show this is by using images.

In this image the Stored Procedures fired by a number of OTHER threads are shown under the ‘conGetDomainTrust’ connection instead of the ones they belong to.

https://imgur.com/a/VwS2j0u

Would be easier if Monitor could store this information..

Edit:

This appears to be a Monitor issue only, below is a list of logged TUniSQL addresses from Stored Procedures fired in order. They use unique connections but since the memory is re-used the TUniSQL points to the same address and Monitor doesn't take into account that his may happen:

Code: Select all

  12/18/2021 8:37:30 AM 0.000 TUniSQL($1265B680) Complete
  12/18/2021 8:37:34 AM 0.000 TUniSQL($1265B680) Complete
  12/18/2021 8:37:49 AM 0.000 TUniSQL($1265B680) Complete
  12/18/2021 8:37:53 AM 0.000 TUniSQL($1265B680) Complete
  12/18/2021 8:37:56 AM 0.000 TUniSQL($1265B680) Complete
  12/18/2021 8:37:59 AM 0.000 TUniSQL($1265B680) Complete
  12/18/2021 8:38:08 AM 0.000 TUniSQL($1265B680) Complete
  12/18/2021 8:38:08 AM 0.000 TUniSQL($1265B680) Complete

FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

Re: Validation Error morphed to value "*** null *** in v9.1.1

Post by FredS » Sat 18 Dec 2021 18:59

To sum this up again:
  • Its not the table nor the constraint when I can fire a non parameterized SQL without issue
  • This is a Thread which runs at the same time as Parallel Tasks dumps data from whatever number of servers
  • The DB Monitor log shows the correct parameters going in and the FBTrace log shows the incorrect data insert attempt
This is as vanilla as it gets, even moved that out of the Thread into Main:

Insert:

Code: Select all

  Con.SQL.SQL.Text := 'insert into trusteddomains (netbiosname, domainid, dnsdomainname, domainsid, dc, dsdomainkinds, trusttype) ';
  Con.SQL.SQL.Add('values (:netbiosname, :domainid, :dnsdomainname, :domainsid, :dc, :dsdomainkinds, :trusttype)');
  Con.SQL.Params[0].Value := 'SMB03';
  Con.SQL.Params[1].Value := 1;
  Con.SQL.Params[2].Value := 'smb03.local';
  Con.SQL.Params[3].Value := 'S-1-5-21-3188387342-845300696-3033364349';
  Con.SQL.Params[4].Value := 'VMSMB03';
  Con.SQL.Params[5].Value := 34;
  Con.SQL.Params[6].Value := 2;
  Con.SQL.Execute;
Error:

Code: Select all

raised exception class EIBCError with message 'violation of FOREIGN KEY constraint "FK_MNGDDOMAINS_ID" on table "TRUSTEDDOMAINS"
Foreign key reference target does not exist
Problematic key value is ("DOMAINID" = -7167)'.
DB Monitor:

Code: Select all

  12/18/2021 10:47:55 AM n/a SQL Execute: insert into trusteddomains (netbiosname, domainid, dnsdomainname, domainsid, dc, dsdomainkinds, trusttype) 
values (:netbiosname, :domainid, :dnsdomainname, :domainsid, :dc, :dsdomainkinds, :trusttype)
:netbiosname(WideString[5])='SMB03' 
:domainid(Byte)=1 
:dnsdomainname(WideString[11])='smb03.local' 
:domainsid(WideString[40])='S-1-5-21-3188387342-845300696-3033364349' 
:dc(WideString[7])='VMSMB03' 
:dsdomainkinds(Byte)=34 
:trusttype(Byte)=2
Domain:

Code: Select all

CREATE DOMAIN DWORD
 AS BIGINT
 check ( value between 0 and 4294967295 )
;
Table:

Code: Select all

CREATE TABLE TRUSTEDDOMAINS
(
  NETBIOSNAME VARCHAR(80) NOT NULL,
  DOMAINID BIGINT NOT NULL,
  DNSDOMAINNAME VARCHAR(120) NOT NULL,
  DOMAINSID STRINGSID NOT NULL,
  DC VARCHAR(80) NOT NULL,
  DSDOMAINKINDS DWORD NOT NULL,
  TRUSTTYPE DWORD NOT NULL,
  CONSTRAINT PK_TRUSTEDDOMAINS PRIMARY KEY (NETBIOSNAME,DOMAINID)
);

ALTER TABLE TRUSTEDDOMAINS ADD CONSTRAINT FK_MNGDDOMAINS_ID
  FOREIGN KEY (DOMAINID) REFERENCES MNGDDOMAINS (ID) ON DELETE CASCADE;  
CREATE UNIQUE INDEX IX_TRUSTEDDOMAINS_SID ON TRUSTEDDOMAINS (DOMAINSID);
Trace log:

Code: Select all

Statement 249:
-------------------------------------------------------------------------------
insert into trusteddomains (netbiosname, domainid, dnsdomainname, domainsid, dc, dsdomainkinds, trusttype) 
values (?, ?, ?, ?, ?, ?, ?)
param0 = varchar(320), "SMB03"
param1 = bigint, "-7167"
param2 = varchar(480), "smb03.local"
param3 = varchar(800), "S-1-5-21-3188387342-845300696-3033364349"
param4 = varchar(320), "VMSMB03"
param5 = bigint, "34"
param6 = bigint, "2"

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Validation Error morphed to value "*** null *** in v9.1.1

Post by ViktorV » Fri 24 Dec 2021 14:30

Thanks for the provided information! Kindly be informed that we have fixed that bug and fix will be included in the next build of UniDAC.

Post Reply