Re: [Zope] Florent Guillaume's database Conflict Error on session objects patch not working ?

2007-02-03 Thread yacine chaouche

Hi Dieter,

What part of what I said don't you understand ? I will try to make it
clearer here :


  The referenced links above do not refer to conflict errors
  but to XMLRPC and strace.

  Then, too, I had great difficulties to understand your problem...


Yes, when I posted the XMLRPC and strace message on the list I did not
know yet the publishing process and everything. So I thought that zope
just went crazy pretending to receive new requests. In reality, it was
the same request that was retried over and over again until no
exception was raised.

Once I understood the publishing process, I edited the publish.py file
to display a traceback  of every raised exception before retrying the
request. Thus, I could see that there were database conflict errors
that were raised.



I am aware that conflicts occure up to 20% of the time, but in my case
it is almost 100% in this specific situation !

You can easily achieve almost sure conflicts.

We did once with a frame based solution:


I do NOT use frames.


If I do not use the session object in my code, I have no errors at all
and everything just goes fine.

Then, you are using some add-on component that *is* using the session
object.



That's what I am saying : in my code I need to use the session to
store objects. When I use the session, in my code, not in a plugin or
so, in my own code, I have errors.
When I do not use session, in my own code, I have no errors. This is
supposed to prove that the conflict error comes from the use of the
session object in my code. This is not supposed to prove that another
plugin is using it anyway...

Thanks,

Y.Chaouche

2007/2/2, Dieter Maurer [EMAIL PROTECTED]:

yacine chaouche wrote at 2007-2-2 14:39 +0100:
 ...
 As discussed  here :
 http://mail.zope.org/pipermail/zope/2007-January/170151.html
 and continued here :
 http://mail.zope.org/pipermail/zope/2007-January/170156.html

 I am experiencing issues regarding a database ConflictError on session 
objects.

Hm, I have issues with your problem descriptions...

  The referenced links above do not refer to conflict errors
  but to XMLRPC and strace.

  Then, too, I had great difficulties to understand your problem...

 ...
It is not a ReadConflictError, nor a
WriteConflictError. It is a ConflictError: database conflict error.

A ConflictError is in fact a WriteConflictError.

I am aware that conflicts occure up to 20% of the time, but in my case
it is almost 100% in this specific situation !

You can easily achieve almost sure conflicts.

We did once with a frame based solution:

   All frames in a frameset accessed the session and tried
   to store some information in it.

   As the browser requested the frames concurrently, there
   was a very high probablity for conflicts.

In our case, there was no real need for most of the frames
to access the session. Removing the unnecessary accesses removed
the problem.

But, if the frames had a real need to store something in the
session, we would have to use persistent subobjects in the session
to separate the access of the various frames into different objects.

If I do not use the session object in my code, I have no errors at all
and everything just goes fine.

Then, you are using some add-on component that *is* using the session
object.

If the session is not used, there will be no session
related conflict error.

Any idea on how to debug this ? Florent, maybe ?  someone help me ! I
am stuck on this for 2 weeks now.

You could try to delete /temp_folder/session_data temporarily
(it will be recreated on the next Zope startup) to find out
which component does use sessions.



--
Dieter


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] session-timeout-minutes value in runtime Zope

2007-02-02 Thread yacine chaouche

I don't know if this is what you want. If you want to have access, in
your code, to the session-timeout-minutes variable, you can try this
methode on your session_data_manager object :

getTimeoutMinutes(self):

Return the number of minutes allowed for subobject inactivity before
expiration. PermissionView management screens

This is from the api documentation of TransientContainer class, found
in the help link in the ZMI of temp_folder/session_data_manager.

In your code, you can use something like :
tal code
you'll be
securely logged in for another span tal:replace=python
context.temp_folder.session_data_manager.getTimeoutMinutes() /span
minutes unless you log out or log in
again.
/tal

Y.Chaouche

2007/1/23, Dieter Maurer [EMAIL PROTECTED]:

Peter Bengtsson wrote at 2007-1-23 13:44 +:
This might be an FAQ but I wasn't able to find it when searching.
How do I get access to the value of 'session-timeout-minutes' coming
from etc/zope.conf in runtime Zope?

The value is used to configure the so called Session Data Manager
(usually /temp_folder/session_data).

Its management page is able to show you the value.

This means, there is some way to access it. You can use this
way in your own application (you might need a proxy role to
get sufficient privileges).



--
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Florent Guillaume's database Conflict Error on session objects patch not working ?

2007-02-02 Thread yacine chaouche

Hi all,

As discussed  here :
http://mail.zope.org/pipermail/zope/2007-January/170151.html
and continued here :
http://mail.zope.org/pipermail/zope/2007-January/170156.html

I am experiencing issues regarding a database ConflictError on session objects.

I use zope 2.9.0 python 2.4.2, and the code of the MultiDB support has
been patched (as suggested by Florent Guillaume)
http://mail.zope.org/pipermail/zodb-dev/2006-January/009737.html

My main concern is to debug my application where, on every couple of
requests coming from two different browsers at the same time (before
the first request is , one of them wins and the other always fails and
raises a conflict error. It is not a ReadConflictError, nor a
WriteConflictError. It is a ConflictError: database conflict error.
I am aware that conflicts occure up to 20% of the time, but in my case
it is almost 100% in this specific situation !

If I do not use the session object in my code, I have no errors at all
and everything just goes fine.

Any idea on how to debug this ? Florent, maybe ?  someone help me ! I
am stuck on this for 2 weeks now.

NOTE : I do not use Zeo, nor frames.

Thanks,

Y.Chaouche
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Florent Guillaume's database Conflict Error on session objects patch not working ?

2007-02-02 Thread yacine chaouche

I forward your message to the list.

I installed faster :
1) It has no INSTALL file
2) I created a better session manager object under the id newSession,
and hit the test button. I Got this error :



Traceback (most recent call last):
 File /opt/aef/Zope-2.9.0/lib/python/ZPublisher/Publish.py, line
113, in publish
   request, bind=1)
 File /opt/aef/Zope-2.9.0//lib/python/ZPublisher/mapply.py, line
88, in mapply
   if debug is not None: return debug(object,args,context)
 File /opt/aef/Zope-2.9.0/lib/python/ZPublisher/Publish.py, line
40, in call_object
   result=apply(object,args) # Type scr to step into published object.
 File /opt/aef/Zope-2.9.0//lib/python/Shared/DC/Scripts/Bindings.py,
line 311, in __call__
   return self._bindAndExec(args, kw, None)
 File /opt/aef/Zope-2.9.0//lib/python/Shared/DC/Scripts/Bindings.py,
line 329, in _bindAndExec
   def _bindAndExec(self, args, kw, caller_namespace):
 File /opt/aef/Zope-2.9.0//lib/python/Shared/DC/Scripts/Bindings.py,
line 348, in _bindAndExec
   return self._exec(bound_data, args, kw)
 File 
/opt/aef/Zope-2.9.0//lib/python/Products/PageTemplates/PageTemplateFile.py,
line 110, in _exec
   return self.pt_render(extra_context=bound_names)
 File /opt/aef/Zope-2.9.0//lib/python/Products/PageTemplates/PageTemplate.py,
line 104, in pt_render
   tal=not source, strictinsert=0)()
 File /opt/aef/Zope-2.9.0//lib/python/TAL/TALInterpreter.py, line
234, in __call__
   def __call__(self):
 File /opt/aef/Zope-2.9.0//lib/python/TAL/TALInterpreter.py, line
238, in __call__
   self.interpret(self.program)
 File /opt/aef/Zope-2.9.0//lib/python/TAL/TALInterpreter.py, line
281, in interpret
   handlers[opcode](self, args)
 File /opt/aef/Zope-2.9.0//lib/python/TAL/TALInterpreter.py, line
507, in do_setLocal_tal
   self.engine.setLocal(name, self.engine.evaluateValue(expr))
 File /opt/aef/Zope-2.9.0//lib/python/Products/PageTemplates/TALES.py,
line 221, in evaluate
   return expression(self)
 File /opt/aef/Zope-2.9.0//lib/python/Products/PageTemplates/Expressions.py,
line 182, in __call__
   def __call__(self, econtext):
 File /opt/aef/Zope-2.9.0//lib/python/Products/PageTemplates/Expressions.py,
line 185, in __call__
   return self._eval(econtext)
 File /opt/aef/Zope-2.9.0//lib/python/Products/PageTemplates/Expressions.py,
line 180, in _eval
   return render(ob, econtext.vars)
 File /opt/aef/Zope-2.9.0//lib/python/Products/PageTemplates/Expressions.py,
line 88, in render
   raise
 File /opt/aef/Zope-2.9.0//lib/python/Products/PageTemplates/Expressions.py,
line 85, in render
   ob = ob()
 File /opt/aef/Zope-2.9.0/lib/python/Products/faster/sessiondata.py,
line 255, in addItemsToSession
   before = len(session)
AttributeError: __len__

Do you use a bug reporting system or something for your product ?

Thank you,

Y.Chaouche


2007/2/2, Tres Seaver [EMAIL PROTECTED]:



-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

yacine chaouche wrote:
 Hi all,

 As discussed  here :
 http://mail.zope.org/pipermail/zope/2007-January/170151.html
 and continued here :
 http://mail.zope.org/pipermail/zope/2007-January/170156.html

 I am experiencing issues regarding a database ConflictError on session 
objects.

 I use zope 2.9.0 python 2.4.2, and the code of the MultiDB support has
 been patched (as suggested by Florent Guillaume)
 http://mail.zope.org/pipermail/zodb-dev/2006-January/009737.html

 My main concern is to debug my application where, on every couple of
 requests coming from two different browsers at the same time (before
 the first request is , one of them wins and the other always fails and
 raises a conflict error. It is not a ReadConflictError, nor a
 WriteConflictError. It is a ConflictError: database conflict error.
 I am aware that conflicts occure up to 20% of the time, but in my case
 it is almost 100% in this specific situation !

 If I do not use the session object in my code, I have no errors at all
 and everything just goes fine.

 Any idea on how to debug this ? Florent, maybe ?  someone help me ! I
 am stuck on this for 2 weeks now.

 NOTE : I do not use Zeo, nor frames.

You might try 'faster', an alternative ZODB-based sessioning
implementation:  one of its goals is to reduce the chance of collisions
compared to the stock implementation:

  http://agendaless.com/Members/tseaver/software/faster/


Tres.
- --
===
Tres Seaver  +1 540-429-0999  [EMAIL PROTECTED]
Palladion Software   Excellence by Designhttp://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFw0aj+gerLs4ltQ4RAuDLAJ9VXpLtmnr5EwYMV1AkS1Gxa0lvmwCgoGIv
hkn26PUMSmmBKO8nDYFdmkU=
=n+Qz
-END PGP SIGNATURE-



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman

[Zope] Re: Florent Guillaume's database Conflict Error on session objects patch not working ?

2007-02-02 Thread yacine chaouche

I added a new faster session object in my root folder. Once it was
created, i was on the property manager form and clicked on the test
tab and got the error reported above.

Is the request[SESSION] object that you use in your code addressing
the classic SESSION object (in temp_folder/session_data_container) or
does it address your new session data objects ? for the latter case,
maybe i should rename the classic (zope's) SESSION object to SESSION2
or something...


Y.Chaouche


2007/2/2, Tres Seaver [EMAIL PROTECTED]:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

yacine chaouche wrote:
 I forward your message to the list.

 I installed faster :
 1) It has no INSTALL file

You're correct.  It installs like other Zope2 products, but it could use
some description of how to replace the stock session manager with the
new one.

 2) I created a better session manager object under the id newSession,
 and hit the test button. I Got this error :

Assuming that you mean the Add button on the Test tab, I can't
reproduce this in my Zopd 2.9-based sandbox (running on the head of the
2.9 branch).  The items get added to the list (assuming that the key is
separated from the value on the same line with a space.


 Traceback (most recent call last):
   File /opt/aef/Zope-2.9.0/lib/python/ZPublisher/Publish.py, line
 113, in publish
 request, bind=1)
   File /opt/aef/Zope-2.9.0//lib/python/ZPublisher/mapply.py, line
 88, in mapply
 if debug is not None: return debug(object,args,context)
   File /opt/aef/Zope-2.9.0/lib/python/ZPublisher/Publish.py, line
 40, in call_object
 result=apply(object,args) # Type scr to step into published object.
   File /opt/aef/Zope-2.9.0//lib/python/Shared/DC/Scripts/Bindings.py,
 line 311, in __call__
 return self._bindAndExec(args, kw, None)
   File /opt/aef/Zope-2.9.0//lib/python/Shared/DC/Scripts/Bindings.py,
 line 329, in _bindAndExec
 def _bindAndExec(self, args, kw, caller_namespace):
   File /opt/aef/Zope-2.9.0//lib/python/Shared/DC/Scripts/Bindings.py,
 line 348, in _bindAndExec
 return self._exec(bound_data, args, kw)
   File 
