[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-perl
Subject:    [Kde-perl] OT: Problems when dealing with perl threads....
From:       Gary Greene <greeneg () phoenuxos ! com>
Date:       2005-12-17 2:48:23
Message-ID: 200512162148.26524.greeneg () phoenuxos ! com
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


Not precisely a perlqt issue, but perl related. I'm trying to move the 
system( rpm ) calls into threads and am having trouble getting it to not 
SigSegv. The code is attached and the output from the terminal is also 
attached.

-- 
Gary L. Greene, Jr.
Sent from uriel
  9:42pm  up 1 day  0:04,  7 users,  load average: 0.07, 0.02, 0.00
 
============================================================
Developer and Project Lead for PhoeNUX OS.
 check out http://www.phoenuxos.com/ for more info.
EMAIL : greeneg@phoenuxos.com
============================================================
 

[Attachment #5 (application/pgp-signature)]
["packageInstTester.pl" (application/x-perl)]

#!/usr/bin/perl -w

# Form implementation generated from reading ui file 'installprogressdlg.ui'
#
# Created: Fri Dec 16 17:50:40 2005
#      by: The PerlQt User Interface Compiler (puic)
#
# WARNING! All changes made in this file will be lost!


use strict;
use utf8;


package installProgressDlg;
use Config;
use Cwd;
use threads;
use threads::shared;
use Qt;
use Qt::debug qw|verbose ambiguous calls|;
use Qt::isa qw( Qt::Dialog );
use Qt::attributes qw(
    progressGroup
    instProgrsTxtBox
    currentPackageLbl
    cPackagesPBar1
    totalProgressLbl
    tPackagesRBar_
    exitInstallPrematurelyBttn
);

BEGIN {
    $Config{useithreads} or die "Recompile Perl with threads to run this program.";
}

sub NEW
{
    shift->SUPER::NEW(@_[0..3]);

    if ( name() eq "unnamed" )
    {
        setName("installProgressDlg" );
    }
    setSizePolicy(Qt::SizePolicy(7, 7, 100, 100, \
this->sizePolicy()->hasHeightForWidth()) );  setMinimumSize(Qt::Size(600, 460) );
    setSizeGripEnabled(0 );


    progressGroup = Qt::GroupBox(this, "progressGroup");
    progressGroup->setGeometry( Qt::Rect(10, 0, 580, 470) );

    my $LayoutWidget = Qt::Widget(progressGroup, '$LayoutWidget');
    $LayoutWidget->setGeometry( Qt::Rect(10, 20, 561, 440) );
    my $layout3 = Qt::VBoxLayout($LayoutWidget, 10, 5, '$layout3');

    instProgrsTxtBox = Qt::TextBrowser($LayoutWidget, "isntProgrsTxtBox");
    instProgrsTxtBox->setCursor( Qt::Cursor(4) );
    instProgrsTxtBox->setFrameShape( &Qt::TextBrowser::Box() );
    instProgrsTxtBox->setFrameShadow( &Qt::TextBrowser::Sunken() );
    instProgrsTxtBox->setDragAutoScroll( 1 );
    instProgrsTxtBox->setTextFormat( &Qt::TextBrowser::RichText() );
    instProgrsTxtBox->setLinkUnderline( 0 );
    instProgrsTxtBox->setWordWrap( &Qt::TextBrowser::NoWrap() );
    instProgrsTxtBox->setWrapPolicy( &Qt::TextBrowser::AtWordBoundary() );
    $layout3->addWidget(instProgrsTxtBox);

    my $layout1 = Qt::VBoxLayout(undef, 0, 5, '$layout1');

    currentPackageLbl = Qt::Label($LayoutWidget, "currentPackageLbl");
    $layout1->addWidget(currentPackageLbl);

    cPackagesPBar1 = Qt::ProgressBar($LayoutWidget, "cPackagesPBar1");
    $layout1->addWidget(cPackagesPBar1);

    totalProgressLbl = Qt::Label($LayoutWidget, "totalProgressLbl");
    $layout1->addWidget(totalProgressLbl);

    tPackagesRBar_ = Qt::ProgressBar($LayoutWidget, "tPackagesRBar_");
    $layout1->addWidget(tPackagesRBar_);
    $layout3->addLayout($layout1);

    my $layout2 = Qt::HBoxLayout(undef, 0, 5, '$layout2');
    my $spacer = Qt::SpacerItem(430, 20, &Qt::SizePolicy::Expanding, \
&Qt::SizePolicy::Minimum);  $layout2->addItem($spacer);

    exitInstallPrematurelyBttn = Qt::PushButton($LayoutWidget, \
"exitInstallPrematurelyBttn");  $layout2->addWidget(exitInstallPrematurelyBttn);
    $layout3->addLayout($layout2);
    languageChange();
    my $resize = Qt::Size(600, 480);
    $resize = $resize->expandedTo(minimumSizeHint());
    resize( $resize );
    clearWState( &Qt::WState_Polished );
}


#  Sets the strings of the subwidgets using the current
#  language.

sub languageChange
{
    setCaption(trUtf8("Installation Progress") );
    progressGroup->setTitle( trUtf8("Installation Progress") );
    currentPackageLbl->setText( trUtf8("Current Package:") );
    totalProgressLbl->setText( trUtf8("Total Progress:") );
    exitInstallPrematurelyBttn->setText( trUtf8("&Cancel Install") );
    exitInstallPrematurelyBttn->setAccel( Qt::KeySequence( trUtf8("Alt+C") ) );
}

sub appendMessage {
    chomp( my $inputMsg = $_[ 0 ] );
    print STDOUT "  = ",$inputMsg,"\n";
    instProgrsTxtBox->append( "$inputMsg" );
    Qt::Application::processEvents();
}

sub rpmDbInit {
    sleep 1;
    &appendMessage( "Create RPM base directories...." );
    mkdir "/DEST/var/", 0755;
    mkdir "/DEST/var/lib", 0755;
    mkdir "/DEST/var/lib/rpm", 0755;
    mkdir "/DEST/var/lock", 0755;
    mkdir "/DEST/var/lock/rpm", 0755;
    mkdir "/DEST/var/tmp", 1777;

    sleep 1;
    &appendMessage( "Create RPM Berkley v4 DB...." );
    system( "/bin/rpm --root /DEST --initdb" );
}

sub installBase {
    chomp( my $argsList = $_[ 0 ] );
    our @packages;
    our $tempPkg;
    share( @packages );
    share( $tempPkg );
    opendir( RPMS, "/RPMS/basesystem" ) or warn "Cannot open directory for reading: \
$!\n";  my $i = 0;
    chomp( @packages = readdir( RPMS ) );
    closedir( RPMS );

    my @retval = ();

    if ( $argsList eq "noscripts" ) {
        &appendMessage( "Preparing base operating system." );
    } else {
        &appendMessage( "Installing base operating system." );
    }

    if ( $argsList eq "noscripts" ) {
        for ( my $i = 0; $i < @packages; $i++ ) {
            next if ( $packages[ $i ] eq "." || $packages[ $i ] eq ".." );
            &appendMessage( "Pre-installing: $packages[ $i ] binaries" );
            our $tempPkg = $packages[ $i ];
            my $passOneBaseInstaller = threads->create( \&firstPassBaseInstaller, \
$tempPkg );  print "Outside thread.\n";
            @retval = $passOneBaseInstaller->join;
        }
    } else {
        my @basePackages = ();
        my $dItor = 0;
        for ( my $j = 0; $j < @packages; $j++ ) {
            next if ( $packages[ $j ] eq "." || $packages[ $j ] eq ".." );
            $basePackages[ $dItor ] = "/RPMS/basesystem/".$packages[ $j ]." ";
            $dItor++;
        }

        print STDOUT @basePackages,"\n";
        my $passTwoBaseInstaller = threads->new( \&secPassBaseInstaller, \
@basePackages );  @retval = $passTwoBaseInstaller->join;
    }
}

sub firstPassBaseInstaller {
    chomp( my $package = $_[ 0 ] );
    print "INSIDE THREAD.\n";
    system( "rpm -i --nodeps --noscripts --notriggers --excludedocs --root /DEST \
/RPMS/basesystem/$package" );  print "PACKAGE ( $package ) Installed.\n";
    $package = undef;
}

sub secPassBaseInstaller {
    chomp( my @packages = @_ );
    print "INSIDE THREAD.\n";
    system( "rpm -ivh --replacefiles --replacepkgs @packages --root /DEST" );
}


1;


package main;

use Qt;
use installProgressDlg;

my $a = Qt::Application(\@ARGV);
my $w = installProgressDlg;
$a->setMainWidget($w);
$w->show();

Qt::Application::processEvents();

$w->rpmDbInit();
$w->installBase( 'noscripts' );

exit $a->exec();


["output.txt" (text/plain)]

uriel:/home/greeneg/Documents/src/phinos # ./packageInstTester.pl
Calling method  QApplication* QApplication::QApplication(int&, char**)
with arguments ('1', ARRAY(0x8171390))
Calling method  QDialog* QDialog::QDialog(QWidget*, const char*, bool, Qt::WFlags)
with arguments (undef, undef, undef, undef)
Calling method  const char* QObject::name() const
with arguments ()
Calling method  void QWidget::setName(const char*)
with arguments ('installPro...')
Calling method  QSizePolicy QWidget::sizePolicy() const
with arguments ()
Calling method  bool QSizePolicy::hasHeightForWidth() const
with arguments ()
Calling method  QSizePolicy* QSizePolicy::QSizePolicy(QSizePolicy::SizeType, \
QSizePolicy::SizeType, uchar, uchar, bool) with arguments ('7', '7', '100', '100', \
'') Calling method  void QWidget::setSizePolicy(QSizePolicy)
with arguments (QSizePolicy)
Calling method  QSize* QSize::QSize(int, int)
with arguments ('600', '460')
Calling method  void QWidget::setMinimumSize(const QSize&)
with arguments (QSize)
Calling method  void QDialog::setSizeGripEnabled(bool)
with arguments ('0')
Calling method  QGroupBox* QGroupBox::QGroupBox(QWidget*, const char*)
with arguments (QDialog, 'progressGr...')
Calling method  QRect* QRect::QRect(int, int, int, int)
with arguments ('10', '0', '580', '470')
Calling method  void QWidget::setGeometry(const QRect&)
with arguments (QRect)
Calling method  QWidget* QWidget::QWidget(QWidget*, const char*)
with arguments (QGroupBox, '$LayoutWid...')
Calling method  QRect* QRect::QRect(int, int, int, int)
with arguments ('10', '20', '561', '440')
Calling method  void QWidget::setGeometry(const QRect&)
with arguments (QRect)
Calling method  QVBoxLayout* QVBoxLayout::QVBoxLayout(QWidget*, int, int, const \
char*) with arguments (QWidget, '10', '5', '$layout3')
Calling method  QTextBrowser* QTextBrowser::QTextBrowser(QWidget*, const char*)
with arguments (QWidget, 'isntProgrs...')
Calling method  QCursor* QCursor::QCursor(int)
with arguments ('4')
Calling method  void QWidget::setCursor(const QCursor&)
with arguments (QCursor)
Calling method  static QFrame::Shape QFrame::Box()
with arguments ()
Calling method  void QFrame::setFrameShape(QFrame::Shape)
with arguments ('1')
Calling method  static QFrame::Shadow QFrame::Sunken()
with arguments ()
Calling method  void QFrame::setFrameShadow(QFrame::Shadow)
with arguments ('48')
Calling method  void QScrollView::setDragAutoScroll(bool)
with arguments ('1')
Calling method  static Qt::TextFormat Qt::RichText()
with arguments ()
Calling method  void QTextEdit::setTextFormat(Qt::TextFormat)
with arguments ('1')
Calling method  void QTextEdit::setLinkUnderline(bool)
with arguments ('0')
Calling method  static QTextEdit::WordWrap QTextEdit::NoWrap()
with arguments ()
Calling method  void QTextEdit::setWordWrap(QTextEdit::WordWrap)
with arguments ('0')
Calling method  static QTextEdit::WrapPolicy QTextEdit::AtWordBoundary()
with arguments ()
Calling method  void QTextEdit::setWrapPolicy(QTextEdit::WrapPolicy)
with arguments ('0')
Calling method  void QBoxLayout::addWidget(QWidget*)
with arguments (QTextBrowser)
Calling method  QVBoxLayout* QVBoxLayout::QVBoxLayout(QWidget*, int, int, const \
char*) with arguments (undef, '0', '5', '$layout1')
Calling method  QLabel* QLabel::QLabel(QWidget*, const char*)
with arguments (QWidget, 'currentPac...')
Calling method  void QBoxLayout::addWidget(QWidget*)
with arguments (QLabel)
Calling method  QProgressBar* QProgressBar::QProgressBar(QWidget*, const char*)
with arguments (QWidget, 'cPackagesP...')
Calling method  void QBoxLayout::addWidget(QWidget*)
with arguments (QProgressBar)
Calling method  QLabel* QLabel::QLabel(QWidget*, const char*)
with arguments (QWidget, 'totalProgr...')
Calling method  void QBoxLayout::addWidget(QWidget*)
with arguments (QLabel)
Calling method  QProgressBar* QProgressBar::QProgressBar(QWidget*, const char*)
with arguments (QWidget, 'tPackagesR...')
Calling method  void QBoxLayout::addWidget(QWidget*)
with arguments (QProgressBar)
Calling method  void QBoxLayout::addLayout(QLayout*)
with arguments (QVBoxLayout)
Calling method  QHBoxLayout* QHBoxLayout::QHBoxLayout(QWidget*, int, int, const \
char*) with arguments (undef, '0', '5', '$layout2')
Lookup for QSizePolicy::Expanding(undef, undef, undef, undef)
did not yeld any result.
Might be a call for an enumerated value (enum).
Trying QSizePolicy::Expanding() with no arguments
at ./packageInstTester.pl line 84.
Calling method  static QSizePolicy::SizeType QSizePolicy::Expanding()
with arguments (undef, undef, undef, undef)
Lookup for QSizePolicy::Minimum(undef, undef, undef, undef)
did not yeld any result.
Might be a call for an enumerated value (enum).
Trying QSizePolicy::Minimum() with no arguments
at ./packageInstTester.pl line 84.
Calling method  static QSizePolicy::SizeType QSizePolicy::Minimum()
with arguments (undef, undef, undef, undef)
Calling method  QSpacerItem* QSpacerItem::QSpacerItem(int, int, \
QSizePolicy::SizeType, QSizePolicy::SizeType) with arguments ('430', '20', '7', '1')
Calling method  void QBoxLayout::addItem(QLayoutItem*)
with arguments (QSpacerItem)
Calling method  QPushButton* QPushButton::QPushButton(QWidget*, const char*)
with arguments (QWidget, 'exitInstal...')
Calling method  static QMetaObject* QDialog::staticMetaObject()
with arguments ()
Calling method  void QBoxLayout::addWidget(QWidget*)
with arguments (QPushButton)
Calling method  void QBoxLayout::addLayout(QLayout*)
with arguments (QHBoxLayout)
Calling method  static QString QDialog::trUtf8(const char*)
with arguments ('Installati...')
Calling method  void QWidget::setCaption(const QString&)
with arguments ('Installati...')
Calling method  static QString QDialog::trUtf8(const char*)
with arguments ('Installati...')
Calling method  void QGroupBox::setTitle(const QString&)
with arguments ('Installati...')
Calling method  static QString QDialog::trUtf8(const char*)
with arguments ('Current Pa...')
Calling method  void QLabel::setText(const QString&)
with arguments ('Current Pa...')
Calling method  static QString QDialog::trUtf8(const char*)
with arguments ('Total Prog...')
Calling method  void QLabel::setText(const QString&)
with arguments ('Total Prog...')
Calling method  static QString QDialog::trUtf8(const char*)
with arguments ('&Cancel In...')
Calling method  void QButton::setText(const QString&)
with arguments ('&Cancel In...')
Calling method  static QString QDialog::trUtf8(const char*)
with arguments ('Alt+C')
Calling method  QKeySequence* QKeySequence::QKeySequence(const QString&)
with arguments ('Alt+C')
Calling method  void QButton::setAccel(const QKeySequence&)
with arguments (QKeySequence)
Calling method  QSize* QSize::QSize(int, int)
with arguments ('600', '480')
Calling method  QSize QDialog::minimumSizeHint() const
with arguments ()
Calling method  QSize QSize::expandedTo(const QSize&) const
with arguments (QSize)
Calling method  void QDialog::resize(const QSize&)
with arguments (QSize)
Lookup for Qt::WState_Polished(undef, undef, undef, undef)
did not yeld any result.
Might be a call for an enumerated value (enum).
Trying Qt::WState_Polished() with no arguments
at ./packageInstTester.pl line 94.
Calling method  static Qt::WidgetState Qt::WState_Polished()
with arguments (undef, undef, undef, undef)
Calling method  void QWidget::clearWState(uint)
with arguments ('8192')
Calling method  QWidget* QLayoutItem::widget()
with arguments ()
Calling method  QLayout* QLayoutItem::layout()
with arguments ()
Calling method  QWidget* QLayout::mainWidget()
with arguments ()
Calling method  QWidget* QLayout::mainWidget()
with arguments ()
Calling method  QWidget* QLayout::mainWidget()
with arguments ()
Calling method  QObject* QObject::parent() const
with arguments ()
Calling method  void QApplication::setMainWidget(QWidget*)
with arguments (QDialog)
Calling method  void QDialog::show()
with arguments ()
Calling method  void QApplication::processEvents()
with arguments ()
  = Create RPM base directories....
Calling method  void QTextEdit::append(const QString&)
with arguments ('Create RPM...')
Calling method  void QApplication::processEvents()
with arguments ()
  = Create RPM Berkley v4 DB....
Calling method  void QTextEdit::append(const QString&)
with arguments ('Create RPM...')
Calling method  void QApplication::processEvents()
with arguments ()
  = Preparing base operating system.
Calling method  void QTextEdit::append(const QString&)
with arguments ('Preparing ...')
Calling method  void QApplication::processEvents()
with arguments ()
  = Pre-installing: setup-2.6-1pnx.i586.rpm binaries
Calling method  void QTextEdit::append(const QString&)
with arguments ('Pre-instal...')
Calling method  void QApplication::processEvents()
with arguments ()
Outside thread.
INSIDE THREAD.
PACKAGE ( setup-2.6-1pnx.i586.rpm ) Installed.
Attempt to free non-existent shared string '144382568', Perl interpreter: 0x8ae4548 \
during global destruction. Attempt to free non-existent shared string '144382608', \
Perl interpreter: 0x8ae4548 during global destruction. Attempt to free non-existent \
shared string '144985808', Perl interpreter: 0x8ae4548 during global destruction. \
Attempt to free non-existent shared string '144985848', Perl interpreter: 0x8ae4548 \
during global destruction. Attempt to free non-existent shared string '144606496', \
Perl interpreter: 0x8ae4548 during global destruction. Attempt to free non-existent \
shared string '144606536', Perl interpreter: 0x8ae4548 during global destruction. \
Attempt to free non-existent shared string '144975736', Perl interpreter: 0x8ae4548 \
during global destruction. Attempt to free non-existent shared string '144975776', \
Perl interpreter: 0x8ae4548 during global destruction. Attempt to free non-existent \
shared string '143581608', Perl interpreter: 0x8ae4548 during global destruction. \
Attempt to free non-existent shared string '143581648', Perl interpreter: 0x8ae4548 \
during global destruction. Attempt to free non-existent shared string '143573616', \
Perl interpreter: 0x8ae4548 during global destruction. Attempt to free non-existent \
shared string '143573656', Perl interpreter: 0x8ae4548 during global destruction. \
Attempt to free non-existent shared string '143672760', Perl interpreter: 0x8ae4548 \
during global destruction. Attempt to free non-existent shared string '143672800', \
Perl interpreter: 0x8ae4548 during global destruction. Attempt to free non-existent \
shared string '143675400', Perl interpreter: 0x8ae4548 during global destruction. \
Attempt to free non-existent shared string '143675440', Perl interpreter: 0x8ae4548 \
during global destruction. Attempt to free non-existent shared string '144953856', \
Perl interpreter: 0x8ae4548 during global destruction. Attempt to free non-existent \
shared string '144953896', Perl interpreter: 0x8ae4548 during global destruction. \
Attempt to free non-existent shared string '144086272', Perl interpreter: 0x8ae4548 \
during global destruction. Attempt to free non-existent shared string '144086312', \
Perl interpreter: 0x8ae4548 during global destruction. Attempt to free non-existent \
shared string '144388480', Perl interpreter: 0x8ae4548 during global destruction. \
Attempt to free non-existent shared string '143678288', Perl interpreter: 0x8ae4548 \
during global destruction. Attempt to free non-existent shared string '143678328', \
Perl interpreter: 0x8ae4548 during global destruction. Attempt to free non-existent \
shared string '144454528', Perl interpreter: 0x8ae4548 during global destruction. \
Attempt to free non-existent shared string '144454568', Perl interpreter: 0x8ae4548 \
during global destruction. Segmentation fault



_______________________________________________
Kde-perl mailing list
Kde-perl@kde.org
https://mail.kde.org/mailman/listinfo/kde-perl


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic