Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3347739
D5530.id18069.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D5530.id18069.diff
View Options
diff --git a/keyserver/src/scripts/create-many-threads-to-trigger-crash-loop.js b/keyserver/src/scripts/create-many-threads-to-trigger-crash-loop.js
new file mode 100644
--- /dev/null
+++ b/keyserver/src/scripts/create-many-threads-to-trigger-crash-loop.js
@@ -0,0 +1,42 @@
+// @flow
+import ashoat from 'lib/facts/ashoat';
+
+import { createThread } from '../creators/thread-creator';
+import { createScriptViewer } from '../session/scripts';
+import { main } from './utils';
+
+const testUserID = '92942';
+const numOfThreads = 1000;
+
+async function createThreads(
+ n: number,
+ spammedUserID: string,
+ spammingUserID: string,
+): Promise<$ReadOnlyArray<string>> {
+ const threads = [];
+ const viewer = createScriptViewer(spammingUserID);
+ const initialMemberIDs = [spammedUserID];
+ const threadRequest = { type: 3, initialMemberIDs, parentThreadID: '1' };
+
+ for (let i = 0; i < n; i++) {
+ const threadResponse = await createThread(viewer, threadRequest);
+ if (threadResponse.newThreadID) {
+ const threadID: string = threadResponse.newThreadID;
+ threads.push(threadID);
+ }
+ }
+ return threads;
+}
+
+// This script is used to trigger socket crash loop
+// Linear issue: https://linear.app/comm/issue/ENG-2075/reproduce-socket-crash-loop-in-production-with-artificial-test-data
+// Usage: set testUserID to the user you wish to trigger the crash loop for,
+// set iOS physical device networking profile to 3G and run the script,
+// open comm on physical device once the script has finnished
+// the app should be in a crash loop
+
+async function createManyThreadsToTriggerCrashLoop() {
+ await createThreads(numOfThreads, testUserID, ashoat.id);
+}
+
+main([createManyThreadsToTriggerCrashLoop]);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 1:08 PM (18 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2569598
Default Alt Text
D5530.id18069.diff (1 KB)
Attached To
Mode
D5530: [keyserver] Add a script for triggering socket crash loop
Attached
Detach File
Event Timeline
Log In to Comment