Mantis - Quercus
Viewing Issue Advanced Details
1991 block always 09-05-07 06:55 10-29-07 14:31
rsouissi  
mo  
normal  
closed 3.1.2  
fixed  
none    
none 3.1.4  
0001991: Cannot run phpBB3RC5
I use the following:
- Resin Pro 3.1.2 and Resin 3.1.2
- JVM 1.6
- Windows XP
- PostgreSQL 8.2 and MySQL 5.0

PHPB3 installs correctly, but when I run the main page, I get this error (in Additional Information section below).

Then I had the idea to rename /phpBB3/cache folder, and I had it working on some pages, until I hit the Administration Panel, where I have this problem:

500 Servlet Exception
string::159: ')' is an unexpected token, expected an expression. in
string::158:
string::159: <?php $_log_count = (isset($this->_tpldata['log'])) ? sizeof($this->_tpldata['log'])
: 0;if ($_log_count) {for ($_log_i = 0; $_log_i < $_log_count; ++$_log_i){$_log_val
= &$this->_tpldata['log'][$_log_i]; if ( ) { ?><?php
} else { ?><?php } ?>
string::160:

So the problem is related to writing php pages in the cache directory which is new to phpBB3.
Also, it seems the behavior of Quercus is different from native PHP because I tried the phpservlet.jar and the native PHP installation and it works normally.

Regards,
R
500 Servlet Exception
java.io.IOException: The process cannot access the file because another
process has locked a portion of the file
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:260)
at com.caucho.vfs.VfsStream.write(VfsStream.java:201)
at com.caucho.vfs.StreamImpl.write(StreamImpl.java:211)
at com.caucho.vfs.WriteStream.write(WriteStream.java:283)
at com.caucho.quercus.lib.file.FileOutput.write(FileOutput.java:136)
at com.caucho.quercus.lib.file.AbstractBinaryOutput.write(AbstractBinaryOutput.java:83)
at com.caucho.quercus.lib.file.FileModule.fwrite(FileModule.java:1681)
at _quercus._phpbb3._includes._functions_0template__php$quercus_template_compile$fun_compile_write.callMethod(C:/Documents and Settings/Riad/Desktop/resin-pro-3.1.2/webapps/php/phpBB3/includes/functions_template.php:751)
at com.caucho.quercus.env.QuercusClass.callMethod(QuercusClass.java:664)
at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:626)
at _quercus._phpbb3._includes._functions_0template__php$quercus_template_compile$fun__tpl_load_file.callMethod(C:/Documents and Settings/Riad/Desktop/resin-pro-3.1.2/webapps/php/phpBB3/includes/functions_template.php:65)
at com.caucho.quercus.program.CompiledMethod_2.callMethod(CompiledMethod_2.java:111)
at com.caucho.quercus.env.QuercusClass.callMethod(QuercusClass.java:641)
at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:615)
at com.caucho.quercus.env.Var.callMethod(Var.java:1005)
at _quercus._phpbb3._includes._template__php$quercus_template$fun__tpl_load.callMethod(C:/Documents and Settings/Riad/Desktop/resin-pro-3.1.2/webapps/php/phpBB3/includes/template.php:288)
at com.caucho.quercus.env.QuercusClass.callMethod(QuercusClass.java:641)
at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:615)
at _quercus._phpbb3._includes._template__php$quercus_template$fun__tpl_include.callMethod(C:/Documents and Settings/Riad/Desktop/resin-pro-3.1.2/webapps/php/phpBB3/includes/template.php:507)
at com.caucho.quercus.env.QuercusClass.callMethod(QuercusClass.java:664)
at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:626)
at _quercus._phpbb3._includes._functions_0template__php$quercus_template_compile$fun_compile.callMethod(C:/Documents and Settings/Riad/Desktop/resin-pro-3.1.2/webapps/php/phpBB3/includes/functions_template.php:203)
at com.caucho.quercus.program.CompiledMethod_3.callMethod(CompiledMethod_3.java:99)
at com.caucho.quercus.program.AbstractFunction.callMethod(AbstractFunction.java:386)
at com.caucho.quercus.env.QuercusClass.callMethod(QuercusClass.java:641)
at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:615)
at _quercus._phpbb3._includes._functions_0template__php$quercus_template_compile$fun__tpl_load_file.callMethod(C:/Documents and Settings/Riad/Desktop/resin-pro-3.1.2/webapps/php/phpBB3/includes/functions_template.php:62)
at com.caucho.quercus.program.CompiledMethod_2.callMethod(CompiledMethod_2.java:111)
at com.caucho.quercus.env.QuercusClass.callMethod(QuercusClass.java:641)
at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:615)
at com.caucho.quercus.env.Var.callMethod(Var.java:1005)
at _quercus._phpbb3._includes._template__php$quercus_template$fun__tpl_load.callMethod(C:/Documents and Settings/Riad/Desktop/resin-pro-3.1.2/webapps/php/phpBB3/includes/template.php:288)
at com.caucho.quercus.env.QuercusClass.callMethod(QuercusClass.java:641)
at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:615)
at _quercus._phpbb3._includes._template__php$quercus_template$fun_display.callMethod(C:/Documents and Settings/Riad/Desktop/resin-pro-3.1.2/webapps/php/phpBB3/includes/template.php:156)
at com.caucho.quercus.program.CompiledMethod_2.callMethod(CompiledMethod_2.java:111)
at com.caucho.quercus.env.QuercusClass.callMethod(QuercusClass.java:641)
at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:615)
at com.caucho.quercus.env.Var.callMethod(Var.java:1005)
at _quercus._phpbb3._includes._functions__php$fun_page_footer.call(C:/Documents and Settings/Riad/Desktop/resin-pro-3.1.2/webapps/php/phpBB3/includes/functions.php:4299)
at com.caucho.quercus.program.CompiledFunction_1.call(CompiledFunction_1.java:83)
at com.caucho.quercus.program.CompiledFunction.callRef(CompiledFunction.java:51)
at com.caucho.quercus.program.AbstractFunction.callRef(AbstractFunction.java:310)
at _quercus._phpbb3._index__php.execute(C:/Documents and Settings/Riad/Desktop/resin-pro-3.1.2/webapps/php/phpBB3/index.php:128)
at com.caucho.quercus.page.QuercusPage.executeTop(QuercusPage.java:119)
at com.caucho.quercus.servlet.ResinQuercusServlet.service(ResinQuercusServlet.java:123)
at com.caucho.quercus.servlet.QuercusServlet.service(QuercusServlet.java:350)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:91)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:103)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:175)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:240)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:263)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:481)
at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:685)
at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:607)
at java.lang.Thread.run(Thread.java:619)

 stream_lock.patch [^] (10,587 bytes) 10-25-07 15:58
 164_flock.patch [^] (1,355 bytes) 10-26-07 18:15
 stream_lock2.patch [^] (11,438 bytes) 10-26-07 18:16