/opt/aef/Zope-2.9.0//lib/python/Products/PageTemplates/PageTemplateFile.py,
 line 110, in _exec
 return self.pt_render(extra_context=bound_names)
   File 
/opt/aef/Zope-2.9.0//lib/python/Products/PageTemplates/PageTemplate.py,
 line 104, in pt_render
 tal=not source, strictinsert=0)()
   File /opt/aef/Zope-2.9.0//lib/python/TAL/TALInterpreter.py, line
 234, in __call__
 def __call__(self):
   File /opt/aef/Zope-2.9.0//lib/python/TAL/TALInterpreter.py, line
 238, in __call__
 self.interpret(self.program)
   File /opt/aef/Zope-2.9.0//lib/python/TAL/TALInterpreter.py, line
 281, in interpret
 handlers[opcode](self, args)
   File /opt/aef/Zope-2.9.0//lib/python/TAL/TALInterpreter.py, line
 507, in do_setLocal_tal
 self.engine.setLocal(name, self.engine.evaluateValue(expr))
   File /opt/aef/Zope-2.9.0//lib/python/Products/PageTemplates/TALES.py,
 line 221, in evaluate
 return expression(self)
   File 
/opt/aef/Zope-2.9.0//lib/python/Products/PageTemplates/Expressions.py,
 line 182, in __call__
 def __call__(self, econtext):
   File 
/opt/aef/Zope-2.9.0//lib/python/Products/PageTemplates/Expressions.py,
 line 185, in __call__
 return self._eval(econtext)
   File 
/opt/aef/Zope-2.9.0//lib/python/Products/PageTemplates/Expressions.py,
 line 180, in _eval
 return render(ob, econtext.vars)
   File 
/opt/aef/Zope-2.9.0//lib/python/Products/PageTemplates/Expressions.py,
 line 88, in render
 raise
   File 
/opt/aef/Zope-2.9.0//lib/python/Products/PageTemplates/Expressions.py,
 line 85, in render
 ob = ob()
   File /opt/aef/Zope-2.9.0/lib/python/Products/faster/sessiondata.py,
 line 255, in addItemsToSession
 before = len(session)
 AttributeError: __len__

 Do you use a bug reporting system or something for your product ?

Yes, there is a collector linked of the product's homepage.

   http://agendaless.com/Members/tseaver/software/faster/

I would note that we have had the product deployed in production for two
customers for six months now, without any issues at all.


Tres.
- --
===
Tres Seaver  +1 540-429-0999  [EMAIL PROTECTED]
Palladion Software   Excellence by Designhttp://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFw2qz+gerLs4ltQ4RAn4nAJ9I5kHhVtcdHHjLKQhiPpZH0/YyJwCdFrV1
X5aHzRbZHQVi1lGLH/Hkpsw=
=ufay
-END PGP SIGNATURE-


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Zope pretends to receive and send XMLRPC data, but strace sees nothing ! (fwd)

2007-01-25 Thread yacine chaouche

Is _p_resolveConflict method of Inceraser executed at all?
I wonder if traceback you see in console is from the
code you added:
traceback.print_exc(file=stdin)

or it is always shown when there is a conflict error.


code
   def _p_resolveConflict(self, old, state1, state2):
   print called the _p_resolveConflict of the Increaser object,self
   try:
   number = max(old,state1,state2)
   except Exception,msg:
   import traceback
   traceback.print_exc(file=sys.stdin)
   return max(old, state1, state2)

/code

Yes, The method was not called. However, the traceback was indeed printed by
the print_exc, since there were no tracebacks before I added this line. In
fact, as Gabriel Genellina said :


That might provoke a ConflictError, forcing a
transaction abort and the request to be re-tried (up to three times,
silently, then it goes logged).


as well as  Pascal Peregrina:


In general, retry is called when a ZODB Conflict Error has happened.
If I remember well, Zope will silently retry 3 times, and then actually
return an error page showing the Conflict Error.


as the documentation says
http://www.zope.org/Documentation/Books/ZDG/current/ObjectPublishing.stx :

If an unhandled exception is raised during the publishing process, Zope
aborts the transaction. As detailed in Chapter 4. Zope handles
ConflictErrors by re-trying the request up to three times. This is done with
the zpublisher_exception_hook.

Thus, I don't think that the traceback is always shown when there's a
conflict error.

So I decided to look into the file suggested by Maciej Wisniowski :


You may take a look at lib/python/ZODB/ConflictResolution.py
method: tryToResolveConflict. There is a call to _p_resolveConflict.


and edited it like this :

code
def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle,
committedData=''):
   # class_tuple, old, committed, newstate = ('',''), 0, 0, 0
   print in ConflictResolution.py, called the tryToResolveConflict method
with arguments :
   print
self,self,oid,oid.__repr__(),committedSerial,committedSerial.__repr__(),oldSerial,oldSerial.__repr__(),newpickle,newpickle.__repr__(),committedData,committedData.__repr__()
   try:
   prfactory = PersistentReferenceFactory()
   file = StringIO(newpickle)
   unpickler = Unpickler(file)
   unpickler.find_global = find_global
   unpickler.persistent_load = prfactory.persistent_load
   meta = unpickler.load()
   if isinstance(meta, tuple):
   klass = meta[0]
   newargs = meta[1] or ()
   if isinstance(klass, tuple):
   klass = find_global(*klass)
   else:
   klass = meta
   newargs = ()

   if klass in _unresolvable:
   print klass,klass.__repr__,is unresolvable
   return None

   newstate = unpickler.load()
   inst = klass.__new__(klass, *newargs)

   try:
   resolve = inst._p_resolveConflict
   except AttributeError:
   print inst.__repr__,has no _p_resolveConflict method
   _unresolvable[klass] = 1
   return None

   old = state(self, oid, oldSerial, prfactory)
   committed = state(self, oid, committedSerial, prfactory,
committedData)

   resolved = resolve(old, committed, newstate)

   file = StringIO()
   pickler = Pickler(file,1)
   pickler.persistent_id = persistent_id
   pickler.dump(meta)
   pickler.dump(resolved)
   print everything's ok
   return file.getvalue(1)
   except (ConflictError, BadClassName):
   print ConflictError during conflict resolution in tryToResolveConflict,
