1s The background job worker process ended abnormally. The background job process ended abnormally. Concept of asynchronous programming

Q: Background job process crashed...


Good day and good week everyone!
Enterprise accounting, edition 3.0 (3.0.46.11).
Platform 8.3.9.2033.
When posting documents in batches, the error "A background job process has crashed" occurs. No reason given...
Restarting the SQL server, server 1C (you never know) does not help ... Maybe someone faced a similar problem ??? It’s even hard to say after what this error appeared, because group holding (closing the month) has not been used for a long time ...

Answer:() () Good afternoon again) I turned on the technology log and found these interesting things (maybe you know what the problem is?):
An operation was attempted on an object that is not a socket...
The process ends. Outgoing call denied...
No hosted server found...

Q: Background jobs


Platform 1C: Enterprise 8.3 (8.3.9.2170), conf BP 3.0.
Integration via external data sources is configured in the configuration (DBMS type - OracleDatabase). A number of tables have been added, from which NSI and postings are being loaded. Because a lot of data, it was decided to do a batch download through background jobs. Portion size - 100,000, batch size - 10,000, number of transactions per document - 1000, number of concurrent background jobs - 8.
I start, load, everything is ok. But if I put it on at night, then it feels like 1s goes into sleep mode, i.e. after some time, as the log shows, background jobs start but do not end. As a result, it turned out that the tasks started at 12 at night, and were completed at 8 in the morning (when I fiddled with the mouse) and after that they continued to be executed further in normal mode. Launched both in the thin and in the thick client. There is a setting in the parameters - the time to fall asleep in a passive session is 1200, but isn't it only for a thin client and can this be a problem? I don't want to turn it off. users do not exit the program, let them fall asleep. Maybe someone faced a similar problem? How did you decide?

Answer:

There is no such possibility.

What's the point of running a background job and waiting for it to complete?
not to spawn more than 8 background jobs?

Drag the background job "manager" to the server side and let it control....

I ran 40-50 background tasks on the Pentuim D840 - the flight is normal, then it already rests on the processor / memory.

Question: How to transfer a file to a background job


Platform 8.3.6.2152
It is necessary to transfer the file from UV to a background task for further processing.
Did it like this:
&AtClient
Procedure Command1(Command) FileDD = New BinaryData(FileName); StorageAddressForBackground = PutIntoTemporaryStorage(FileDD, UniqueIdentifier); StartUploadUploadOnServer(StorageAddressToBackground) EndProcedure &OnServer Function StartUploadUploadOnServer(StorageAddressForBackground) Method Parameters = New Array; Method Parameters.Add(StorageAddressForBackground); Task = BackgroundTasks.Run("MyCommonModule.MyBackground", MethodParameters); EndFunctions
In the general module:

Procedure MyBackground(StorageAddress) Export FileDD = GetFromTempStorage(StorageAddress); If TypeValue(FileDD) = Type("BinaryData") Then Journal entryRegister Journal entryRegister("Debug","No DD"); EndIf ; EndProcedure Tried like this: PlaceFiles = New Array; PlacedFiles.Add(New Description of File to be Transferred(FileName)); PlacedFiles = New Array; If NOT PutFiles(PutFiles, PutFiles, False , UniqueIdentifier) ​​Then Return ; EndIf ; StorageAddressForBackground = PlacedFiles.Storage; Tried like this: StorageAddressForBackground = PlaceInTemporaryStorage(Undefined, UniqueIdentifier); PutFile(StorageAddressForBackground, FileName, False );
From the background to the client through temporary storage, it is normally transferred, but from the client to the background - nothing for some reason.

Answer: In general, everything turned out to be quite simple. It turns out you can stupidly pass BinaryData as a parameter to the background task. For unskilled fans to quote the help and tell that "as intended" the working code:
&AtClient
Procedure Command1(Command) RunUploadUploadOnServer(New BinaryData(FileName)) EndProcedure
&AtServer Function RunUploadUploadAtServer(DD) MethodParameters = New Array; Method Parameters.Add(DD); Task = BackgroundTasks.Run("MyCommonModule.MyBackground", MethodParameters); EndFunction Procedure MyBackground(FileDD) Export If TypeVin(FileDD) = Type("BinaryData") Then Journal entryRegister("Debug","There is DD"); Otherwise Journal entryRegister("Debug","No DD"); EndIf ; EndProcedure

