roundcube's update.sh should only run on container upgrade
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.5k
- Forks
- 999
- PR merge metrics
- No merged PRs in 30d
Description
Environment & Version
Version: 2024.06
Description
My webmail container will not start. Specifically, it crashes when executing the /var/www/roundcube/bin/update.sh script and keeps restarting ad infinitum.
I think the problem might be with the high number of contacts for users 6 and 7. I suspect that the script either runs out of resources to process the contact entries (hitting php memory limit perhaps?) or the container startup times out and the process is killed.
I would be grateful for any help, including better workaround. I am not sure if simply disabling the update script is safe long term.
Workaround
Disabling the update script by commenting out the following lines in start.py.
print("Upgrading database")
try:
subprocess.check_call(["/var/www/roundcube/bin/update.sh", "--version=?", "-y"], stderr=subprocess.STDOUT, preexec_fn=demote())
except subprocess.CalledProcessError as exc:
exit(4)
else:
print("Cleaning database")
try:
subprocess.check_call(["/var/www/roundcube/bin/cleandb.sh"], stderr=subprocess.STDOUT, preexec_fn=demote())
except subprocess.CalledProcessError as exc:
exit(5)
Logs
cze 30 09:16:16 hostname mailu-webmail[569]: WARNING: Changed defaults (These config options have new default values):
cze 30 09:16:16 hostname mailu-webmail[569]: - 'skin'
cze 30 09:16:16 hostname mailu-webmail[569]: - 'smtp_port'
cze 30 09:16:16 hostname mailu-webmail[569]: - 'smtp_user'
cze 30 09:16:16 hostname mailu-webmail[569]: - 'smtp_pass'
cze 30 09:16:16 hostname mailu-webmail[569]: - 'jquery_ui_skin_map'
cze 30 09:16:16 hostname mailu-webmail[569]: Executing database schema update.
cze 30 09:16:16 hostname mailu-webmail[569]: Indexing contacts for user 1...
cze 30 09:16:18 hostname mailu-webmail[569]: Indexing contacts for user 2...
cze 30 09:16:18 hostname mailu-webmail[569]: Indexing contacts for user 3...
cze 30 09:16:18 hostname mailu-webmail[569]: Indexing contacts for user 4...
cze 30 09:16:18 hostname mailu-webmail[569]: Indexing contacts for user 5...
cze 30 09:16:18 hostname mailu-webmail[569]: Indexing contacts for user 6...
cze 30 09:18:02 hostname mailu-webmail[569]: CRITICAL:root:Received SIGTERM, terminating.
cze 30 09:18:02 hostname mailu-webmail[569]: Initializing database
cze 30 09:18:02 hostname mailu-webmail[569]: Already initialized
cze 30 09:18:02 hostname mailu-webmail[569]: Upgrading database
cze 30 09:18:03 hostname mailu-webmail[569]: WARNING: Changed defaults (These config options have new default values):
cze 30 09:18:03 hostname mailu-webmail[569]: - 'skin'
cze 30 09:18:03 hostname mailu-webmail[569]: - 'smtp_port'
cze 30 09:18:03 hostname mailu-webmail[569]: - 'smtp_user'
cze 30 09:18:03 hostname mailu-webmail[569]: - 'smtp_pass'
cze 30 09:18:03 hostname mailu-webmail[569]: - 'jquery_ui_skin_map'
cze 30 09:18:03 hostname mailu-webmail[569]: Executing database schema update.
cze 30 09:18:03 hostname mailu-webmail[569]: Indexing contacts for user 1...
cze 30 09:18:04 hostname mailu-webmail[569]: Indexing contacts for user 2...
cze 30 09:18:04 hostname mailu-webmail[569]: Indexing contacts for user 3...
cze 30 09:18:04 hostname mailu-webmail[569]: Indexing contacts for user 4...
cze 30 09:18:04 hostname mailu-webmail[569]: Indexing contacts for user 5...
cze 30 09:18:04 hostname mailu-webmail[569]: Indexing contacts for user 6...
cze 30 09:19:33 hostname mailu-webmail[569]: Indexing contacts for user 7...
cze 30 09:20:01 hostname mailu-webmail[569]: CRITICAL:root:Received SIGTERM, terminating.
Additional information
sqlite> select user_id, count(*) from contacts group by user_id order by user_id;
1|7
6|2078
7|1029
10|16
11|2
12|3
15|1
17|5
18|10
20|10
21|10
22|10
25|10
29|1
30|1
31|12
35|1
36|13
38|10
40|19
42|3
43|29
138|12
140|11
162|9
164|11
165|8
166|5
167|10
169|1
sqlite> select user_id, count(*) from collected_addresses group by user_id order by user_id;
1|4
2|1
3|1
5|2
6|402
7|1792
10|1
11|33
12|75
14|9
15|5
16|31
17|8
18|15
19|6
20|6
21|8
22|4
25|16
26|13
27|2
28|10
29|10
30|7
35|13
36|21
38|8
40|1
42|9
43|9
44|1
45|1
47|1
50|5
51|5
57|1
58|3
59|4
60|1
71|1
72|2
73|1
77|3
78|9
82|4
83|1
85|7
94|2
95|2
103|14
108|1
111|1
114|5
115|2
116|1
118|1
121|1
136|1
137|1
140|17
141|1
162|2
164|4
165|1
166|3
167|3
169|14
172|1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading start.py and the startup log around the calls to /var/www/roundcube/bin/update.sh and cleandb.sh. Compare the initialization and upgrade paths, then verify that database updates run during a container upgrade without rerunning on ordinary restarts; the webmail container should start successfully with large contact sets.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- backend, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100