ConflictResolution.py
   import traceback
   import sys
   traceback.print_exc(file = sys.stdout)
   return None
   except:
   print Exception raised in in tryToResolveConflict,
ConflictResolution.py
   import traceback
   import sys
   traceback.print_exc(file=sys.stdout)
   # If anything else went wrong, catch it here and avoid passing an
   # arbitrary exception back to the client.  The error here will mask
   # the original ConflictError.  A client can recover from a
   # ConflictError, but not necessarily from other errors.  But log
   # the error so that any problems can be fixed.
   logger.error(Unexpected error, exc_info=True)
   return None

/code

Now let's see what's going on in the console :

console
in ConflictResolution.py, called the tryToResolveConflict method with
arguments :
self tempstorage.TemporaryStorage.TemporaryStorage instance at 0x43fb6aac
oid '\x00\x00\x00\x00\x00\x00\x00\t' committedSerial
'\x03k#\x93\x1d\xff\xf5\x11' oldSerial '\x03k#\x91^t\xf1D' newpickle '(
cProducts.Transience.Transience\nIncreaser\nq\x01)tq\x02.J\x88\xa6\xb8E.'
committedData ''
ConflictError during conflict resolution in tryToResolveConflict,
ConflictResolution.py
Traceback (most recent call last):
 File /opt/aef/Zope-2.9.0/lib/python/ZODB/ConflictResolution.py, line
126, in tryToResolveConflict
   old = state(self, 

Re: [Zope] Zope pretends to receive and send XMLRPC data, but strace sees nothing ! (fwd)

2007-01-25 Thread yacine chaouche

Concerning zeo, I do not use it in the developpement plateforme, but there's
one in the test and production platformes, so maybe I will face the problem
during the test phase.
I do not understand : session objects should be unique for each browser, so
why are there conflict errors on them ?


If ZEO cannot reach your product (import it), it cannot run any
conflict resolution. Make sure that the ZEO server setup has access to
those Products that do conflict resolution.


The product that does conflict resolution is the Transient object (I think
it is the session object) , which is Zope2.9.0/lib/python/Products/Transcience.
I think that zeo should see it.


2007/1/25, yacine chaouche [EMAIL PROTECTED]:


Is _p_resolveConflict method of Inceraser executed at all?
I wonder if traceback you see in console is from the
code you added:
traceback.print_exc(file=stdin)

or it is always shown when there is a conflict error.

code
def _p_resolveConflict(self, old, state1, state2):
print called the _p_resolveConflict of the Increaser object,self
try:
number = max(old,state1,state2)
except Exception,msg:
import traceback
traceback.print_exc(file=sys.stdin)
return max(old, state1, state2)

/code

Yes, The method was not called. However, the traceback was indeed printed
by the print_exc, since there were no tracebacks before I added this line.
In fact, as Gabriel Genellina said :

That might provoke a ConflictError, forcing a
transaction abort and the request to be re-tried (up to three times,
silently, then it goes logged).

as well as  Pascal Peregrina:

In general, retry is called when a ZODB Conflict Error has happened.
If I remember well, Zope will silently retry 3 times, and then actually
return an error page showing the Conflict Error.

as the documentation says
http://www.zope.org/Documentation/Books/ZDG/current/ObjectPublishing.stx :

If an unhandled exception is raised during the publishing process, Zope
aborts the transaction. As detailed in Chapter 4. Zope handles
ConflictErrors by re-trying the request up to three times. This is done with
the zpublisher_exception_hook.

Thus, I don't think that the traceback is always shown when there's a
conflict error.

So I decided to look into the file suggested by Maciej Wisniowski :

You may take a look at lib/python/ZODB/ConflictResolution.py
method: tryToResolveConflict. There is a call to _p_resolveConflict.

and edited it like this :

code
def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle,
 committedData=''):
# class_tuple, old, committed, newstate = ('',''), 0, 0, 0
print in ConflictResolution.py, called the tryToResolveConflict
method with arguments :
print
self,self,oid,oid.__repr__(),committedSerial,committedSerial.__repr__(),oldSerial,oldSerial.__repr__(),newpickle,newpickle.__repr__(),committedData,committedData.__repr__()

try:
prfactory = PersistentReferenceFactory()
file = StringIO(newpickle)
unpickler = Unpickler(file)
unpickler.find_global = find_global
unpickler.persistent_load = prfactory.persistent_load
meta = unpickler.load()
if isinstance(meta, tuple):
klass = meta[0]
newargs = meta[1] or ()
if isinstance(klass, tuple):
klass = find_global(*klass)
else:
klass = meta
newargs = ()

if klass in _unresolvable:
print klass,klass.__repr__,is unresolvable
return None

newstate = unpickler.load()
inst = klass.__new__(klass, *newargs)

try:
resolve = inst._p_resolveConflict
except AttributeError:
print inst.__repr__,has no _p_resolveConflict method
_unresolvable[klass] = 1
return None

old = state(self, oid, oldSerial, prfactory)
committed = state(self, oid, committedSerial, prfactory,
committedData)

resolved = resolve(old, committed, newstate)

file = StringIO()
pickler = Pickler(file,1)
pickler.persistent_id = persistent_id
pickler.dump(meta)
pickler.dump(resolved)
print everything's ok
return file.getvalue(1)
except (ConflictError, BadClassName):
print ConflictError during conflict resolution in
tryToResolveConflict, ConflictResolution.py
import traceback
import sys
traceback.print_exc(file = sys.stdout)
return None
except:
print Exception raised in in tryToResolveConflict,
ConflictResolution.py
import traceback
import sys
traceback.print_exc(file=sys.stdout)
# If anything else went wrong, catch it here and avoid passing an
# arbitrary exception back to the client.  The error here will
mask
# the original ConflictError.  A client can recover from a
# ConflictError, but not necessarily from other errors.  But log
# the error so that any

Re: [Zope] Zope pretends to receive and send XMLRPC data, but strace sees nothing ! (fwd)

2007-01-24 Thread yacine chaouche

As Gabriel Genellina said earlier in this discussion, the probleme could
come from the dicoLignes variable that is stored in the session.I don't get
it, the exception says that the Increaser object is responsible of the
conflict error :

ZODB.POSException.ConflictError database conflict error (oid 0x09, class
Products.Transience.Transience.Increaser, serial this txn started with
0x036b192256c66688 2007-01-23 16:34:20.337891, serial currently committed
0x036b19236a4be0ee 2007-01-23 16:35:24.913219)

But the Increaser class has a _p_resolveConflict method :

code
class Increaser(Persistent):
   
   A persistent object representing a typically increasing integer that
   has conflict resolution which uses the greatest integer out of the three
   available states.
   
   ...
   def _p_resolveConflict(self, old, state1, state2):
   return max(old, state1, state2)

/code

http://www.zope.org/Members/jim/ZODB/ApplicationLevelConflictResolution says
:
 When a conflict is detected, then the database checks to see if the class
of the object being saved defines the method, _p_resolveConflict. If the
method is defined, then the method is called on the object. If the method
succeeds, then the object change can be committed, otherwise a
ConflictErroris raised as usual.

But how can the simple instruction return max(old,state1,state2) not
succeed ??!!

anyway, i decided to rewrite it like this :
code
   def _p_resolveConflict(self, old, state1, state2):
   try:
   number = max(old,state1,state2)
   except Exception,msg:
   import traceback
   traceback.print_exc(file=sys.stdin)
   return max(old, state1, state2)
/code

And still the same exception is raised !

traceback on the console
exception raised in the publish module, in function publish
Traceback (most recent call last):
 File /opt/aef/Zope-2.9.0/lib/python/ZPublisher/Publish.py, line 119, in
publish
   transactions_manager.commit()
 File /opt/aef/Zope-2.9.0//lib/python/Zope2/App/startup.py, line 234, in
commit
   transaction.commit()
 File /opt/aef/Zope-2.9.0//lib/python/transaction/_manager.py, line 96,
in commit
   return self.get().commit(sub, deprecation_wng=False)
 File /opt/aef/Zope-2.9.0//lib/python/transaction/_transaction.py, line
380, in commit
   self._saveCommitishError() # This raises!
 File /opt/aef/Zope-2.9.0//lib/python/transaction/_transaction.py, line
378, in commit
   self._commitResources()
 File /opt/aef/Zope-2.9.0//lib/python/transaction/_transaction.py, line
433, in _commitResources
   rm.commit(self)
 File /opt/aef/Zope-2.9.0//lib/python/ZODB/Connection.py, line 484, in
commit
   self._commit(transaction)
 File /opt/aef/Zope-2.9.0//lib/python/ZODB/Connection.py, line 526, in
_commit
   self._store_objects(ObjectWriter(obj), transaction)
 File /opt/aef/Zope-2.9.0//lib/python/ZODB/Connection.py, line 554, in
_store_objects
   s = self._storage.store(oid, serial, p, self._version, transaction)
 File /opt/aef/Zope-2.9.0//lib/python/tempstorage/TemporaryStorage.py,
line 200, in store
   data=data)
ConflictError: database conflict error (oid 0x09, class
Products.Transience.Transience.Increaser, serial this txn started with
0x036b1eec70e150ee 2007-01-24 17:16:26.456283, serial currently committed
0x036b1eee46e27955 2007-01-24 17:18:16.613593)
/traceback

(i edited publish.py and added a traceback.print_exc(file=stdin) instruction
in the beginning of the except block).



Y.Chaouche

2007/1/23, Maciej Wisniowski [EMAIL PROTECTED]:


 And here is the exception that is raised:

 exception raised in the publish module, in function publish
 ZODB.POSException.ConflictError database conflict error (oid 0x09, class
 Products.Transience.Transience.Increaser, serial this txn started with
 0x036b192256c66688 2007-01-23 16:34:20.337891, serial currently
committed
 0x036b19236a4be0ee 2007-01-23 16:35:24.913219)

 What happend ?
Sorry for doing that but I'll send you to list archives.
There were a lot of threads about conflict errors. I think
you'll find them helpful.

--
Maciej Wisniowski


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Zope pretends to receive and send XMLRPC data, but strace sees nothing ! (fwd)

2007-01-23 Thread yacine chaouche

Hello all,


From times to times, apparently randomly, I have the following uncaught

exception in the console :

2007-01-23 10:41:07 ERROR ZServer uncaptured python exception, closing
channel ZServer.HTTPServer.zhttp_channel connected 10.75.49.51:48177 at
0x44562e6c channel#: 140 requests: (socket.error:(104, 'Connection reset by
peer') [/opt/python2.4.2/lib/python2.4/asynchat.py|initiate_send|219]
[/opt/aef/Zope-2.9.0/lib/python/ZServer/medusa/http_server.py|send|417]
[/opt/python2.4.2/lib/python2.4/asyncore.py|send|332])

In addition, i have edited this file
:Zope-2.9.0/lib/python/ZPublisher/HTTPRequest.py
as follows :
code
   def retry(self):
   print retry called in HTTPRequest for the,self.retry_count,time
   self.retry_count=self.retry_count+1
   self.stdin.seek(0)
   r=self.__class__(stdin=self.stdin,
environ=self._orig_env,
response=self.response.retry()
)
   r.retry_count=self.retry_count
   return r
/code

I only added a single print line to see if this method was called. And
indeed, it is ! Does anyone knows when (in what circumstances) this method
could be called ???

console trace
ip: 10.75.49.155 requests counting of lines 11 to 21
ip: 10.75.49.51 requests counting of lines 11 to 21
sending results to 10.75.49.155
sending results to 10.75.49.51
retry called in HTTPRequest for the 0 time
ip: 10.75.49.51 requests counting of lines 11 to 21

/console trace

Thanks.

Y.Chaouche

2007/1/19, yacine chaouche [EMAIL PROTECTED]:


It writes and reads objects in the session, maybe the probleme comes from
here ? Here's a little sinppet :

def toutCompter(self):

xmlrpc methode, called from a web borwser.

