Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Support
  3. GET GROUP truncated

GET GROUP truncated

Scheduled Pinned Locked Moved Solved Support
apigroups
19 Posts 3 Posters 1.7k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • nebulonN Offline
    nebulonN Offline
    nebulon
    Staff
    wrote on last edited by
    #5

    Since the UI is using the very same REST api, looks like something else in your stack is truncating the response then.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      darren
      wrote on last edited by
      #6

      I was wrong. The UI also has truncated group membership. Here's the console:
      image.png

      1 Reply Last reply
      0
      • girishG Offline
        girishG Offline
        girish
        Staff
        wrote on last edited by
        #7

        @darren try this on the server

        mysql -uroot -ppassword -e 'select count(*) from box.groupMembers WHERE groupId="gid-4802e498-4b29-4eec-bcee-57186b126aa4"'
        
        1 Reply Last reply
        0
        • D Offline
          D Offline
          darren
          wrote on last edited by
          #8

          +----------+
          | count(*) |
          +----------+
          | 6048 |
          +----------+

          1 Reply Last reply
          0
          • girishG Offline
            girishG Offline
            girish
            Staff
            wrote on last edited by
            #9

            @darren thanks. I wonder if the issue here is that we hit some packet limits . Did you already do a simple curl to check if the output is truncated or not? i.e a simple curl and not via another app, just to eliminate all other possible issues.

            1 Reply Last reply
            0
            • girishG Offline
              girishG Offline
              girish
              Staff
              wrote on last edited by
              #10

              @darren From a quick review of our code, it seems we don't use that API in the frontend. Only place is when you try to delete a group in the UI, the api is called to get the group count. So, if you click delete Group in the UI, do you see the correct count in the delete confirm dialog? Of course, don't follow through with the deletion (be careful!)

              1 Reply Last reply
              0
              • D Offline
                D Offline
                darren
                wrote on last edited by
                #11

                Yes it's truncated with a simple curl as well. What's weird is that the truncation also occurs within the response for the specific group at the /groups endpoint and not just the groups/:groupId endpoint.

                the deletion dialog has the understated member count:

                This group still has 1599 member(s). Are you sure this group is not used?

                1 Reply Last reply
                0
                • girishG Offline
                  girishG Offline
                  girish
                  Staff
                  wrote on last edited by girish
                  #12

                  @darren I think the issue is that we use GROUP_CONCAT and apparently this has a max length - https://dev.mysql.com/doc/refman/8.4/en/server-system-variables.html#sysvar_group_concat_max_len

                  Can you try editing /etc/mysql/mysql.cnf and adding group_concat_max_len=65536 (just something large) in the mysqld section ? After that systemctl restart mysql

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    darren
                    wrote on last edited by
                    #13

                    Unfortunately the response is the same so far after updating the config file and restarting mysql on the server. I am going to try set max_allowed_packet to a larger value as well.

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      darren
                      wrote on last edited by
                      #14

                      Hmm nm I looked at max_allowed_packet and presumably the default of 64MB is not constraining the response.

                      1 Reply Last reply
                      0
                      • girishG Offline
                        girishG Offline
                        girish
                        Staff
                        wrote on last edited by
                        #15

                        mmm, I was pretty sure it's the group concat.

                        You can try the mysql directly. mysql -uroot -ppassword box. and then (just replace the group id below),

                        mysql> SELECT id,name,source,GROUP_CONCAT(groupMembers.userId) AS userIds FROM userGroups LEFT OUTER JOIN groupMembers ON userGroups.id = groupMembers.groupId WHERE userGroups.id = 'gid-07e5c661-f43b-45b1-8dc0-8355ca3f05da' GROUP BY userGroups.id
                            -> ;
                        +------------------------------------------+--------+--------+-----------------------------------------------------------------------------------+
                        | id                                       | name   | source | userIds                                                                           |
                        +------------------------------------------+--------+--------+-----------------------------------------------------------------------------------+
                        | gid-07e5c661-f43b-45b1-8dc0-8355ca3f05da | people |        | uid-1b9e3dcd-d91d-462b-8dac-d13f01febb14,uid-ca8ccd80-6cd2-4221-9150-e0b2d69333f4 |
                        +------------------------------------------+--------+--------+-----------------------------------------------------------------------------------+
                        1 row in set (0.00 sec)
                        
                        
                        1 Reply Last reply
                        0
                        • D Offline
                          D Offline
                          darren
                          wrote on last edited by
                          #16

                          @girish Good news I was able to isolate a little more. It seems like 65536 bytes is the length at which the group_concat was actually being truncated. So setting group_concat_max_len = 65536 wasn't doing anything. But if I set that to a sufficiently higher value, e.g. group_concat_max_len = 4294967295, we can get the full group membership within mysql. I have not yet been able to get the full response from the API though.

                          mysql> SHOW VARIABLES LIKE '%group_concat%';+----------------------+------------+
                          | Variable_name        | Value      |
                          +----------------------+------------+
                          | group_concat_max_len | 4294967295 |
                          +----------------------+------------+
                          1 row in set (0.01 sec)
                          
                          mysql> SELECT length(GROUP_CONCAT(groupMembers.userId))-length(replace(GROUP_CONCAT(groupMembers.userId),',','')) AS userIds FROM userGroups LEFT OUTER JOIN groupMembers ON userGroups.id = groupMembers.groupId WHERE userGroups.id = 'gid-4802e498-4b29-4eec-bcee-57186b126aa4';
                          +---------+
                          | userIds |
                          +---------+
                          |    6047 |
                          +---------+
                          1 row in set (0.01 sec)
                          
                          1 Reply Last reply
                          0
                          • D Offline
                            D Offline
                            darren
                            wrote on last edited by
                            #17

                            Ah I think I've found it. You're setting group_concat_max_len = 65536 on line 66 of database.js.
                            Looks like this commit: https://git.cloudron.io/cloudron/box/-/commit/94a196bfa00ff689b0862fe797d64a917111a91d

                            1 Reply Last reply
                            0
                            • girishG Offline
                              girishG Offline
                              girish
                              Staff
                              wrote on last edited by
                              #18

                              @darren thanks! I have bumped the limit now. https://git.cloudron.io/cloudron/box/-/commit/34969d9980da38937f88201a01460109f04a60ac . Guess we have to make member pagination API at some point.

                              1 Reply Last reply
                              1
                              • girishG girish has marked this topic as solved on
                              • D Offline
                                D Offline
                                darren
                                wrote on last edited by
                                #19

                                Thank you!

                                1 Reply Last reply
                                0
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                • Login

                                • Don't have an account? Register

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Bookmarks
                                • Search