Question: Running a background job under the right user


Hello!
There is 1C: Enterprise 8.3 (8.3.11.2924), UT 11.3.4.93 client - server.
In this configuration, movements in the register "Customer settlements on documents" are performed not at the time of posting the document, but by the scheduled task "Performing deferred movements on settlements with customers / suppliers".
At the same time, sometimes the scheduled task gave an error, because. tried to make movements in the closed period (Before the date of prohibition of editing). In the settings of the scheduled task, a special user was registered, for whom the ban date is open, after that everything began to work.
However, there is a need to make sure that the movement data on the registers is done at the time the document is posted, and not when the scheduled background job starts.
If you run the code itself, which performs a routine task when posting a document, then the same error occurs - the period is closed. And if you programmatically launch a background task that launches the same code at the time of the document, then it causes exactly the same error, because the period is closed, and the programmatically launched background task is launched under the name of the current user, and his ban date is closed. However, when a scheduled background job is run that has the "correct" user set in the scheduler, everything goes well. Here's how to do it programmatically, how to programmatically run a background task under the desired user "through the scheduler", how do standard scheduled tasks do it, tell me please?

Answer:

Is it not under the one under which it is configured?
It must be a config glitch

Lis2007 said:

Hello! At the same time, sometimes the scheduled task gave an error, because. tried to make movements in the closed period (Before the date of prohibition of editing). In the settings of the scheduled task, a special user was registered, whose ban date is open, after that everything began to work

Click to reveal...

Question: Debugging a background job


The background job is running with an error. Decided to debug.
I run through external processing with one line:
BackgroundJobs.Run("MyModule.MyJob");
Doesn't hit a breakpoint in a module.
Debugging on the server is allowed, checkbox in debugging, automatic connection, background jobs - worth it. What else could be the problem?

Answer: In common modules, there was an appeal to functions requiring client-side rather than server-side execution. I had to put them in brackets #If Client Then. The background worked too.

Question: Error while performing the exchange


Good afternoon Tell me where to dig:
I perform an exchange in the accounting database. About three dozen documents are unloaded from the UT-shki through a typical exchange. They think for a long time (about an hour) and end with the message:
background job process crashed

Probably, not a single serious configuration on 1C 8.3 or 8.2 can do without the use of scheduled and background tasks. They are very convenient, as they will be executed according to a clearly defined schedule without user and programmer intervention.

For example, you need to exchange data with another program once a day. Using routine and background tasks, 1C will be able to perform these actions on its own, for example, during non-working hours. This method will not affect the work of users in any way and will save time.

First, let's figure out what they mean and how they differ:

  • Scheduled task allows you to run any specific actions according to a pre-configured schedule.
  • Background job is an object that contains the actions to be performed.

Suppose that our company sells something and has its own website with prices. Once a day, we want to unload them to maintain relevance.

Open the configuration and add a scheduled task.

Setting properties

Consider the most important parameters that must be filled in its properties.

  • In field " Method name» the procedure of some specific general module is selected, which will be directly executed. It will indicate all the actions for uploading prices to our website. Note that the execution will take place on the server. This is logical, because routine operations are performed without user intervention.
  • Scheduled task can be disabled or enabled as needed. No need to change his schedule every time. To do this, in the properties palette, check or uncheck the " Usage».
  • Another important setting is whether this scheduled task will be predetermined, or not. Predefined scheduled jobs run automatically. If this flag is not set, then you will need to run them programmatically, or use the "Job Console" processing with ITS.
  • You can also specify the number of repetitions and the interval between them upon crash. Abnormal completion refers to those situations when tasks did not complete due to an error.

Schedule setting

The final step is to set up a schedule for our upload to the site using the appropriate hyperlink in the properties palette.

You will see a typical schedule setting in 1C 8.3. There is nothing complicated here. In this example, we set up the launch of our upload of prices to the site daily from five to seven in the morning. In the event that the scheduled task does not have time to work out before 7:00, it will be completed the next day.

Blocking scheduled tasks

Run the standard 1C Enterprise Server Administration utility and open the properties of the infobase where you created the scheduled task (for 1C client-server versions).

