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

Startup failure "s32 field doesn't match size: expected 4, actual 8" with PostgreSQL #4050

Closed
whitslack opened this issue Sep 15, 2020 · 2 comments · Fixed by #4064
Closed
Assignees
Milestone

Comments

@whitslack
Copy link
Collaborator

Issue and Steps to Reproduce

Attempting to start C-Lightning 0.9.1 using the PostgreSQL backend results in the following fatal error:

s32 field doesn't match size: expected 4, actual 8

Tracing with GDB reveals that this message is coming from the new fillin_missing_channel_id function at line 1256.

The channels.id column is of type BIGSERIAL (i.e., BIGINT), but the db_postgres_column_int function enforces that the column width is 4 bytes. This obviously fails.

Workaround

  1. Change the channels.id column type to INTEGER.
    ALTER TABLE channels ALTER COLUMN id TYPE INTEGER;
    
  2. Start lightningd so that the database upgrade can occur. The process will eventually fail to start with the following fatal error:
    u64 field doesn't match size: expected 8, actual 4
    
  3. Change the channels.id column type back to BIGINT.
    ALTER TABLE channels ALTER COLUMN id TYPE BIGINT;
    
  4. Start lightningd as normal.
whitslack referenced this issue Sep 16, 2020
v2 channel open uses a different method to derive the channel_id, so now
we save it to the database so that we dont have to remember how to
derive it for each.

includes a migration for existing channels
@martinbehrens
Copy link

Able to replicate with v0.9.0 and v0.9.1 exactly as described. Workaround works as well, thanks @whitslack

@gabridome
Copy link
Contributor

gabridome commented Sep 16, 2020

Nope. The workaround didn't work for me.
I have tried with 0.9.1.
I have executed point 1., point 2., obtained the same message, executed point 3. but, when I restart lightningd, I always have

s32 field doesn't match size: expected 4, actual 8 .

I also made a git pull to the last commit on master but the result is the same.

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

Successfully merging a pull request may close this issue.

5 participants