View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
19985Bug reportsRemoteControlpublic2025-05-09 11:36
Reporterginosupport Assigned To 
PrioritynoneSeveritypartial_block 
Status newResolutionopen 
Product Version6.6.x 
Summary19985: RemoteControl invite_participants returns HTTP 500 error
Description

We have a few surveys that have a decent amount (>30k) of participants use RemoteControl invite_participants to send invitations to fill in the surveys.

We're using the invite_participants function without specifying which exact participants should be invited.
We're supplying iSurveyID = some number, bEmail = true, continueOnError = true, aTokenIds = null.

The expectation is "LimeSurvey will send emails to everyone that is eligible for an invitation". However, instead we're getting a HTTP 500 error. It's hard to pinpoint the exact cause.

Steps To Reproduce

Steps to reproduce

Not 100% sure. It consistently fails for some surveys, but consistently works for others (with fewer participants?). It's not immediately obvious what the problem is.

My hunch is:

  • create a survey
  • add > 10001 participants with valid emailaddresses and valid tokens (so they are eligible for an invitation)
  • call invite_participants without specifying specific participants to invite (aTokenIds = null). I'm not sure if this will already fail. It might work
  • call invite_participants again with aTokenIds = null. Probably error, because it returns information about the first 5k participants that already got an email without actually sending any new emails?

Alternative possibility:

  • create a survey
  • add > 10001 participants with valid emailaddresses, of which the first 5k are expired (or not valid yet)
  • call invite_participants without specifying specific participants to invite (aTokenIds = null). I have a feeling this will fail

Expected result

Multiple things:

  • I expect it to completely ignore participants that are not valid anymore or not valid yet. I don't expect those in the response at all, or at least let me specify whether i want to know about those.
  • I expect the docs to mention something about a limitation to 5000 participants. Nice to have would be if that limitation was removed
  • If there are more than some limit people to invite, i expect it to at least invite participants up to that limit. It should not matter if there are also more than that limit of expired/not valid yet/already invited participants. If there are 1000 expired participants and 6000 that are eligible for an invitation and the limit of emails to send if 5000, i expect 5000 emails to be sent, not just 4000 because there are 1000 irrelevant participants.

Actual result

  • HTTP 500 response without an explanation of what's wrong

Also

  • It seems to limit the result to 5000 participants, which is not mentioned anywhere in the docs. There seems to be no way around this without specifying specific participants?

Note: I have a feeling the same problem might occur under specific circumstances in remind_participants, but did not actively run into that. If you find the cause, please check if remind_participants is also affected

TagsNo tags attached.
Bug heat4
Complete LimeSurvey version number (& build)6.10.0+250106
I will donate to the project if issue is resolvedNo
Browsernone
Database type & versionPostgreSQL
Server OS (if known)RHEL 9
Webserver software & version (if known)
PHP Version8.0.x

Users monitoring this issue

There are no users monitoring this issue.

Activities

ginosupport

ginosupport

2025-05-08 12:37

reporter   ~82608

I have done some further investigation and was at least able to narrow down the problem and found a related but different problem in the process.
First of all, i found where the 5000 number came from, which turns out to be a general setting (mail batch size), so I think you can ignore my earlier comments about that not being mentioned anywhere (my bad on that part). Although it might still be nice to have a "Note that the configured batch size is applied" to the documentation.

Playing around with this setting, I was able to exclude some of my earlier hunches on a managable testscenario. I used a batch size of 5 for the steps below

  • Adding 7 (valid) participants and sending invitations (via invite_participants) does not result in an error. It correctly sends 5 emails first and then sends the remainder in the next call to invite_participants.
  • Adding 12 participants and sending invitations does not result in an error. It correctly sends 5 emails.
  • Adding 7 participants with a startdate in the future does not result in an error. No emails are sent (correct)
  • Adding 1 participant with a startdate in the past AFTER adding 7 participants with a startdate in the future does not trigger any emails. There is no error, just nothing happens at all. This is wrong. It expect it to invite this 1 participant that can be invited. The 7 participants with a startdate in the future should have no influence on the amount of emails to send.
  • Adding 6 or 11 participants with a startdate in the past AFTER adding 7 participants with a startdate in the future does not trigger any emails. This seems to have the exact same effect as the previous bullet. This is also wrong for the same reason. (I would have expected 5 emails in this case and then more in the next batch(es)). The 7 participants with a startdate in the future should have no influence on the amount of emails to send.
  • Adding 5 participants with a startdate in the past and enddate of today and then adding 1 participant with a startdate in the past (no enddate) does not trigger any emails. This seems to have the exact same effect as the previous bullet. This is also wrong for the same reason. I expect 1 email in this case. The 5 'expired' participants should have no influence on the amount of emails to send.

So far I was not able to reproduce the HTTP 500 error on a (managable) testset, but the above findings should still be looked at because it just doesn't do what I would expect. I did not investigate the remind_participants functionality but I am expecting the same behavior there.

ginosupport

ginosupport

2025-05-08 12:39

reporter   ~82609

By the way, the results described in my previous comment were done on version 6.12.3

mfavetti

mfavetti

2025-05-08 21:53

developer   ~82617

My guess is the 500 error is the result of a timeout. Either the php worker itself is timing out (max_execution_time in php.ini or set_time_limit in code somewhere) Or the web server is timing out waiting for it (for example fastcgi_read_timeout/proxy_read_timeout for nginx.)

Could also be both with one masking the other. I.e. if you fix the shorter one, the other one could still come into play.

You might also play with the email batch size and delay between batches to get it to finish before the timeout.

ginosupport

ginosupport

2025-05-09 09:30

reporter   ~82622

Interesting suggestion. I don't fully understand how the batch delay is relevant, because i'm only calling the endpoint once? But it's definitely worth looking into. Thanks for the pointer.

Anyway, even disregarding the HTTP 500 error (potential timeout), the behavior isn't what I would functionally expect either. I hope that can be addressed

mfavetti

mfavetti

2025-05-09 09:53

developer   ~82623

i think it works something like this
number of emails to send = n
batch size = b
wait time = w

sent = 0
while(sent < n) {
send_emails(b)
sent+=b
wait(w)
}

so when you call if they're 50,000 emails to send and batch size is 500 and delay is 1 minute, it would easily take over an hour just in delays, not to mention how long it takes to send the emails themselves

mfavetti

mfavetti

2025-05-09 10:12

developer   ~82625

never mind just read through the code, the delay only seems relevant for sending through the admin interface

the remote control endpoint just sends one round of the batch size

so perhaps the time it takes to send 5000 emails is greater than the relevant timeout in your case

ginosupport

ginosupport

2025-05-09 11:36

reporter   ~82626

Ok, that would mean that I should set a lower batch size. However, the effect would be even fewer mails being sent (likely none at all) because of the unwanted behavior that it considers the future participants as well, so that won't really work for me.

Issue History

Date Modified Username Field Change
2025-02-28 16:41 ginosupport New Issue
2025-05-08 12:37 ginosupport Note Added: 82608
2025-05-08 12:37 ginosupport Bug heat 0 => 2
2025-05-08 12:39 ginosupport Note Added: 82609
2025-05-08 21:53 mfavetti Note Added: 82617
2025-05-08 21:53 mfavetti Bug heat 2 => 4
2025-05-09 09:30 ginosupport Note Added: 82622
2025-05-09 09:53 mfavetti Note Added: 82623
2025-05-09 10:12 mfavetti Note Added: 82625
2025-05-09 11:36 ginosupport Note Added: 82626