Background import do not work when timeout

Your software
My Mautic version is: 3.3.4
My PHP version is: 7.3.31
My Database type and version is: mysql 8

Your problem
My problem is: Import background does not work when cron time out

These errors are showing in the log:

Steps I have tried to fix the problem: stop import and then start again until finished

When I load a csv file and using cronfig launching mautic:import command then it times out and does not work in the next commands launched by cron… I have to stop the import and start it again then it works until the next time out and again start/stop to force to load all the rows

It happens the same if I launch the command manually … times out with error 500 and do not work again until I stop and start the import.

You might have an error in your import file maybe. Are the " and ; and , in the right place?
Try a simple import with couple of email addresses and no other data.

Hi Joeyk
Thank you for your help, support and answer.
It is happening with all the csv files I have tried (dozens) and the result is always the same.
the csv files have only email addresses.
Until the cron makes a time out works fine… so loads 4-5k emails correctly, but after this in the next cron job nothing happens and the import shows processing for ever… Is when I have to stop and restart again an then the next job process new addresses until the time out…
It only works fine if I import them in the browser that is a pity :frowning: , so I am forced to do it in the browser to complete the full import in once
I hope this clarifies your question

You are mentioning “next cronjob”. Are you putting a cap on the import to make sure the cron doesn’t start to re-import the same thing? You can do it with the “limit=2000” switch
What happens if you import in browser?

No I am not using any kind of cap.
I am using cronfig plugin. This is executing the command mautic:import each 5 minutes. The cron job gives a ESOCKETTIMEDOUT as it is longer for heavy loads (i.e. 100.000 contacts) but is continuing in the next job, but the next job does not perform anything and the status of the import holds in “processing”
By the way, where is the limit switch?
As said before in the browser is working fine. Just have the browser working 1 hour or more

I don’t use the cronfig plugin.
Here is the list of commands:

Hi Joeyk
It is not a matter of cronfig… If you use the command.php with mautic:import the result is the same.
The import after a while gives a http error 500 and the next command execution does not make anything.
Just try to load a csv with 100.000 rows you will see that

I have no issues with import right now.
Are you running multiple crons while you are importing in the background? Segments? Campaigns?

Sure. I am running Segment update, campaign rebuild, campaign trigger and email send
When I started to use Mautic with version 2 I did not have this problem at all

I’m having this issue too. I’m uploading 3+ million emails and it seems the script is either timing out or something is killing the process. The output from the command just says

2438504/3048135 [======================>-----] 79%Killed

I’d assume we’re running into a script timeout or a limitation of PHP? @joeyk Is there a way to increase the timeout for uploads? Or do you know of a setting that would keep this from happening?

Hi, I don’t know about a solution here.

Maybe this helps:

Imports data to Mautic

mautic:import [options]

-i, --id[=ID] Specific ID to import. Defaults to next in the queue. [default: false]
-l, --limit[=LIMIT] Maximum number of records to import for this script execution. [default: 0]
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
–ansi Force ANSI output
–no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-e, --env=ENV The Environment name. [default: “prod”]
–no-debug Switches off debug mode.
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

The mautic:import command starts to import CSV files when some are created.

I usually use the batch setting and never had an issue with import, but I never tried to stuff 3M contacts to my Mautic at once.