Warning: Can't synchronize with repository "(default)" (/home/git/ome.git does not appear to be a Git repository.). Look in the Trac log for more information.
Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

Task #3774 (closed)

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

Bug: uuid.uuid4() causes OmeroPy client creation to fail on Mac OSX

Reported by: jamoore Owned by: jamoore
Priority: critical Milestone: OMERO-Beta4.3
Component: OmeroPy Version: n.a.
Keywords: n.a. Cc: cneves
Resources: n.a. Referenced By: n.a.
References: n.a. Remaining Time: 0.0d
Sprint: 2011-01-13 (3)

Description

When starting multiple django processes on Mac OSX, two different PIDs might generate the same client UUID leading to a failed login:

Thu, 06 Jan 2011 16:24:18 blitz_gateway DEBUG    Connect attempt, pid=15591, sUuid=b0837a80-0e35-4032-92d3-aaa0cd08a95c, group=None, self.sUuid=None, self._BaseClient__uuid=9d9873d9-bc2e-4fb9-a51f-313b30995234
24:38
Thu, 06 Jan 2011 16:24:21 blitz_gateway DEBUG    Connect attempt, pid=15590, sUuid=b0837a80-0e35-4032-92d3-aaa0cd08a95c, group=None, self.sUuid=None, self._BaseClient__uuid=9d9873d9-bc2e-4fb9-a51f-313b30995234

produces something like:

2011-01-06 13:40:48,864 ERROR [ ome.services.blitz.fire.SessionManagerI] (l.Server-5) Error while creating ServiceFactoryI
Ice.AlreadyRegisteredException
    kindOfObject = "servant"
    id = "session-ffb674a5-6ec1-4d17-8d6c-0afef9559b1c/f2fa1c4b-411e-4a92-88e6-8a3bc2f2b772"
        at IceInternal.ServantManager.addServant(ServantManager.java:34)

See:

Change History (10)

comment:1 Changed 13 years ago by jmoore

Under Python 2.6.6, the workaround is already in place:

$ python
Python 2.6.6 (r266:84292, Dec 30 2010, 16:35:14) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import uuid
>>> uuid._uuid_generate_random
>>> uuid._uuid_generate_time

comment:3 Changed 13 years ago by cneves

Because I've been having this issue for a long time now, and because updating to 2.6.6 would be dependency hell all over again, I followed the link on the previous comment and downloaded http://svn.python.org/view/*checkout*/python/branches/release26-maint/Lib/uuid.py placing it in lib/python/omero/nuuid.py

I then changed lib/python/omero/clients.py from:

  import uuid

to

  import omero.nuuid as uuid

and changed nuuid.py from

 import sys

to

 sys = __import__('sys')

to prevent omero.sys to be imported. All works wonderfully now!

FYI, I'm on OSX 10.6 with default python 2.6.1.

comment:4 Changed 13 years ago by jmoore

  • Remaining Time set to 0.25

comment:5 Changed 13 years ago by jmoore

  • Status changed from new to accepted

comment:6 Changed 13 years ago by jmoore

  • Remaining Time changed from 0.25 to 0
  • Resolution set to fixed
  • Status changed from accepted to closed

(In [8903/omero]) Added omero_ext.uuid.py for handling Python:#8621 (Fix #3774)

The new idiom for importing uuid is:

      import omero_ext.uuid as uuid # see ticket:3774

comment:7 Changed 13 years ago by Carlos Neves <carlos@…>

(In [5b04916524c57f02c8c51876eb9c3be130dd2d98/ome.git]) Added omero_ext.uuid.py for handling Python:#8621 (Fix #3774)

The new idiom for importing uuid is:

      import omero_ext.uuid as uuid # see ticket:3774

comment:8 Changed 13 years ago by jmoore <josh@…>

(In [40ddaa8c242e974d97211baad64848ec70f68f21/ome.git] on branch develop) Fixing use of uuid4 in servants.py (See #3774)

comment:9 Changed 13 years ago by jmoore <josh@…>

(In [dbbf3e9b3d7d65c1b924921f1ab40e1734ef4f7a/ome.git] on branch dev_4_2) Fixing use of uuid4 in servants.py (See #3774)

comment:10 Changed 13 years ago by Carlos Neves <carlos@…>

(In [5b04916524c57f02c8c51876eb9c3be130dd2d98/ome.git]on branches 4_1_custom, dev_4_1_custom, josh/4.1-web-backport) Added omero_ext.uuid.py for handling Python:#8621 (Fix #3774)

The new idiom for importing uuid is:

      import omero_ext.uuid as uuid # see ticket:3774
Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.66925 sec.)

We're Hiring!