Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017 Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
<== Date ==> <== Thread ==>

Subject: Re: Segmentation fault at dbConvert.c in Ubuntu 32/64 bit
From: Carsten Winkler <carsten.winkler@helmholtz-berlin.de>
To: <tech-talk@aps.anl.gov>
Date: Thu, 23 Feb 2017 09:09:55 +0100

Thanks to Freddie we have a patch now for the issue for 64 bit systems.
I have to revise that the problem also occurs at 32 bit systems. I apologize for the inconvenience.
dbConvert.c works at 32 bit system fine! The issue occurs at 64 bit systems only.

Best regards,
Carsten

Am 21.02.2017 um 11:42 schrieb freddie.akeroyd@stfc.ac.uk:

Hi,

 

I think  get_precision()  expects a  long*  for the precision but the variable passed is declared   int   in getFloatString() and getDoubleString(). In theory this could cause a crash on 64 bit linux as int and long are different sizes, but It wouldn’t explain the 32bit crash though as int and long are the same size on that architecture…

 

Regards,

 

Freddie

 

 

From: tech-talk-bounces@aps.anl.gov [mailto:tech-talk-bounces@aps.anl.gov] On Behalf Of Ralph Lange
Sent: 21 February 2017 08:54
To: Carsten Winkler
Cc: EPICS Tech Talk
Subject: Re: Segmentation fault at dbConvert.c in Ubuntu 32/64 bit

 

Hi Carsten,

 

The default value for precision used when you comment out the lines you mention is 6.

Can you achieve the same (i.e. avoid segfaults) by setting PREC to 6 in your database?

If yes: which PREC values cause segfaults?

 

Cheers,
~Ralph

 

 

On Tue, Feb 21, 2017 at 9:15 AM, Carsten Winkler <carsten.winkler@helmholtz-berlin.de> wrote:

I forgot to give you the used db entry. Here it is:

record(waveform, "caLab:waveString")
{
    field(DESC, "String waveform record")
    field(NELM, 48)
    field(FTVL, "STRING")
    field (PINI, "YES")
    field (PREC, 3)

}


Am 20.02.2017 um 15:40 schrieb Carsten Winkler:
> Hi there,
>
> I always run into a  "Segmentation fault" in function "putFloatString" |
> "putDoubleString" of BASE/src/db/dbConvert.c
>
> When I comment out following lines (call of get_precision) everything is
> working again:
> 3947
> 3948
> 4157
> 4158
>
> Test system
> =================================================
> Ubunu 16.04 (64 bit)
> EPICS BASE 3.14.12.6 (64 bit)
>
>
> To check the error, I used this code:
> test.cpp
> =================================================
>
> #include <malloc.h>
> #include <cadef.h>
> //#define DOUBLE
>
> using namespace std;
>
> int main() {
>     chid chanID;
>     int iNumber = 1;
>     int timeout = 0;
>     void *pValue = 0x0;
>
>     ca_context_create(ca_enable_preemptive_callback);
> #if defined DOUBLE
>     pValue = (double*)malloc(iNumber*sizeof(double));
>     for(int i=0; i<iNumber; i++) {
>         ((double*)pValue)[i] = (double)((1+i)*3.1415926535897);
>     }
> #else
>     pValue = (float*)malloc(iNumber*sizeof(float));
>     for(int i=0; i<iNumber; i++) {
>         ((float*)pValue)[i] = (float)((1+i)*3.1415926535897);
>     }
> #endif
>     ca_create_channel("caLab:waveString", 0, 0, 50, &chanID);
>     timeout = 3000;
>     while(ca_state(chanID) != cs_conn && timeout--) {
>         epicsThreadSleep(.001);
>     }
> #if defined DOUBLE
>     ca_array_put(DBR_DOUBLE, 1, chanID, pValue);
> #else
>     ca_array_put(DBR_FLOAT, 1, chanID, pValue);
> #endif
>     ca_context_destroy();
>     free(pValue);
>     return 0;
> }
>
> g++ -I/usr/local/epics/base-3.14.12.6/include/os/Linux
> -I/usr/local/epics/base-3.14.12.6/include -O0 -g3 -Wall -c
> -fmessage-length=0 -MMD -MP -MF"test.d" -MT"test.d" -o "test.o" "test.cpp"
> g++ -L/usr/local/epics/base-3.14.12.6/lib/linux-x86_64 -o "test"
> test.o   -lCom -lca
>
> Any advice to solve this issue?
>
> Best regards
> Carsten Winkler
>
> PS Same problem in 32 bit systems
>
>
> ________________________________
>
> Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
>
> Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.
>
> Aufsichtsrat: Vorsitzender Dr. Karl Eugen Huthmacher, stv. Vorsitzende Dr. Jutta Koch-Unterseher
> Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking
>
> Sitz Berlin, AG Charlottenburg, 89 HRB 5583
>
> Postadresse:
> Hahn-Meitner-Platz 1
> D-14109 Berlin
>
> http://www.helmholtz-berlin.de
>