documentXML = ComptageXML()
#this reads and writes objects in the session
dicoLignes  = self._fabriquerDicoLignes()
#do things with dicoLignes
for inumLigneCourante in xrange(borneInf,borneSup) :
snumLigneCourante = str(inumLigneCourante)
ligne = dicoLignes[snumLigneCourante][requete]
#do things here
self._ajouterAuDico(snumLigneCourante,ligne,comptage,arbre)

if ligne :
self._mettreEnSession(resultats)

response = self.REQUEST.RESPONSE
response.setHeader(Content-Type,text/xml)
response.setHeader (charset,utf-8)
chaineXML = documentXML.formatXML()
print sending results to +addresseIP
return chaineXML

def _fabriquerDicoLignes(self):
formulaire = self.getForm()
dicoLignes = self.getSession(self,dicoLignes) or {}
for key in formulaire.keys():
#do things...
self.setSession(dicoLignes, dicoLignes)
return dicoLignes

def _fabriquerListeLignes(self):
dicoLignes = RacineAbstraite.getSession(self,dicoLignes) or {}
listeNumeros = dicoLignes.keys()
listeNumeros.sort ( lambda x,y: cmp(int(x), int(y)) )
return [ dicoLignes[str(inumeroLigne)][requete] for inumeroLigne
in \
sorted( [int(snumeroLigne) for snumeroLigne in
dicoLignes.keys()] ) ]

def _ajouterAuDico(self,p_snumeroCle,p_ligne,p_comptage,p_arbre):
dicoLignes = RacineAbstraite.getSession(self,'dicoLignes') or {}
dicoLignes[p_snumeroCle]  =
{'requete':p_ligne,'comptage':p_comptage,'arbre':p_arbre}
self.setSession('dicoLignes',dicoLignes)

def _mettreEnSession(self,p_resultats):

Mettre en session les résultats d'un comptage.


# Initialise de la SESSION
dicoResultatRecherche = {
'listeCriteres' : [self._fabriquerListeLignes(),
self.getForm('numeroLigne')],
'nombreEntreprises' : p_resultats[0][0],
'listeComptage' : p_resultats,
'listeEntreprises'  : [],
}
#On conserve la requete et le resultat en session
self.setSession('resultatRecherche',
p_dicoResultatRecherche.copy())


When toutCompter is called by browser 1, then he will write and read, say,
the dicoLignes object in the session.
When toutCompter is called by browser 2 parallely, is it the same
dicoLignes object that it tries to access or another one is created ? can
there be conflicts somehow ?

Y.Chaouche

2007/1/19, yacine chaouche [EMAIL PROTECTED]:

 I mean triple couples of lines of code.

 2007/1/19, yacine chaouche  [EMAIL PROTECTED]:
 
  The toutCompter methode does a lot of thing and it would take a triple
  couples of lines to describe what it does all.
  Anyway, is there a way for me to detect ConflictErrors ? they don't
  appear on the console so i guess they are catched.
 
  Y.Chaouche
 
  2007/1/19, Gabriel Genellina [EMAIL PROTECTED] :
  
   At Thursday 18/1/2007 16:30, Andreas Jung wrote:
  
  
   zope trace to the console
   ip: 10.75.49.155 requests counting of lines 1 to 11
   ip: 10.75.49.51 requests counting of lines 1 to 11
   sending results to 10.75.49.155

Re: [Zope] Zope pretends to receive and send XMLRPC data, but strace sees nothing ! (fwd)

2007-01-23 Thread yacine chaouche

Got it !

I edited this file :
Zope-2.9.0/lib/python/ZPublisher/Publish.py
and added a print line in the publish function, at the beginning of the
first except block :
code
def publish(request, module_name, after_list, debug=0,...):

   ...
   try:
   request.processInputs()

   request_get=request.get
   response=request.response
   ...
   except:
   print exception raised in the publish module, in function publish,
sys.exc_type,sys.exc_value
   # DM: provide nicer error message for FTP
   sm = None
   if response is not None:
   sm = getattr(response, setMessage, None)
   ...
/code
print exception raised in the publish module, in function publish,
sys.exc_type,sys.exc_value
/code

And here is the exception that is raised:

exception raised in the publish module, in function publish
ZODB.POSException.ConflictError database conflict error (oid 0x09, class
Products.Transience.Transience.Increaser, serial this txn started with
0x036b192256c66688 2007-01-23 16:34:20.337891, serial currently committed
0x036b19236a4be0ee 2007-01-23 16:35:24.913219)

What happend ?

Y.Chaouche

2007/1/23, Maciej Wisniowski [EMAIL PROTECTED]:



 From times to times, apparently randomly, I have the following
 uncaught exception in the console :

 2007-01-23 10:41:07 ERROR ZServer uncaptured python exception, closing
 channel ZServer.HTTPServer.zhttp_channel connected 10.75.49.51:48177
 http://10.75.49.51:48177 at 0x44562e6c channel#: 140 requests:
 (socket.error:(104, 'Connection reset by peer')
 [/opt/python2.4.2/lib/python2.4/asynchat.py|initiate_send|219]
 [/opt/aef/Zope-
 2.9.0/lib/python/ZServer/medusa/http_server.py|send|417]
 [/opt/python2.4.2/lib/python2.4/asyncore.py|send|332])
This means that when Zope was sending a response to the browser,
user pressed a 'Stop' button in browser, closed browser tab/window etc.
Nothing to worry about.

--
Maciej Wisniowski

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Zope pretends to receive and send XMLRPC data, but strace sees nothing !

2007-01-19 Thread yacine chaouche

Sorry, it seems I didn't click on the right button :), here is the message
sent to the list this time :

Thank you Andreas for showing me this nice tool which is tcpflow.

Thanks to it, I am now sure that the probleme is coming from zope.


Would you take a look at this :
[EMAIL PROTECTED]:~/HTTPCONNECTIONS# tcpflow host 10.75.49.100 and port 8081
tcpflow[20104]: listening on eth0

The tcpflow is run on the 10.75.49.51 machine, the one that zope thinks it
sends two times the XMLRPC query.
10.75.49.100 is the server that runs zope.

Now i click on the button, on both browsers (remember they are on different
machines), invoking the method toutCompter via xmlhttprequest, and wait
for zope to complete the requests :

