ZEOS 7.1.0-alpha, ParamByName, SIGSEGV Exception, FPC

The stable tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.
ATILIUS_REGULUS
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 26.07.2013, 10:22
Location: Germany

ZEOS 7.1.0-alpha, ParamByName, SIGSEGV Exception, FPC

Post by ATILIUS_REGULUS »

Since I had a hard time to figure out the following problem,
I would like to give a short description of the problem and
its solution for other programming fellows.


Enviroment:
************
- ZEOS 7.1.0-alfa
- Codetyphon 4.4 - 64 Bit
- fpc 2.7.1 - 64 Bit
- Kubuntu 13.04 - 64 Bit
- Database POSTGRESQL 9.1.8


Problem:
************
Sporadic program exceptions (SIGSEGV Exception) running the
debugger, sometimes debugger is crashing, sometimes IDE is
crashing.
The problem is occuring during an assignment of a string to a
parameter with ParamByName of a TZQuery.

Example:
Sample_Q.Params.ParamByName ('F_FIRSTNAME').AsString := 'Hans';

It doesn't matter if the active property of the TZQuery is set to TRUE
or FALSE, this assignment will cause exceptions sporadicly.
It took me many days to find that problem, searching in the debugger
and in assembler.
It seems that the TZQuery has problems with converting the pascal
string to the params.


Solution:
************
The problem could be solved by assigning the datatype of the param
a specific value instead of the standard ftUnknown.
Setting the datatype of the param 'F_FIRSTNAME' to ftString solved
the problem.

Since I never had to set a paramtype inside the DELPHI components
years before, the problem was very subtle to me using CODETYPHON, fpc
and ZEOS.


If anybody gets exceptions with TZQuery, try to set the datatype
of the params by hand to a different value than ftUnknown.


Cheers,
ATILIUS

POST SCRIPTUM:
Since the ZeosLib 7.0 Beta Forum is locked, I had to set the posting here.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

ATILIUS_REGULUS,

uff that's a huge surprice! Wondering about the FPC behavior here.
The problem could be solved by assigning the datatype of the param
a specific value instead of the standard ftUnknown.
Setting the datatype of the param 'F_FIRSTNAME' to ftString solved
the problem.
That i do not understand. IMHO should the IDE set the type automatically on assigning a string and if ParamType = ftUnknown, thought.

First of all i propose you update your ZeosLib working copy because of this:
http://zeos.firmos.at/viewtopic.php?p=17638#17638

There was a Ubuntu problem only and comparing rowvalues with the current buffer did fail if a value was null previously.

On the other hand (if the issue remains): Are you able to attach a little app which points me to this issue?

Btw. You're usng the 7.1 branch. There is a thread for it: http://zeos.firmos.at/viewforum.php?f=38
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
ATILIUS_REGULUS
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 26.07.2013, 10:22
Location: Germany

Post by ATILIUS_REGULUS »

Michael,

Thanks for the quick reply, I am aware that
working with the stable version would be
a good idea.
But since I decided to work with Codetyphon,
I like to stay with the component versions
they deliver. If I would install different component
versions, I will always have to assemble
the components by hand, when a new
codetyphon version is coming out.

The strings which were assigned to ParamByName().AsString
have been containing values and were not empty or null strings.
Also the problem occurred at different places, were strings
have been assigned to ParamByName().AsString.

Currently the problem occurs at a quite big pascal project,
but I tried to produce a little application for you with the
problem. Unfortunatly, the problem could not be reproduced
with the smale application.

Please note, that the SIGSEGV exception occured sporadicly
and not always, which made it extremly difficult to trace them,
sometimes I didn't get an exception for hours, but as the program
became bigger, the exceptions became more frequent and
finally I figured out, that the exception occured during assigning
a string to a param like
Sample_Q.Params.ParamByName ('F_FIRSTNAME').AsString := S;

If I can reproduce the problem with a small sample application,
I will let you know.

Cheers,
ATILIUS
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

ATILIUS,
I will always have to assemble
the components by hand, when a new
codetyphon version is coming out.
Well that's right. I was running into the same issue. I simply did overwrite the all subfolders of the pl_ZeosDBO\Source folder(not sure yet). So checkout \testing-7.1 from SVN and overwrite the codetyphon used Zeos-files. This will safe your and my time if we allready catched the bug.
Please note, that the SIGSEGV exception occured sporadicly
and not always, which made it extremly difficult to trace them,
sometimes I didn't get an exception for hours, but as the program
became bigger, the exceptions became more frequent and
finally I figured out, that the exception occured during assigning
a string to a param like
Sample_Q.Params.ParamByName ('F_FIRSTNAME').AsString := S;
well i know. But i had a stable behavior if i simply did update a row-string-value which was empty before. That didn't happen if there was a value assigned before. Insertiation was no problem. The link above points to FireBird but i'm sure it was a common issue for all providers and Ubuntu. Like i wrote in the other thread: I can't say if it's a thing for a bugtracker of FPC. But there is a complete different behavior between Windows and Ubuntu in function AnsiCompStr (didn't test other OS's so i made the workaround gloabal for all non Windows OS's. Just because i've no clue about a Ubuntu define only)