In the window that opens (after entering the login and password for accessing IB), check that the flag on the item "Blocking scheduled tasks is enabled" is not set. If you encounter a situation where the task does not work, check this setting first.

In the same way, you can completely disable scheduled tasks in 1C 8.3. To disable specific background jobs, you can use the "Background Jobs Console" processing built into recent releases.

Background and scheduled jobs in file mode

In this mode, setting up and running these jobs is much more difficult to organize. Most often, an additional account is created, the session of which will always be open.

Activation of scheduled tasks in this case is performed using the method "PerformProcessingTasks()".

You can also use the following construct:

The procedure name must be the name of the client procedure to be executed. The interval shows how many seconds the execution will take. The "Once" parameter is optional. It reflects whether the given procedure will be performed once or several times.

Tracking errors in background jobs

You can view the progress of background jobs, as well as the presence of possible errors in the registration log. In the filter, set the selection to the "Background task" application and, if necessary, select the importance of interest, for example, only "Errors".

The log will show all entries that match your selection with a comment that you can use to understand the cause of the error.

The problem is not new and is discussed from time to time in various 1C forums. The simplest and most popular solution is to restart the 1C server. Unfortunately, this option is not always acceptable or highly undesirable. In this case, there are more delicate solutions.

Here one of these ways in the form of a brief step-by-step instruction:

1. Using the 1C server administration console, we are looking for a problem fA new job in the connection list (for example, by its start time, compared with the start time of a scheduled job in the job console). We definethe worker process in which the hung connection is located.

2. Open the properties of this process and mark it as unused (if one single process is used, then you must first create a new worker process so that all active connections reconnect to it). We remember the PID number of this process.


3. We are waiting for all current connections to move from the disabled process to one of the used ones. Ultimately, only problematic compounds should remain in our process, which we want to remove.

4. On the computer with the 1C server, using the task manager, we look for the corresponding rphost.exe process by the PID of the disabled worker process and delete it.

5 . Just in case, you can delete the 1C workflow that we disabled with the help of the admin. console and, if necessary, create a new one.

6. Ready. You can log in to the job console and check the health of a scheduled job.

In this article I will describe my, so far small, experience in organizing data exchange through the universal EnterpriseData format.

In my case, the exchange is configured between the configurations "Trade Management 11.2" (hereinafter referred to as UT) and "Enterprise Accounting 3.0.43" (hereinafter referred to as BP). The exchange is one-way, from UT to BP. Prior to updating Trade Management 11.1 to version 11.2, data exchange was configured using the Data Conversion 2.0 configuration. However, after switching to "11.2" in "Trade Management", errors appeared during the work of users. The procedure for updating the exchange rules was carried out, but this did not give a result. The debugger showed that the problem was in the data exchange. It was decided to remove the data exchange setting in both configurations and set it up again.

Both "Trade Management" and "Enterprise Accounting" work for us in a client-server version. I started setting up synchronization with UT. I performed it in such a way that the data was unloaded from the UT to a file. That is synchronization through the network directory. In the BP, I configured the exchange in such a way that no data was unloaded from the BP.

