Upgrading from 4.2.6 to 4.3.1 gives me an NullPointerException on RolestoGrantsMigration

I upgraded from 4.2.6 to 4.3.1, and now i get an NPE on start. I get a bunch of messages about the RolesToGrantsMigration for each stream & user combo, and then it hard fails. Ideas?

2022-06-02T20:51:59.972Z INFO  [RolesToGrantsMigration] Migrating entity <grn::::stream:5c354dba79728d3d0193d92d> permissions <[streams:read]> to <VIEW> grant for user <username_removed>
2022-06-02T20:51:59.974Z INFO  [RolesToGrantsMigration] Migrating entity <grn::::stream:5c354dba79728d3d0193d92d> permissions <[streams:read]> to <VIEW> grant for user <username_removed>
2022-06-02T20:51:59.975Z ERROR [ConfigurationManagementPeriodical] Error while running migration <GrantsMetaMigration{2020-08-03T12:08:00Z}>
java.lang.NullPointerException: null
	at org.graylog2.migrations.V20200803120800_GrantsMigrations.RolesToGrantsMigration.lambda$migrateRoleToGrant$1(RolesToGrantsMigration.java:100) ~[graylog.jar:?]
	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
	at org.graylog2.migrations.V20200803120800_GrantsMigrations.RolesToGrantsMigration.lambda$migrateRoleToGrant$3(RolesToGrantsMigration.java:99) ~[graylog.jar:?]
	at java.util.HashMap.forEach(HashMap.java:1337) ~[?:?]
	at org.graylog2.migrations.V20200803120800_GrantsMigrations.RolesToGrantsMigration.migrateRoleToGrant(RolesToGrantsMigration.java:92) ~[graylog.jar:?]
	at org.graylog2.migrations.V20200803120800_GrantsMigrations.RolesToGrantsMigration.lambda$upgrade$0(RolesToGrantsMigration.java:68) ~[graylog.jar:?]
	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
	at org.graylog2.migrations.V20200803120800_GrantsMigrations.RolesToGrantsMigration.upgrade(RolesToGrantsMigration.java:65) ~[graylog.jar:?]
	at org.graylog2.migrations.V20200803120800_GrantsMigrations.GrantsMetaMigration.upgrade(GrantsMetaMigration.java:112) ~[graylog.jar:?]
	at org.graylog2.periodical.ConfigurationManagementPeriodical.doRun(ConfigurationManagementPeriodical.java:42) [graylog.jar:?]
	at org.graylog2.plugin.periodical.Periodical.run(Periodical.java:77) [graylog.jar:?]
	at java.lang.Thread.run(Thread.java:829) [?:?]

okay, this seems to be an issue with my mongo? there’s something in a role’s permissions set that’s causing it to NPE…

Okay: I think I figured this out.

There were some streams, views, and other things that didn’t exist that were referenced in the permissions role that didn’t exist. So I went through each one in the UI to make sure it exists:

{
    "_id" : ObjectId("588b96ebb8c80650fbfedb78"),
    "name" : "Devs",
    "permissions" : [
    "streams:read:5966284288556d64b2263a2d",
    "streams:read:588b9810b8c80650fbfedceb",
    "streams:read:5d174b75379e562d7d50afaa",
    "streams:read:59319ffb5bbb195f4922d561",
    "streams:read:58eb9c8488556d16ca64514d",
    "streams:read:58eb9c2688556d16ca6450e5",
    "streams:read:5f68e60885b504028308d189",
    "streams:read:5a53a058b9dd1b63275d10e6",
    "streams:read:591355a0b9dd1b536a2a0fda",
    "streams:read:5ad9e9bf88556d75301df0a3",
    "streams:read:5911c8bab9dd1b536a2882c7",
    "streams:read:5b2ac051db1f0a17286f3608",
    "streams:read:5af1f9c1b9dd1b0701e04453",
    "streams:read:588b9810b8c80650fbfedce8",
    "streams:read:58f773d1b9dd1b4dcae9adb9",
    "streams:read:5c354dba79728d3d0193d92d"
    "dashboards:edit:5a1d84e65bbb1960bc52e43d",
    "dashboards:read:5a1d84e65bbb1960bc52e43d",
    "dashboards:read:5af448a3b9dd1b0701e29626",
    "dashboards:read:5cf7bbbb379e56488a1d1bc7",
    "dashboards:edit:5af448a3b9dd1b0701e29626",
    "dashboards:read:5ddd7f0c379e56203cae81c3"
  ],
	"description" : "You know, for Devs",
	"read_only" : false,
	"name_lower" : "devs"
}

I did get the migration to finish by pulling all but one of them, and the leader started.

However, it seems like I may have to write a bunch of inserts to get the other non-migrated ones there, unless there’s some way I can re-run a migration. Kinda surprised this didn’t happen earlier given the date on the migration code, but…

1 Like

Hello,

Thanks for posting issue.

I’m not sure, to be honest , this is the first I have hear of it.
By chance have you tried GitHub?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.