Perforce Server 2020 Giving Problems On Multiple Logins

105 Views Asked by At

On migrating from 2015 perforce server to 2019, i was facing parrallel login issues from Java API for P4, P4JAVA.

On 2019 server ,if multiple IServer objects( say server1 and server2) made connection to the server using same userId, then logging out of server1 (i.e. server1.logout()) ends session for all other IServer objects concurrently logged in.

This does not happen for 2015 server and ending seesion for server1 using logout doesn't result in the same for server2.

Is this the expected working for 2019 server? Can changing any properties revert 2019 authentication to work similar to 2015 server? I have attached a piece of code below and output for further reference

  public static void main(String args[]) throws P4JavaException, URISyntaxException {
    IOptionsServer server1 = null, server2 =null;
    server1 = connectServer(server1,"p4javassl://127.0.0.1:1666");
    server2 = connectServer(server2,"p4javassl://127.0.0.1:1666");
    System.out.println(server1.getLoginStatus());
    System.out.println(server2.getLoginStatus());
    server1.logout();
    System.out.println(server1.getLoginStatus());
    System.out.println(server2.getLoginStatus());
  }
  public static IOptionsServer connectServer(IOptionsServer server,String URL)
      throws P4JavaException, URISyntaxException {
    Properties defaultProps = new Properties();
    defaultProps.put(RpcPropertyDefs.RPC_SOCKET_SO_TIMEOUT_NICK, "90000");
    defaultProps.putAll(System.getProperties());
    server = ServerFactory.getOptionsServer(URL, defaultProps);
    TrustOptions trustOptions = new TrustOptions(true, false, true);
    ((IOptionsServer) server).addTrust(trustOptions);
    server.connect();
    server.setUserName("usr");
    server.login("pass");
    return server;
  }

Output for 2019 server

User super ticket expires in 11 hours 59 minutes. User super ticket expires in 11 hours 59 minutes. Perforce password (P4PASSWD) invalid or unset.

Perforce password (P4PASSWD) invalid or unset.

Output for 2015 server

User super ticket expires in 11 hours 59 minutes. User super ticket expires in 11 hours 59 minutes. Perforce password (P4PASSWD) invalid or unset.

User super ticket expires in 11 hours 59 minutes.

1

There are 1 best solutions below

0
On

All client-side tickets are stored in a ticket file (P4TICKETS), keyed by username and server port. You can see all your tickets by running the p4 tickets command.

When you do a p4 logout, the ticket for the current user/port is deleted from the local tickets file, requiring you to p4 login again to get a new copy of it from the server. Since a regular logout doesn't invalidate the ticket on the server, you can remain "logged in" as long as you keep a copy of the ticket; you could do this by having multiple tickets files, or by simply saving the hash and then restoring it (you can also pass a ticket hash as P4PASSWD if it's not in the tickets file).