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

Missing imports sometimes result in very confusing error trace #6092

Closed
radeusgd opened this issue Mar 27, 2023 · 7 comments
Closed

Missing imports sometimes result in very confusing error trace #6092

radeusgd opened this issue Mar 27, 2023 · 7 comments
Assignees
Labels
--bug Type: bug -compiler p-medium Should be completed in the next few sprints

Comments

@radeusgd
Copy link
Member

radeusgd commented Mar 27, 2023

The mentioned bug seems a bit random and very hard to track down, I did not manage to find a small self-contained repro.

But it's been causing problems to me and @jdunkerley quite a lot in the recent weeks, in quite random moments.

The issue is that sometimes when running the project, we get a wall of errors saying that some names/types could not be found, for example:

In module Standard.Database.Internal.Redshift.Redshift_Dialect:
Compiler encountered errors:
Redshift_Dialect.enso[29:28-29:43]: The name `Postgres_Dialect` could not be found.
Redshift_Dialect.enso[42:12-42:15]: The name `Text` could not be found.
Redshift_Dialect.enso[51:20-51:24]: The name `Query` could not be found.
Redshift_Dialect.enso[51:29-51:41]: The name `SQL_Statement` could not be found.
Redshift_Dialect.enso[53:9-53:22]: The name `Base_Generator` could not be found.
Redshift_Dialect.enso[67:32-67:46]: The name `Internal_Column` could not be found.
Redshift_Dialect.enso[67:51-67:64]: The name `Sort_Direction` could not be found.
Redshift_Dialect.enso[67:69-67:75]: The name `Nothing` could not be found.
Redshift_Dialect.enso[67:79-67:91]: The name `Text_Ordering` could not be found.
Redshift_Dialect.enso[67:96-67:111]: The name `Order_Descriptor` could not be found.
Redshift_Dialect.enso[69:9-69:24]: The name `Postgres_Dialect` could not be found.
Redshift_Dialect.enso[74:20-74:29]: The name `Connection` could not be found.
Redshift_Dialect.enso[74:34-74:46]: The name `SQL_Join_Kind` could not be found.
Redshift_Dialect.enso[74:51-74:54]: The name `Text` could not be found.
Redshift_Dialect.enso[74:59-74:67]: The name `From_Spec` could not be found.
Redshift_Dialect.enso[74:72-74:80]: The name `From_Spec` could not be found.
Redshift_Dialect.enso[74:85-74:90]: The name `Vector` could not be found.
Redshift_Dialect.enso[74:95-74:100]: The name `Vector` could not be found.
Redshift_Dialect.enso[74:105-74:110]: The name `Vector` could not be found.
Redshift_Dialect.enso[74:115-74:119]: The name `Table` could not be found.
Redshift_Dialect.enso[76:9-76:28]: The name `Database_Join_Helper` could not be found.
Redshift_Dialect.enso[81:27-81:30]: The name `Text` could not be found.
Redshift_Dialect.enso[81:35-81:41]: The name `Boolean` could not be found.
Redshift_Dialect.enso[88:26-88:39]: The name `Naming_Helpers` could not be found.
Redshift_Dialect.enso[89:31-89:44]: The name `Naming_Helpers` could not be found.
Redshift_Dialect.enso[94:24-94:39]: The name `SQL_Type_Mapping` could not be found.
Redshift_Dialect.enso[95:29-95:49]: The name `Postgres_Type_Mapping` could not be found.
Redshift_Dialect.enso[100:36-100:43]: The name `SQL_Type` could not be found.
Redshift_Dialect.enso[100:48-100:61]: The name `Column_Fetcher` could not be found.
Redshift_Dialect.enso[104:9-104:29]: The name `Column_Fetcher_Module` could not be found.
Redshift_Dialect.enso[107:28-107:43]: The name `Statement_Setter` could not be found.
Redshift_Dialect.enso[108:33-108:48]: The name `Postgres_Dialect` could not be found.
Redshift_Dialect.enso[111:31-111:46]: The name `Aggregate_Column` could not be found.
Redshift_Dialect.enso[111:51-111:57]: The name `Boolean` could not be found.
Redshift_Dialect.enso[111:61-111:90]: The name `Unsupported_Database_Operation` could not be found.
Redshift_Dialect.enso[114:9-114:12]: The name `True` could not be found.
In module Standard.Database.Connection.Database:
Compiler encountered errors:
Database.enso[18:12-18:27]: The name `Postgres_Options` could not be found.
Database.enso[18:29-18:42]: The name `SQLite_Options` could not be found.
Database.enso[18:44-18:59]: The name `Redshift_Options` could not be found.
Database.enso[18:65-18:82]: The name `Connection_Options` could not be found.
Database.enso[18:87-18:96]: The name `Connection` could not be found.
Database.enso[18:100-18:108]: The name `SQL_Error` could not be found.
Database.enso[19:25-19:42]: The name `Connection_Options` could not be found.
Aborting due to 43 errors and 1 warnings.

But this often refers to pretty standard types like Text and Nothing which surely are imported in this file!

To reproduce it:

Other repros are quite possible, but this bug is very brittle and random. The steps above are ones that allowed me to reproduce the issue consistently.

@radeusgd radeusgd added p-medium Should be completed in the next few sprints --bug Type: bug triage labels Mar 27, 2023
@radeusgd
Copy link
Member Author

Apparently, the following patch seems to fix the issue that is present on the linked branch:

Index: distribution/lib/Standard/Database/0.0.0-dev/src/Internal/Redshift/Redshift_Dialect.enso
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/Redshift/Redshift_Dialect.enso b/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/Redshift/Redshift_Dialect.enso
--- a/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/Redshift/Redshift_Dialect.enso	(revision f6f7aa541f6d7e47c8af6c7a1760bd28e383f22a)
+++ b/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/Redshift/Redshift_Dialect.enso	(date 1679937196832)
@@ -17,8 +17,9 @@
 import project.Internal.IR.Query.Query
 import project.Internal.Postgres.Postgres_Dialect
 import project.Internal.Common.Database_Join_Helper
-import project.Internal.SQL_Type_Mapping.SQL_Type_Mapping
 import project.Internal.Postgres.Postgres_Type_Mapping.Postgres_Type_Mapping
+import project.Internal.SQL_Type_Mapping.SQL_Type_Mapping
+import project.Internal.Statement_Setter.Statement_Setter
 from project.Errors import Unsupported_Database_Operation
 
 ## PRIVATE

So it seems the issue has something to do with imports.

Applying this patch and rebuiliding with buildEngineDistribution makes stuff compile. The test suite runs. It fails because I took a snapshot of my branch at a point where a test was failing. But the indication that stuff changed is that the tests actually get to run.

Once I revert this mentioned patch, and rebuild again with buildEngineDistribution, I again get the wall of text of 'not found' errors, as above.

@radeusgd
Copy link
Member Author

@jdunkerley @hubertp could you confirm if you can repro the issue using the steps I listed above?

It is very brittle so I want to check if I provided all necessary details. I manage to consistently reproduce it on my machine, but I'm not sure if that is enough.

@JaroslavTulach JaroslavTulach moved this from ❓New to 📤 Backlog in Issues Board Mar 28, 2023
@hubertp
Copy link
Collaborator

hubertp commented Mar 28, 2023

@radeusgd can't reproduce w/ or w/o caches using the provided instructions.

@hubertp
Copy link
Collaborator

hubertp commented Mar 28, 2023

Also, if I was to bet, I suspect it could have something to do with outdated caches of IRs/bindings.

@jdunkerley jdunkerley moved this from 📤 Backlog to ❓New in Issues Board Mar 28, 2023
@jdunkerley jdunkerley moved this from ❓New to 📤 Backlog in Issues Board Mar 28, 2023
@jdunkerley jdunkerley added this to the Design Partners milestone Mar 28, 2023
@hubertp
Copy link
Collaborator

