Wednesday, 15 January 2014

python - Django & Oracle DB lose contact -



python - Django & Oracle DB lose contact -

i have django project uses oracle 11 database. regularly receive exception django:

operationalerror: ora-03135: connection lost contact process id: 0 session id: 0 serial number: 0

there no particular django view causes exception. can come view.

from stack trace, appears exception thrown within middleware. there no 3rd party middleware causing issue, it's standard django built-in.

where best place debugging issue? i've found little on web regarding error. of parameteres in django.settings module (such databases config) play role?

there many different causes error:

configuration of connection pool

check if connection pool has parameters timeout or lifetime. have had issues myself parameter causing error ora-03135 after 1 min of inactivity of pooled session. solution in case using non pooled connections, not viable applications. in case, setting higher timeout might trick.

try activate highest level of debug on django and/or middleware see if logs messages sessions expiring in pool. restart middleware , time how long takes start failing. if short period of time (e.g. 60 seconds), might want alter timeout , create sure pool has plenty sessions load.

network errors / firewall

all kinds of network problems such dropped packets or network card issues can cause connection drop.

in order debug one, connect database using sqlplus , run given command. after that, leave session inactive 10,20,30,60 , 120 minutes (one effort @ time). allow know if problem happens through connection pool or sqlplus well. if latter true, might network problem or configuration (such firewall timeout) killing session due inactivity. true if session dies after same interval (e.g. after 2 hours). seek same experiment on other machines see if timeout still occurs. if occurs hosts, might issue switch host connected to. network engineers might need involved.

the os keepalive configuration might help in case. below link windows. http://blogs.technet.com/b/nettracer/archive/2010/06/03/things-that-you-may-want-to-know-about-tcp-keepalives.aspx

another way go debugging such errors enabling tns tracing on client and/or server. done configuring parameters trace_level_client , trace_level_server respectively on client , server sqlnet.ora files. there other parameters required going. check oracle documentation on subject.

oracle server side disconnection

the database may disconnect session because of issue it, bug in oracle or when sessions killed administrator. best way diagnose such issues looking database alert.log matching time when got error log contents. if session died on server, there entry stating sessions terminated , path trace file containing additional info disconnection. if oracle bug causing it, have search proper prepare through oracle support.

also, user may associated oracle profile has configured connection_time or idle_time. in order debug if cause of issue, associate user oracle profile without such restrictions.

python django oracle oracle11g

No comments:

Post a Comment