________________________________

Helmholtz-Zentrum Berlin für Materialien und Energie GmbH

Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.

Aufsichtsrat: Vorsitzender Dr. Karl Eugen Huthmacher, stv. Vorsitzende Dr. Jutta Koch-Unterseher
Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking

Sitz Berlin, AG Charlottenburg, 89 HRB 5583

Postadresse:
Hahn-Meitner-Platz 1
D-14109 Berlin

http://www.helmholtz-berlin.de

 





Helmholtz-Zentrum Berlin für Materialien und Energie GmbH

Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.

Aufsichtsrat: Vorsitzender Dr. Karl Eugen Huthmacher, stv. Vorsitzende Dr. Jutta Koch-Unterseher
Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking

Sitz Berlin, AG Charlottenburg, 89 HRB 5583

Postadresse:
Hahn-Meitner-Platz 1
D-14109 Berlin

http://www.helmholtz-berlin.de
--- src/db/dbConvert.c	2016-12-09 20:53:29.000000000 +0100
+++ src/db/dbConvert.c	2017-02-22 13:55:58.839396000 +0100
@@ -1628,7 +1628,7 @@
     char *pbuffer = (char *)pto;
     float	*psrc=(float *)(paddr->pfield);
     long	status = 0;
-    int		precision = 6;
+    long	precision = 6;
     struct rset	*prset = 0;
 
     if(paddr) prset = dbGetRset(paddr);
@@ -1838,7 +1838,7 @@
     char *pbuffer = (char *)pto;
     double *psrc=(double *)(paddr->pfield);
     long	status = 0;
-    int		precision = 6;
+    long	precision = 6;
     struct rset	*prset = 0;
 
     if(paddr) prset = dbGetRset(paddr);
@@ -3940,7 +3940,7 @@
     const float *pbuffer = (const float *)pfrom;
     char	*pdest=(char *)(paddr->pfield);
     long	status = 0;
-    int		precision = 6;
+    long	precision = 6;
     struct rset *prset = dbGetRset(paddr);
     short size=paddr->field_size;
 
@@ -4150,7 +4150,7 @@
     const double *pbuffer = (const double *)pfrom;
     char	*pdest=(char *)(paddr->pfield);
     long	status = 0;
-    int		precision = 6;
+    long	precision = 6;
     struct rset *prset = dbGetRset(paddr);
     short size=paddr->field_size;
 

References:
Segmentation fault at dbConvert.c in Ubuntu 32/64 bit Carsten Winkler
Re: Segmentation fault at dbConvert.c in Ubuntu 32/64 bit Carsten Winkler
Re: Segmentation fault at dbConvert.c in Ubuntu 32/64 bit Ralph Lange
RE: Segmentation fault at dbConvert.c in Ubuntu 32/64 bit freddie.akeroyd

Navigate by Date:
Prev: RE: Re: IOC Connecting Problem Mark Rivers
Next: memory leak after unloading of ca.lib Carsten Winkler
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
Navigate by Thread:
Prev: Re: Segmentation fault at dbConvert.c in Ubuntu 32/64 bit Benjamin Franksen
Next: Medm Menu Object with non-sequential choices Newby, Mary A
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
ANJ, 23 Feb 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·