Re: Oracle bug report

2004-09-07 Thread Alan DeKok
Andrea Gabellini [EMAIL PROTECTED] wrote:
 looking at the code, the server return SQL_DOWN if there is any type of error.
 
 Errors like ORA-01401: inserted value too large for column are set by the 
 Oracle server, so the server is up and running.
 
 In this situation it's not a good idea to reconnect the socket.

  Excellent.

 Performing some tests, I found two specific errors that mean database 
 down: ORA-03113 and ORA-03114.
 
 So I wrote a new function, sql_check_error (like the mysql one), that 
 checks the error code and return SQL_DOWN or -1.
 
 I don't know if this solve the bug, but surely it manages better the query.

  OK.  If you can submit this patch to bugs.freeradius.org, into #128,
that would help.

  Alan DeKok.


- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: Oracle Bug Report

2004-09-07 Thread Alan DeKok
Kostas Zorbadelos [EMAIL PROTECTED] wrote:
 This seems like a good improvement in the freeradius code.
 Will this patch be accepted in the CVS and be available in a next
 minor revision? 

  If it fixes the problem you're seeing, yes.

  I don't run Oracle, so I can't test it myself.

  Alan DeKok.

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


RE: Oracle Bug Report

2004-09-05 Thread ElHassan, Omar
Title: RE: Oracle Bug Report







 Date: Sat, 04 Sep 2004 18:07:44 +0200
 To: [EMAIL PROTECTED]
 From: Andrea Gabellini [EMAIL PROTECTED]
 Subject: Re: Oracle bug report
 Reply-To: [EMAIL PROTECTED]
 
 Hi,
 
 looking at the code, the server return SQL_DOWN if there is 
 any type of error.
 
 Errors like ORA-01401: inserted value too large for column 
 are set by the 
 Oracle server, so the server is up and running.
 
 In this situation it's not a good idea to reconnect the socket.
 
 Performing some tests, I found two specific errors that mean 
 database 
 down: ORA-03113 and ORA-03114.
 
 So I wrote a new function, sql_check_error (like the mysql one), that 
 checks the error code and return SQL_DOWN or -1.
 
 I don't know if this solve the bug, but surely it manages 
 better the query.
 
 In this patch I set the commit on success.
 
I am of the belief that this is an Oracle 8 (8.1.7.0.0) problem. The machine I'm running on, was upgraded to Oracle 9.2 last week. The problem still occurred if I used the the Oracle 8 Shared Libs. However, it disappears when using the 9.2 versions of those libs.

Perhaps, there is a patch for Oracle 8 that addresses this issue.


Regards,
Omar El-Hassan





Re: Oracle bug report

2004-09-04 Thread Andrea Gabellini
Hi,
looking at the code, the server return SQL_DOWN if there is any type of error.
Errors like ORA-01401: inserted value too large for column are set by the 
Oracle server, so the server is up and running.

In this situation it's not a good idea to reconnect the socket.
Performing some tests, I found two specific errors that mean database 
down: ORA-03113 and ORA-03114.

So I wrote a new function, sql_check_error (like the mysql one), that 
checks the error code and return SQL_DOWN or -1.

I don't know if this solve the bug, but surely it manages better the query.
In this patch I set the commit on success.


--- 
src/modules/rlm_sql/drivers/rlm_sql_oracle/sql_oracle.c.orig 
2004-08-12 12:57:50.320339000 +0200
+++ src/modules/rlm_sql/drivers/rlm_sql_oracle/sql_oracle.c 2004-09-04 
17:49:29.388796000 +0200
@@ -73,6 +73,25 @@
}
 }

+/*
+ *
+ * Function: sql_check_error
+ *
+ * Purpose: check the error to see if the server is down
+ *
+ */
+static int sql_check_error(SQLSOCK *sqlsocket, SQL_CONFIG *config) {
+
+   if (strstr(sql_error(sqlsocket, config), ORA-03113) ||
+   strstr(sql_error(sqlsocket, config), ORA-03114)) {
+   radlog(L_ERR,rlm_sql_oracle: OCI_SERVER_NOT_CONNECTED);
+   return SQL_DOWN;
+   }
+   else {
+   radlog(L_ERR,rlm_sql_oracle: OCI_SERVER_OK);
+   return -1;
+   }
+}
 /*
  *
@@ -244,22 +263,20 @@
(ub4) 0,
(OCISnapshot *) NULL,
(OCISnapshot *) NULL,
-   (ub4) OCI_DEFAULT);
+   (ub4) OCI_COMMIT_ON_SUCCESS);
-   if ((x != OCI_NO_DATA)  (x != OCI_SUCCESS)) {
-   radlog(L_ERR,rlm_sql_oracle: execute query failed in 
sql_query: %s,
-   sql_error(sqlsocket, config));
-   return SQL_DOWN;
+   if (x == OCI_SUCCESS) {
+   return 0;
}

-   x = OCITransCommit(oracle_sock-conn, oracle_sock-errHandle, (ub4) 0);
-   if (x != OCI_SUCCESS) {
-   radlog(L_ERR,rlm_sql_oracle: commit failed in sql_query: %s,
+   if (x == OCI_ERROR) {
+   radlog(L_ERR,rlm_sql_oracle: execute query failed in 
sql_query: %s,
sql_error(sqlsocket, config));
-   return SQL_DOWN;
+   return sql_check_error(sqlsocket, config);
+   }
+   else {
+   return -1;
}
-
-   return 0;
 }

At 15.27 03/09/2004, you wrote:
OK, it seems bugs.freeradius.org is experiencing problems.
I submit the bug here with the corresponding debugging outputs. When
the problems are restored, I will submit it in bugs also...
Short Description:
Freeradius crashes upon oracle errors in accounting queries
Way to reproduce:
Run radiusd -X and from a shell
for ((i=0;$i30; i=$i+1)); do radclient -d ~/freeradius/BUILD/etc/raddb/ 
-f testacct localhost acct testing123; sleep 2; done

testacct file:
User-Name = kzorbatest
Acct-Session-Id = 123456789009876543211234567890ABCDEFGHI
NAS-IP-Address = 62.103.3.155
Acct-Status-Type = Start
(very big Acct-Session-Id will cause oracle error (ORA-01401: inserted
value too large for column)
Environment:
Solaris 8, gcc 2.95.3, Oracle 8.1.7
Attached are the outputs of
gdb executable core with the bt and also output of truss
Kostas
--
  Kostas Zorbadelos
  Systems Developer, Otenet SA
  mailto: [EMAIL PROTECTED]
  Out there in the darkness, out there in the night
  out there in the starlight, one soul burns brighter
  than a thousand suns.


---
Television... a medium. So called because it is neither rare nor well-done.
---
Ing. Andrea Gabellini
Email: [EMAIL PROTECTED]
Tel: 0549 886111 (Italy)
Tel. +378 0549 886111 (International)
Intelcom San Marino S.p.A.
Strada degli Angariari, 3
47891 Rovereta
Repubblic of San Marino
http://www.omniway.sm  http://www.intelcom.sm
- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Oracle bug report

2004-09-03 Thread Kostas Zorbadelos
OK, it seems bugs.freeradius.org is experiencing problems.
I submit the bug here with the corresponding debugging outputs. When
the problems are restored, I will submit it in bugs also...

Short Description:
Freeradius crashes upon oracle errors in accounting queries

Way to reproduce:
Run radiusd -X and from a shell

for ((i=0;$i30; i=$i+1)); do radclient -d ~/freeradius/BUILD/etc/raddb/ -f testacct 
localhost acct testing123; sleep 2; done

testacct file:
User-Name = kzorbatest
Acct-Session-Id = 123456789009876543211234567890ABCDEFGHI
NAS-IP-Address = 62.103.3.155
Acct-Status-Type = Start

(very big Acct-Session-Id will cause oracle error (ORA-01401: inserted
value too large for column)


Environment:
Solaris 8, gcc 2.95.3, Oracle 8.1.7

Attached are the outputs of 
gdb executable core with the bt and also output of truss

Kostas
 
-- 
  Kostas Zorbadelos
  Systems Developer, Otenet SA 
  mailto: [EMAIL PROTECTED]
  
  Out there in the darkness, out there in the night
  out there in the starlight, one soul burns brighter
  than a thousand suns.

[EMAIL PROTECTED]:~-gdb /space/radius/freeradius/BUILD/sbin/radiusd ./core 
GNU gdb 6.0
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type show copying to see the conditions.
There is absolutely no warranty for GDB.  Type show warranty for details.
This GDB was configured as sparc-sun-solaris2.8...(no debugging symbols found)...
Core was generated by `radiusd -X'.
Program terminated with signal 10, Bus error.
Reading symbols from /usr/lib/libcrypt_i.so.1...(no debugging symbols found)...
done.
Loaded symbols for /usr/lib/libcrypt_i.so.1
Reading symbols from /space/radius/freeradius/BUILD/lib/libradius-1.0.0.so...done.
Loaded symbols for /space/radius/freeradius/BUILD/lib/libradius-1.0.0.so
Reading symbols from /space/radius/freeradius/BUILD/lib/libltdl.so.3...done.
Loaded symbols for /space/radius/freeradius/BUILD/lib/libltdl.so.3
Reading symbols from /usr/lib/libdl.so.1...done.
Loaded symbols for /usr/lib/libdl.so.1
Reading symbols from /usr/lib/libnsl.so.1...done.
Loaded symbols for /usr/lib/libnsl.so.1
Reading symbols from /usr/lib/libresolv.so.2...done.
Loaded symbols for /usr/lib/libresolv.so.2
Reading symbols from /usr/lib/libsocket.so.1...done.
Loaded symbols for /usr/lib/libsocket.so.1
Reading symbols from /usr/lib/librt.so.1...done.
Loaded symbols for /usr/lib/librt.so.1
Reading symbols from /usr/lib/libpthread.so.1...done.
Loaded symbols for /usr/lib/libpthread.so.1
Reading symbols from /usr/lib/libc.so.1...done.
Loaded symbols for /usr/lib/libc.so.1
Reading symbols from /usr/lib/libgen.so.1...done.
Loaded symbols for /usr/lib/libgen.so.1
Reading symbols from /usr/lib/libmp.so.2...done.
Loaded symbols for /usr/lib/libmp.so.2
Reading symbols from /usr/lib/libaio.so.1...done.
Loaded symbols for /usr/lib/libaio.so.1
Reading symbols from /usr/platform/SUNW,Sun-Fire-480R/lib/libc_psr.so.1...done.
Loaded symbols for /usr/platform/SUNW,Sun-Fire-480R/lib/libc_psr.so.1
Reading symbols from /usr/lib/libthread.so.1...done.
Loaded symbols for /usr/lib/libthread.so.1
Reading symbols from /usr/lib/nss_files.so.1...done.
Loaded symbols for /usr/lib/nss_files.so.1
Reading symbols from /space/radius/freeradius-1.0.0/BUILD/lib/rlm_exec-1.0.0.so...
done.
Loaded symbols for /space/radius/freeradius-1.0.0/BUILD/lib/rlm_exec-1.0.0.so
Reading symbols from /space/radius/freeradius-1.0.0/BUILD/lib/rlm_expr-1.0.0.so...
done.
Loaded symbols for /space/radius/freeradius-1.0.0/BUILD/lib/rlm_expr-1.0.0.so
Reading symbols from /space/radius/freeradius-1.0.0/BUILD/lib/rlm_pap-1.0.0.so...
done.
Loaded symbols for /space/radius/freeradius-1.0.0/BUILD/lib/rlm_pap-1.0.0.so
Reading symbols from /space/radius/freeradius-1.0.0/BUILD/lib/rlm_chap-1.0.0.so...
done.
Loaded symbols for /space/radius/freeradius-1.0.0/BUILD/lib/rlm_chap-1.0.0.so
Reading symbols from 
/space/radius/freeradius-1.0.0/BUILD/lib/rlm_mschap-1.0.0.so...done.
Loaded symbols for /space/radius/freeradius-1.0.0/BUILD/lib/rlm_mschap-1.0.0.so
Reading symbols from /space/radius/freeradius-1.0.0/BUILD/lib/rlm_unix-1.0.0.so...
done.
Loaded symbols for /space/radius/freeradius-1.0.0/BUILD/lib/rlm_unix-1.0.0.so
Reading symbols from /space/radius/freeradius-1.0.0/BUILD/lib/rlm_eap-1.0.0.so...
done.
Loaded symbols for /space/radius/freeradius-1.0.0/BUILD/lib/rlm_eap-1.0.0.so
Reading symbols from 
/space/radius/freeradius-1.0.0/BUILD/lib/rlm_eap_md5-1.0.0.so...done.
Loaded symbols for /space/radius/freeradius-1.0.0/BUILD/lib/rlm_eap_md5-1.0.0.so
Reading symbols from 
/space/radius/freeradius-1.0.0/BUILD/lib/rlm_eap_leap-1.0.0.so...done.
Loaded symbols for /space/radius/freeradius-1.0.0/BUILD/lib/rlm_eap_leap-1.0.0.so
Reading symbols from 
/space/radius/freeradius-1.0.0/BUILD/lib/rlm_eap_gtc-1.0.0.so...done.
Loaded symbols for 

Re: Oracle bug report

2004-09-03 Thread Dave Weis
On Fri, 3 Sep 2004, Kostas Zorbadelos wrote:
OK, it seems bugs.freeradius.org is experiencing problems.
I submit the bug here with the corresponding debugging outputs. When
the problems are restored, I will submit it in bugs also...
Short Description:
Freeradius crashes upon oracle errors in accounting queries
Way to reproduce:
Run radiusd -X and from a shell
for ((i=0;$i30; i=$i+1)); do radclient -d ~/freeradius/BUILD/etc/raddb/ -f testacct 
localhost acct testing123; sleep 2; done
testacct file:
User-Name = kzorbatest
Acct-Session-Id = 123456789009876543211234567890ABCDEFGHI
NAS-IP-Address = 62.103.3.155
Acct-Status-Type = Start
(very big Acct-Session-Id will cause oracle error (ORA-01401: inserted
value too large for column)
That is because the session ID column is declared as a 32 character 
varchar. You are putting 39 characters into it. If the spec defines a 
maximum length of 32 characters, then you have too long of a session ID, 
or the column isn't large enough.

dave
--
Dave Weis
[EMAIL PROTECTED]
http://www.internetsolver.com/
- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: Oracle bug report

2004-09-03 Thread Kostas Zorbadelos
On Fri, Sep 03, 2004 at 08:54:42AM -0500, Dave Weis wrote:
 
 On Fri, 3 Sep 2004, Kostas Zorbadelos wrote:
 OK, it seems bugs.freeradius.org is experiencing problems.
 I submit the bug here with the corresponding debugging outputs. When
 the problems are restored, I will submit it in bugs also...
 Short Description:
 Freeradius crashes upon oracle errors in accounting queries
 Way to reproduce:
 Run radiusd -X and from a shell
 for ((i=0;$i30; i=$i+1)); do radclient -d ~/freeradius/BUILD/etc/raddb/ 
 -f testacct localhost acct testing123; sleep 2; done
 testacct file:
 User-Name = kzorbatest
 Acct-Session-Id = 123456789009876543211234567890ABCDEFGHI
 NAS-IP-Address = 62.103.3.155
 Acct-Status-Type = Start
 (very big Acct-Session-Id will cause oracle error (ORA-01401: inserted
 value too large for column)
 
 That is because the session ID column is declared as a 32 character 
 varchar. You are putting 39 characters into it. If the spec defines a 
 maximum length of 32 characters, then you have too long of a session ID, 
 or the column isn't large enough.
 
 dave


Yes, I know. I caused the oracle error on purpose to cause the crash.

Kostas
 
 -- 
 Dave Weis
 [EMAIL PROTECTED]
 http://www.internetsolver.com/
 
 
 - 
 List info/subscribe/unsubscribe? See 
 http://www.freeradius.org/list/users.html
 

-- 
  Kostas Zorbadelos
  Systems Developer, Otenet SA 
  mailto: [EMAIL PROTECTED]
  
  Out there in the darkness, out there in the night
  out there in the starlight, one soul burns brighter
  than a thousand suns.


- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html