Python crashes after attaching pty to a konsole kpart

Bug #117731 reported by Martin Böhm
14
Affects Status Importance Assigned to Milestone
python-kde3 (Ubuntu)
Fix Released
High
Jonathan Riddell
Feisty
Fix Released
High
Jonathan Riddell
Gutsy
Fix Released
High
Jonathan Riddell

Bug Description

Binary package hint: python-kde3

Python crashes when a pty is attached to a konsole KPart.

The code snippet that causes the crash:

        (self.master, self.slave) = pty.openpty()
        self.konsole.setPtyFd(self.master) # this line triggers it

The result:

kdecore (KProcess): WARNING: setPty()
kdecore (KProcess): WARNING: _attachPty() 10
In file tools/qgvector.cpp, line 176: Out of memory
KCrash: Application 'gd-test.py' crashing...

Affected applications:
* kubuntu dist-upgrade tool (update-manager)
* kubuntu gdebi tool (gdebi) -- to be released for Gutsy

Revision history for this message
Martin Böhm (martin.bohm) wrote :

On my older machine ( Pentium III, 320MB RAM ), it does crash every time for:
 * Kubuntu 7.04 with KDE 3.5.6
 * Kubuntu 7.04 with KDE 3.5.7

and it won't crash for:
 * Kubuntu 6.10 with pre-update repositories

Revision history for this message
Scott Kitterman (kitterman) wrote :

I took a bit of a look at this and have some ideas.

Would you please attach your gd-test.py program to the bug so I can test without having to recreate it.

Changed in python-kde3:
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Martin Böhm (martin.bohm) wrote :

Uploading a file that should be enough to test the error ( I'm not on an affected machine, so someone has to test it).

Revision history for this message
Scott Kitterman (kitterman) wrote :

Thanks for the test case. That does it.

Changed in python-kde3:
assignee: nobody → kitterman
status: Confirmed → Triaged
Revision history for this message
Martin Böhm (martin.bohm) wrote :

I fixed a forgotten "import" in the test case that made it dependent on gdebi-kde.

Revision history for this message
Scott Kitterman (kitterman) wrote :

I'm pretty sure this is in Konsole somewhere and I'm equally sure I won't be able to fix it.

Changed in python-kde3:
assignee: kitterman → nobody
Revision history for this message
Frode M. Døving (frode) wrote :

from gutsy qt, tools/qgvector.cpp:

QGVector::QGVector( uint size )·· · // create vectors with nullptrs
{
    len = size;
    numItems = 0;
    if ( len == 0 ) {· · · · // zero length
· vec = 0;
· return;
    }
    vec = NEW(Item,len);
    Q_CHECK_PTR( vec ); // this is line 176
    memset( (void*)vec, 0, len*sizeof(Item) );· // fill with nulls
}

Revision history for this message
Martin Böhm (martin.bohm) wrote :

Explanation for the "Out of memory" message, quoting Qt Docs:

void Q_CHECK_PTR ( void * p )
  If p is 0, prints a warning message containing the source code file name and line number, saying that the program ran out of memory.

Revision history for this message
Scott Kitterman (kitterman) wrote : Re: [Bug 117731] Re: Python crashes after attaching pty to a konsole kpart

That would match my theory that the oom message is a symptom not where the
root cause is.

Revision history for this message
Scott Kitterman (kitterman) wrote :

Just to keep things interesting...

The edgy-updates SRU had a kdelibs part too. Here is the diff from the pty related patch from edgy-updates to gutsy. Someone who actually understands the code is going to have to peck through it and see if there are any gems.

Martin Pitt (pitti)
Changed in python-kde3:
assignee: nobody → jr
Revision history for this message
Jonathan Riddell (jr) wrote :

Postponing, this is hardly a new bug, it doesn't affect everyone and we'll look at it after feature freeze.

Revision history for this message
Martin Böhm (martin.bohm) wrote :
Revision history for this message
Martin Böhm (martin.bohm) wrote :
Revision history for this message
Martin Böhm (martin.bohm) wrote :
Revision history for this message
Jonathan Riddell (jr) wrote :
Revision history for this message
Martin Böhm (martin.bohm) wrote :

After extensive testing and patching, I have discovered that the bug is located in the kdebase/konsole/konsole/TEHistory.cpp file. Reverting it to pre-feisty state helps.

Revision history for this message
Henrik Nilsen Omma (henrik) wrote :

Moving milestone to beta.

Revision history for this message
Martin Böhm (martin.bohm) wrote :

This diff of TEHistory.cpp and TEHistory.h (between KDE 3.5.7 a 3.5.5) contains the problematic code.

Revision history for this message
Jonathan Riddell (jr) wrote :

I've uploaded to gutsy and there havn't been any problems.

Since this is needed for the dist upgrade tool I've prepared a patch for feisty-proposed, attached.

Changed in python-kde3:
status: Triaged → Fix Released
Jonathan Riddell (jr)
Changed in python-kde3:
assignee: nobody → jr
status: New → In Progress
Revision history for this message
Scott Kitterman (kitterman) wrote :

I ran Martin's test script that had (before) reproduced the problem on my Gutsy machine and it now runs correctly. If someone can provide a Feisty Konsole package to test, I can test on the same machine there.

Revision history for this message
Martin Pitt (pitti) wrote :

Changelog: Can you please use the standard "LP: #1234" syntax and describe the patch and its rationale a bit? (This will be read by users upgrading their stable releases).

The diff is quite intrusive, and I am not able to verify it with eyeballing. However, this more or less seems to be a revert to a previous state of the code, so if it has been tested in gutsy, I am fine with it.

Revision history for this message
Scott Kitterman (kitterman) wrote :

The proposed change solves the problem on my KDE 3.5.6 Feisty machine. Ran the mhb's script before the update and got the OOM crash. Ran it after with no problem.

Revision history for this message
Scott Kitterman (kitterman) wrote :

Marking High for Feisty because dist-upgrades to Gutsy on low memory machines (RAM + swap < ~ 1.5 GB) will fail.

Changed in python-kde3:
importance: Undecided → High
Revision history for this message
Jonathan Riddell (jr) wrote :

uploaded to feisty-proposed

Jonathan Riddell (jr)
Changed in python-kde3:
status: In Progress → Fix Committed
Revision history for this message
James D. Freels (freelsjd) wrote :

I now have this problem in feisty due to an upgrade to kdebase et al on 09/26 (3.5.6-0ubuntu20.4). I would rather not upgrade to gutsy at the moment and my konsole is NOT usable. Crashes with the following error message:

konsole
kdecore (KProcess): WARNING: _attachPty() 11
KCrash: Application 'konsole' crashing...

when opened from gnome-terminal !

Revision history for this message
Scott Kitterman (kitterman) wrote : Re: [Bug 117731] Re: Python crashes after attaching pty to a konsole kpart

That's a different bug than this one.

Revision history for this message
Thanos (r-lemme) wrote :

>>>> Marking High for Feisty because dist-upgrades to Gutsy on low memory machines (RAM + swap < ~ 1.5 GB) will fail.

I have the same error with 3Gb ram + 2Gb swap

Revision history for this message
Brian Murray (brian-murray) wrote :

I verified that the test cases provided no longer crash with konsole version 3.5.6-0ubuntu20.3. I used both Martin's gd-test.py and Riddell's konsole.py test applications. They both caused crashes with konsole version 3.5.6-0ubuntu20.4.

Revision history for this message
Jonathan Riddell (jr) wrote :

package moved to -updates

Martin Pitt (pitti)
Changed in python-kde3:
status: Fix Committed → Fix Released
Revision history for this message
Matevž Jekovec (matevz-jekovec) wrote :

I'm still having out-of-RAM crashes in kubuntu gdebi. Using the latest updated gutsy.

Revision history for this message
Matevž Jekovec (matevz-jekovec) wrote :

I have 512MB of physical RAM and 700MB swap.
gdebi-kde returns
kdecore (KProcess): WARNING: setPty()

kdecore (KProcess): WARNING: _attachPty() 27

before crashing.

Revision history for this message
Scott Kitterman (kitterman) wrote : Re: [Bug 117731] Re: Python crashes after attaching pty to a konsole kpart

Probably a different bug. Please file it against thar package.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.