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

Using the ilike operator in js query builder caused typescript type checker FATAL Error #1188

Open
BKG01 opened this issue Jul 23, 2024 · 2 comments

Comments

@BKG01
Copy link

BKG01 commented Jul 23, 2024

  • EdgeDB Version: {'4.0-rc.2+6264436'}
  • EdgeDB CLI Version: EdgeDB CLI 5.1.0+8ff9f85
  • OS Version: MacOS Sononata 14.5

Steps to Reproduce:

  1. Use an ilike operator in the query below:
export async function checkDuplicateEmailParent(
  email: string,
): Promise<boolean> {
  try {
    // Query the Parent table to find a user with the given email
    const user = await e
      .select(e.User, (user) => ({
        email: true,
        filter_single: e.op(user.email, "=", email),
      }))
      .run(client)

    // Check if the user with the given email exists
    return !!user // Return true if user exists, otherwise false
  } catch (error) {
    console.error("Error checking for duplicate email:", error)
    throw error
  }
}

2.Run npx tsc

Relevant part of the schema

Schema:

 type User extending Timestamped {
    required email: str { constraint exclusive; };
    required passwordHash: str;
    title: str;
    firstName: str;
    lastName: str;
    emailVerified: bool;
    lastLogin: str;
    multi link notes := .<createdBy[is Note];
    surveyResponse := .<user[is SurveyResponse];
    token := .<user[is Token];
    userGroup := .<user[is UserGroupUsers];
    courseProgress := .<user[is CourseProgress];
    courseDeployment := .<user[is CourseDeployment];
    organisation: Organisation;
    `role`: `Role`{
      on target delete allow;
    };
    permissions := (
      with r := .role
      select r.permissions
    );
  }

  type Student extending User {
    dateOfBirth: datetime;
    # single link school: School; 
    seniorSchoolCohort: int32;
    juniorSchoolCohort: int32;
    parentPhone: str;
    parentEmail: str;
    parentFirstName: str;
    schoolName: str;
    schoolLocation: str;
    schoolYear: str;
    schoolForm: str;
    phone: str;
  }
  
  type Teacher extending User {
    formClass: str;
  }

  type Parent extending User {
    phone: str;
    school: School;
    childEmail: str;
    childRelationship: str;
  }

Originally raised in Microsoft typescript GitHub microsoft/TypeScript#59308

Error created is:

<--- Last few GCs --->

[15520:0x158008000]    58969 ms: Mark-sweep 4038.2 (4138.1) -> 4026.3 (4142.3) MB, 1964.9 / 0.0 ms  (average mu = 0.269, current mu = 0.015) allocation failure; scavenge might not succeed
[15520:0x158008000]    60669 ms: Mark-sweep 4042.3 (4142.3) -> 4032.1 (4147.8) MB, 1670.2 / 0.0 ms  (average mu = 0.156, current mu = 0.017) allocation failure; scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0x104fee598 node::Abort() [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
 2: 0x104fee794 node::ModifyCodeGenerationFromStrings(v8::Local<v8::Context>, v8::Local<v8::Value>, bool) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
 3: 0x105142e70 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
 4: 0x105142e20 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
 5: 0x1052b85bc v8::internal::EmbedderStackStateScope::EmbedderStackStateScope(v8::internal::Heap*, v8::internal::EmbedderStackStateScope::Origin, cppgc::EmbedderStackState) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
 6: 0x1052b7348 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
 7: 0x1052aed00 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
 8: 0x1052af4fc v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
 9: 0x105299ea8 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
10: 0x1055859e0 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
11: 0x10584510c Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
12: 0x1057fc620 Builtins_CloneFastJSArray [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
13: 0x1058697c8 Builtins_ArrayPrototypeSlice [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
14: 0x10c5de948
15: 0x10cb1a3fc
16: 0x10cef0fb4
17: 0x10cba9f58
18: 0x10cbaa864
19: 0x10cbaa584
20: 0x10cbaa864
21: 0x10cee1c14
22: 0x10cbaa970
23: 0x10c76d780
24: 0x10cbe476c
25: 0x10cedcf08
26: 0x10c5e24a8
27: 0x10cbaa628
28: 0x10cbaa864
29: 0x10cbaa584
30: 0x10cbaa864
31: 0x10cee1c14
32: 0x10cbaa970
33: 0x10c76d780
34: 0x10cbe4518
35: 0x10cedcf08
36: 0x10c5e24a8
37: 0x10cbaa628
38: 0x10cbaa864
39: 0x10cbaa584
40: 0x10cbaa864
41: 0x10cee1c14
42: 0x10cbaa970
43: 0x10c76d780
44: 0x10cbe476c
45: 0x10cedcf08
46: 0x10c5e24a8
47: 0x10cbaa628
48: 0x10cbaa864
49: 0x10cbaa584
50: 0x10cbaa864
51: 0x10cee1c14
52: 0x10c9f45b4
53: 0x10c76d780
54: 0x10cbe4924
55: 0x10cedcf08
56: 0x10c5e24a8
57: 0x10c9f4f80
58: 0x10c9f47f8
59: 0x10c9f4eb8
60: 0x10cee1c14
61: 0x10cee9fb8
62: 0x10c5e24a8
63: 0x10c9f44d4
64: 0x10cee1c14
65: 0x10c9f45b4
66: 0x10cee1c14
67: 0x10cee9fb8
68: 0x10c5e24a8
69: 0x10c9f44d4
70: 0x10cee1c14
71: 0x10d131e24
72: 0x10cd91310
73: 0x10ce30fe8
74: 0x10ce39668
75: 0x10d12a854
76: 0x10c99ae98
77: 0x10c9b13e8
78: 0x10d108e48
79: 0x10c8eea58
80: 0x10d10ccd0
81: 0x10c909844
82: 0x10c8ee8a4
83: 0x10cba5e18
84: 0x10cb68488
85: 0x10c8eead8
86: 0x10cba5e18
87: 0x10c9570fc
88: 0x10cae3eb0
89: 0x10cd1e5f0
90: 0x10cd1cb10
91: 0x10c8eeb58
92: 0x10cba5e18
93: 0x10ce31090
94: 0x10ce396a4
95: 0x10d12a854
96: 0x10c99ae98
97: 0x10c9b13e8
98: 0x10d108e48
99: 0x10c8eea58
100: 0x10ce11d54
101: 0x10c8ee8e8
102: 0x10cba5e18
103: 0x10ccabef0
104: 0x10ccac294
105: 0x10c9ea834
106: 0x10cd9b604
107: 0x10cbb3944
108: 0x10cb0cd24
109: 0x10cbd8e2c
110: 0x10ca6a6a4
111: 0x10cb9d794
112: 0x10d118b44
113: 0x10cb79a38
114: 0x10c99c370
115: 0x10c991464
116: 0x10cb9d4fc
117: 0x10d118b44
118: 0x10cb79a38
119: 0x10c998514
120: 0x10d1234d8
121: 0x10cb9d730
122: 0x10d118b44
123: 0x10cb79a38
124: 0x10c99845c
125: 0x10cb9d89c
126: 0x10d118b44
127: 0x10c75070c
128: 0x10c44ced8
129: 0x10cbb5a80
130: 0x10c44d0e0
131: 0x10cb9d7c4
132: 0x10d118b44
133: 0x10cb79b5c
134: 0x10cb6a1a8
135: 0x10ceee5cc
136: 0x10cc926b0
137: 0x10d074ba0
138: 0x10cb68a34
139: 0x10c84f288
140: 0x10c85063c
141: 0x10c84f664
142: 0x10c84fd5c
143: 0x10c84f7c0
144: 0x10c84fa5c
145: 0x10c717a80
146: 0x10c45ea7c
147: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
148: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
149: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
150: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
151: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
152: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
153: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
154: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
155: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
156: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
157: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
158: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
159: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
160: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
161: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
162: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
163: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
164: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
165: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
166: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
167: 0x1057d0198 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
168: 0x1057ce4d0 Builtins_JSEntryTrampoline [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
169: 0x1057ce164 Builtins_JSEntry [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
170: 0x10524fe60 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
171: 0x10524f558 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
172: 0x105157074 v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
173: 0x104fd33a0 node::builtins::BuiltinLoader::CompileAndCall(v8::Local<v8::Context>, char const*, node::Realm*) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
174: 0x105061a88 node::Realm::ExecuteBootstrapper(char const*) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
175: 0x104fb9604 node::StartExecution(node::Environment*, char const*) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
176: 0x104fb95b4 node::StartExecution(node::Environment*, std::__1::function<v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfo const&)>) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
177: 0x104f4400c node::LoadEnvironment(node::Environment*, std::__1::function<v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfo const&)>) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
178: 0x105028dc4 node::NodeMainInstance::Run(int*, node::Environment*) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
179: 0x105028b04 node::NodeMainInstance::Run() [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
180: 0x104fbbe58 node::LoadSnapshotDataAndRun(node::SnapshotData const**, node::InitializationResult const*) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
181: 0x104fbc024 node::Start(int, char**) [/opt/homebrew/Cellar/node@18/18.20.3/bin/node]
182: 0x18f0260e0 start [/usr/lib/dyld]
fish: Job 1, 'npx tsc' terminated by signal SIGABRT (Abort)
@BKG01 BKG01 changed the title Using the like operator in js query builder caused typescript type checker FATAL Error Using the ilike operator in js query builder caused typescript type checker FATAL Error Jul 23, 2024
@scotttrinh
Copy link
Collaborator

@BKG01

We have a canary build out which hopes to address this, do you mind trying that out and see if it works in your use case or if it has any issues elsewhere?

npm install -D @edgedb/generate@canary

@BKG01
Copy link
Author

BKG01 commented Jul 24, 2024

@scotttrinh Thanks, I'll have a test with that... (It might be a few days before I can circle back with results).

@msullivan msullivan transferred this issue from edgedb/edgedb Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants