LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-30-2011, 01:11 AM   #1
rabbit2345
Member
 
Registered: Apr 2007
Location: SC
Distribution: Kubuntu 20.04 LTS
Posts: 378

Rep: Reputation: 41
Can a segmentation fault affect other running programs?


Hi,

So I tried a little C programming, and got a bunch of segmentation fault the first few tries. But from what I understand, the whole purpose of segmentation faults is the protect other programs from the damaging effects of my program. Yet, if I trigger a segfault enough times, weird things happen to my other running programs. I usually run a console inside Kate, and after 10 or so segfaults, Kate sometimes freezes or randomly highlights text, etc. just random behavior. Also, my desktop will occasionally hang and things will start failing, like copying files and such. I have to log out to restore everything to normal, but logging out is difficult since the logout prompt freezes.

I have never experienced such behavior before I began programming, my system has been relatively stable. I run my program from inside Kate's console, so I was wondering if all KDE applications share memory or something, because this has happened once or twice, and only when I trigger a segfault many times. I know segfaults are not good, but they should not affect anything other than itself, right?


thanks,
rabbit2345
 
Old 07-30-2011, 02:13 AM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by rabbit2345 View Post
Hi,

So I tried a little C programming, and got a bunch of segmentation fault the first few tries. But from what I understand, the whole purpose of segmentation faults is the protect other programs from the damaging effects of my program. Yet, if I trigger a segfault enough times, weird things happen to my other running programs. I usually run a console inside Kate, and after 10 or so segfaults, Kate sometimes freezes or randomly highlights text, etc. just random behavior. Also, my desktop will occasionally hang and things will start failing, like copying files and such. I have to log out to restore everything to normal, but logging out is difficult since the logout prompt freezes.

I have never experienced such behavior before I began programming, my system has been relatively stable. I run my program from inside Kate's console, so I was wondering if all KDE applications share memory or something, because this has happened once or twice, and only when I trigger a segfault many times. I know segfaults are not good, but they should not affect anything other than itself, right?


thanks,
rabbit2345
For starters, check the 'kate' memory consumption after each segmentation fault. If it increases, I have a theory.
 
Old 07-30-2011, 03:52 PM   #3
rabbit2345
Member
 
Registered: Apr 2007
Location: SC
Distribution: Kubuntu 20.04 LTS
Posts: 378

Original Poster
Rep: Reputation: 41
Hi,

OK, so I checked kate's memory usage after each segfault, and it doesn't seem to be increasing. But then again, I only crashed the program for 5 minutes or so. The buggy behavior only occurred after a day or so of segfaults.

I'm curious what your theory was, as it may very well be what you're thinking, it just happens slowly throughout the day. Also, the test segfault I triggered was caused by trying to print a string with %i. I'm not sure exactly how to reproduce this bug, but I will continue to monitor kate's memory usage.


thanks,
rabbit2345
 
Old 07-30-2011, 04:22 PM   #4
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
I'm pretty sure the terminal emulator embedded in kate runs as a part of the same process. This means the kate process also handles the pseudo-terminal; therefore, if whatever leads to the segfault does something strange with the pseudo-terminal it might effect kate. About the only things I can think of that might cause that to happen are output of unprintable characters that the emulator might not know how to handle or an "accidental" call to a termios or ioctl operation.
Kevin Barry

PS Try to run the segfaulting program with nohup a bunch of times in the kate terminal and see if it causes the same errors.

PPS I've had problems in recent versions of kate when programming, but I'm not sure the source. Sometimes when I type the characters the cursor will move behind what I'm typing, putting it in reverse, and sometimes backspace will delete characters that aren't by the cursor. This is always localized to a certain part of the document and normally only happens after pasting multiple lines. Maybe your version of kate is buggy, too. I'm also wondering if your problems coincide with kate's code highlighting or code formatting, since I don't imagine you edited many C files in kate before you started programming.

Last edited by ta0kira; 07-30-2011 at 04:32 PM.
 
Old 07-30-2011, 10:52 PM   #5
rabbit2345
Member
 
Registered: Apr 2007
Location: SC
Distribution: Kubuntu 20.04 LTS
Posts: 378

Original Poster
Rep: Reputation: 41
Hi,

I checked the process tables and it does look like the terminal is part of kate instead to a seperate process like I thought before. So the repeated segfaults could potentially have an impact, but they still shouldn't since my program and kate don't share memory. I can also see a my program's entry in the process table, as expected. Also, if kate does share memory, then is it shared with the whole KDE system? Since the logout prompt and konqueror and kdesktop all behave strangely as well.


thanks,
rabbit2345
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
powersaved not running: segmentation fault JamesHall Linux - Software 1 05-18-2007 08:42 PM
Segmentation fault while running RPM KaruppuSwamy.T Linux - General 5 12-03-2004 05:56 AM
Segmentation fault when running ls kd7trn Linux - Software 2 09-10-2004 04:54 PM
Segmentation fault, I can't execute many programs finrold Linux - Software 3 11-20-2003 01:21 AM
segmentation fault running UT linoob Linux - Software 6 09-11-2003 08:33 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration