Closed yahonda closed 5 years ago
Thank you! I'll make Oracle 18c environment and check it. As for the two failures in test_break.rb, I'll try to turn off the tests by checking latency.
@yahonda
The ORA-03113: end-of-file on communication channel
error was fixed by 1f78956.
Oracle 18c server-side processes crash when OCI8::LOB#sync=
is used. This is not an Oracle-side bug, but a ruby-oci8 bug. It internally calls OCILobOpen() with incorrect arguments. It had not worked from the beginning. I changed problematic methods no operation.
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
errors disappear by the above commit. I guess that some resources are locked during recovery from server process crash.
The rest 1 failure was fixed locally. I'll commit it later.
Thanks for the fix. It looks good.
$ FULLTEST=true make check
ruby -w setup.rb setup
setup.rb:280: warning: assigned but unused variable - vname
setup.rb:280: warning: assigned but unused variable - desc
setup.rb:280: warning: assigned but unused variable - default2
---> lib
---> lib/oci8
<--- lib/oci8
---> lib/dbd
<--- lib/dbd
<--- lib
---> ext
---> ext/oci8
make
make[1]: Entering directory '/home/yahonda/git/ruby-oci8/ext/oci8'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/yahonda/git/ruby-oci8/ext/oci8'
<--- ext/oci8
<--- ext
ruby -w setup.rb test
setup.rb:280: warning: assigned but unused variable - vname
setup.rb:280: warning: assigned but unused variable - desc
setup.rb:280: warning: assigned but unused variable - default2
mkdir -p ./test
/home/yahonda/.rbenv/versions/2.5.1/bin/ruby -w -I/home/yahonda/git/ruby-oci8/ext/oci8 -I/home/yahonda/git/ruby-oci8/lib -I/home/yahonda/git/ruby-oci8/support -I/home/yahonda/git/ruby-oci8/test /home/yahonda/git/ruby-oci8/test/test_all.rb
/home/yahonda/git/ruby-oci8/test/test_object.rb:5: warning: method redefined; discarding old inspect
Run options: --seed 27677
# Running:
................................../home/yahonda/git/ruby-oci8/lib/oci8/oci8.rb:354: warning: Use OCI8.charset_id2name instead of OCI8#charset_id2name.
............../home/yahonda/git/ruby-oci8/lib/oci8/oci8.rb:354: warning: Use OCI8.charset_id2name instead of OCI8#charset_id2name.
Skip test_bind_string_as_nchar. It needs Oracle server whose database chracter set is incompatible with unicode.
..........................................................................unsupported return type (MDSYS.SDO_GEOMETRY.GET_WKB)
unsupported return type (MDSYS.SDO_GEOMETRY.GET_WKT)
unsupported return type (MDSYS.SDO_GEOMETRY.ST_COORDDIM)
unsupported return type (MDSYS.SDO_GEOMETRY.GET_GML)
unsupported return type (MDSYS.SDO_GEOMETRY.GET_GML)
unsupported return type (MDSYS.SDO_GEOMETRY.GET_GML)
unsupported return type (MDSYS.SDO_GEOMETRY.GET_GML)
unsupported return type (MDSYS.SDO_GEOMETRY.GET_GML311)
unsupported return type (MDSYS.SDO_GEOMETRY.GET_GML311)
unsupported return type (MDSYS.SDO_GEOMETRY.GET_GML311)
unsupported return type (MDSYS.SDO_GEOMETRY.GET_GML311)
unsupported return type (MDSYS.SDO_GEOMETRY.GET_GML321)
unsupported return type (MDSYS.SDO_GEOMETRY.GET_GML321)
unsupported return type (MDSYS.SDO_GEOMETRY.GET_GML321)
unsupported return type (MDSYS.SDO_GEOMETRY.GET_GML321)
unsupported return type (MDSYS.SDO_GEOMETRY.GET_KML)
unsupported return type (MDSYS.SDO_GEOMETRY.GET_GEOJSON)
.....FF............F........................................................................
Finished in 56.219151s, 3.8065 runs/s, 240.6297 assertions/s.
1) Failure:
TestBreak#test_timeout [/home/yahonda/git/ruby-oci8/test/test_break.rb:121]:
Expected |2018-08-12 14:23:42 +0000 - 2018-08-12 14:23:38 +0000| (4.178137285) to be <= 1.
2) Failure:
TestBreak#test_non_blocking_mode [/home/yahonda/git/ruby-oci8/test/test_break.rb:48]:
OCIBREAK.
Expected: 2
Actual: 5
3) Failure:
TestPackageType#test_describe_package [/home/yahonda/git/ruby-oci8/test/test_package_type.rb:44]:
ADD_REC1_VALUES > arguments > [1] > arguments > size.
Expected: 1
Actual: 0
214 runs, 13528 assertions, 3 failures, 0 errors, 0 skips
'system /home/yahonda/.rbenv/versions/2.5.1/bin/ruby -w -I/home/yahonda/git/ruby-oci8/ext/oci8 -I/home/yahonda/git/ruby-oci8/lib -I/home/yahonda/git/ruby-oci8/support -I/home/yahonda/git/ruby-oci8/test /home/yahonda/git/ruby-oci8/test/test_all.rb' failed
Try 'ruby setup.rb --help' for detailed usage.
Makefile:13: recipe for target 'check' failed
make: *** [check] Error 1
$
The following two failures seems due to network which doesn't support Out-of-band data(OOB).
Some VPN routers and firewalls block OOB and OCI8#break doesn't work. When DISABLE_OOB=on
is set in sqlnet.ora and TNS connections are used, the following test also fail even on local machine.
1) Failure:
TestBreak#test_timeout [/home/yahonda/git/ruby-oci8/test/test_break.rb:121]:
Expected |2018-08-12 14:23:42 +0000 - 2018-08-12 14:23:38 +0000| (4.178137285) to be <= 1.
2) Failure:
TestBreak#test_non_blocking_mode [/home/yahonda/git/ruby-oci8/test/test_break.rb:48]:
OCIBREAK.
Expected: 2
Actual: 5
The following failure was fixed by https://github.com/kubo/ruby-oci8/commit/bbda06b03ec7e14a07de8dbd78cf1180d3b7421f.
3) Failure:
TestPackageType#test_describe_package [/home/yahonda/git/ruby-oci8/test/test_package_type.rb:44]:
ADD_REC1_VALUES > arguments > [1] > arguments > size.
Expected: 1
Actual: 0
Thanks for the fix. I have confirmed TestPackageType#test_describe_package
has been addressed.
For two remaining failures. Thanks for the useful information since I did not know "Out-of-band data"
Just FYI Oracle database and listener are running on Docker. ruby-oci8 unit test runs on a local machine (docker host) with the following configuration.
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3cad31ceea39 oracle/database:18.3.0-ee "/bin/sh -c 'exec $O…" 3 weeks ago Up 3 weeks (healthy) 0.0.0.0:1521->1521/tcp, 5500/tcp oracle-container
$
docker run -d -p 1521:1521 -e ORACLE_PWD=admin --name oracle-container oracle/database:18.3.0-ee
$ echo $TWO_TASK
ORCLPDB1
ORCLPDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL=TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME=ORCLPDB1)
)
)
I'm wondering if this is "local" connection or not. Let me take some more look at it.
I don't have docker environments. I guess that -p 1521:1521
doesn't forward out-of-band data as ssh port forwarding doesn't.
Could you run server.rb
on docker and run client.rb
on a local machine?
server.rb
prints receive data: #
and receive oob_data: !
when packets from client.rb
are received. However when out-of-band data are blocked, it prints receive data: #
only.
# server.rb
require 'socket'
port = 1521 # Change the port number
server_sockets = Socket.tcp_server_sockets(port)
sockets = server_sockets.clone
loop do
ret = IO::select(sockets)
ret[0].each do |sock|
if server_sockets.include?(sock)
# new connection
sockets << sock.accept[0]
else
begin
oob_data = sock.recv_nonblock(1, Socket::MSG_OOB)
puts "receive oob_data: #{oob_data}"
rescue Errno::EINVAL
end
begin
data = sock.read_nonblock(1)
puts "receive data: #{data}"
rescue EOFError
sock.close
sockets.delete(sock)
end
end
end
end
# client.rb
require 'socket'
host = 'localhost'
port = 1521 # Change the port number
sock = TCPSocket.new(host, port)
while sleep 1
sock.send('!', Socket::MSG_OOB)
puts "send oob_data: !"
sock.write('#')
puts "send data: #"
end
When disable_oob=on
is in your sqlnet.ora, then break_poll_skip
may have an effect on timing. From my notes:
The default value for
break_poll_skip
is 3 and it comes into play whendisable_oob='on'
. This saves cpu on the server side and should be changed (increased) when server side cpu is a consideration.
Thanks for providing server.rb
and client.rb
. Since there is no ruby
command installed on Docker container, it may take some more time to provide the result of running server.rb
.
Here is the result of running client.rb and server.rb. Ctrl-c to terminate each ruby processes.
$ ruby client.rb
send oob_data: !
send data: #
send oob_data: !
send data: #
send oob_data: !
send data: #
send oob_data: !
send data: #
send oob_data: !
send data: #
send oob_data: !
send data: #
send oob_data: !
send data: #
send oob_data: !
send data: #
send oob_data: !
send data: #
send oob_data: !
send data: #
send oob_data: !
send data: #
send oob_data: !
send data: #
send oob_data: !
send data: #
send oob_data: !
send data: #
send oob_data: !
send data: #
^CTraceback (most recent call last):
1: from client.rb:7:in `<main>'
client.rb:7:in `sleep': Interrupt
$
$ ruby server.rb
receive data: #
receive data: #
receive data: #
receive data: #
receive data: #
receive data: #
receive data: #
receive data: #
receive data: #
receive data: #
receive data: #
receive data: #
receive data: #
receive data: #
receive data: #
^Cserver.rb:10:in `select': Interrupt
from server.rb:10:in `block in <main>'
from server.rb:9:in `loop'
from server.rb:9:in `<main>'
$
There is no receive oob_data: !
at server.rb then looks like out-of-band data are blocked.
@cjbj
Thanks for the comment.
I mean I do not intend to disable OOB, I wanted Oracle Database running on Docker using https://github.com/oracle/docker-images/tree/master/OracleDatabase/SingleInstance/dockerfiles/18.3.0 behaves same as Oracle Database running without Docker to run ruby-oci8 unit test runs green.
This issue is solved by using the docker container's IP address.
Get the docker container's IP address.
$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' container_name
172.17.0.2
Set the address to tnsnames.ora at the docker host or use //172.17.0.2/ORCLPDB1
.
ORCLPDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL=TCP)(HOST = 172.17.0.2)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME=ORCLPDB1)
)
)
make check
ran successfully for Oracle 18.3 in my docker.
Thanks for the update. Let me check at my local environment soon.
Using the container IP address resolves these errors. Thanks for the useful information.
$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' oracle-container
172.17.0.2
$ more tnsnames.ora
ORCLPDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL=TCP)(HOST =172.17.0.2)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME=ORCLPDB1)
)
)
$
Oracle 18c database has been released to the public. https://www.oracle.com/technetwork/database/enterprise-edition/downloads/oracle18c-linux-180000-5022980.html
make check
shows 3 failures and 7 errors as below. 2 failures also reproduces with Oracle 12c on Docker.Environment:
Oracle client where ruby-oci8 runs:
Ubuntu 18.04 LTS (GNU/Linux 4.15.0-29-generic x86_64)
Ruby 2.5.1
Oracle client installed by using alien command:
oracle-instantclient18.3-basic-18.3.0.0.0-1.x86_64.rpm
oracle-instantclient18.3-sqlplus-18.3.0.0.0-1.x86_64.rpm
oracle-instantclient18.3-devel-18.3.0.0.0-1.x86_64.rpm
Database running using Docker:
https://github.com/oracle/docker-images/tree/master/OracleDatabase Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Actual results: