php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58784 DBMS Server crash after select and quer
Submitted: 2009-07-31 10:58 UTC Modified: 2010-05-26 08:07 UTC
From: m dot sijmons at nibble dot nl Assigned:
Status: Wont fix Package: ingres (PECL)
PHP Version: 5.2.8 OS: All
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: m dot sijmons at nibble dot nl
New email:
PHP Version: OS:

 

 [2009-07-31 10:58 UTC] m dot sijmons at nibble dot nl
Description:
------------
The server crashes after doing a select with the "first" and the "offset" clause in it.


If I do the following select in sql monitor I get the following result:

* SELECT first 10 distinct table_name, table_owner FROM iitables WHERE 
table_type = 'T' and table_name like 'ii%' order by 1, 2  OFFSET  30;\g
Executing . . .


+--------------------------------+--------------------------------+
|table_name                      |table_owner                     |
+--------------------------------+--------------------------------+
|ii_key_info                     |$ingres                         |
|ii_key_map                      |$ingres                         |
|ii_limits                       |$ingres                         |
|ii_locks                        |$ingres                         |
|ii_longremarks                  |$ingres                         |
|ii_menuargs                     |$ingres                         |
|ii_objects                      |$ingres                         |
|ii_qbfnames                     |$ingres                         |
|ii_rcommands                    |$ingres                         |
|ii_rel_cncts_ent                |$ingres                         |
+--------------------------------+--------------------------------+
(10 rows)
continue

In PHP with the same query the server crahses


If I Change the query in PHP so that the "first" value is bigger than the offset the PHP program runs OK

So I change in PHP

$SQL = "SELECT first 10 distinct table_name, table_owner FROM iitables WHERE table_type = 'T' and table_name like 'ii%' order by 1, 2  OFFSET  30"; 

into 

$SQL = "SELECT first 40 distinct table_name, table_owner FROM iitables WHERE table_type = 'T' and table_name like 'ii%' order by 1, 2  OFFSET  30";

Two Problems with this issue:

1) The DBMS server should never crash doing a select

2) The behaviour of first and offset in PHP is different than in the terminal monitor.




Reproduce code:
---------------
<?php
function crash_server($link)
{
  $SQL = "SELECT first 10 distinct table_name, table_owner FROM iitables WHERE table_type = 'T' and table_name like 'ii%' order by 1, 2  OFFSET  30";
  $result1 = ingres_query($link, $SQL);
  if ($result1 == FALSE)
  {
  	echo "Error in Select";
  	return;
  }
  $row = 0;
  while ($dbRow = ingres_fetch_row($result1))
  {
  	$row++;
    echo $row . "|" . $dbRow[1] . "|" . $dbRow[2] . "</br>";
  }
  ingres_free_result($result1);
}
$database="phpgen_dev";
$user="msijmons";
$password="dummy";
$link = ingres_connect($database, $user, $password);
if ($link == FALSE)
{
	echo "Error in connect";
}
else 
{	
  crash_server($link);	
  ingres_close($link);
}
?>

Expected result:
----------------
1|ii_key_info |$ingres 
2|ii_key_map |$ingres 
3|ii_limits |$ingres 
4|ii_locks |$ingres 
5|ii_longremarks |$ingres 
6|ii_menuargs |$ingres 
7|ii_objects |$ingres 
8|ii_qbfnames |$ingres 
9|ii_rcommands |$ingres 
10|ii_rel_cncts_ent |$ingres 