zope trace to the console
ip: 10.75.49.155 requests counting of lines 1 to 11
ip: 10.75.49.51 requests counting of lines 1 to 11
sending results to 10.75.49.155
sending results to 10.75.49.51
ip: 10.75.49.51 requests counting of lines 1 to 11
sending results to 10.75.49.51
/zope trace


Zope says he got 2 requests form 10.75.49.51 and sent it the results 2
times. Ok, let's check the tcpflow then for these supposed connections :
[EMAIL PROTECTED]:~/HTTPCONNECTIONS# ls
total 8,0K
-rw-r--r-- 1 root root 873 2007-01-18 18:52 010.075.049.051.41131-010.075
.049.100.08081
-rw-r--r-- 1 root root 607 2007-01-18 18:53
010.075.049.100.08081-010.075.049.051.41131

Allright, first file (machine to server):

[EMAIL PROTECTED]:~/HTTPCONNECTIONS# cat 
010.075.049.051.41131-010.075.049.100.08081
POST /aef/rechercheMultiligne/toutCompter HTTP/1.1
Host: 10.75.49.100:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.8.1) Gecko/20061010
Firefox/2.0
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9
,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: fr,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-15,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Referer: http://10.75.49.100:8081/aef/rechercheMultiligne
Content-Length: 224
Cookie: _ZopeId=58653529A2r8NuahgXc
Pragma: no-cache
Cache-Control: no-cache

requete_1=ape%2012*requete_2=ape%2012*requete_3=ape%2012*requete_4=ape%2012*requete_5=ape%2012*requete_6=ape%2012*requete_7=ape%2012*requete_8=ape%2012*requete_9=ape%2012*requete_10=ape%2012*borneInf=0borneSup=
10[EMAIL PROTECTED]:~/HTTPCONNECTIONS#


Allright, there is only ONE POST request. So zope didnt really got two
requests. Now let's see if it sent the data two times as it presumes :

[EMAIL PROTECTED]:~/HTTPCONNECTIONS# cat 
010.075.049.100.08081-010.075.049.051.41131
HTTP/1.1 200 OK
Server: Zope/(Zope 2.9.0-, python 2.4.2, linux2) ZServer/1.1
Date: Thu, 18 Jan 2007 17:51:42 GMT
Content-Length: 413
Charset: utf-8
Content-Type: text/xml; charset=utf-8

?xml version=1.0 encoding=utf-8 ?comptagescomptage
numLigne=13/comptagecomptage numLigne=23/comptagecomptage
numLigne=33/comptagecomptage numLigne=43/comptagecomptage
numLigne=53/comptagecomptage numLigne=63/comptagecomptage
numLigne=73/comptagecomptage numLigne=83/comptagecomptage
numLigne=93/comptagecomptage numLigne=103/comptage/comptages
[EMAIL PROTECTED]:~/HTTPCONNECTIONS#

The results were sent just one time, not two.

What is going on here ?

Any comment would be really appreciated.

Thanks,
Y.Chaouche
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Zope pretends to receive and send XMLRPC data, but strace sees nothing ! (fwd)

2007-01-19 Thread yacine chaouche

The toutCompter methode does a lot of thing and it would take a triple
couples of lines to describe what it does all.
Anyway, is there a way for me to detect ConflictErrors ? they don't appear
on the console so i guess they are catched.

Y.Chaouche

2007/1/19, Gabriel Genellina [EMAIL PROTECTED]:


At Thursday 18/1/2007 16:30, Andreas Jung wrote:


zope trace to the console
ip: 10.75.49.155 requests counting of lines 1 to 11
ip: 10.75.49.51 requests counting of lines 1 to 11
sending results to 10.75.49.155
sending results to 10.75.49.51
ip: 10.75.49.51 requests counting of lines 1 to 11
sending results to 10.75.49.51
/zope trace


Zope says he got 2 requests form 10.75.49.51 and sent it the results 2
times. Ok, let's check the tcpflow then for these supposed connections :
[...]
Allright, there is only ONE POST request. So zope didnt really got two
requests. Now let's see if it sent the data two times as it presumes :
[...]
The results were sent just one time, not two.

What is going on here ?

What does the toutCompter method really does? Does it modify some
object state? That might provoke a ConflictError, forcing a
transaction abort and the request to be re-tried (up to three times,
silently, then it goes logged).


--
Gabriel Genellina
Softlab SRL






__
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Zope pretends to receive and send XMLRPC data, but strace sees nothing ! (fwd)

2007-01-19 Thread yacine chaouche

I mean triple couples of lines of code.

2007/1/19, yacine chaouche [EMAIL PROTECTED]:


The toutCompter methode does a lot of thing and it would take a triple
couples of lines to describe what it does all.
Anyway, is there a way for me to detect ConflictErrors ? they don't appear
on the console so i guess they are catched.

Y.Chaouche

2007/1/19, Gabriel Genellina [EMAIL PROTECTED]:

 At Thursday 18/1/2007 16:30, Andreas Jung wrote:


 zope trace to the console
 ip: 10.75.49.155 requests counting of lines 1 to 11
 ip: 10.75.49.51 requests counting of lines 1 to 11
 sending results to 10.75.49.155
 sending results to 10.75.49.51
 ip: 10.75.49.51 requests counting of lines 1 to 11
 sending results to 10.75.49.51
 /zope trace
 
 
 Zope says he got 2 requests form 10.75.49.51 and sent it the results 2
 times. Ok, let's check the tcpflow then for these supposed connections
 :
 [...]
 Allright, there is only ONE POST request. So zope didnt really got two
 requests. Now let's see if it sent the data two times as it presumes :
 [...]
 The results were sent just one time, not two.
 
 What is going on here ?

 What does the toutCompter method really does? Does it modify some
 object state? That might provoke a ConflictError, forcing a
 transaction abort and the request to be re-tried (up to three times,
 silently, then it goes logged).


 --
 Gabriel Genellina
 Softlab SRL






 __
 Preguntá. Respondé. Descubrí.
 Todo lo que querías saber, y lo que ni imaginabas,
 está en Yahoo! Respuestas (Beta).
 ¡Probalo ya!
 http://www.yahoo.com.ar/respuestas

 ___
 Zope maillist  -  Zope@zope.org
 http://mail.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
  http://mail.zope.org/mailman/listinfo/zope-dev )



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to get modules that are called by external methods reloaded?