hubertp commented Mar 28, 2023

I was eventually able to confirm. And yes, it seems to be cache-related. If there is an error when generating the local caches, like missing import, it seems to be silent. As a result, having a partial cache and an existing source code, leads to rather obscure error message.
First, investigating if we can report problems much quicker, when generating the index. Second, will need to see if we can somehow work with such half-broken caches and bindings.

hubertp added a commit that referenced this issue Mar 29, 2023
`--compile` command would run the compilation pipeline but silently
omit any encountered errors, thus skipping the serialization.
This maybe was a good idea in the past but it was problematic now that
we generate indexes on build time.
This resulted in rather obscure errors (#6092) for modules that were
missing their caches.

Making compilation more resilient to sudden cache misses is a separate
item.
hubertp added a commit that referenced this issue Mar 29, 2023
`--compile` command would run the compilation pipeline but silently
omit any encountered errors, thus skipping the serialization.
This maybe was a good idea in the past but it was problematic now that
we generate indexes on build time.
This resulted in rather obscure errors (#6092) for modules that were
missing their caches.

Making compilation more resilient to sudden cache misses is a separate
item.
hubertp added a commit that referenced this issue Mar 29, 2023
`--compile` command would run the compilation pipeline but silently
omit any encountered errors, thus skipping the serialization.
This maybe was a good idea in the past but it was problematic now that
we generate indexes on build time.
This resulted in rather obscure errors (#6092) for modules that were
missing their caches.

Making compilation more resilient to sudden cache misses is a separate
item.
hubertp added a commit that referenced this issue Mar 29, 2023
`--compile` command would run the compilation pipeline but silently
omit any encountered errors, thus skipping the serialization.
This maybe was a good idea in the past but it was problematic now that
we generate indexes on build time.
This resulted in rather obscure errors (#6092) for modules that were
missing their caches.

Making compilation more resilient to sudden cache misses is a separate
item.
@enso-bot
Copy link

enso-bot bot commented Mar 29, 2023

Hubert Plociniczak reports a new STANDUP for yesterday (2023-03-28):

Progress: More investigation into reported issues. Added more debug info 6099 in the absence of steps to reproduce. Struggled to reproduce 6092 but eventually got it. One problem is that we silently dropping errors during cache generation. The other is that we should be able to recover from caching issues. It should be finished by 2023-03-29.

Next Day: Next day I will be working on the #6092 task. Provide a workaround for reporting errors. Catch up on the final design of execution contexts.

@enso-bot
Copy link

enso-bot bot commented Mar 29, 2023

Hubert Plociniczak reports a new STANDUP for today (2023-03-29):

Progress: Added a workaround for reporting errors. Started to look into caches when dealing with broken caches. Filed 6135 as a follow up, since it will take a bit more time to get right and it is not the most pressing issue anymore. Meetings on execution contexts, scheduled tickets with follow up work. Started working on 6129 by replacing IOEnvironment with contexts. It should be finished by 2023-03-29.

Next Day: Next day I will be working on the #6129 task. Continue implementing the changes according to the design.

@hubertp hubertp moved this from 📤 Backlog to 👁️ Code review in Issues Board Mar 30, 2023
mergify bot pushed a commit that referenced this issue Mar 30, 2023
`--compile` command would run the compilation pipeline but silently omit any encountered errors, thus skipping the serialization. This maybe was a good idea in the past but it was problematic now that we generate indexes on build time.
This resulted in rather obscure errors (#6092) for modules that were missing their caches.

The change should significantly improve developers' experience when working on stdlib.

# Important Notes
Making compilation more resilient to sudden cache misses is a separate item to be worked on.
@hubertp hubertp moved this from 👁️ Code review to 🌟 Q/A review in Issues Board Mar 30, 2023
@github-project-automation github-project-automation bot moved this from 🌟 Q/A review to 🟢 Accepted in Issues Board Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
--bug Type: bug -compiler p-medium Should be completed in the next few sprints
Projects
Archived in project
Development

No branches or pull requests

4 participants