So i propuse you follow my advice first before investing time into a sample app and tracking the same issue, propably.
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
ATILIUS_REGULUS
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 26.07.2013, 10:22
Location: Germany

Post by ATILIUS_REGULUS »

Ok, I will install \testing-7.1 and will let you know, if the problem is still there.
Cheers,
Juergen
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

Nice you confirm my advice. Waiting for reply.
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
ATILIUS_REGULUS
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 26.07.2013, 10:22
Location: Germany

Post by ATILIUS_REGULUS »

After installing /testing-7.1/src,
I was not able to reproduce the problem anymore,
id est the problem vanished and the \testing-7.1
code is more stable.

In any case, if the problem will occur again,
I will let you know.

Thank you so far for pointing me to the new code.

Cheers,
Juergen
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

ATILIUS_REGULUS,

it would be nice if someone can inform the CodeTyphon crew about this issue. We're really sorry about. But the project-manager and me have not so much time to check everything agains each available OS's. Can you write them please?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
ATILIUS_REGULUS
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 26.07.2013, 10:22
Location: Germany

Post by ATILIUS_REGULUS »

Dear Michael,

Being aware of the problem of checking programs against the different OS's and other software, I will inform Codetyphon; I just have to wait until my registration at the pilotlogic forum is confirmed before I can post a message.

Cheers,
Juergen
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

Juergen,

that's very nice. Point them to this and the second thread. I don't know if the can react emmidiately. But everthing is better than nothing..

Cheers, Michael

Edit: Can you update http://www.lazarusforum.de/viewtopic.ph ... 192594f90d too? ((:
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
patyit
Junior Boarder
Junior Boarder
Posts: 37
Joined: 10.02.2012, 18:39

Post by patyit »

EgonHugeist, Juergen,

I still can confirm that bug in http://zeos.firmos.at/viewtopic.php?p=17638#17638
is resolved, still no other problems detected ...

Regards, Patyi
ATILIUS_REGULUS
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 26.07.2013, 10:22
Location: Germany

Post by ATILIUS_REGULUS »

Addendum:
After installing the files from /testing-7.1/src, the exceptions become less frequent, but I still get some exceptions by assigning a string to ParamByName.
Furthermore, when assigning other datatypes like Int64 or TDate to ParamByName, exceptions arrise also sporadicly.
The problem can be avoided by assigning a datatype to the param like ftDate or ftLargeInt respectivly.
Cheers,
ATILIUS
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

ATILIUS_REGULUS,

i did run our tests on
XUbuntu 13
FireBird2.5
CodeTyphon 4.4
ZeosDBO 7.0.4 and 7.0.3 and 7.1-beta and 7.2-alpa

i can confirm your reported random EXTERNAL SIGDEV's with ALL these revisions. and it happens in the DB unit or Variants of FPC.

Have to pass for the moment. It looks like Zeos(the reported bug of Patyit) and FPC(your report) have a problem in CodeTyphon 4.4.

now i have to fiddle out how to get a stable FPC and the FPC2.7 running on Ubuntu.

patyit,

do you use Parameters in your Queries too?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
patyit
Junior Boarder
Junior Boarder
Posts: 37
Joined: 10.02.2012, 18:39

Post by patyit »

EgonHugeist,

Yes almost always, but mostly in form Params[0].AsString rarely
ParamByName('par').AsString. Using string, integer, datetime and float data types,
(not using Int64 or Date data types in parameters)
but have no problems by now on Lazarus 1.1 svn, FPC 2.6.3 svn, FPC 2.7.1 svn, Zeos 7.1.0 svn testing.
ATILIUS_REGULUS
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 26.07.2013, 10:22
Location: Germany

Post by ATILIUS_REGULUS »

Addendum:

When assigning a string value to a normal variant, no exceptions arise.

Example:

Var
S: String;
V: Variant;

Begin
S := 'Hans';
V := S;
End;


Furthermore, the exceptions become more frequent, if the TZQuery is active during the assining:

Sample_Q.Active := TRUE;
Sample_Q.Params.ParamByName ('F_FIRSTNAME').AsString := 'Hans';


Cheers,
ATILIUS
Post Reply