2007-01-19 Thread yacine chaouche

I think that when you restart zope, it compiles everything that is in the
products directory. So what happens when you compile it for yourself while
zope is running ?

If you have only one machine,  you can setup multiple zope instances to
develop and debug on them so that you are not obliged to restart the
production instance.

Y.Chaouche
2007/1/19, Gaute Amundsen [EMAIL PROTECTED]:


On Friday 19 January 2007 12:13, Maciej Wisniowski wrote:
  Subject says it sall.
  Only way I have found so far is to restart zope, and on a production
  server, that is not very popular. Takes about 10 minutes on ours..

 Have you tried to go into Edit form of your external method
 and just hit Save button?
 This should tell you that External method was updated.

Most definitely.
That updates everything in the file in the Extensions folder, but noting
that
this file imports.

Gaute
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to get modules that are called by external methods reloaded?

2007-01-19 Thread yacine chaouche

You are right Jens, but I thought that Gaute wanted to apply some
modifications to a module and see the results live, without restarting
zope.

Y.Chaouche

2007/1/19, Jens Vagelpohl [EMAIL PROTECTED]:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 19 Jan 2007, at 14:09, yacine chaouche wrote:

 I think that when you restart zope, it compiles everything that is
 in the products directory. So what happens when you compile it for
 yourself while zope is running ?

Sorry, that's just plain wrong. If a PYC file exists for a given PY
file and the PY file has not been changed since the PYC file has been
created then the module will not be recompiled.

jens


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFFsOTERAx5nvEhZLIRAkgOAJwN1OdUZydIXoXw2+Hz+yOwEH6ubACfSc8D
tX/z6pFyQ8f0QVVd3X0d9N4=
=XT9P
-END PGP SIGNATURE-
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Zope pretends to receive and send XMLRPC data, but strace sees nothing !

2007-01-18 Thread yacine chaouche

Hi,
I have an ajax application that is composed by :
1) An ajax client which is a web page with a button that calls a zope
object's method, say toutCompter.
2) An ajax server (zope), with a zope object that has the method
toutCompter (all zope object methods are XMLRPC callable right ?).

I use two browsers on two separate machines. I call the methode on the two
browsers, and compares the zope trace and strace output of the network
activity. The problem is that zope says he sends data but strace don't, and
zope says he receives data and again strace don't.

This is the zope/python code that prints to the console :
zope/python
   def toutCompter(self):
   
   this method is called via XMLRPC.
   
   IPAdresse  = self.REQUEST[REMOTE_ADDR]
   print ip:,IPAdresse,requests counting of lines,self.getForm
('min'),to,self.getForm('max')
   ... #some processing here. creation of XMLData
   print sending results to +IPAdresse
   return XMLData
/zope/python


Zope says :

zope traces to the console
ip: 10.75.49.155 requests counting of lines 10 to 20
ip: 10.75.49.51 requests counting of lines 10 to 20
sending results to 10.75.49.155
sending results to 10.75.49.51
ip: 10.75.49.51 requests counting of lines 10 to 20
sending results to 10.75.49.51
/zope trace

while strace says (SIGRTMIN were stripped out, are they of any use here ?):

strace
recv(24, 0x8d1e7e4, 4096, 0)= -1 ECONNRESET (Connection reset by
peer)
recv(24, POST /aef/rechercheMultiligne/to..., 4096, 0) = 686
recv(28, POST /aef/rechercheMultiligne/to..., 4096, 0) = 649
recv(28, requete_11=%2410%20and%20ptel%20..., 4096, 0) = 445
send(24, HTTP/1.1 200 OK\r\nServer: Zope/(Z..., 666, 0) = 666
recv(24, 0x8ebac04, 4096, 0)= -1 ECONNRESET (Connection reset by
peer)
send(28, HTTP/1.1 200 OK\r\nServer: Zope/(Z..., 643, 0) = 643
/strace

As you can see, the first part of the zope trace:

ip: 10.75.49.155 requests counting of lines 10 to 20
ip: 10.75.49.51 requests counting of lines 10 to 20

corresponds to this part of the strace :
recv(24, 0x8d1e7e4, 4096, 0)= -1 ECONNRESET (Connection reset by
peer)
recv(24, POST /aef/rechercheMultiligne/to..., 4096, 0) = 686
comment WHERE IS POST DATA FOR SOCKET 24??? /comment
recv(28, POST /aef/rechercheMultiligne/to..., 4096, 0) = 649
recv(28, requete_11=%2410%20and%20ptel%20..., 4096, 0) = 445

This part is ok. XMLHTTPRequest data is sent, saying :hello ! i request the
toutCompter methode. This is the post-data that you need to process my
query. Thanks folk, seeya !.

Now the second part is wierd, because the zope trace and strace DO NOT MATCH
:

zope trace part II, sending data back to XMLHTTPRequest
sending results to 10.75.49.155
sending results to 10.75.49.51
ip: 10.75.49.51 requests counting of lines 10 to 20
sending results to 10.75.49.51
/zope trace

strace part II, data sent only to one machine !
send(24, HTTP/1.1 200 OK\r\nServer: Zope/(Z..., 666, 0) = 666
recv(24, 0x8ebac04, 4096, 0)= -1 ECONNRESET (Connection reset by
peer)
send(28, HTTP/1.1 200 OK\r\nServer: Zope/(Z..., 643, 0) = 643
/strace

let's match line by line :
=

zope   strace
=


sending results to 10.75.49.155 = send(24, HTTP/1.1
200 OK\r\nServer: Zope/(Z..., 666, 0) = 666
sending results to 10.75.49.51  = you are such a liar !
no data was really sent !
ip: 10.75.49.51 requests counting of lines 10 to 20 = WHAT ? there's no
recv at all !! except for the reset !
sending results to 10.75.49.51 = send(28, HTTP/1.1 200
OK\r\nServer: Zope/(Z..., 643, 0) = 643
=


This behaviour is repeated every time i use two browsers, be it on the same
machine or on two separate machines.
It all seems like zope would save the xmlrpc requests in a buffer and
process on of the requests many times (sometimes more than twice !), or
something alike.
I would like to notice here that I use Zope 2.9.0 in single thread mode and
python 2.4.2
I would really appreciate anybody's comment on this strange brehaviour.

Thank you.
Y.Chaouche
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )