Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2022-03

JSON RPC on Mac M1 fails

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Hairy Pixels

I don’t know where to start debugging this yet but I found that compiling for the aarch64 target now breaks my Pascal language server which uses JSON RPC.

It breaks early on when sending the first message (initialize) which I register like this:

	JSONRPCHandlerManager.RegisterHandler('initialize', TInitialize);

And then the client returns back the message:

No class "initialize" with method "initialize" was found.

Which I assumed is from the JSON RPC layer.

Are there known bugs with the code on aarch64? Strangely the old x86_64 version does run but it failed trying to find some units in directories which were outside the project directory (no idea why this one thing broke). My only guess is maybe some ifdefs are broken for aarch64 since that’s something I came across in my own code.

Regards,
Ryan Joseph

Reply by email

Michael Van Canneyt
to Hairy Pixels
Hairy Pixels wrote 7 lines
I don’t know where to start debugging this yet but I found that compiling for the aarch64 target now breaks my Pascal language server which uses JSON RPC. It breaks early on when sending the first message (initialize) which I register like this: JSONRPCHandlerManager.RegisterHandler('initialize', TInitialize);

So you get an exception here ?

And then the client returns back the message: No class "initialize" with method "initialize" was found.

It's not normal that there is 2 times 'initialize' ?

The first should be a class name, and the second a method name.

Which I assumed is from the JSON RPC layer.

Yes.

If you updated from trunk:

I fixed some bugs in the JSONRPC mechanism.
Maybe you are now bumping into something that used to work by accident but which is now caught...

But then I would also barf at Hairy Pixels.

Michael.

Reply by email

Hairy Pixels
to Michael Van Canneyt
Show quoted text 7 lines
On Mar 9, 2022, at 10:48 PM, Michael Van Canneyt via fpc-pascal wrote: > It breaks early on when sending the first message (initialize) which I register like this: > > JSONRPCHandlerManager.RegisterHandler('initialize', TInitialize); So you get an exception here ?

No that’s fine it’s when the client (Sublime Text) returns with the error below.

Show quoted text 7 lines
> > And then the client returns back the message: > > No class "initialize" with method "initialize" was found. It's not normal that there is 2 times 'initialize' ?

So the class should be TInitialize right? That’s the class I registered so it makes sense it couldn’t find it if it thinks it’s called “initialize”.

I fixed some bugs in the JSONRPC mechanism. Maybe you are now bumping into something that used to work by accident but which is now caught…

I’m building from 3.2.2 sources and I rebuilt for x86 (which runs on the M1 also) and the bug goes away so there’s something about this particular architecture.

Are there any tests I could run to try to figure this out? I’m not very familiar with the JSON RPC library except that I extended an already existing implementation.

Regards,
Ryan Joseph

Reply by email

Michael Van Canneyt
to Hairy Pixels
Hairy Pixels wrote 20 lines
> On Mar 9, 2022, at 10:48 PM, Michael Van Canneyt via fpc-pascal wrote: > >> It breaks early on when sending the first message (initialize) which I register like this: >> >> JSONRPCHandlerManager.RegisterHandler('initialize', TInitialize); > > So you get an exception here ? No that’s fine it’s when the client (Sublime Text) returns with the error below. > >> >> And then the client returns back the message: >> >> No class "initialize" with method "initialize" was found. > > It's not normal that there is 2 times 'initialize' ? So the class should be TInitialize right? That’s the class I registered so it makes sense it couldn’t find it if it thinks it’s called “initialize”.

No, initialize is correct for the class name, you registered the handler with that name. I don't know what the method name is.

Show quoted text 8 lines
> I fixed some bugs in the JSONRPC mechanism. > Maybe you are now bumping into something that used to work by accident but > which is now caught… I’m building from 3.2.2 sources and I rebuilt for x86 (which runs on the M1 also) and the bug goes away so there’s something about this particular architecture.

Barring an uninitialized variable, this seems to rule out an error in JSON-RPC itself. There is nothing architecture-specific about the code.

Are there any tests I could run to try to figure this out? I’m not very familiar with the JSON RPC library except that I extended an already existing implementation.

The only way is to debug your server, see where it goes wrong.

Michael.

Reply by email