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

Core dumps with neovim under certain conditions #34

Closed
mikehaertl opened this issue Jun 4, 2022 · 10 comments · Fixed by #37 or #39
Closed

Core dumps with neovim under certain conditions #34

mikehaertl opened this issue Jun 4, 2022 · 10 comments · Fixed by #37 or #39

Comments

@mikehaertl
Copy link

This issue was initially reported to neovim-treesitter here: nvim-treesitter/nvim-treesitter#2979. But the stack trace seems to point to an issue with the parser so re-reporting it here.

Describe the bug

When I edit prisma files neovim sometimes crashes with a core dump.

To Reproduce

  1. Edit a prisma file (see below for my example)
  2. Yank line 24 ( id Int @id @default(autoincrement()) in the User model)
  3. Paste the line at the end of the file
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

datasource db {
  provider = "sqlite"
  url      = "file:./dev.db"
}

generator client {
  provider = "prisma-client-js"
}

model Link {
  id          Int       @id @default(autoincrement())
  createdAt   DateTime  @default(now())
  description String
  url         String
  postedBy    User?     @relation(fields: [postedById], references: [id])
  postedById  Int?
  votes       Vote[]
}

model User {
  id          Int       @id @default(autoincrement())
  name        String
  email       String    @unique
  password    String
  links       Link[]
  votes       Vote[]
}
@victorhqc
Copy link
Owner

Hello! Thank you for reporting the issue. I'll take a look, looks like some issue in the parser.

@mikehaertl
Copy link
Author

Thanks. Can you somehow reproduce the issue? I found that it already happens for the simplest example like this:

model User {
  id  Int  @id
}

When I copy the middle line and paste it at the end it crashes.

@victorhqc
Copy link
Owner

Thanks, that's definitely something easier to work with.

@victorhqc
Copy link
Owner

Hey @mikehaertl the issue should be resolved, I was able to reproduce something similar locally, not a core_dump, but I did hang infinitely. The latest release (1.2.2) should fix the problem.

Let me know if you find something else! Thanks again for reporting.

@ghost
Copy link

ghost commented Jun 10, 2022

I don't think that it was fixed. I was trying to reproduce this in helix-editor/helix#2703 too, but even with master branch there is still segmentation fault.

@mikehaertl
Copy link
Author

@victorhqc I just tried and could not reproduce the issue anymore, thanks.

@seshotake Can you give an example that causes issues? Then I can try to reproduce it with neovim.

@mikehaertl
Copy link
Author

@victorhqc Sorry, I was too quick. The example code from the comment above now works.

But then I tried wie a slightly more complex example and got a segmentation fault again. I found that I don't even have to copy anything:

model User {
  id          Int       @id @default(autoincrement())
}
  id          Int       @id @default(autoincrement())

If I paste this into a file (with another editor) and try to open it with neovim it immediately crashes.

@victorhqc
Copy link
Owner

Aha, then there are probably more reasons for it, thanks! I'll take a look.

@victorhqc
Copy link
Owner

@mikehaertl can you check again with this branch? Maybe with some other cases could still happen, but I'm not sure.

@mikehaertl
Copy link
Author

Looks better now. I played around a bit and had no crashes so far. Thank you.

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