vala-language-server icon indicating copy to clipboard operation
vala-language-server copied to clipboard

Crash after autocompliting with posix profile and GLib

Open gavr123456789 opened this issue 4 years ago • 12 comments

Describe the bug Crash after autocompliting with posix profile

Software OS and version (e.g. Ubuntu 20.04): Arch Code editor (e.g. VSCode): VSCode Vala Language Server (e.g. git commit, or PPA/AUR version): master Vala version (valac --version): 0.50

To Reproduce Source code repo: any code with add_global_arguments('--profile=posix', language:'vala') in meson

Steps to reproduce the behavior:

  1. Open vala file after meson build --reconfigure command, first auto-complite mkdir worked, than crash.

Crash log(there was 2 of them) https://pastebin.com/fvHFW9Us

gavr123456789 avatar Feb 17 '21 20:02 gavr123456789

This part shows every time after open file
https://pastebin.com/JRYLADHJ

gavr123456789 avatar Feb 17 '21 20:02 gavr123456789

Hmm...seems to work for me:

% ls -lt
total 8
-rw-r--r-- 1 pferro pferro 105 Feb 17 16:00 thing.vala
-rw-r--r-- 1 pferro pferro 137 Feb 17 15:59 meson.build

meson.build:

project('test', 'vala', 'c')

add_global_arguments('--profile=posix', language: 'vala')

executable('thing',
  sources: ['thing.vala'])

thing.vala:

using Posix;

void main() {
    exit(EXIT_SUCCESS);
}

Prince781 avatar Feb 17 '21 21:02 Prince781

https://user-images.githubusercontent.com/30507409/108271739-50c97800-7182-11eb-863f-f1f871ac304a.mp4

Hmm, just recompiled from cloned master, it reproducible.

gavr123456789 avatar Feb 17 '21 21:02 gavr123456789

@gavr123456789 If you remove the [Compact]class Sas {} from your code does that now work?

Removing the GType runtime type system, like you're doing, is going to cause problems with any assumptions made by the type system.

Your code:

[Compact]
class Sas {
    public int a;
}

void func (Sas sas) {
}

void main () { 
}

can be compiled to C with:

valac --profile=posix test.vala --ccode

but the generated C code doesn't declare the Sas type, so the C compiler won't compile it. Compiling Vala code that doesn't target the GType system is still a work in progress.

astavale avatar Feb 20 '21 12:02 astavale

@gavr123456789 I do notice that I get these messages:

(vala-language-server:249867): vala-CRITICAL **: 14:51:38.065: vala_source_reference_to_string: assertion 'self != NULL' failed

But no crash. Do you have Vls: Fail on Criticals enabled?

Prince781 avatar Feb 20 '21 19:02 Prince781

I understand what the problem is!
I still had the glib packages enabled in meson.
In the video, you can see how 2k problems appear.
изображение So, if you have both dependency('glib-2.0'), and add_global_arguments('--profile=posix', language:'vala') then vls crashes.

gavr123456789 avatar Feb 26 '21 16:02 gavr123456789

So, if you have both dependency('glib-2.0'), and add_global_arguments('--profile=posix', language:'vala') then vls crashes.

Even with this change, I still can't reproduce this issue.

Prince781 avatar Feb 26 '21 19:02 Prince781

Hmm, now it doesnt crashes, but works really slow and non stop spawn this criticals and errors.
...
Found that, try with dependency ('gtk4', version: '>= 4.0.0'),

https://user-images.githubusercontent.com/30507409/109360957-1e61fe00-7899-11eb-95dc-6f61f2c7b48c.mp4

gavr123456789 avatar Feb 26 '21 22:02 gavr123456789

So then should I close this?

Prince781 avatar Feb 27 '21 00:02 Prince781

Isnt that still a problem? Can you reproduce it with gtk 4 dep?

gavr123456789 avatar Feb 27 '21 01:02 gavr123456789

Yeah, I've been able to reproduce this actually.

Prince781 avatar Apr 29 '21 21:04 Prince781

It honestly seems like this is an issue in upstream, as I'm getting errors deep in libvala. However this is also a very unusual configuration that's impractical (no one is going to use GLib with a Posix profile).

Prince781 avatar Jul 03 '21 15:07 Prince781