Segmentation fault on remote server.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello people.

On a site which I made for a friend of mine, dedicated to organizing
student exchanges, I wrote a simple flash which updates the top logo with
several images, when someone enters, after a certain time.
(http://tcef.org)

After a while, I noticed 'core' dump in several directories. There
doesn't seem to be any error in the generation of the logo itself. Still,
each time the logo is generated, I find a new core. I have a copy of the
site at home - no problem.

So I compiled a 'gdb' on the site, and ran 'gdb php.cgi core':

Loaded symbols for /usr/lib/libz.so.1
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
Failed to read a valid object file image from memory.
Core was generated by `php.cgi'.
Program terminated with signal 11, Segmentation fault.
[New process 9983]
#0  0x00002ba7967eab6c in ming_gc_remove_node (node=0xb73cc0) at gc.c:46
46			node->prev->next = node->next;

gdb> bt
#0  0x00002ba7967eab6c in ming_gc_remove_node (node=0xb73cc0) at gc.c:46
#1  0x00002ba7968014c6 in destroySWFJpegBitmap (jpegBitmap=0xb73d40) at jpeg.c:247
#2  0x00000000006b8a1e in list_entry_destructor (ptr=<value optimized out>) at /home/tcef1/src/php-5.2.9/Zend/zend_list.c:184
#3  0x00000000006b5e3a in zend_hash_apply_deleter (ht=0x9cac08, p=0x2ba797b7be50) at /home/tcef1/src/php-5.2.9/Zend/zend_hash.c:611
#4  0x00000000006b60a8 in zend_hash_graceful_reverse_destroy (ht=0x9cac08) at /home/tcef1/src/php-5.2.9/Zend/zend_hash.c:646
#5  0x00000000006abcda in zend_deactivate () at /home/tcef1/src/php-5.2.9/Zend/zend.c:866
#6  0x000000000066c3f5 in php_request_shutdown (dummy=<value optimized out>) at /home/tcef1/src/php-5.2.9/main/main.c:1492
#7  0x000000000072896b in main (argc=1, argv=0x7fff14cdf4d8) at /home/tcef1/src/php-5.2.9/sapi/cgi/cgi_main.c:2053


I notice the problem with destroySWFJpegBitmap, but that's about as far as my knowledge
goes. Debugging over a SSH and a not too fast ADSL isn't too easy either. I tried to install
Ming 0.4, but had problems recompiling PHP.

libming.so.0.3.0
php 5.2.9

The code causing the problem (this is my first attempt at using ming!):

  $imgsep = 3;
  $imgext = "jpeg";
  // First we make a list of images available.
  $imgdir = "img/topimages";
  if ($dir = @opendir($imgdir)) {
    while (($file = readdir($dir)) !== false) {
      if (!ereg("[0-9][0-9][0-9]\." . $imgext, $file)) continue;
      $imgs[] = $file;
    }
    closedir($dir);   
    unset($img);
    $totw = $imgsep;
    // Select enough random images to fill (at least) 800 pixels wide
    while ($totw < 800) { 
      $idx = rand(0, count($imgs)-1);
      $file = $imgs[$idx];
      $size = getimagesize($imgdir . "/" . $file);
      $flist[$file] = $size[0];
      $totw += $size[0] + $imgsep;
      unset($imgs[$indx]);
    }
    // Start the movie
    $mov = new SWFMovie();
    $mov->setBackground(0,0,0);
    $mov->setDimension($totw, 137);
    $mov->setframes(2000);
    $nextx = 0;
    $imgnr = 0;
    // Now add all the images to the movie
    $pos = $imgsep;
    foreach ($flist as $img => $wid) {
      $bm = new SWFBitmap(fopen($imgdir . "/" . $img, "r"));
      $bm_id[$img] = $mov->add($bm);
      $bm_id[$img]->moveto($pos, 0);
      $bm_id[$img]->scaleto(1, 0);
      $pos += $wid + $imgsep;  
      // Set a random number to determine moment of appearance
      $flist[$img] = rand(0, 10);
    }
    // Make all images appear slowly
    $i = 0;
    $more = 1;
    while ($more) {
      $mov->nextFrame();
      $more = 0;
      foreach ($flist as $img => $wid) {
        if ($i > $wid) {
          $factor = ($i - $wid)/10;
          if ($factor >= 1.0) 
            $factor = 1.0;
          else
            $more = 1;
          $bm_id[$img]->scaleto(1, $factor*$factor);
        } else
          $more = 1;
      }
      $i++;
    }
    // Wait a bit
    for ($i = 0; $i < 4; $i++)
      $mov->nextframe();
    // Then make the title appear
    $bm = new SWFBitmap(fopen($imgdir . "/chase.jpeg", "r"),
                        fopen($imgdir . "/chase.msk", "r"));
    $bm_id = $mov->add($bm);
    $bm_id->moveto(120, 140);
    // Shift the image in
    for ($i = 140; $i > 100; $i -= 2) {
      $mov->nextframe();
      $bm_id->moveto(120, $i);
    }
    // Get the logo
    $bm = new SWFBitmap(fopen($imgdir . "/logo.jpeg", "r"),
                        fopen($imgdir . "/logo.msk", "r"));
    $bm_id = $mov->add($bm);
    $bm_id->scaleto(0, 1);
    $bm_id->moveto(12, 10); 
    // And make the logo appear
    for ($i = 0; $i <= 1.0; $i += 0.1) {
      $mov->nextframe();
      $bm_id->scaleto($i, 1);
    }
    // Save the movie
    $mov->save("img/topmovie/toplogo.swf");
  }

------------------------------------------------------------------------------
_______________________________________________
Ming-users mailing list
Ming-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/ming-users

[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux