Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

realm.string_id: Possible caching issue when subdomain is changed. #19885

Open
eeshangarg opened this issue Oct 1, 2021 · 1 comment
Open

Comments

@eeshangarg
Copy link
Member

In #19741, as a part of converting a demo organization into a regular organization, we allow the user to edit the subdomain of their organization on conversion. Writing this code led to a weird issue, and the steps to reproduce it are as follows:

  1. Fetch my PR update_realm: Allow demo orgs to be converted to regular orgs. #19741 locally if it isn't already merged.
  2. Comment out the redirection in success_continuation in static/js/admin.js on line 107.
  3. Run the development environment and create a demo realm on /devlogin.
  4. Now click on the gear icon and select Manage organization. On the demo organization red banner at the top, click "Convert organization" and type in a subdomain and click "Convert".
  5. You will eventually see the following exception in the run-dev.py script output:
2021-10-01 18:39:36,651 INFO: process_fts_updates: Processed 100 rows catching up
Tornado server (re)started on port 9993
Django process (re)started. Quit the server with CONTROL-C.
2021-10-01 18:39:47.433 INFO [process_queue] 14 queue worker threads were launched
2021-10-01 18:40:17.983 INFO [zr] 127.0.0.1       GET     200  94ms (db: 16ms/17q) (+start: 14ms) / [None] (unauth@zulip via Mozilla)
2021-10-01 18:40:19.745 INFO [zr] 127.0.0.1       GET     401   2ms /json/messages (unauth@zulip via Mozilla)
2021-10-01 18:40:19.745 WARN [django.server] "GET /json/messages?anchor=first_unread&num_before=200&num_after=200&client_gravatar=true HTTP/1.1" 401 86
2021-10-01 18:40:20.255 INFO [zr] 127.0.0.1       GET     200 188ms (md: 74ms/1) (db: 5ms/3q) (+start: 19ms) /devlogin/ (unauth@zulip via Mozilla)
2021-10-01 18:40:23.852 INFO [zulip.send_email] Sending followup_day1 email to ['user-23 <user-23@zulip.com>']
2021-10-01 18:40:23.867 INFO [] Emails sent in development are available at http://zulipdev.com:9991/emails
2021-10-01 18:40:23.893 INFO [zulip.send_email] Sending followup_day2 email to ['user-23 <user-23@zulip.com>']
2021-10-01 18:40:23.906 INFO [] Emails sent in development are available at http://zulipdev.com:9991/emails
2021-10-01 18:40:24.205 INFO [zr] 127.0.0.1       POST    302 656ms (mem: 34ms/95) (md: 18ms/7) (db: 239ms/161q) (+start: 14ms) /devtools/register_demo_realm/ (unauth@zulip via Mozilla)
2021-10-01 18:40:24.205 INFO [django.server] "POST /devtools/register_demo_realm/ HTTP/1.1" 302 0
2021-10-01 18:40:24.459 INFO [zr] 127.0.0.1       GET     302  25ms (db: 8ms/6q) (+start: 13ms) /accounts/login/subdomain/dfc665e9b08909a25e6f2a09a3af321e (24@demo-cfyc6372 via Mozilla)
2021-10-01 18:40:24.460 INFO [django.server] "GET /accounts/login/subdomain/dfc665e9b08909a25e6f2a09a3af321e HTTP/1.1" 302 0
2021-10-01 18:40:24.563 INFO [zr:9993] 127.0.0.1       POST    200  14ms (db: 1ms/3q) /api/v1/events/internal [1633113574:0/0] (24@demo-cfyc6372 via internal)
2021-10-01 18:40:24.675 INFO [zr:9993] 127.0.0.1       POST    200   1ms /api/v1/events/internal [1633113574:0/0] (24@demo-cfyc6372 via internal)
2021-10-01 18:40:24.694 INFO [zr] 127.0.0.1       GET     200 170ms (mem: 6ms/10) (db: 56ms/39q) (+start: 14ms) / [1633113574:0] (24@demo-cfyc6372 via Mozilla)
2021-10-01 18:40:26.685 INFO [zr] 127.0.0.1       POST    200  92ms (db: 39ms/2q) /json/users/me/tutorial_status (24@demo-cfyc6372 via Mozilla)
2021-10-01 18:40:26.837 INFO [zr] 127.0.0.1       GET     200 277ms (mem: 17ms/10) (db: 150ms/10q) /json/messages (24@demo-cfyc6372 via Mozilla)
2021-10-01 18:40:26.867 INFO [zr] 127.0.0.1       GET     200 304ms (mem: 18ms/13) (db: 180ms/5q) /json/messages [in] (24@demo-cfyc6372 via Mozilla)
2021-10-01 18:40:26.913 INFO [zr] 127.0.0.1       POST    200  87ms (mem: 10ms/6) /json/users/me/presence (24@demo-cfyc6372 via Mozilla)
2021-10-01 18:40:27.214 INFO [zr] 127.0.0.1       GET     200 545ms (mem: 101ms/16) (db: 310ms/7q) /json/messages [is:private] (24@demo-cfyc6372 via Mozilla)
2021-10-01 18:40:27.238 INFO [zr:9993] 127.0.0.1       GET     200   6ms (lp: 692ms) /json/events [1633113574:0/1/presence] (24@demo-cfyc6372 via Mozilla)
2021-10-01 18:40:27.385 INFO [zr] 127.0.0.1       GET     200 119ms (db: 50ms/6q) /json/messages [is:private] (24@demo-cfyc6372 via Mozilla)
2021-10-01 18:40:27.544 INFO [zr] 127.0.0.1       POST    200   7ms /json/report/narrow_times [20ms/319ms/819ms] (24@demo-cfyc6372 via Mozilla)
2021-10-01 18:40:27.553 INFO [zr:9993] 127.0.0.1       GET     200   8ms (lp: 135ms) /json/events [1633113574:0/1/update_message_flags] (24@demo-cfyc6372 via Mozilla)
2021-10-01 18:40:27.633 INFO [zr] 127.0.0.1       POST    200 120ms (db: 21ms/8q) /json/messages/flags [add read/1] actually 1 (24@demo-cfyc6372 via Mozilla)
2021-10-01 18:40:38.592 INFO [zr] 127.0.0.1       POST    200  41ms (db: 16ms/4q) /json/realm (24@eeshan via Mozilla)
2021-10-01 18:41:11.037 WARN [] User user-23@zulip.com (eeshan) attempted to access API on wrong subdomain (demo-cfyc6372)
2021-10-01 18:41:11.038 INFO [zr] 127.0.0.1       POST    400   3ms /json/messages/flags (24@eeshan via Mozilla)
2021-10-01 18:41:11.038 INFO [zr] status=400, data=b'{"result":"error","msg":"Account is not associated with this subdomain","code":"BAD_REQUEST"}\n', uid=24@eeshan
2021-10-01 18:41:11.039 WARN [django.server] "POST /json/messages/flags HTTP/1.1" 400 94
2021-10-01 18:41:11.133 WARN [] User user-23@zulip.com (eeshan) attempted to access API on wrong subdomain (demo-cfyc6372)
2021-10-01 18:41:11.135 INFO [zr] 127.0.0.1       POST    400   3ms /json/report/unnarrow_times (24@eeshan via Mozilla)
2021-10-01 18:41:11.135 INFO [zr] status=400, data=b'{"result":"error","msg":"Account is not associated with this subdomain","code":"BAD_REQUEST"}\n', uid=24@eeshan
2021-10-01 18:41:11.135 WARN [django.server] "POST /json/report/unnarrow_times HTTP/1.1" 400 94
2021-10-01 18:41:12.094 WARN [] User user-23@zulip.com (eeshan) attempted to access API on wrong subdomain (demo-cfyc6372)
2021-10-01 18:41:12.097 INFO [zr] 127.0.0.1       POST    400  13ms /json/messages/flags (24@eeshan via Mozilla)
2021-10-01 18:41:12.097 INFO [zr] status=400, data=b'{"result":"error","msg":"Account is not associated with this subdomain","code":"BAD_REQUEST"}\n', uid=24@eeshan
2021-10-01 18:41:12.098 WARN [django.server] "POST /json/messages/flags HTTP/1.1" 400 94
2021-10-01 18:41:13.672 INFO [zr:9993] 127.0.0.1       GET     200   5ms (lp: 46.0s) /json/events [1633113574:0/1/heartbeat] (24@eeshan via Mozilla)
2021-10-01 18:41:13.698 WARN [:9993] User user-23@zulip.com (eeshan) attempted to access API on wrong subdomain (demo-cfyc6372)
2021-10-01 18:41:13.699 INFO [zr:9993] 127.0.0.1       GET     400   2ms /json/events (24@eeshan via Mozilla)
2021-10-01 18:41:13.699 INFO [zr:9993] status=400, data=b'{"result":"error","msg":"Account is not associated with this subdomain","code":"BAD_REQUEST"}\n', uid=24@eeshan
2021-10-01 18:41:15.472 WARN [:9993] User user-23@zulip.com (eeshan) attempted to access API on wrong subdomain (demo-cfyc6372)
2021-10-01 18:41:15.478 INFO [zr:9993] 127.0.0.1       GET     400   8ms /json/events (24@eeshan via Mozilla)
2021-10-01 18:41:15.482 INFO [zr:9993] status=400, data=b'{"result":"error","msg":"Account is not associated with this subdomain","code":"BAD_REQUEST"}\n', uid=24@eeshan
2021-10-01 18:41:16.783 WARN [] User user-23@zulip.com (eeshan) attempted to access API on wrong subdomain (demo-cfyc6372)
2021-10-01 18:41:16.784 INFO [zr] 127.0.0.1       POST    400   2ms /json/users/me/presence (24@eeshan via Mozilla)
2021-10-01 18:41:16.784 INFO [zr] status=400, data=b'{"result":"error","msg":"Account is not associated with this subdomain","code":"BAD_REQUEST"}\n', uid=24@eeshan
2021-10-01 18:41:16.784 WARN [django.server] "POST /json/users/me/presence HTTP/1.1" 400 94
2021-10-01 18:41:18.239 WARN [:9993] User user-23@zulip.com (eeshan) attempted to access API on wrong subdomain (demo-cfyc6372)
2021-10-01 18:41:18.240 INFO [zr:9993] 127.0.0.1       GET     400   2ms /json/events (24@eeshan via Mozilla)
2021-10-01 18:41:18.240 INFO [zr:9993] status=400, data=b'{"result":"error","msg":"Account is not associated with this subdomain","code":"BAD_REQUEST"}\n', uid=24@eeshan
2021-10-01 18:41:22.745 WARN [:9993] User user-23@zulip.com (eeshan) attempted to access API on wrong subdomain (demo-cfyc6372)
2021-10-01 18:41:22.745 INFO [zr:9993] 127.0.0.1       GET     400   2ms /json/events (24@eeshan via Mozilla)
2021-10-01 18:41:22.746 INFO [zr:9993] status=400, data=b'{"result":"error","msg":"Account is not associated with this subdomain","code":"BAD_REQUEST"}\n', uid=24@eeshan
2021-10-01 18:41:31.060 WARN [:9993] User user-23@zulip.com (eeshan) attempted to access API on wrong subdomain (demo-cfyc6372)
2021-10-01 18:41:31.061 INFO [zr:9993] 127.0.0.1       GET     400   2ms /json/events (24@eeshan via Mozilla)
2021-10-01 18:41:31.061 INFO [zr:9993] status=400, data=b'{"result":"error","msg":"Account is not associated with this subdomain","code":"BAD_REQUEST"}\n', uid=24@eeshan
2021-10-01 18:41:44.053 WARN [:9993] User user-23@zulip.com (eeshan) attempted to access API on wrong subdomain (demo-cfyc6372)
2021-10-01 18:41:44.054 INFO [zr:9993] 127.0.0.1       GET     400   2ms /json/events (24@eeshan via Mozilla)
2021-10-01 18:41:44.054 INFO [zr:9993] status=400, data=b'{"result":"error","msg":"Account is not associated with this subdomain","code":"BAD_REQUEST"}\n', uid=24@eeshan
2021-10-01 18:41:50.077 WARN [] User user-23@zulip.com (eeshan) attempted to access API on wrong subdomain (demo-cfyc6372)
2021-10-01 18:41:50.077 INFO [zr] 127.0.0.1       GET     400   2ms /json/messages (24@eeshan via Mozilla)
2021-10-01 18:41:50.078 INFO [zr] status=400, data=b'{"result":"error","msg":"Account is not associated with this subdomain","code":"BAD_REQUEST"}\n', uid=24@eeshan
2021-10-01 18:41:50.078 WARN [django.server] "GET /json/messages?anchor=101&num_before=1000&num_after=0&client_gravatar=true HTTP/1.1" 400 94
2021-10-01 18:42:05.078 WARN [:9993] User user-23@zulip.com (eeshan) attempted to access API on wrong subdomain (demo-cfyc6372)
2021-10-01 18:42:05.079 INFO [zr:9993] 127.0.0.1       GET     400   2ms /json/events (24@eeshan via Mozilla)
2021-10-01 18:42:05.079 INFO [zr:9993] status=400, data=b'{"result":"error","msg":"Account is not associated with this subdomain","code":"BAD_REQUEST"}\n', uid=24@eeshan
2021-10-01 18:42:07.055 WARN [] User user-23@zulip.com (eeshan) attempted to access API on wrong subdomain (demo-cfyc6372)
2021-10-01 18:42:07.056 INFO [zr] 127.0.0.1       POST    400   3ms /json/users/me/presence (24@eeshan via Mozilla)
2021-10-01 18:42:07.056 INFO [zr] status=400, data=b'{"result":"error","msg":"Account is not associated with this subdomain","code":"BAD_REQUEST"}\n', uid=24@eeshan
2021-10-01 18:42:07.057 WARN [django.server] "POST /json/users/me/presence HTTP/1.1" 400 94
2021-10-01 18:42:25.329 INFO [] Batch-processing 1 missedmessage_emails events for user 24
2021-10-01 18:42:39.053 WARN [:9993] User user-23@zulip.com (eeshan) attempted to access API on wrong subdomain (demo-cfyc6372)
2021-10-01 18:42:39.054 INFO [zr:9993] 127.0.0.1       GET     400   2ms /json/events (24@eeshan via Mozilla)
2021-10-01 18:42:39.055 INFO [zr:9993] status=400, data=b'{"result":"error","msg":"Account is not associated with this subdomain","code":"BAD_REQUEST"}\n', uid=24@eeshan
2021-10-01 18:42:57.053 WARN [] User user-23@zulip.com (eeshan) attempted to access API on wrong subdomain (demo-cfyc6372)
2021-10-01 18:42:57.054 INFO [zr] 127.0.0.1       POST    400   3ms /json/users/me/presence (24@eeshan via Mozilla)
2021-10-01 18:42:57.054 INFO [zr] status=400, data=b'{"result":"error","msg":"Account is not associated with this subdomain","code":"BAD_REQUEST"}\n', uid=24@eeshan
2021-10-01 18:42:57.055 WARN [django.server] "POST /json/users/me/presence HTTP/1.1" 400 94
2021-10-01 18:43:34.050 WARN [:9993] User user-23@zulip.com (eeshan) attempted to access API on wrong subdomain (demo-cfyc6372)
2021-10-01 18:43:34.051 INFO [zr:9993] 127.0.0.1       GET     400   1ms /json/events (24@eeshan via Mozilla)
2021-10-01 18:43:34.051 INFO [zr:9993] status=400, data=b'{"result":"error","msg":"Account is not associated with this subdomain","code":"BAD_REQUEST"}\n', uid=24@eeshan
2021-10-01 18:43:47.046 WARN [] User user-23@zulip.com (eeshan) attempted to access API on wrong subdomain (demo-cfyc6372)
2021-10-01 18:43:47.047 INFO [zr] 127.0.0.1       POST    400   2ms /json/users/me/presence (24@eeshan via Mozilla)
2021-10-01 18:43:47.047 INFO [zr] status=400, data=b'{"result":"error","msg":"Account is not associated with this subdomain","code":"BAD_REQUEST"}\n', uid=24@eeshan
2021-10-01 18:43:47.048 WARN [django.server] "POST /json/users/me/presence HTTP/1.1" 400 94

@timabbott FYI

@zulipbot
Copy link
Member

zulipbot commented Oct 5, 2021

Hello @zulip/server-production members, this issue was labeled with the "area: production" label, so you may want to check it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants