2.2.4. Sessions and connections


<< Prev   Next >>

2.2.4.1. General information

Session defines the active infobase user and the processing thread assigned to the user. Any of these entities can become an active user:

  • 1C:Enterprise client application instance
  • Web application instance running the web client
  • External connection instance (obtained from the V83.COMConnector object)
  • Background job instance
  • Web service call

Sessions can be active or hibernating. A hibernating session can maintain normal operation of the client application after the client computer is switched to different power-saving modes. A session hibernates when:

  • Session connection terminates abnormally (applicable for thick client, external connection, and thin client with direct server connection). If the network link is physically terminated, server requires 2–3 minutes to detect loss of connection to the client application;
  • Client application session times out due to inactivity (applicable for web client and thin client connected over web server). If power-saving mode is disabled on the client computer and no user operations are performed in the client application, it calls 1C:Enterprise server every 5-10 minutes to keep the session active. Therefore, it is not recommended that you set session hibernation time below 10 minutes.

Any activity of the client application wakes the session. A hibernating session is terminated when:

  • Hibernating session times out.
  • Locks set by the hibernating session conflict with the locks an active session attempts to set.

When an active session hibernates, its client license is revoked and becomes available. When a hibernating session wakes, it attempts to acquire a client license (provided that it has a client license prior to hibernation). If a license cannot be acquired, the session is terminated with a fatal exception.

Timeout values for inactive session hibernation and hibernating session termination are set in the infobase parameter settings in Designer.

All data stored in a cluster and related to an active user and becoming obsolete once the user session ends is referred to as session data. Session data includes:

  • Infobase
  • Session number
  • Authenticated infobase user
  • Interface language
  • Session parameter values
  • Temporary storages
  • Session statistics
  • Managed application form data
  • Internal data of the platform

Session data is saved by the cluster manager. Session data service is used for this purpose. Session data is retained when the service cluster restarts. If the active user makes no calls to the cluster during the timeout period and the session is not assigned to a connection, the session hibernates. The inactivity timeout period is set in the infobase parameter settings in Designer. The default value is 1200 seconds. To keep the session from hibernating, thin client and web client call the cluster every 10 minutes or less. For quicker access, session data is cached both in the working processes and thick clients. The list of active sessions is displayed in the list of active users.

Session data changes made during a server call are stored in the working process and passed to the cluster manager only when control is returned to the client (normally, or after a software exception).

Session data changes are not saved in the cluster manager if:

  • A working process was abnormally terminated during a server call.
  • A data transfer error has occurred when control was returned to the client.

Connection is used by sessions to access 1C:Enterprise server cluster, it contains a limited set of connection data and is not associated with the active user. Connections are also used in interactions between cluster processes.

To access the cluster from client, you need to assign the session to a connection. While the client does not attempt to access the cluster, no assignment is required.

Sessions and connections are used in different ways in different 1C:Enterprise modes.

  • Designer and thick client:
    • Upon startup: establishes connection, creates a session, and assigns the session to the connection.
    • Upon exit: cancels session assignment, closes the session and connection.
  • One web service call, and one execution of a background or scheduled job:
    • When the call starts: selects a connection from the pool, creates a session, and assigns the session to the connection.
    • When the call ends: cancels session assignment, terminates the session, returns the connection to the pool.
  • The thin client and web client start the session at startup and end the session at shutdown:
    • At the beginning of a cluster call, a connection from the pool is selected, and a session of this client is assigned to it.
    • At the end of the call, the session assignment to the connection is canceled and the connection is returned to the pool.

Session information can be viewed in:

  • Event log
  • Cluster console
  • Software administration tools
  • Technological log
  • Global context

Cluster administrator can retrieve a list of open sessions for a specific infobase or for the whole cluster, using the cluster administration utility or software administration tools.

Cluster administrator can end a session using the cluster administration utility or software administration tools. This will terminate the active user's session. Ending a session assigned to a connection will also close this connection.

Cluster administrator can set a session creation lock using the cluster administration utility or software administration tools. This prohibits creation of new sessions but does not affect any existing ones.

2.2.4.2. Connection types

Connections are classified into two general types:

  • Infobase connections
  • Internal connections with working processes in the cluster
2.2.4.2.1. Infobase connections

Infobase connections have several distinctive features:

  • Connection is established to a specific infobase in the cluster.
  • Code in 1C:Enterprise language can be executed in such connection.
  • Connection can be reestablished over time.
  • Connection can be terminated using a cluster console command or from 1C:Enterprise language.
  • Infobase connections in a working process of the cluster prevent the process from stopping or starting.

The following infobase connection types are available:

  • Thick client
  • Thin client
  • Designer
  • Web server extension module
  • COM connection
  • Background job

Thick client

This connection is established between a thick client and an infobase. The connection is used to modify infobase data and perform other functions supported by infobase configuration.

The Thick client connection is established when a thick client is started interactively in 1C:Enterprise mode, or when Automation Client/Server technology is used to connect to an infobase, for example:

// Create 1C:Enterprise Automation server
AutomationServer= New COMObject("V83.Application");

// Establish infobase connection
// TestBase in cluster 1541 of the TestSrv main server
AutomationServer.Connect("Srvr="TestSrv";Ref="TestBase");

This connection is established between a thin client and an infobase. The connection is used to modify infobase data and perform other functions supported by infobase configuration.

The Thin client connection is established when a thin client is started interactively, or when Automation Client/Server technology is used to connect to an infobase, for example:

// Create 1C:Enterprise Automation server
AutomationServer = New COMObject("V83C.Application");

// Establish infobase connection
// TestBase in cluster 1541 of the TestSrv main server
AutomationServer.Connect("Srvr="TestSrv";Ref="TestBase");

This connection is established between Designer and an infobase. The connection is used to create or modify infobase configurations, and perform administrative or scheduled activities.

Web server extension module

This connection is established between a web server and a working process of the server. You can use this connection for operation of: web clients, Internet services, thin clients over HTTP, and mobile clients.

The connection is established when an Internet service is called, or when a web client, thin client over HTTP, or mobile client calls 1C:Enterprise server. The connection exists until the web server is restarted or the connection is removed from the connection pool of web server extension modules (until its pool lifetime expires or until it is replaced by other connections).

See also:

  • Internet services
  • Mobile client

COM connection

This connection is established between a process using an external 1C:Enterprise connection and an infobase. The connection is used to modify infobase data and perform other functions supported by infobase configuration.

COM connection is established when COM technology is used to connect to an infobase, for example:

// Create 1C:Enterprise Automation server
COMConnector = New COMObject("V83.COMConnector");

// Establish infobase connection
// TestBase in cluster 1541 of the TestSrv main server
ConnectInfobase = COMConnector.Connect("Srvr="TestSrv";Ref="TestBase");

This connection is established between a working process of the cluster and an infobase. The connection is intended for executing the background job procedure code.

The background job connection is established in the following situations:

  • Receipt of a list of scheduled jobs registered in the infobase
  • Start of a scheduled job registered in the infobase
  • Background job start from 1C:Enterprise language
  • Report execution in the background
  • Background search by substring
  • Background list query execution
  • Start of background restructuring

Among others, developers can start background jobs using 1C:Enterprise language expressions. Example:

// Run the background job described in the procedure
// UpdateFullTextSearchIndex
// of the ScheduledProcedures common module
BackgroundJob = BackgroundJobs.Execute("ScheduledProcedures.UpdateFullTextSearchIndex");

The background job connection is maintained while the background job procedure context exists. Once the procedure is completed or the report is generated, the background job connection is closed.

See also:

  • Background jobs
  • Background report generation
2.2.4.2.2. Service connections

Service connections:

  • Access a working process rather than a specific infobase.
  • Do not run code in 1C:Enterprise language.
  • Cannot be terminated by a user.
  • Do not prevent working processes of a server cluster from stopping or starting.

The following service connection types are available:

  • Job scheduler
  • Debugger
  • Cluster console
  • Administration server
  • COM administrator
  • System background job

Job scheduler

This connection is established between the job scheduler and a working process. You can use this connection to manage background jobs, which includes starting scheduled jobs at specified moments of time. This connection is also used in other situations when the cluster manager (rmngr) calls the working process (rphost), for example, when getting session lists.

The job scheduler connection is established during the first start of a background job. It can create a connection between a background job and an infobase within the same working process of a server cluster. After the background job connection is closed, the job scheduler connection stays active until the working process of the cluster is terminated or deleted.

Debugger

This connection is established between the debugger and a working process of a cluster in debug mode. You can use this connection to manage the debugging process and search for currently available debug items.

The debugger connection is established upon debug item attachment or search. The connection is closed upon debug item detachment or completion.

Cluster console

This connection is established between the server cluster console (mmc) and a working process. You can use this connection to administer server cluster infobases.

The cluster console connection is established when working process data is accessed (for example, when getting infobase parameters, a detailed list of infobase connections, and so on).

Administration server

This connection is established between the remote administration server of a server cluster and a working process. You can use this connection to administer server cluster infobases.

The remote administration connection is established when working process data is accessed (for example, when getting infobase parameters, a detailed list of infobase connections, and so on).

COM administrator

This connection is established with a working process of the server using COM technology. You can use this connection to administer server cluster infobases.

The COM administrator connection is established when a working process is accessed using COM technology, for example:

// Create 1C:Enterprise COMConnector
COMConnector = New COMObject("V83.COMConnector");

// Establish connection with working process 1562
// in cluster 1541 of the TestSrv main cluster
ConnectWorkingProcess = COMConnector.ConnectWorkingProcess("tcp://TestSrv:1562");

This connection is established between a working process of the cluster and an infobase. You can use this connection to perform background updates of database configuration.

The background job connection is closed when background restructuring is completed.

2.2.4.3. Session types

The following session types are available:

  • Thick client
  • Thin client
  • Web client
  • Mobile client
  • Designer
  • COM connection
  • WS connection
  • Background job
  • Cluster console
  • Administration server
  • COM administrator

Descriptions of sessions are generally similar to the above descriptions of corresponding connections. Descriptions of other sessions are provided below.

Web client

This session is a web client instance presentation in a server cluster. You can use this session to modify infobase data and apply other features available in the infobase configuration. Web client calls the server over the Web server extension module connection.

The Web client session is created when web client is started in interactive mode. It is closed when the interactive infobase session is terminated (the last web browser window is closed).

Mobile client

This session is a mobile client instance presentation in a server cluster. You can use this session to modify infobase data and apply other features available in the infobase configuration. Web client calls the server over the Web server extension module connection.

The Mobile client session is created when mobile client is started on a mobile device. It is closed when the infobase session is terminated (the mobile application is closed on the mobile device).

<< Prev   Next >>

Icon/Social/001 Icon/Social/006 Icon/Social/005 Icon/Social/004 Icon/Social/002