Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Ranger usersync fails with returned a response status of 400 Bad Request

avatar
Contributor

Usersync finds correclty users from given user seachfilter string, but fails with update with bad request 400

----grep

01 Sep 2016 13:46:04 INFO LdapUserGroupBuilder [UnixUserSyncThread] - Updating user count: 13, userName: user1, groupList: [group1, group2]

01 Sep 2016 13:46:04 INFO LdapUserGroupBuilder [UnixUserSyncThread] - LDAPUserGroupBuilder.updateSink() completed with user count: 13

01 Sep 2016 13:46:04 ERROR LdapUserGroupBuilder [UnixUserSyncThread] - sink.addOrUpdateUser failed with exception: POST http://server1:6080/service/users/default returned a response status of 400 Bad Request, for user: user1, groups: [group1, group2]

----grep

why it uses URL (API I guess) http://server1:6080/service/users/default which gives bad request 400 ?

Ranger 0.5.0.2.4

1 ACCEPTED SOLUTION

avatar

can you please provide the more error details from the logs and please check xa_portal.log also , there also you must see some error reg. why 400 ERROR was thrown

View solution in original post

5 REPLIES 5

avatar

can you please provide the more error details from the logs and please check xa_portal.log also , there also you must see some error reg. why 400 ERROR was thrown

avatar
Contributor

avatar
Contributor

looking errors in xa-portal.log, there is error Please make sure while create/update given userId should be of x_user

I tried delete users from ranger database (through rest api) delete operation hung. I canceled.

Seems that database left some weird status, where some data weren't deleted

Now updating again userdata from LDAP, some user groups failing to update, because some old id-s still exists in database.

Deleting wrongly syncronized data from ranger is very essential function, which today is not there!

avatar
Contributor

This issue has been fixed in RANGER 0.6. Please refer RANGER-1041 for the fix details.

avatar
Expert Contributor

This issue is usually seen when user wan't removed properly from Ranger db and some information is still available in user tables.


For example in above situation it might be possible that 'user1' is not available in x_user table but its still part of other user tables such as x_portal_user, x_portal_user_role, x_user_module_perm, x_auth_sess etc.


Perform below steps to resolve this issue.

Verify whether problematic user is available in other tables

MariaDB [ranger]> select * from x_user where user_name = 'user1';
MariaDB [ranger]> select id from x_portal_user where login_id = 'user1'; 
+----+
| id |
+----+
| 44 |
+----+

MariaDB [ranger]> delete from x_portal_user_role where id = 44; 
MariaDB [ranger]> delete from x_user_module_perm where user_id = 44;
MariaDB [ranger]> delete from x_auth_sess where user_id = 44;
MariaDB [ranger]> delete from x_portal_user where id = 44; 


To get all such user's

MariaDB [ranger]>  select * from x_portal_user_role where id not in (select id from x_user);
MariaDB [ranger]>  select * from x_user_module_perm where user_id not in (select id from x_user);
MariaDB [ranger]>  select * from x_auth_sess where user_id not in (select id from x_user);
MariaDB [ranger]>  select * from x_portal_user where id not in (select id from x_user);


Remove users which are not part of x_user table but available in other tables

MariaDB [ranger]>  delete from x_portal_user_role where id not in (select id from x_user); 
MariaDB [ranger]>  delete from x_user_module_perm where user_id not in (select id from x_user); 
MariaDB [ranger]>  delete from x_auth_sess where user_id not in (select id from x_user); 
MariaDB [ranger]>  delete from x_portal_user where id not in (select id from x_user); 


Restart usersync process