SimpleIdServer icon indicating copy to clipboard operation
SimpleIdServer copied to clipboard

[SCIM] Get group error "Size must be between 0 and 16793600(16MB)"

Open gabrielemilan opened this issue 6 months ago • 5 comments

Hello guys,

we have this issue when the group has thousands of users inside:

Groups?filter=displayName+eq+"GLOBAL-READ"

The error is: { "schemas": [ "urn:ietf:params:scim:api:messages:2.0:Error" ], "status": "500", "scimType": "internalServerError", "detail": "Command aggregate failed: PlanExecutor error during aggregation :: caused by :: BSONObj size: 76105902 (0x48948AE) is invalid. Size must be between 0 and 16793600(16MB) First element: Representation: { _id: "876c7a69-d1be-4e05-aa65-d8406f0bda79", _t: [ "SCIMRepresentation", "SCIMRepresentationModel" ], ExternalId: null, ResourceType: "Group", Version: 6731, DisplayName: "GLOBAL-READ", RealmName: "", Created: new Date(1752069237447), LastModified: new Date(1753778133279), SchemaRefs: [ { $ref: "scimSchemas", $id: "urn:ietf:params:scim:schemas:core:2.0:Group" } ], AttributeRefs: null }." }

This Group has around 20,000 members.

Can you please check?

Regards. Gabriele

gabrielemilan avatar Jul 30 '25 07:07 gabrielemilan

Hello,

There is indeed an issue in the FindSCIMRepresentations function in the SCIMRepresentationQueryRepository class. When a group contains a large number of attributes, the following query throws an exception. The LINQ query is translated into a MongoDB aggregate command, and the resulting data size exceeds 16 MB.

var filteredRepresentationsWithAttributes = from a in filteredRepresentations
                                            join b in _scimDbContext.SCIMRepresentationAttributeLst.AsQueryable() on a.Id equals b.RepresentationId into Attributes
                                            select new
                                            {
                                                Representation = a,
                                                Attributes = Attributes
                                            };
											

This issue should be fixed in the release/v6.0.4 branch. Could you please try again and confirm?

KR,

SID

simpleidserver avatar Aug 09 '25 19:08 simpleidserver

hello @simpleidserver we have another issue related to the same problem. We have about 20k users in the same group, the get it takes more than 13 minutes:

Image

gabrielemilan avatar Nov 05 '25 12:11 gabrielemilan

Hello,

We’ve made some changes in the master branch, and the performance issue has been significantly improved. For a group with 10,300 users, execution time has dropped from 36 seconds to 500 ms after the modifications.

Could you please fetch the latest master branch and try again?

simpleidserver avatar Nov 05 '25 22:11 simpleidserver

I tried again and it takes about 1min, is better but...

Image

gabrielemilan avatar Nov 06 '25 10:11 gabrielemilan

Even with 15,000 members in the group, the operation executes in 500 ms on my local machine using MongoDB. Without additional information, we can’t help you further with this issue.

simpleidserver avatar Nov 07 '25 13:11 simpleidserver