Jackrabbit Content Repository
  1. Jackrabbit Content Repository
  2. JCR-3205

Missing support for lock timeout and ownerHint in jcr-server

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.6
    • Fix Version/s: 2.3.7
    • Labels:
      None

      Description

      trying to set the lock timeout when creating a lock seems not to work over the davex transport. the timeout is always 2147483.

      this was my test code:

      import javax.jcr.*;
      import javax.jcr.lock.*;

      import org.apache.jackrabbit.jcr2spi.RepositoryImpl;
      import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig;

      String url = "http://localhost:8080/server/";
      String workspace = "tests";

      RepositoryConfig config = new RepositoryConfigImplTest(repoUrl);
      Repository repo = RepositoryImpl.create(config);

      Credentials sc = new SimpleCredentials("admin","admin".toCharArray());
      Session s = repo.login(sc,workspace);

      Node t;
      if (s.getRootNode().hasNode("test"))

      { t = s.getRootNode().getNode("test"); }

      else

      { t = s.getRootNode().addNode("test", "nt:unstructured"); }

      t.addMixin("mix:lockable");
      s.save();
      LockManager m = s.getWorkspace().getLockManager();
      Lock l = m.lock(t.getPath(), false, true, 10, "me");
      System.out.println(l.getSecondsRemaining());

      and the output is 2147483

      the relevant communication fragment is below, i attach the full trace in case i miss something.

      LOCK /server/tests/jcr%3aroot/test HTTP/1.1
      Timeout: Second-10
      Depth: 0
      Link: <urn:uuid0c740bb9-042a-4ef2-b019-1a6c52784c29>; rel="http://www.day.com/jcr/webdav/1.0/session-id"
      Authorization: Basic YWRtaW46YWRtaW4=
      User-Agent: Jakarta Commons-HttpClient/3.0
      Host: localhost:8080
      Content-Length: 254
      Content-Type: text/xml; charset=UTF-8

      <?xml version="1.0" encoding="UTF-8" standalone="no"?><D:lockinfo xmlns="DAV:"><D:lockscope><dcr:exclusive-session-scoped xmlns:dcr="http://www.day.com/jcr/webdav/1.0"/></D:lockscope><D:locktype><D:write/></D:locktype><D:owner>me</D:owner></D:lockinfo>

      HTTP/1.1 200 OK
      Content-Type: text/xml; charset=utf-8
      Content-Length: 450
      Lock-Token: <aa724c28-3c24-41e8-a3b4-9fc129adf732>
      Server: Jetty(6.1.x)

      <?xml version="1.0" encoding="UTF-8" standalone="no"?><D:prop xmlns="DAV:"><D:lockdiscovery><D:activelock><D:lockscope><dcr:exclusive-session-scoped xmlns:dcr="http://www.day.com/jcr/webdav/1.0"/></D:lockscope><D:locktype><D:write/></D:locktype><D:depth>0</D:depth><D:timeout>Second-2147483</D:timeout><D:owner>admin</D:owner><D:locktoken><D:href>aa724c28-3c24-41e8-a3b4-9fc129adf732</D:href></D:locktoken></D:activelock></D:lockdiscovery></D:prop>

      by the way: if i do not explicitly logout before the program exits, the lock is also not released even though it is session based. should the session not trigger a logout on destruction?

      1. tcpdump.log
        121 kB
        David Buchmann

        Activity

        David Buchmann created issue -
        Hide
        David Buchmann added a comment -

        full dump of the tcp communication between client and server for the sample code, done with wireshark and formatted a little bit for readability.

        Show
        David Buchmann added a comment - full dump of the tcp communication between client and server for the sample code, done with wireshark and formatted a little bit for readability.
        David Buchmann made changes -
        Field Original Value New Value
        Attachment tcpdump.log [ 12510322 ]
        Julian Reschke made changes -
        Assignee Julian Reschke [ reschke ]
        Hide
        Julian Reschke added a comment -

        The LOCK response indicates that the timeout value wasn't used; will investigate...

        Show
        Julian Reschke added a comment - The LOCK response indicates that the timeout value wasn't used; will investigate...
        Hide
        angela added a comment -

        adjusted the component to jackrabbit-jcr-server. as far as i know the jsr 283 lock features
        are implemented in jcr2spi and the various spi-implementations. however, they are missing
        in the jcr-server (JcrActiveLock and DefaultItemCollection).

        will take a look at it.

        Show
        angela added a comment - adjusted the component to jackrabbit-jcr-server. as far as i know the jsr 283 lock features are implemented in jcr2spi and the various spi-implementations. however, they are missing in the jcr-server (JcrActiveLock and DefaultItemCollection). will take a look at it.
        angela made changes -
        Assignee Julian Reschke [ reschke ] angela [ anchela ]
        Component/s jackrabbit-jcr-server [ 12312058 ]
        Component/s jackrabbit-jcr2spi [ 12312060 ]
        Component/s jackrabbit-spi2jcr [ 12312061 ]
        angela made changes -
        Summary Lock timeout not working with jcr2spi Missing support for lock timeout and ownerHint in jcr-server
        Hide
        angela added a comment -

        modified the DefaultItemCollection to use LockManager#lock instead of
        Node#lock and adjusted the webdav active-lock object accordingly.

        since both features are defined to be optional by the jcr specification automated
        testing would require quite some changes in the tck and the jcr2spi tests.
        i did some quick verifications stepping into the OpenScopedLockTest and the
        server was responding as expected with the fixes in place.

        david, thanks for reporting this issue.

        Show
        angela added a comment - modified the DefaultItemCollection to use LockManager#lock instead of Node#lock and adjusted the webdav active-lock object accordingly. since both features are defined to be optional by the jcr specification automated testing would require quite some changes in the tck and the jcr2spi tests. i did some quick verifications stepping into the OpenScopedLockTest and the server was responding as expected with the fixes in place. david, thanks for reporting this issue.
        angela made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.4 [ 12318241 ]
        Resolution Fixed [ 1 ]
        Julian Reschke made changes -
        Component/s locks [ 11615 ]
        Hide
        Jukka Zitting added a comment -

        Merged to the 2.4 branch in revision 1232530.

        Show
        Jukka Zitting added a comment - Merged to the 2.4 branch in revision 1232530.
        Jukka Zitting made changes -
        Fix Version/s 2.3.7 [ 12319482 ]
        Fix Version/s 2.4 [ 12318241 ]
        Hide
        David Buchmann added a comment -

        thanks, the timeout is now taken into account by the server and works fine!

        what still confuses me is the reply by the server for infinite timeout (before and after this fix):

        <D:timeout>Second-2147483</D:timeout>

        this number is
        2^21+50331

        which seems pretty random to me. coincidally, this number is exactly 2^31 - 1 (2147483647) without the last 3 digits. can it be that there are some weird string operations happening on server side?

        Show
        David Buchmann added a comment - thanks, the timeout is now taken into account by the server and works fine! what still confuses me is the reply by the server for infinite timeout (before and after this fix): <D:timeout>Second-2147483</D:timeout> this number is 2^21+50331 which seems pretty random to me. coincidally, this number is exactly 2^31 - 1 (2147483647) without the last 3 digits. can it be that there are some weird string operations happening on server side?
        Hide
        Julian Reschke added a comment -

        Looks like a problem mapping Long.MAX_LONG to Infinite. Could you please open a separate ticket?

        Show
        Julian Reschke added a comment - Looks like a problem mapping Long.MAX_LONG to Infinite. Could you please open a separate ticket?
        David Buchmann made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            angela
            Reporter:
            David Buchmann
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development