The background job 8.3 worker process terminated abnormally. – Removing irrelevant synchronization information

Users often complain that “1C 8.3 is slow”: document forms open slowly, documents take a long time to process, the program starts, reports take a long time to generate, and so on.

Moreover, such “glitches” can occur in different programs:

The reasons may be different. This is not restored documents, a weak computer or server, the 1C server is incorrectly configured.

In this article I want to look at one of the simplest and most common reasons slow work programs – . This instruction will be relevant for users of file databases for 1-2 users, where there is no competition for resources.

If you are interested in more serious optimization of client-server options for system operation, visit the section of the site.

Where are the scheduled tasks in 1C 8.3?

Before I had time to load the program, many background tasks were completed in 1C. You can view them by going to the “Administration” menu, then “Support and Maintenance”:

Get 267 video lessons on 1C for free:

This is what the window with completed tasks looks like:

And so full list all scheduled tasks that are launched:

Among these tasks you can see such as ““, loading various classifiers, checking the relevance of the program version, and so on. For example, I have no use for almost all of these tasks. I don’t keep currency records, I control the versions myself, and load classifiers as needed.

Accordingly, it is in my (and in most cases in your) interests to disable unnecessary tasks.

Disabling routine and background tasks in 1C 8.3

Probably every 1C 8.3 programmer sooner or later had to set up the execution of certain tasks on a schedule. Below I will give detailed description of these mechanisms, I hope it will be useful information for beginner 1C programmers. This is very convenient, because it does not require human action, routine task can be configured once and works according to your schedule.

You will find detailed instructions using an example below.

What are routine and background tasks in 1C

  • Scheduled tasks- This special mechanism 1C enterprise 8.3, designed to perform a specific action according to a given schedule.
  • Background job- objects generated by a routine task that directly perform the intended action without the participation of the user or 1C 8.2 programmer.

The mechanism of scheduled and background jobs works in client-server mode (SQL), thanks to the functionality of the DBMS. If you have a file database, then the task can also be configured, but according to a slightly different principle.

Setting up background jobs in 1C client-server mode

First, let's create a new metadata object - a routine task. I will call my task “Loading Currency Rates”. Let's look at the properties palette of this configuration object:

Get 267 video lessons on 1C for free:

  • Method name— path to the procedure that will be executed in a background job according to a given schedule. The procedure must be in a common module. It is recommended not to use standard ones, but to create your own. Don't forget that background jobs run on the server!
  • Usage— a sign of using a routine task.
  • Predetermined— indicates whether the routine task is predetermined. If you want the routine task to work immediately after being placed in the database, specify this flag. Otherwise, you will need to use Job Console processing or cause the job to run programmatically.
  • Number of retries when a task terminates abnormally— how many times the background job was restarted if it was executed with an error.
  • Retry interval when job terminates abnormally— how often the background job will be restarted if it was completed with an error.

And the most interesting setting is Schedule:

Here you configure the launch interval of the procedure specified in the “Method name” field. Let's say I configured

Attention! Don't forget to disable the blocking of routine and background tasks at the DBMS level!

This can be done in the administration utility of the client-server version or when creating a new database:

Setting up routine tasks in 1C file mode

In file mode, setting up such jobs is somewhat more difficult. For such a task, a separate session of the 1C program must be launched. This is often solved by creating a “technical” user whose session is always running.

In file mode, a routine job is initialized when the “RunTaskProcessing()” method is launched.

For a specific user, you can configure this method to run using another method −

ConnectWaitHandler( <ИмяПроцедуры>, <Интервал>, <Однократно>).

  • Procedure name— the name of the procedure connected as a wait handler. The name of the exported procedure of a managed application module (a regular application module) or a global shared module. The procedure must be located on the client.
  • Interval— period between executions of operations in seconds.
  • One time- how to complete the task, once or not.

ConnectWaitHandler, 3600 ) ;

A two-minute video that shows how to set up a routine task in the 1C configurator:

" In it we will look at new features that do not relate to the system interface, but significantly expand the provided functionality of the 1C:Enterprise 8 platform.

Applicability

The article discusses the 1C:Enterprise platform version 8.3.4.437. All functionality described in the article has been updated to version 8.3.11.

Other innovations in 1C:Enterprise 8.3

Let's continue to get acquainted with the innovations of the 1C:Enterprise 8.3 platform.

Background and scheduled tasks in the file infobase

In many typical platform configurations 8.2 there was a constant that indicated the user under whom the tasks were executed in the file version.

When the system started running under this user, a wait handler was connected, which called the built-in language method with a certain periodicity ExecuteTaskProcessing().

This approach created additional difficulties and inconveniences for using routine tasks in the file database.

This could be especially critical when working with configurations such as “Comprehensive automation” or "Control manufacturing enterprise, in which regulatory tasks play a rather important role.

If This Is File IB Then
=
Constants.UserForExecutingRoutineTasksInFileVariant.Get();
If chValueVariable(“glCurrentUser”) =
UserTo ExecuteTaskRegl Then
// with an interval of seconds we call the procedure for working with routine tasks
SupportRegularTaskForFileVersion();
IntervalForPoll=
Constants.IntervalForPollingRoutineTasksInFileVariant.Get();
If IntervalForPoll= Undefined
OR IntervalForPoll= 0 Then
IntervalForPoll= 60 ;
EndIf ;
ConnectWaitHandler(“Support for RoutineTaskForFileVersion”,
IntervalForPoll);
EndIf ;
EndIf ;

On the platform 8.3 implemented the work of background and scheduled jobs in the file infobase without using the global context method call ExecuteTaskProcessing().

Background and routine tasks are performed directly in one of the client applications (thin, thick client) or by a web server extension.

A background job started by a session is executed by the same client application that initiated it.

Background jobs are executed sequentially, i.e. On one client application, only one background task (including routine ones) can be executed at one time.

Routine tasks are performed by only one client application. To control the launch of scheduled tasks, a command line key is used /AllowExecuteScheduledJobs.

Routine tasks are executed by the first client application in the startup order, which is not prohibited from executing routine tasks (to prohibit the session, the session must be launched with the command line parameter /AllowExecuteScheduledJobs -Off).

When that session ends, execution moves on to any of the remaining running sessions.

If the client application launch line explicitly indicates the need to run routine tasks (in command line indicated /AllowExecuteScheduledJobs -Force), then routine tasks begin to be executed on it, regardless of the presence of other sessions.

Routine tasks are processed once every 60 seconds.

Note that the routine tasks of the application solution (in the file version) began to be executed no earlier than 1 minute after the client application was launched. Starting with version 8.3.8, this time has been doubled, and therefore routine tasks begin to be executed a maximum of 2 minutes after the client is launched (in the file version).

This decision is due to a reduction in the delay when starting the application. In addition, in release 8.3.7 the ability was added quick definition that the current session is a background job session. This is implemented using the new global context method GetCurrentInfoBaseSession(), as well as a new method for the infobase session GetBackgroundTask().

Below is code that illustrates the above:

To enlarge, click on the image.

Calculation of checksums

The platform now includes mechanisms for calculating data checksums.

Let us recall that checksum(hash) is a value calculated from a set of data by applying a certain algorithm and used to check the integrity of data during transmission or storage.

Hashes can be used to check the identity of data (for example, you need to make sure that the file was not damaged when transferring it; check whether changes were made to the file, and if so, then upload it to the database again).

For this purpose, an object was implemented in the platform HashingData, available on the server, in the thick client, external connection, and also on the mobile application server.

This object has two methods: Add() And AddFile(), which update the hash sum taking into account the data passed in the parameters.

Platform 8.3.4.437 supports calculation of the following hash functions: CRC32, MD5, SHA1, SHA256. But the functions SHA1 And SHA256 are not supported on the mobile platform.

Let's look at a simple example. It is assumed that on the server in the program directory there is a file “ ragent.exe" Need to calculate MD5-sum for this file.

To do this, we will create an external processing, on the form of which we will place the command Calculate. The handler contains the following code:

