All responses within the same session are supposed to have the same 
session_id. The fact that all three Ajax requests can access the session 
doesn't necessarily mean they are being processed in parallel (the requests 
might still be completing one after another).

It would be helpful if you could attach a minimal app that demonstrates the 
problem.

Anthony

On Sunday, August 9, 2015 at 12:30:01 PM UTC-4, Val K wrote:
>
> I realize your advice - no effect!
> I analyzed *session.connect* and found  strange  place at the biginig of 
> *connect *definition:
> ...
> self._unlock(response)   # -  *unconditional unlock *session file witch 
> have a name == response.session_id
> ...
>
> Then I  changed definition of ajx_bug(): form=SQLFORM.factory(Field('
> any', *comment=response.session_id* ), table_name=form_name)
> and here is I got:
>
> Many Ajx Form
> ajx_frm_0:
> Any
> 127.0.0.1-dd2c6b6c-3141-4826-8887-ab1691b67350
> ajx_frm_1:
> Any
> 127.0.0.1-dd2c6b6c-3141-4826-8887-ab1691b67350
> ajx_frm_2:
> Any
> 127.0.0.1-dd2c6b6c-3141-4826-8887-ab1691b67350
>
>
>
>
>
>
> All ajax responses have the same response_id! i.e. each ajax-process can 
> unlock session file locked by another!
> In other words, requests parallel processing works properly across 
> sessions, but  not within one session, because all responses within session 
> have the same response_id
> It seems, that file is not locked across parallel process (on my Win7 at 
> least), may because it is children of one parent or something else?
>
>
>
> On Sunday, August 9, 2015 at 3:28:04 PM UTC+3, Anthony wrote:
>>
>> Does the problem occur only on the first page load of the session? If so, 
>> does the problem go away if you add the following line at the top of the 
>> many_ajx_form function:
>>
>>     session.dummy_data = 'dummy data'
>>
>> If that's the case, then this is the same problem diagnosed in the 
>> original thread, with something like the above as the solution. The problem 
>> is not that Ajax reads fail to lock the session -- the problem is that at 
>> the very beginning of the session when the initial set of Ajax requests are 
>> made, there is no session file to lock at all. Adding some dummy data to 
>> the session in the parent page will force a session file to be created, so 
>> the session file will then exist and therefore be locked when the Ajax 
>> requests come in. Note, this won't work with sessions stored in the DB or 
>> in cookies, as there is no session locking at all with those methods (you 
>> will need some other means to avoid session race conditions in those cases).
>>
>> Anthony
>>
>>
>>
>>
>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to