Linux-Development-Apps Digest #293, Volume #7    Thu, 22 Mar 01 07:13:08 EST

Contents:
  Re: GPL (Josef Allen)
  Re: Could I program the system shutdown? ("Arthur H. Gold")
  Re: seg fault when creating new objects under linux ("Arthur H. Gold")
  Position of dialog windows? ([EMAIL PROTECTED])
  Re: seg fault when creating new objects under linux ("D. Stimits")
  strange sql command ("Marcel Stör")
  Re: sizeof returns wrong structure size (Rolf Magnus)
  Re: seg fault when creating new objects under linux (Benoit Mordelet)
  Linux + PostgreSQL + Apache + JDBC + Tomcat JSP / Servlets:  Ready for prime time? 
(Flacco)
  Shared library - linux glibc6 2.1.3x, dlclose generate segmentation fault (Tomasz 
Karczewski)
  Re: Linux + PostgreSQL + Apache + JDBC + Tomcat JSP / Servlets:  Ready for prime 
time? (Paul Colquhoun)
  Re: Linux + PostgreSQL + Apache + JDBC + Tomcat JSP / Servlets:  Ready for prime 
time? (Reality is a point of view)
  Re: Linux + PostgreSQL + Apache + JDBC + Tomcat JSP / Servlets:  Ready  (mlw)

----------------------------------------------------------------------------

From: Josef Allen <[EMAIL PROTECTED]>
Subject: Re: GPL
Date: Wed, 21 Mar 2001 23:08:24 -0500

Thanks

Josef D. Allen

On 21 Mar 2001, Nate Eldredge wrote:

> Josef Allen <[EMAIL PROTECTED]> writes:
> 
> > What does the acronym GPL standard for?
> 
> General Public License.
> 
> http://www.gnu.org/copyleft/gpl.txt
> 
> -- 
> 
> Nate Eldredge
> [EMAIL PROTECTED]
> 
> 


------------------------------

Date: Wed, 21 Mar 2001 22:36:59 -0600
From: "Arthur H. Gold" <[EMAIL PROTECTED]>
Subject: Re: Could I program the system shutdown?

Juergen Heinzl wrote:
> 
> In article <[EMAIL PROTECTED]>, Afonso Sam wrote:
> >Could I shutdown the system by my program? Is there any Linux-api for
> >system shutdown available? or any simple way to call KDE's system
> >shutdown?
> [-]
> shutdown(2), but beware -- shutdown(8) does a bit more for you
> then just shooting down the kernel, so an explicit fork() / exec(),
> I'd avoid system() for security reasons here, is probably the
> right thing to do.
I'm not sure what security problem you're referring to; if
you give the full path for shutdown, I'm not sure I see what
could go wrong.
I think I'd also provide a short delay, as that way you
could be sure that the command actually ran...and then exit
gracefully.
> 
> You may want to re-direct stdin and stdout to some file, too. Just
> in case something goes wrong, although if it's an X application
> it'd be okay of course since nothing could mess up your screen.
> 
--ag
-- 
Artie Gold, Austin, TX  (finger the cs.utexas.edu account
for more info)
mailto:[EMAIL PROTECTED] or mailto:[EMAIL PROTECTED]
--
Clone Bernie!

------------------------------

Date: Wed, 21 Mar 2001 22:32:31 -0600
From: "Arthur H. Gold" <[EMAIL PROTECTED]>
Subject: Re: seg fault when creating new objects under linux

grant wrote:
> 
> i've seen a lot of posts where people are complaining of seg faults
> when calling malloc directly under linux.
> 
> however, i'm experiencing something a bit different..in my multithreaded
> program,
> i'm getting a seg fault in malloc after calling new to create an object.
> i'm running linux red-hat 6.2 and have compiled everything correctly..
> 
> source code looks like this:
> 
> m_data.m_pString = new char[strlen(val) + 1];
> 
> i've confirmed that strlen(val) is 4. there's no reason (not that i know of)
> that the OS shouldn't be able to allocate the character array for me. i've
> topped
> my machine, memory and CPU usage look fine.
> 
> i get crash stack like this (this is with electric fence linked in):
> #0  0x8072255 in memalign () at main.cpp:164
> #1  0x8072637 in malloc () at main.cpp:164
> #2  0x400781e6 in __builtin_new (sz=5) from
> /usr/lib/libstdc++-libc6.1-1.so.2
> #3  0x400783bc in __builtin_vec_new (sz=5)
>    from /usr/lib/libstdc++-libc6.1-1.so.2
> #4  0x804c478 in TupleElement::TupleElement (this=0x4034dfe0,
>     val=0x40251f7f "temp") at ../Network/Message.cpp:47
> #5  0x804d17c in TupleMessage::addArgument (this=0x40233fe8,
>     arg=0x40251f7f "temp") at ../Network/Message.h:249
> #6  0x80771af in LogMessageEvent::LogMessageEvent (this=0x40233fe8,
>     module=0x40251f7f "temp", messageType=1, sessionID=0, verbosity=10,
>     errorCode=0, message=0xbfffe280) at ../Network/GeneratedMessages.h:1141
> 
> also, the seg fault doens't just happen there...
> it happens ALL OVER THE PLACE - whenever i call new for char, int, etc even
> when the size of the object is very small (4 bytes, 48 bytes etc).. i seg
> fault all
> over. also, seg faults happen on subsequent calls to "delete"
> 
> ugh. any idea??? thanks.
It's not malloc. You've trashed your heap sometime before
the offending malloc call...either by free()-ing already
free()-ed memory, free()-ing a pointer you've changed or
something of the like.

Unfortunately, thesse kinds of bugs are among the most
devilish to find (fortunately, once you do -- and deliver
the compulsory slap to your forehead -- they're usually easy
to fix).

Happy hunting!

HTH,
--ag 
-- 
Artie Gold, Austin, TX  (finger the cs.utexas.edu account
for more info)
mailto:[EMAIL PROTECTED] or mailto:[EMAIL PROTECTED]
--
Clone Bernie!

------------------------------

From: [EMAIL PROTECTED]
Subject: Position of dialog windows?
Date: 22 Mar 2001 02:14:56 GMT

Can someone tell me how I can find out the position and size of opened dialog
windows in X? I am writing a facility where I record X-Events and then can
replay them at a leter time. To do this I need to get a snapshot of all the
dialogs open at some time, along with their positions and size.
If anyone can help me find the size and position of the opened dialogs then
your help will be greatly appreciated.
Thanks in advance,
Brad.

 -----  Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web  -----
  http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
   NewsOne.Net prohibits users from posting spam.  If this or other posts
made through NewsOne.Net violate posting guidelines, email [EMAIL PROTECTED]

------------------------------

Date: Wed, 21 Mar 2001 23:24:25 -0700
From: "D. Stimits" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Subject: Re: seg fault when creating new objects under linux

grant wrote:
> 
> hmm.. val is defintely NULL terminated.
> also, the declaration of member pointer m_pString is:
> 
> char *m_pstring;
> 
> which is certainly correct...
> 
> keep in mind, these seg faults when calling the new operator
> are happening all over the place - not just at that one line of
> code, which makes me think as to whether or not tehre's a bigger (more
> insidious) form of general memory corruption going on.... does this look
> linux specific somehow? perhaps there's a malloc patch that we're missing???

Memory allocation in linux is one of the more solid pieces of code.
Although it is possible the problem is somewhere in glibc, it is
unlikely. Someone else mentioned that corruption doesn't always occur at
the same time that the seg fault hits; seg fault occurs when a problem
is actually detected. One thing I would do is try the program with -g
and no optimization, then again without -g and with -O6 optimization;
the reason is that it changes the stack frame somewhat by doing this,
and random corruption will still show but at different
locations/times...which is a clue that corruption was earlier than when
it was failing. In reality, it will probably require a close look at all
the code to figure out exactly where it is failing and why. There are
some lib's out there for testing against memory problems, basically they
replace the new/delete or malloc/free with bounds checking versions so
they can tell you when they see potential conflict. Another thing that
sometimes happens is someone mixes new/delete with malloc/free when
working with a combination of C++ and C libs, which is a "bad" thing.
One last possibility is that when you come up with a stack frame, you
can also go back to each level of the stack and check parameters to see
what values they were called with in each function...see if they are
"sane". Add lots of assert() functions to your code wherever pointers or
memory allocation is present.

D. Stimits, [EMAIL PROTECTED]

> 
> thanks.
> 
> D. Stimits <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]...
> > grant wrote:
> > >
> > > i've seen a lot of posts where people are complaining of seg faults
> > > when calling malloc directly under linux.
> > >
> > > however, i'm experiencing something a bit different..in my multithreaded
> > > program,
> > > i'm getting a seg fault in malloc after calling new to create an object.
> > > i'm running linux red-hat 6.2 and have compiled everything correctly..
> > >
> > > source code looks like this:
> > >
> > > m_data.m_pString = new char[strlen(val) + 1];
> >
> > Since strlen() requires a null terminated string, is there any
> > possibility that "val" is improperly terminated? Try echoing the return
> > of strlen(val) just prior to the new assignment. FYI, what is the
> > declaration of member pointer m_pString? The declaration might make a
> > difference.
> >
> > >
> > > i've confirmed that strlen(val) is 4. there's no reason (not that i know
> of)
> > > that the OS shouldn't be able to allocate the character array for me.
> i've
> > > topped
> > > my machine, memory and CPU usage look fine.
> > >
> > > i get crash stack like this (this is with electric fence linked in):
> > > #0  0x8072255 in memalign () at main.cpp:164
> > > #1  0x8072637 in malloc () at main.cpp:164
> > > #2  0x400781e6 in __builtin_new (sz=5) from
> > > /usr/lib/libstdc++-libc6.1-1.so.2
> > > #3  0x400783bc in __builtin_vec_new (sz=5)
> > >    from /usr/lib/libstdc++-libc6.1-1.so.2
> > > #4  0x804c478 in TupleElement::TupleElement (this=0x4034dfe0,
> > >     val=0x40251f7f "temp") at ../Network/Message.cpp:47
> > > #5  0x804d17c in TupleMessage::addArgument (this=0x40233fe8,
> > >     arg=0x40251f7f "temp") at ../Network/Message.h:249
> > > #6  0x80771af in LogMessageEvent::LogMessageEvent (this=0x40233fe8,
> > >     module=0x40251f7f "temp", messageType=1, sessionID=0, verbosity=10,
> > >     errorCode=0, message=0xbfffe280) at
> ../Network/GeneratedMessages.h:1141
> > >
> > > also, the seg fault doens't just happen there...
> > > it happens ALL OVER THE PLACE - whenever i call new for char, int, etc
> even
> > > when the size of the object is very small (4 bytes, 48 bytes etc).. i
> seg
> > > fault all
> > > over. also, seg faults happen on subsequent calls to "delete"
> > >
> > > ugh. any idea??? thanks.

------------------------------

From: "Marcel Stör" <[EMAIL PROTECTED]>
Subject: strange sql command
Date: Thu, 22 Mar 2001 07:50:35 +0100
Reply-To: "Marcel Stör" <[EMAIL PROTECTED]>

hi folks

if i try to execute the following command oracle asks to enter the value for
mid, since it obviously interpretes it as a keyword or built-in function:

select oid, pid, p2maincat from t_product where p2maincat = 'Equity
Switzerland Small & mid Cap';

how to avoid this? i need to tell the database even more clearly that
everything right from the = is one single string.

cheers, marcel



------------------------------

From: Rolf Magnus <[EMAIL PROTECTED]>
Subject: Re: sizeof returns wrong structure size
Date: Thu, 22 Mar 2001 09:14:25 +0100

Grant Edwards wrote:

> In my experience, I want to specify alignment for two reasons:
> 
>  1) to match hardware
>  2) to match data layouts specified by other organizations
> 
> I don't understand how a system might "not [be] able to align
> as I want".  If I can put the data where I want using memcpy()
> and an array of chars, then the compiler can certainly generate
> code to do something similar.

In another post, you wrote:
> It seems odd to design a low level systems lanuage like C
> and not have a facility to specify the layout of data in memory.

So on one hand, you say a low level language like C should let you do 
things, on the other hand, you want it to automatically insert code to work 
around hardware limitiations and make it transparent for you.

> anding and oring them into words/bytes isn't considered "a lot
> of overhead" but making sizeof return a value that is equal to
> 
> (address of the last field) - (address of first field) + (sizeof last
> field)
> 
> is beyond the pale.

sizeof is evaluated at compile time. So there is no overhead. If you have a 
structure that is 25 bytes long, all occurences of sizeof(thestruct) are 
replaced by 25 before the code is created.

------------------------------

From: Benoit Mordelet <[EMAIL PROTECTED]>
Subject: Re: seg fault when creating new objects under linux
Date: Thu, 22 Mar 2001 09:55:01 +0100

grant a écrit :
> 
> i've seen a lot of posts where people are complaining of seg faults
> when calling malloc directly under linux.
> 
> however, i'm experiencing something a bit different..in my multithreaded
> program,
> i'm getting a seg fault in malloc after calling new to create an object.
> i'm running linux red-hat 6.2 and have compiled everything correctly..
> 
> source code looks like this:
> 
> m_data.m_pString = new char[strlen(val) + 1];
> 
> i've confirmed that strlen(val) is 4. there's no reason (not that i know of)
> that the OS shouldn't be able to allocate the character array for me. i've
> topped
> my machine, memory and CPU usage look fine.
> 
> i get crash stack like this (this is with electric fence linked in):
> #0  0x8072255 in memalign () at main.cpp:164
> #1  0x8072637 in malloc () at main.cpp:164
> #2  0x400781e6 in __builtin_new (sz=5) from
> /usr/lib/libstdc++-libc6.1-1.so.2
> #3  0x400783bc in __builtin_vec_new (sz=5)
>    from /usr/lib/libstdc++-libc6.1-1.so.2
> #4  0x804c478 in TupleElement::TupleElement (this=0x4034dfe0,
>     val=0x40251f7f "temp") at ../Network/Message.cpp:47
> #5  0x804d17c in TupleMessage::addArgument (this=0x40233fe8,
>     arg=0x40251f7f "temp") at ../Network/Message.h:249
> #6  0x80771af in LogMessageEvent::LogMessageEvent (this=0x40233fe8,
>     module=0x40251f7f "temp", messageType=1, sessionID=0, verbosity=10,
>     errorCode=0, message=0xbfffe280) at ../Network/GeneratedMessages.h:1141
> 
> also, the seg fault doens't just happen there...
> it happens ALL OVER THE PLACE - whenever i call new for char, int, etc even
> when the size of the object is very small (4 bytes, 48 bytes etc).. i seg
> fault all
> over. also, seg faults happen on subsequent calls to "delete"
> 
> ugh. any idea??? thanks.

while searching a solution for a similar problem recently, I found this
(in malloc man page, no need to ask google for hours :)

       Crashes in malloc(), free() or realloc() are almost always
       related to heap corruption, such as overflowing  an  allo­
       cated chunk or freeing the same pointer twice.

       Recent  versions of Linux libc (later than 5.4.23) and GNU
       libc (2.x) include a malloc implementation which  is  tun­
       able  via  environment  variables.   When MALLOC_CHECK_ is
       set, a special (less  efficient)  implementation  is  used
       which  is  designed  to be tolerant against simple errors,
       such as double calls of free() with the same argument,  or
       overruns of a single byte (off-by-one bugs).  Not all such
       errors can be proteced against, however, and memory  leaks
       can  result.   If  MALLOC_CHECK_ is set to 0, any detected
       heap corruption is silently ignored; if set to 1, a  diag­
       nostic  is  printed  on  stderr;  if  set to 2, abort() is
       called immediately.  This can be useful because  otherwise
       a  crash may happen much later, and the true cause for the
       problem is then very hard to track down.

ben

------------------------------

Date: Thu, 22 Mar 2001 04:08:59 -0500
From: Flacco <[EMAIL PROTECTED]>
Crossposted-To: comp.lang.java.advocacy,comp.lang.java.tech,comp.os.linux.advocacy
Subject: Linux + PostgreSQL + Apache + JDBC + Tomcat JSP / Servlets:  Ready for prime 
time?


In the past, I've used NT/VB/IIS/ASP/MTS/SQLServer for web apps.  I'm a 
recent Linux convert, and would like to look into using 
Linux/Apache/Tomcat/JDBC/PostrgreSQL for some future projects.

 From what I see so far, I like it conceptually, but I wonder how this 
combination performs in the real world, in terms of speed and 
reliability, on modest hardware (say, dual P700's with 256MB).

I don't want to invest a lot of time in this kind of environment if 
there are performance problems under load, if services stop running 
unexpectedly, if ports mysteriously shut down, etc. etc.

Has anyone worked extensively with this combination?  What were your 
experiences?

Would you recommend replacement implementations for any of the 
components I've listed to make the environment more reliable?

Any pointers to websites that discuss these issues?


Thanks


------------------------------

From: Tomasz Karczewski <[EMAIL PROTECTED]>
Subject: Shared library - linux glibc6 2.1.3x, dlclose generate segmentation fault
Date: Thu, 22 Mar 2001 11:07:38 +0100

Hello,

I have a problem with Shared library created by gcc under linux with
glibc6 2.1.3-17.
I load libx.so library using dlopen function and unload using dlclose,
when I call dlclose segmentation fault error is generated.

I have own _ini and _fini functions there, but I termopary remove it
from library, then I have default _ini and _fini, stiil that same :-(

I use there shared memory and pthreads, mutex and conditional wariable
from POSIX.

The most interested is thad the error is generated under glibc6 2.1.13-x
under Debian Potato and RedHat 6.2, but under unstable Debian and RedHat
7.1 beta with glibc6 2.2.1 there is not any problem?

Unfortunately I had use RedHat 6.2 with glibc6 2.1.3-x

Best regards
Tom

--
nick: KaTo
[EMAIL PROTECTED]




------------------------------

From: [EMAIL PROTECTED] (Paul Colquhoun)
Crossposted-To: comp.lang.java.advocacy,comp.lang.java.tech,comp.os.linux.advocacy
Subject: Re: Linux + PostgreSQL + Apache + JDBC + Tomcat JSP / Servlets:  Ready for 
prime time?
Reply-To: <[EMAIL PROTECTED]>
Date: Thu, 22 Mar 2001 11:10:36 GMT

On Thu, 22 Mar 2001 04:08:59 -0500, Flacco <[EMAIL PROTECTED]> 
wrote:
|
|In the past, I've used NT/VB/IIS/ASP/MTS/SQLServer for web apps.  I'm a 
|recent Linux convert, and would like to look into using 
|Linux/Apache/Tomcat/JDBC/PostrgreSQL for some future projects.
|
| From what I see so far, I like it conceptually, but I wonder how this 
|combination performs in the real world, in terms of speed and 
|reliability, on modest hardware (say, dual P700's with 256MB).
|
|I don't want to invest a lot of time in this kind of environment if 
|there are performance problems under load, if services stop running 
|unexpectedly, if ports mysteriously shut down, etc. etc.
|
|Has anyone worked extensively with this combination?  What were your 
|experiences?
|
|Would you recommend replacement implementations for any of the 
|components I've listed to make the environment more reliable?
|
|Any pointers to websites that discuss these issues?


Unless you need any of the advanced features of PostgreSQL,
then mSQL or MySQL would be faster.


-- 
Reverend Paul Colquhoun,      [EMAIL PROTECTED]
Universal Life Church    http://andor.dropbear.id.au/~paulcol
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
xenaphobia: The fear of being beaten to a pulp by
            a leather-clad, New Zealand woman.

------------------------------

From: [EMAIL PROTECTED] (Reality is a point of view)
Crossposted-To: comp.lang.java.advocacy,comp.lang.java.tech,comp.os.linux.advocacy
Subject: Re: Linux + PostgreSQL + Apache + JDBC + Tomcat JSP / Servlets:  Ready for 
prime time?
Date: 22 Mar 2001 11:47:47 GMT

 +---- [EMAIL PROTECTED] wrote (Thu, 22 Mar 2001 04:08:59 -0500):
 | Has anyone worked extensively with this combination?  What were your 
 | experiences?

The JVM still needs work, maybe PostgreSQL and Tomcat too.

 | Would you recommend replacement implementations for any of the 
 | components I've listed to make the environment more reliable?

Try FreeBSD + MySQL + TUX + PHP? ;)

 | Any pointers to websites that discuss these issues?
 +----

Each piece as plenty of users that will run into problems
before you do . . .

-- 
Gary Johnson     [EMAIL PROTECTED]
Privacy on the net is still illegal.
<a href=http://www.squeak.org>Tired of selfish technology monopolies?</a>

------------------------------

From: mlw <[EMAIL PROTECTED]>
Crossposted-To: comp.lang.java.advocacy,comp.lang.java.tech,comp.os.linux.advocacy
Subject: Re: Linux + PostgreSQL + Apache + JDBC + Tomcat JSP / Servlets:  Ready 
Date: Thu, 22 Mar 2001 07:10:51 -0500

Paul Colquhoun wrote:

> 
> Unless you need any of the advanced features of PostgreSQL,
> then mSQL or MySQL would be faster.

I have seen lots of benchmarks that prove that this is simply not true.
Specifically, MySQL does a lot of table and file locking, where as Postgres
does not. So a single query in MySQL may be slightly faster, but as number of
concurrent queries increases, Postgres scales as well as the big boys, and
MySQL to eat itself up with file locking.


-- 
I'm not offering myself as an example; every life evolves by its own laws.
========================
http://www.mohawksoft.com

------------------------------


** FOR YOUR REFERENCE **

The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:

    Internet: [EMAIL PROTECTED]

You can send mail to the entire list by posting to the
comp.os.linux.development.apps newsgroup.

Linux may be obtained via one of these FTP sites:
    ftp.funet.fi                                pub/Linux
    tsx-11.mit.edu                              pub/linux
    sunsite.unc.edu                             pub/Linux

End of Linux-Development-Apps Digest
******************************

Reply via email to