&OnClient
Procedure Calculate (Command)
Result = CalculateOnServer();
Report(String(Result));
End of Procedure
&OnServer
Function CalculateOnServer()
Hash = New HashingData(HashFunction.MD5);
Hash.AddFile(CatalogPrograms() + “ragent.exe” );
Return Hash.HashSum ;
EndFunction

In edition platform 8.3.10+ in the method Add() object HashingData It became possible to use a stream of binary data, which greatly simplified their use in solving various applied problems of updating hash sums.

Working with protected versions of protocols SMTP/POP3

On the platform 8.3 it became possible to use protected versions of protocols SMTP/POP3(there are terms SMTPS/POP3S or SSLSMTP/SSLPOP3).

For object InternetMailProfile new properties implemented:

  • Use SSLSMTP;
  • UseSSLPOP3;
  • Only SecureAuthenticationSMTP;
  • Only POP3 Secure Authentication.

Properties SMTP Authentication And POP3 authentication object InternetMailProfile, as well as transfers SMTPAuthentication method And POP3 Authentication Method It is not recommended to use them - they are supported for compatibility.

Using a secure protocol SMTPS makes it possible to send mail from 1C, using by mailbox Google.

Let's look at an example. On the form we will place fields for entering the subject of the letter and the recipient's address, and for entering the text of the letter - a formatted document field.

To enlarge, click on the image.

When you press the button Send The following code will be executed:

&OnClient
Procedure Send (Command) Mail = New InternetMail; Profile = New InternetMailProfile;
Profile.SMTPServerAddress= “smtp.googlemail.com” ;
Profile.UserSMTP= “[email protected]” ;
Profile.PasswordSMTP= “PASSWORD” ;
Profile.UseSSLSMTP= True ;
Profile.SMTPPort = 465 ; Attempt
Mail.Connect(Profile);
Exception
Report(ErrorDescription());
Return ;
EndAttempt ; MailMessageText= “” ;
Attachments = New Structure ;
Text.GetHTML(MailMessageText, Attachments); MailMessage= New InternetMailMessage;
MailMessage.Recipients.Add(To whom );
MailMessage.Subject= Subject;
MailMessage.Texts.Add(MailMessageText,
MailMessageTextType.HTML); Mail.Send ( MailMessage); Mail.Disconnect();
End of Procedure

Note that in our example, if the SMTP server was unable to send an email to the recipient(s), then the method Mail.Send(MailMessage) threw an exception. This caused certain inconvenience for the developers, because... The reason for throwing the exception was not obvious.

In version 8.3.9, this behavior has changed, and now the Send() method returns a match whose key is the recipient and whose value is the diagnostic from the mail server. This allows you to accurately determine the reasons for the failure to send an email message to each recipient. In compatibility mode with version 8.3.8, the behavior has not changed.

Duplex printing

On the platform 8.2 The platform itself did not manage duplex printing; this function could only be controlled using the printer driver.

On the platform 8.3 it became possible to control duplex printing for a spreadsheet document, a graphic diagram (from the built-in language and interactively) and a text document (interactive only).

System enumerations appeared in the built-in language:

  • Duplex Printing Type(None, FlipUp, FlipLeft);
  • (Auto, MirrorTop, MirrorLeft, Do Not Use).

And for objects TabularDocument And GraphicScheme properties appeared Duplex Printing And Alternation of Page Arrangements, with which you can change the layout of printed pages.

In platform version 8.3.9, the DuplexPrintType system enumeration has a new value added UsePrinterSettings. Selecting this value allowed you to use the printer settings when printing system documents. In 8.3.8 compatibility mode, the behavior is unchanged and the corresponding printer settings are ignored.

The dialog for publishing an information base on a web server has been made more functional. Now publishing from the configurator allows you to set all file parameters default.vrd.

For the dialog for publishing a web client and Web services through the configurator, the following is implemented:

  • ability to control the availability of Web services by default (attribute pointEnableCommon element ws);
  • ability to control the execution of background jobs in the file version (attribute allowexecutescheduledjobs element ws).

If checkbox “Publish Web Services by Default” on the bookmark “Basic” is installed, then when updating the publication, the selected Web services will be published automatically.