Actual result:
--------------
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]: Fri Jul 31 16:38:25 2009 E_QE0002_INTERNAL_ERROR	A QEF internal error occurred. 
 Associated error messages which provide more detailed information about the  problem can be found in the error log (errlog.log)
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]: An error occurred in the following session:
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]: >>>>>Session 11866CC0:5888<<<<<
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]:     DB Name: phpgen_dev                       (Owned by: msijmons               
          )
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]:     User: msijmons                         (msijmons                        ) 
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]:     User Name at Session Startup: msijmons                        
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]:     Terminal: console         
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]:     Group Id:                                 
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]:     Role Id:                                 
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]:     Application Code: 00000000            Current Facility: QEF (00000006)
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]:     Client user: administrator
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]:     Client host: AEOLUS
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]:     Client tty: AEOLUS
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]:     Client pid: 5064
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]:     Client connection target: phpgen_dev
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]:     Client information: user='administrator',host='AEOLUS',tty='AEOLUS',
pid=5064,conn='phpgen_dev'
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]:     Description: 
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]:     Query: open ~Q scroll cursor for SELECT first 10 distinct table_name, 
table_owner FROM iitables WHERE table_type = 'T' and table_name like 'ii%' 
order by 1, 2  OFFSET  30 for readonly 
General Protection Exception @70f72798 SP:11aad794 BP:11aad860 AX:0 CX:f82ac54 DX:0 BX:11866cc0 SI:7c8024c7 DI:12f908
>>>CS_SCB found at 11866CC0<<<
cs_next: 704B0D80	cs_prev: 11840100
cs_length: 138592.	cs_type: FFFFABCD
cs_self: 11866CC0 (294022336.)
cs_stk_size: 00000000 (0.)
cs_state: CS_COMPUTABLE (00000001)	cs_mask:  (00000000)
cs_mode: CS_INPUT(00000002)	cs_nmode: CS_OUTPUT(00000003)
cs_thread_type: CS_NORMAL(00000000)
cs_username: msijmons                        
cs_sem_count: 00000000
-----------------------------------
Stack trace beginning at qea_fetch+888 (70f72798)
Stack dmp name II\INGRES\1bd0  pid 7120 session 11866cc0: qeq_fetch: (iilibqef,Base:70f50000)qea_fetch/70f71f10( 0fa475f4 1187f
ee4 0f82ac54 00000004 )
Stack dmp name II\INGRES\1bd0  pid 7120 session 11866cc0: qef_call: (iilibqef,Base:70f50000)qeq_fetch/70fbadc0( 1187fee4 )
Stack dmp name II\INGRES\1bd0  pid 7120 session 11866cc0: scs_sequencer: (iilibqef,Base:70f50000)qef_call/70f8db90( 0000000c 11
87fee4 )
Stack dmp name II\INGRES\1bd0  pid 7120 session 11866cc0: CS_setup: ????????( 00000002 11866cc0 11866d00 )
Stack dmp name II\INGRES\1bd0  pid 7120 session 11866cc0: GetModuleFileNameA: ????????( )
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]: Fri Jul 31 16:38:26 2009 E_SC0216_QEF_ERROR	Error returned by QEF.
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]: Fri Jul 31 16:38:26 2009 E_SC0206_CANNOT_PROCESS	An internal error prevents further processing of this query. 
 Associated error messages which provide more detailed information about the problem can be found in the error log, II_CONFIG:errlog.log
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]: Query:  open ~Q scroll cursor for SELECT first 10 distinct table_name, table_owner FROM iitables WHERE table_type = 'T' and table_name like 'ii%' order by 1, 2  OFFSET  30 for readonly 
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866cc0]: LQuery: open ~Q scroll cursor for SELECT first 10 distinct table_name, table_owner FROM iitables WHERE table_type = 'T' and table_name like 'ii%' order by 1, 2  OFFSET  30 for readonly 
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]: Fri Jul 31 16:38:28 2009 E_QE0002_INTERNAL_ERROR	A QEF internal error occurred. 
 Associated error messages which provide more detailed information about the  problem can be found in the error log (errlog.log)
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]: An error occurred in the following session:
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]: >>>>>Session 11866C80:5768<<<<<
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]:     DB Name: phpgen_dev                       (Owned by: msijmons               
          )
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]:     User: msijmons                         (msijmons                        ) 
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]:     User Name at Session Startup: msijmons                        
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]:     Terminal: console         
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]:     Group Id:                                 
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]:     Role Id:                                 
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]:     Application Code: 00000000            Current Facility: QEF (00000006)
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]:     Client user: administrator
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]:     Client host: AEOLUS
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]:     Client tty: AEOLUS
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]:     Client pid: 5064
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]:     Client connection target: phpgen_dev
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]:     Client information: user='administrator',host='AEOLUS',tty='AEOLUS',
pid=5064,conn='phpgen_dev'
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]:     Description: 
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]:     Query: open ~Q scroll cursor for SELECT first 10 distinct table_name, 
table_owner FROM iitables WHERE table_type = 'T' and table_name like 'ii%' 
order by 1, 2  OFFSET  30 for readonly 
General Protection Exception @70f72798 SP:11aad794 BP:11aad860 AX:0 CX:f82ac54 DX:0 BX:11866c80 SI:7c8024c7 DI:12f908
>>>CS_SCB found at 11866C80<<<
cs_next: 704B0D80	cs_prev: 11840100
cs_length: 138592.	cs_type: FFFFABCD
cs_self: 11866C80 (294022272.)
cs_stk_size: 00000000 (0.)
cs_state: CS_COMPUTABLE (00000001)	cs_mask:  (00000000)
cs_mode: CS_INPUT(00000002)	cs_nmode: CS_OUTPUT(00000003)
cs_thread_type: CS_NORMAL(00000000)
cs_username: msijmons                        
cs_sem_count: 00000000
-----------------------------------
Stack trace beginning at qea_fetch+888 (70f72798)
Stack dmp name II\INGRES\1bd0  pid 7120 session 11866c80: qeq_fetch: (iilibqef,Base:70f50000)qea_fetch/70f71f10( 0fa475f4 1187f
ea4 0f82ac54 00000004 )
Stack dmp name II\INGRES\1bd0  pid 7120 session 11866c80: qef_call: (iilibqef,Base:70f50000)qeq_fetch/70fbadc0( 1187fea4 )
Stack dmp name II\INGRES\1bd0  pid 7120 session 11866c80: scs_sequencer: (iilibqef,Base:70f50000)qef_call/70f8db90( 0000000c 11
87fea4 )
Stack dmp name II\INGRES\1bd0  pid 7120 session 11866c80: CS_setup: ????????( 00000002 11866c80 11866cc0 )
Stack dmp name II\INGRES\1bd0  pid 7120 session 11866c80: GetModuleFileNameA: ????????( )
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]: Fri Jul 31 16:38:28 2009 E_SC0221_SERVER_ERROR_MAX	Error count for server has been exceeded.
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]: Query:  open ~Q scroll cursor for SELECT first 10 distinct table_name, table_owner FROM iitables WHERE table_type = 'T' and table_name like 'ii%' order by 1, 2  OFFSET  30 for readonly 
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]: LQuery: open ~Q scroll cursor for SELECT first 10 distinct table_name, table_owner FROM iitables WHERE table_type = 'T' and table_name like 'ii%' order by 1, 2  OFFSET  30 for readonly 
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]: Fri Jul 31 16:38:28 2009 E_PS0501_SESSION_OPEN	There were open sessions when trying to shut down the parser facility.
AEOLUS            ::[II\INGRES\1bd0    , 7120      ,  11866c80]: Fri Jul 31 16:38:28 2009 E_DM005B_SESSION_OPEN	Session(s) are open.
AEOLUS            ::[II\NMSVR\17f4     , 6132      , 00000001]: Fri Jul 31 16:38:28 2009 E_GC0154_GCN_SRV_SHUTDOWN	Registered server shutdown: class INGRES, address II\INGRES\1bd0
AEOLUS	::[II\RMCMD\ab4    , 2740      , ffffffff]: Fri Jul 31 16:38:28 2009 E_RE000F_DAEMON_GET_DBEVENT	Cannot get dbevent. The SQL error code was -37000.
AEOLUS            ::[II\NMSVR\17f4     , 6132      , 00000005]: Fri Jul 31 16:38:28 2009 E_GC0154_GCN_SRV_SHUTDOWN	Registered server shutdown: class RMCMD, address II\RMCMD\ab4
AEOLUS	::[II\RMCMD\ab4    , 2740      , ffffffff]: Fri Jul 31 16:38:28 2009 E_RE0002_RMCMD_DOWN	Visual DBA RMCMD Server Normal Shutdown.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-26 08:07 UTC] grant dot croker at ingres dot com
Sorry, but your problem does not imply a bug in PECL itself.  For a
list of more appropriate places to ask for help using PECL, please
visit http://pecl.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PECL.

This is a problem with Ingres and scrollable cursors when an 
out of range offset is used. There is nothing I can do in the 
driver to prevent this. Raise an issue via 
https://servicedesk.ingres.com or via http://bugs.ingres.com.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 08:01:28 2024 UTC