Notes
(0002365)
nam   
10-18-07 11:42   
There is a bug in how Quercus does file locking on Windows. Windows only support mandatory file locking where other applications are prohibited from reading/writing to a locked file. Operating systems with advisory file locking (i.e. Linux) are not affected.

(0002392)
mo   
10-25-07 15:57   
Updated qa test 6000.qa and added 6001.qa and 6002.qa to test read-only
and write-only streams.
(0002393)
mo   
10-25-07 16:09   
Attached is one approach to fixing this problem. It involves reworking
some pieces in the VFS layer but keeps the changes as small as possible.

This patch makes blocking the default for flock, for some reason
non-blocking is the default in the current implementation.

The patch also makes the FileOutput, FileInput, and FileInputOutput
use the actual stream opened by the VFS layer. This avoids the
crashing problems under Windows.

This patch also returns true when a LOCK_EX is requested for a read-only
stream or LOCK_SH is requested for a write-only stream. C PHP seems to
allow this for some reason but Java raises a NonReadableChannelException
or a NonWritableChannelException exception in these cases.

With this patch, 6000.qa, 6001.qa, and 6002.qa all pass. But, it
causes regressions in 1646.qa and 164f.qa since they both use
the questionable approach of passing LOCK_EX to a read-only stream,
or LOCK_SH to a write-only stream.
(0002395)
mo   
10-26-07 18:14   
Added:
php/6003.qa
php/6004.qa
php/6005.qa

Updated:
php/1646.qa
php/164f.qa

Made both of the regression tests check a read/write stream so that
both LOCK_SH and LOCK_EX could be set on the same stream. The results
of these two test cases did not match the native PHP results under
Windows. I will also attach an updated patch that takes care of
another unhandled problem of releasing the previous lock when
setting a new lock.
(0002396)
mo   
10-26-07 18:21   
The new stream_lock2.patch fixes all the current known problems
under Windows. It will return false for a flock(LOCK_SH) applied
to a write-only stream (php/6003.qa) and for the case
where a flock(LOCK_EX) is applied to a read-only stream (php/6004.qa).
The code also correctly releases a previously held lock when
switching from LOCK_EX to LOCK_SH on a read-write stream (php/6005.qa).
(0002407)
mo   
10-29-07 14:31   
Rechecked the test results under Linux and committed stream_lock3.patch.