Otherwise, the Web services will be marked as unpublishable. This flag corresponds to the attribute pointEnableCommon element ws in the file default.vrd, intended for setting up a web client and Web services.

Attribute pointEnableCommon ws element is responsible for the possibility of using in this information base Web services that are published without explicitly indicating permission for use (attribute enable element point).

If the attribute has a value true, then all Web services for which the attribute value is not explicitly specified enable element point, will be permitted for use.

Otherwise, the use of such Web services will be prohibited.

Settings “Background jobs in file mode” matches attribute allowexecutescheduledjobs ws element in the file default.vrd.

Attribute allowexecutescheduledjobs controls the ability to execute routine tasks by the web server extension for the file version of the infobase.

The attribute can take the following values:

  • off– in this case, the web server extension will not perform routine tasks. Routine tasks will be performed by a client application (if one exists), which connects to the infobase directly, without using a web server.
  • force– in this case, the web server extension will perform routine tasks.
    If the value of this attribute is not specified, then routine tasks will be performed by the application with which the first connection to the infobase will be made.

The publishing window on the web service has become even more convenient and ergonomic in the current release of the platform. Now the parameters describing OpenID authentication are placed on a separate tab.

Numbering of infobase objects

On the platform 8.3 The mechanism for automatically numbering information base objects has been redesigned. The uniqueness of a number or code (including those obtained as a result of automatic generation of a number or code) is always checked when recording an object.

An indication of which number or code is not unique has been added to the text of the message about violation of the uniqueness of a number or code.

The use of a vacant number or code has changed. New number or the code is assigned without using released numbers or codes, if there are already issued numbers or codes with a large (in order) prefix of the number or code.

Aggregate functions of the data composition system expression language

New aggregate functions are implemented in the expression language of the data composition system:

  • Every();
  • Any();
  • StandardDeviationofPopulation();
  • StandardSampleDeviation();
  • VarianceSamples();
  • VarianceofPopulation();
  • CovariancePopulation();
  • SampleCovariance();
  • Correlation();
  • RegressionSlope();
  • RegressionSegment();
  • RegressionCount();
  • RegressionR2();
  • RegressionAverageX();
  • RegressionAverageY();
  • RegressionAverageSXX();
  • RegressionAverageSYY();
  • RegressionAverageSXY().

As the names indicate, these are statistical functions, which means that developers have the opportunity to create complex reports without having to develop procedures for calculating statistical data.

To enlarge, click on the image.

As you can see from the figure, there are no new functions in the drop-down list, but if you enter them manually, there will be no error message, and the report will be generated:

Also of interest new featureClassificationABC(). The result of the function will be the class number, starting from 1 (1 corresponds to class A, 2 to class B, 3 to class C, etc.).

Let's demonstrate how this function works. Let's create a new external report “Classification of goods” based on request:

CHOOSE
Product consumptionProducts.Product,
Product ConsumptionProducts.Quantity
FROM
Document.Consumption of Goods.Goods HOW Product consumptionProducts

Let's define a new calculated field Class:

To enlarge, click on the image.

Let's configure the resources as follows:

To enlarge, click on the image.

In user mode, the report looks like this:

In conclusion, we note that from edition to edition in the 1C 8.3 platform the ACS mechanism is constantly being improved and refined, and within the framework of our “newbie” article it is not possible to present these changes in full. Yes, this seems unnecessary, because when working on the current version of the platform, you can always use various help systems to help you analyze this or that aspect of the operation of this mechanism.

In addition, do not forget about our separate course Professional development of reports in 1C 8.3 on the Data Composition System, which breaks down down to the atom all the subtleties and pitfalls when working with this mechanism. Check out the demo for yourself.

So, let's sum up the intermediate results. Up to this point, we have become acquainted with the new capabilities of the Taxi interface and managed forms, as well as with some previously not provided capabilities of the platform itself. Now it’s time to see what convenient features have become available to the developer in the configurator.

Some tasks in document management and accounting may need to be performed periodically. For example, on the twentieth. Or daily.

Typically, a company tries to create rules for performing such tasks - who, when and how should complete the task, who should control it.

Such tasks are called regulated, that is, performed in accordance with regulations.

In IT, monitoring is often performed in a regulated manner.

This is well known to the system administrator - there are special programs that periodically check the performance of servers and network infrastructure and notify the administrator by SMS or email.

Similar things exist for webmasters - to check the availability of the site during the day.

In 1C, monitoring tasks and any other periodic tasks that should be performed automatically according to a schedule are performed using the 1C Scheduled Tasks mechanism.

Let's talk about them today.

Scheduled tasks 1C

Scheduled tasks 1C are those that allow you to perform them as they do, but on a schedule.

The 1C routine task itself in the configurator is a way to specify settings and set a schedule. By the way, the schedule can be changed dynamically later in 1C Enterprise mode.

Background jobs can be created from the text of a program in the 1C language arbitrarily without a scheduled 1C job - for parallel computing on the server.

The execution of routine 1C tasks can be disabled temporarily - in.

Adding a 1C routine task

Routine 1C tasks are located in the configuration in the General/Routine 1C tasks branch. Let's add a new 1C regulatory task and indicate its name.

In the property of the 1C routine task, the Method name is indicated, just as in. The function will be located in a common module with the Server checkbox checked in the properties, that is, the module must be added in advance.

The 1C scheduled task property - Task name - determines the name under which the task will appear in task management tools.

The 1C routine task property – Key – allows you to group several different 1C routine tasks. Only one job with the same key value can be started at a time. The value itself can be arbitrary. An empty value is not taken into account during control (that is, it is considered empty).

The property of a 1C routine task - Predefined - determines that when 1C Enterprise is launched, such a task will be created in a single copy with the schedule specified in the configurator. Non-predefined tasks appear programmatically at the time of the schedule.

In typical configurations, for example Accounting edition 2.0, such routine 1C tasks as Configuration Update and Recalculation of Totals are predefined, but such as Data Exchange or Deferred Movements are not predefined.

Usage – enables the task (that is, it will only be executed if the Usage checkbox is checked).

Retry in case of abnormal termination - as you might guess, means restarting the task if it could not complete successfully the first time - it is indicated how many times to restart and how long after the abnormal termination.

1C routine task management and monitoring

To manage routine 1C tasks, there is a special standard processing Job Console. It can also be found on.

This processing refers to the so-called universal external standard 1C processing, which is often not included in the configuration, but is distributed separately, for example, on ITS disks.

Using job console processing you can:

  • Enable/disable execution of routine 1C task
  • Assign/change the schedule of a routine 1C task (and other parameters)
  • Specify the 1C user on whose behalf the routine 1C task will be performed
  • See what tasks were completed when and with what result, errors in completing 1C tasks
  • Complete the task.

Copies of databases and 1C routine tasks

If you use server 1C, then the following situation occurs:

  • For your own purposes (for example, for programming), a copy of the working database is made
  • Working, testing, etc. in a copy of the database
  • You forget to turn off routine 1C tasks in such a test database.

While 1C routine tasks perform tasks related only to their information base, there is nothing in it.

However, often routine 1C tasks can save any files, data to other databases, exchange, send emails.

In this case, you may get an interesting mixture between the result of performing routine 1C tasks in the working database and copies.

Routine 1C tasks for copies of the working database must be disabled in .

Fulfillment and non-fulfillment of 1C regulatory tasks

When creating routine 1C tasks, you must remember:

  • Tasks are performed by themselves - they need to be monitored
  • Tasks are executed in a module on the server
  • Tasks are performed under a different Windows user, with different rights.

First, you need to check that the task is being performed and can be completed as a routine 1C task.

Secondly, the server module means that many things that are available on the client are not available. For example, sometimes, not all documents can be posted only on the server, since their algorithm may provide that the posting is started manually by the user and non-server functions can be used, for example
Warning("Hello!")

Thirdly, if a task deals with something outside the 1C database, then the rights of the Windows user under which the task is executed become important.

The third point is especially important when developing. If the module cannot be executed on the server, the task will not be executed at all. To check, you need to run the task at least once and see the result “Task Completed” in the Task Console processing.

Platforms: 1C:Enterprise 8.3, 1C:Enterprise 8.2, 1C:Enterprise 8.1
Configurations: All configurations

2012-11-13
53992

In document management, there are tasks that require periodic execution - for example, on the twentieth, or daily. As a rule, companies create specially for this purpose certain rules, which indicate when and how the required task should be performed, and who should control the process. Such tasks are performed according to regulations and are called regulated.

Quite often, monitoring regulations are observed in IT. This method is very familiar to administrators, since for this purpose there are special programs used to periodically check the functionality of the network infrastructure and servers. They notify the administrator about detected problems via SMS or email.

A similar system operates for webmasters, and the site’s availability is checked within 24 hours. Using the "Routine tasks" mechanism in 1C, monitoring tasks are carried out, as well as periodic tasks that are performed according to a schedule in automatic mode in 1C. Let's take a closer look at this topic.

Scheduled tasks 1C

The 1C object, called “Routine tasks,” makes it possible to process information not after a problem occurs, but according to a schedule. In the configurator, a routine task is a way to set settings and set a schedule. In addition, it is possible to subsequently change the schedule in 1C Enterprise mode.

When using file database data, tasks are not executed automatically. In order to start the process, you need to start a 1C session in 1C Enterprise mode and start executing a routine task in it.

All standard configurations have a user setting that allows you to specify that when 1C is running, routine tasks will be performed automatically.

Using the client-server version of 1C makes it possible to automatically perform tasks on the server. At the scheduled time - a background job is launched, which executes necessary actions. For parallel computing on the server, a background job can be created from the program text using the 1C language, without using a scheduled 1C job. The action of a scheduled task can be temporarily disabled using the 1C server management console.

Adding a scheduled task

Routine tasks are located in - Configurator - General - Routine tasks. Add a new "task" and provide a name. Next, you need to go to the “Tasks” properties. And select Method Name. Here, you need to specify a handler function, just as it happens in an event subscription. This function will be located in the general module and marked with a “bird” Server in the properties. This means that the required module must be added in advance.

The name of the task in the Properties of a scheduled task allows you to define its name, which will then appear in the task management tools. The Routine Task Properties function is a key that allows you to group several different routine tasks. In this case, only one task with the same key value can be launched at a time. Here, the value can be arbitrary, but it must be filled in, since an empty value is not taken into account by the system.

In Accounting edition 2.0, which is a standard configuration, routine tasks such as: “Recalculation of totals” and “Updating the configuration” are predefined, but such as, for example, “Deferred movements” and “Data exchange” are not predefined.

Retry on abnormal termination - restarts the current job. Designed to perform a launch that was not successful the first time. Here, it is indicated how many times you can restart and after what time has passed after an abnormal termination.

Monitoring and management tools for routine tasks 1C

The standard processing “Task Console”, which can be found on the ITS disks, is responsible for managing a routine task. This processing is a universal external standard processing for 1C. As a rule, it is not included in the configuration, but is purchased separately.

With its help you can perform the following actions:

Turn on and off a scheduled task;

Assign and change schedules;

Designate the user name with which the routine task will be performed;

See completed tasks (when and with what result), as well as task errors;

Routine task and copies of databases

When using server 1C, the following moment may arise:

To program, you need to make a copy of the working database;

The need to work in copies of the database (testing);

For some reason, the scheduled task was not included in the test database.

If one of these situations arose during the execution of tasks by a routine task that are associated only with its database, then this does not entail negative consequences. But, often, a routine task can save files or other data, send emails, and conduct exchanges. In this case, confusion may arise between the results of the “job” and the copies. To prevent this from happening, you need to disable “tasks” in the server management console.

Completed and not completed regulatory tasks

When creating routine tasks, it is important to check whether the task can be executed as a routine task. It's important to know that the server module doesn't do many things that are possible on the client. Further, a task that deals with something that is outside the database - an important role in this is played by the rights of the Windows user under which the task is executed.

The last factor is especially important, since if the module is not executed on the server, then the task cannot be completed in principle. To check, you need to run one task and evaluate the result.