Error calling context method (Validate): Error validating XDTO data:
The structure of the object "/Counterparty's Bank Account/Bank" does not match the type: (http://v8.1c.ru/edi/edi_stnd/EnterpriseData/1.1)KeyPropertiesBank
Checking the "BIC" property:
shape: element
name: (http://v8.1c.ru/edi/edi_stnd/EnterpriseData/1.1)BIC
type:
Required property missing
Object: Agreement with counterparty No. ...

To analyze the error, I clicked on the "Composition of data to be sent" icon and in the list of counterparties registered for sending contracts, I found the contract under which the error appeared. Opened the contract, memorized the bank account of the counterparty specified in the contract. Then I moved on to bank accounts registered for shipping. It turned out that the required account was not in the list of registered ones. I rewired the troubled bank account and contract. After that, manually registered the required bank account.

I tried again to synchronize data from UT. This time the data was uploaded successfully. An XML file has been generated in the network folder, containing data for transferring from UT to BP.

The next step is to upload the data from the file to the Enterprise Accounting Department. In the "Enterprise Accounting" configuration, I clicked the "Synchronize" button, the processing form opened with the message "Data analysis in progress". A little later, the message changed to "Data is being uploaded." At the same time, the indicator and counter showed that more than 80 thousand objects were being unloaded from the BP. This confused me, because I indicated in the settings that nothing should be unloaded from the PSU. Processing took a long time and ended with an error:

Event: Communication
(CommonModule.LongOperations.Module(371)): Background job worker process crashed
ThrowException(ErrorText);

To localize the error, I tried to change the synchronization settings and the operation options of the BP base. As a result, when I converted the database to the file version, the system worked adequately: the form for comparing two databases opened. After matching the objects, the initial synchronization was successful. Then I again transferred the database to the client-server version.

With further "running" of synchronization, it was necessary to make some changes to the rules for converting objects. It's time to use the "Data Conversion 3.0" configuration. The built-in configuration help describes how to work. The articles on the ITS website also helped.

As a result, I loaded the following data into "Data Conversion 3.0":

  • Texts of the general module "Data Exchange Manager Via UniversalFormat" from two bases
  • Diagram of both bases
  • Description of the EnterpriseData format (from any one database)
  • Conversion rules

After downloading, I opened the rules for converting data, objects, properties in "Data Conversion 3.0". Made the changes I needed. Then I used the "Unload exchange manager module" button. The text of the module has been copied to the clipboard. It remains only to insert it into the configuration.

Having experimented with setting up rules in "Data Conversion 3.0", I concluded for myself that in the case when the changes made are minor, it is easier to set up rules directly in the UT and BP configurations, in the general module "Data Exchange Manager Via UniversalFormat". If the edits are serious, such as, for example, adding a new object in exchange, then you should use the configuration " Data conversion 3.0".

I performed the task of adding the document "Order to the supplier" to the exchange plan using " Data conversion 3.0". In the standard version of UT - BP, this document is not included in the exchange plan.

Let's remember that the rules for registering objects for unloading are still configured in the "Data Conversion 2.0" configuration.

These are the first impressions about data synchronization through the universal EnterpriseData format.

P.S. If you have questions and your own observations on data exchange through the Universal Format and configurations " Data conversion 3.0", write in the comments. We will exchange experiences.

  • Data synchronization
  • Universal EntepriseData Format
  • Data Conversion 3.0
  • Data Conversion 2.0
  • Trade management
  • Enterprise accounting

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 a detailed description of these mechanisms, I hope this will be useful information for beginner 1C programmers. This is very convenient, because it does not require human actions, the scheduled task is configured once and works according to your schedule.

Detailed instructions with an example can be found below.

What are scheduled and background tasks in 1C

  • Scheduled assignments is a special 1C enterprise 8.3 mechanism designed to perform a specific action on a given schedule.
  • Background job- objects generated by a scheduled task that directly performs the inherent action without the participation of the user or programmer 1C 8.2.

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

Setting up background tasks in the client-server mode of operation 1C

To begin with, let's create a new metadata object - a scheduled task. I will name my task "LoadingCurrency Rates". Consider the properties palette of this configuration object:

Get 267 1C video lessons for free:

  • Method name— path to the procedure that will be executed in the background task according to the specified schedule. The procedure must be in a shared 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 the use of a scheduled task.
  • predetermined Indicates whether the scheduled job is predefined. If you want the scheduled task to work immediately after being placed in the database, specify this attribute. Otherwise, you will need to use the "Job Console" processing or call the job to run programmatically.
  • Number of retries when a job crashes— how many times the background job was restarted if it was executed with an error.
  • Job abort retry interval- how often the background task will be restarted if it was completed with an error.

And the most interesting setting - Schedule:

Here you can set the interval for starting the procedure specified in the "Method name" field. Let me set up

Attention! Don't forget to disable the blocking of scheduled and background jobs 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 scheduled tasks in the file mode of operation 1C

In file mode, setting up such tasks is somewhat more difficult. For such a task, a separate session of the 1C program must be launched. Often this is solved by the institution of the "technical" user, whose session is always running.

In the file mode, the initialization of the scheduled job occurs when the "ExecuteJobProcessing()" method is launched.

For a specific user, it is possible to configure this method to run using another method −

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

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

ConnectWaitingHandler, 3600 ) ;

A two-minute video showing how to set up a scheduled task in the 1C configurator:



Have questions?

Report a typo

Text to be sent to our editors: