Ticket #571 (new バグ指摘)

Opened 14 years ago

Last modified 10 years ago

セッション変数の排他制御で不具合

Reported by: Seasoft Owned by: seasoft
Priority: Milestone: バックログ
Component: その他 Version: コミュニティ (eccube-comu)
Keywords: Cc:
修正済み: no

Description (last modified by Seasoft) (diff)

セッション変数の排他制御に不具合を見つけました。

(1) 14:12:40 	/index.php 		sfSessRead
(2) 14:12:45 	/index.php 		sfSessWrite
(3) 14:12:45 	/resize_image.php 	sfSessRead
(4) 14:12:47 	/index.php 		sfSessRead ← これが問題
(5) 14:12:50 	/resize_image.php 	sfSessWrite
(6) 14:12:52 	/index.php 		sfSessWrite
(7) 14:12:52 	/resize_image.php 	sfSessRead
(8) 14:12:57 	/resize_image.php 	sfSessWrite

※ /index.php と /resize_image.php は処理に約5秒間要するようにしてあります。

(3)(4)は、何れも(2)時点のデータを参照しており、(5)の書き込みを(6)が上書きしています。

そこで、SC_Helper_Session で行なっている session_set_save_handler を外すと、(4)は(5)の後に発生し、問題は解決されました。

ならば、EC-CUBE のセッション管理の不具合かと思い、PHP 公式マニュアルの session_set_save_handler 関数に書かれたサンプルに差し替えて見ました。しかし、同様の症状が発生しました。よって、PHP の session_set_save_handler 関数の不具合ということだと思うのですが、アプリケーション側で救えないでしょうか?

なお、同じファイル同士 ( /index.php 同士など ) では、適切にロックが行なわれました。 /index.php と /products/list.php の組み合わせなどは NG でした。

※ PHP 5.2.9 / FreeBSD & Linux にて再現確認しております。

傾向

  • resize_image.php の利用が多いと発生しやすいようです。
  • クライアント環境の通信が低速な環境ほど、発生しやすいです。(PHS通信カードで検証すると、簡単に再現できました。)

Change History

comment:1 Changed 14 years ago by Seasoft

  • Description modified (diff)

comment:2 follow-up: ↓ 4 Changed 14 years ago by nanasess

具体的には, セッションを OPEN しているのにも関わらず, 別のファイルからアクセスすると WRITE してしまう現象ということでよろしいでしょうか?

Apache や, PHP のコンパイルオプションはどのようになっていますでしょうか? また, KeepAlive? は ON になっていますでしょうか?

できれば EC-CUBE を使用しないでの再現ケースがあると良いと思います.

bugs.php.net に報告など必要でしたら手伝います!

comment:3 in reply to: ↑ description Changed 14 years ago by Seasoft

フォーラムにて AMUAMU 様より、「確か当該PHPのバグはPHP 5.3でfixされていた気がします」との情報をいただきました。
 http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=5090&forum=1

当方では未検証です。

comment:4 in reply to: ↑ 2 Changed 14 years ago by Seasoft

nanasess への返信

具体的には, セッションを OPEN しているのにも関わらず, 別のファイルからアクセスすると WRITE してしまう現象ということでよろしいでしょうか?

現状確認されているのは、「セッションを OPEN しているのにも関わらず, 別のファイルからアクセスすると READ してしまう現象」となります。

Apache や, PHP のコンパイルオプションはどのようになっていますでしょうか?

Apache

Server version: Apache/2.2.9 (Unix)
Server built:   Jul 14 2008 15:36:56
Server's Module Magic Number: 20051115:15
Server loaded:  APR 1.2.12, APR-Util 1.2.12
Compiled using: APR 1.2.12, APR-Util 1.2.12
Architecture:   32-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/etc/httpd"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

PHP

phpinfo()
PHP Version => 5.2.9

System => Linux localhost.localdomain 2.6.27.25-78.2.56.fc9.i686 #1 SMP Thu Jun 18 12:47:50 EDT 2009 i686
Build Date => Apr 17 2009 03:40:39
Configure Command =>  './configure'  '--build=i386-redhat-linux-gnu' '--host=i386-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--enable-gd-native-ttf' '--with-t1lib=/usr' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar' '--without-mime-magic' '--without-sqlite' '--with-libxml-dir=/usr' '--enable-xml' '--with-system-tzdata' '--enable-force-cgi-redirect' '--enable-pcntl' '--with-imap=shared' '--with-imap-ssl' '--enable-mbstring=shared' '--enable-mbregex' '--with-ncurses=shared' '--with-gd=shared' '--enable-bcmath=shared' '--enable-dba=shared' '--with-db4=/usr' '--with-xmlrpc=shared' '--with-ldap=shared' '--with-ldap-sasl' '--with-mysql=shared,/usr' '--with-mysqli=shared,/usr/bin/mysql_config' '--enable-dom=shared' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--enable-soap=shared' '--with-xsl=shared,/usr' '--enable-xmlreader=shared' '--enable-xmlwriter=shared' '--enable-fastcgi' '--enable-pdo=shared' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-mysql=shared,/usr' '--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr' '--with-pdo-dblib=shared,/usr' '--enable-json=shared' '--enable-zip=shared' '--with-readline' '--enable-dbase=shared' '--with-pspell=shared' '--with-mcrypt=shared,/usr' '--with-mhash=shared,/usr' '--with-tidy=shared,/usr' '--with-mssql=shared,/usr' '--with-unixODBC=shared,/usr'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
Scan this dir for additional .ini files => /etc/php.d
additional .ini files parsed => /etc/php.d/dbase.ini,
/etc/php.d/gd.ini,
/etc/php.d/json.ini,
/etc/php.d/mbstring.ini,
/etc/php.d/mysql.ini,
/etc/php.d/mysqli.ini,
/etc/php.d/pdo.ini,
/etc/php.d/pdo_mysql.ini,
/etc/php.d/pdo_pgsql.ini,
/etc/php.d/pdo_sqlite.ini,
/etc/php.d/pgsql.ini,
/etc/php.d/xdebug.ini,
/etc/php.d/zip.ini

PHP API => 20041225
PHP Extension => 20060613
Zend Extension => 220060519
Debug Build => no
Thread Safety => disabled
Zend Memory Manager => enabled
IPv6 Support => enabled
Registered PHP Streams => php, file, data, http, ftp, compress.bzip2, compress.zlib, https, ftps, zip
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters => string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, convert.iconv.*, bzip2.*, zlib.*

また, KeepAlive? は ON になっていますでしょうか?

httpd.conf

KeepAlive Off

comment:5 Changed 14 years ago by kajiwara

  • Milestone changed from EC-CUBE2.4.3 to EC-CUBE2.4.4

こちらですが、もう少し確認が必要かと思いますので、次期バージョンにマイルストーンを変更させていただきたいと思います。

申し訳ございませんが、よろしくお願いいたします。

comment:6 Changed 14 years ago by nanasess

2.4.x での根本解決が難しそうですので、 milestone:EC-CUBE2.5.0 へ変更します

comment:7 Changed 14 years ago by nanasess

  • Milestone changed from EC-CUBE2.4.4 to EC-CUBE2.5.0

comment:8 follow-up: ↓ 9 Changed 14 years ago by nanasess

  • Priority changed from to

comment:9 in reply to: ↑ 8 Changed 14 years ago by Seasoft

  • Description modified (diff)

今のところ、私どものお客様環境で、2サイト(別々のオーナー)で具体的な不具合が検出されました。

何れも、PHP 5.2 系の環境です。

comment:10 Changed 13 years ago by nanasess

  • Milestone changed from EC-CUBE2.5.0beta to EC-CUBE2.5.1(仮)

comment:11 Changed 13 years ago by kotani

  • 修正済み unset
  • Milestone changed from EC-CUBE2.11.1 to EC-CUBE2.12.0(仮)

comment:12 Changed 12 years ago by kajiwara

  • Milestone changed from EC-CUBE2.12.0 to バックログ

こちら、かなり時間が立っているようですので一旦担当者を外させていただきます。

comment:13 follow-up: ↓ 14 Changed 12 years ago by nanasess

r21638 の修正で解消されていると思われますが, いかがでしょう?

再現可能な環境をお持ちの方は確認をお願いします.

comment:14 in reply to: ↑ 13 Changed 10 years ago by Seasoft

nanasess への返信

r21638 の修正で解消されていると思われますが, いかがでしょう?

EC-CUBE 2.12.2 / PHP 5.2.5 の環境で再現が疑われる(不確実です)現象が見られました。

バキュームが行われておらず dtb_session の (行数は少ないものの) アクセス速度が極端に低下している状況下で発現しております。アクセス回線は良好な環境でした。

Note: See TracTickets for help on using tickets.