1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 <2020> 2021 2022 2023 2024 2025 | 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 2018 2019 <2020> 2021 2022 2023 2024 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: String size limit for Eiger FileWriter when compiling with g++ > 5.2 |
From: | "Wlodek, Jakub via Tech-talk" <tech-talk at aps.anl.gov> |
To: | Bruno Martins <brunoseivam at gmail.com> |
Cc: | "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov> |
Date: | Wed, 4 Mar 2020 18:23:52 +0000 |
Hi Bruno,
Thanks for letting me know, that makes sense. I think that the current fix is probably OK for now, it only required changing about 10 lines, so it wasn't overly complex.
I wonder if there are any other instances of EPICS drivers that would suffer from a similar problem, with std::string memcpy calls to put them on a queue.
Best,
Jakub
From: Bruno Martins <brunoseivam at gmail.com>
Sent: Wednesday, March 4, 2020 1:19 PM To: Wlodek, Jakub <jwlodek at bnl.gov> Cc: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov> Subject: Re: String size limit for Eiger FileWriter when compiling with g++ > 5.2 I believe memcpy'ing a std::string might not be safe. My theory is that std::string internals changed: the underlying data is probably being automatically deallocated between sending a string on one end and getting it on the other end of a queue, since
we're essentially copying bytes. It might not happen for smaller strings because their content is probably inlined in the std::string type itself.
Maybe that was always the behavior, but the inlining length threshold is the thing that changed.
The way I see it, you have to either keep the change you mentioned OR use a different queue that's aware of the data type it is transporting, taking ownership of the queue items (which, AFAIK, EPICS doesn't provide).
Bruno
On Wed, Mar 4, 2020 at 12:12 PM Wlodek, Jakub via Tech-talk <tech-talk at aps.anl.gov> wrote:
|