-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Update graphql.net to 4.6.1 #10782
Update graphql.net to 4.6.1 #10782
Conversation
can you merge dev on this, so that the tests run. also for infos here is the current pr to do this upgrade, with the outstanding work #9087 which maybe useful to see what has already been done, and is still needed to do |
yeah sadly actual work keeps getting the better of me so i haven't had chance to work on it much in ages. Theres def stuff in the other PR we should use though; as i changed a lot to work to how graphql.net 4 expects in terms of DI, Permissions, etc and it should be more performant (as it removes some locks etc). It would be good if we could maybe bring these 2 pr's together tho? take any of this which fixers outstanding issues in the other one ? @MikeKry |
Ups.. I do not know why I could not find this PR when I searched for any update tasks/tickets.. So far my PR is working, I have found some problems when including into existing project and fixed them. I can take a look at other PR and use some of it. @carlwoodhouse do you have anything specific in mind that you know should be changed? IDK if it would not be better to merge just an update so it would work with new versions of gatsby and then create tickets to update authorization etc. to new standards? |
i think this pr also resolves - Dynamic fields are broken & Custom validators for max results need re-implementing to new spec & Check GraphQLFieldNameAttribute from original PR |
yeah this is why its worth doing a comparision of the two (maybe target this at that branch as its on orchards github) and seeing where we are. My main concern is a lot changed around document execution, dataloaders and some other threadsafety stuff ... but its been a while since i looked at it ...; so while this may compile and work .... (you've done an awesome job btw) - we need to make sure we dont break all the weird race conditions we had to fix in the first place (a lot of which are fixed in the newer versions) |
@carlwoodhouse Thanks, I will take a look at it and compare what could be changed. I have done this using migration guides from 2->3 and 3->4 and used suggested solutions, so I hope it will be all OK, but it will definitely need someone who will check for know errors, as I test it only for errors that I know. @deanmarcussen Is it enough to merge dev into my branch and push? or should i create a PR against dev? So far I am fixing some minor errors in tests but soon it will be fixed. |
I mean a quick look through a lot is really similar; so you've done a great job (its no small thing which is why time has eluded me to finish the other PR heh); just think its worth bringing the two together so we get any optimizations etc from the other PR - and the unfinished stuff from here too. You seem to have done the DI wire-up somewhat different to me which i'd need to look at too. |
these days we have to merge main not dev i think @deanmarcussen :P |
your text field changes fix the dynamic content issue on the other PR :) |
yes merge main, not dev :) |
fix tests, remove services from graphqlcontext, fix where and orderby
… update-grahpqlnet-4.6.1
Ok, I have merged items that made sense for me to merge from other PR, tests ran successfully locally, and I merged main into this branch, so I hope it could be ok. |
If you’re ok with it; it might be an idea to target this pr at the
other branch ag/graphql4 rather then main so we can see if there is any other notable
differences. (That branch is in this repo rather then a fork so you should
be able to merge it down to your fork) Then we can use that branch for
further testing.
I agree we should aim to get that mergable asap and then optimise after;
but I want to do some testing around data loaders and concurrency before we
do.
…On Tue, 30 Nov 2021 at 18:33, MikeKry ***@***.***> wrote:
@deanmarcussen <https://github.com/deanmarcussen> @carlwoodhouse
<https://github.com/carlwoodhouse>
Ok, I have merged items that made sense for me to merge from other PR,
tests ran successfully locally, and I merged main into this branch, so I
hope it could be ok.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10782 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADRUEF3RI7VEF5MEKSIS5DUOUKHRANCNFSM5JCBLZKA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
As long as it's not ready it should stay in a branch. Move it to the Orchard Core repository if you want but don't merge it in the main branch if it's creating regressions that need to be fixed first. So, move it to a |
That’s what i said i think :p the ag:graphql4 branch is here ;)
…On Tue, 30 Nov 2021 at 19:16, Jasmin Savard ***@***.***> wrote:
As long as it's not ready it should stay in a branch. Move it to the
Orchard Core repository if you want but don't merge it in the main branch
if it's creating regressions that need to be fixed first. So, move it to a
graphql-4.6.1 branch in here. Then you may be able to compare the 2
branches locally.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10782 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADRUEHDGDJZ7VHTW3OOK53UOUPHRANCNFSM5JCBLZKA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Well, as long as it's not merged on top of the main branch yet. 😉 |
I am okay with that as long as it will help with getting done ASAP :) I would be thankful if it would get merged this week if possible, because it blocks for me two projects that are dependend on graphql.. and I am ready to assist with this if needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generally looks good, added a few comments and queries
src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/GraphQLMiddleware.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/GraphQLMiddleware.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/GraphQLMiddleware.cs
Outdated
Show resolved
Hide resolved
|
||
// changed in V4 | ||
var encodedBytes = _utf8Encoding.GetBytes(await _writer.WriteToStringAsync(result)); | ||
await context.Response.Body.WriteAsync(encodedBytes, 0, encodedBytes.Length); // documentWriter causes problems when querying _schema |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you elaborate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
documentWriter.WriteAsync throws error when grahpql tries to get schema
"System.InvalidOperationException: Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead."
I did not find the cause and using workaround with AllowSynchronousIO does not seem ok to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this does ring a bell ... is this an issue in the ag/graphql4 branch currently then ? i have no idea why i changed it .... yours looks closer to the original tbh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs more thoughts, will buffer all responses, and the big ones could be an issue in terms of perf. Maybe at least use an ArrayPool?
src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Extensions/DataLoaderExtensions.cs
Outdated
Show resolved
Hide resolved
...chardCore/OrchardCore.Apis.GraphQL.Abstractions/OrchardCore.Apis.GraphQL.Abstractions.csproj
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Extensions/FieldTypeExtensions.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/ContentItemsFieldType.cs
Show resolved
Hide resolved
I have found some problems with update, I will try to resolve them and then push along with resolved change request |
Fix where condition with nested objects, fix where conditions with AddScalarFilterFields
Pushed with fixes of nested where conditions and scalar filters => maybe there could be better solution, but this one ensures same functionality as we had before. There could be also unit test for nested where conditions. I will continue testing, maybe some more errors will comes up. |
Yeah I think there is def some missing unit tests .. feel free to add any
that cover scenarios you find issues with
…On Thu, 2 Dec 2021 at 14:15, MikeKry ***@***.***> wrote:
@carlwoodhouse <https://github.com/carlwoodhouse>
Pushed with fixes of nested where conditions and scalar filters => maybe
there could be better solution, but this one ensures same functionality as
we had before. There could be also unit test for nested where conditions.
I will continue testing, maybe some more errors will comes up.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10782 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADRUEFUXTFA2CFLIOG3TPLUO55QRANCNFSM5JCBLZKA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
@@ -26,14 +26,13 @@ public RequiresPermissionValidationRule(IAuthorizationService authorizationServi | |||
|
|||
public async Task<INodeVisitor> ValidateAsync(ValidationContext validationContext) | |||
{ | |||
var operationType = OperationType.Query; | |||
// shouldn't we access UserContext from validationcontext inside MatchingNodeVisitor actions? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably :)
Can I ask, is there anything waiting for me or can we move this forward? |
mostly thoughts on @sebastienros comment about the buffering of the response for the changes around the write and the negative performance implications .. |
Do you want me to look at it or you will do it yourself? |
If you could that would be great :) happy to feedback on it though.
…On Mon, 13 Dec 2021 at 14:09, MikeKry ***@***.***> wrote:
@carlwoodhouse <https://github.com/carlwoodhouse>
Do you want me to look at it or you will do it yourself?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10782 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADRUEFZHNUUTRA227GVOSDUQX5BRANCNFSM5JCBLZKA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
The problem with WriteAsync is in Serialize method in newtonsoft.json. which causes problems when writing directly into response. I see two variants in here: |
I have pushed the change so you can all look at it. I think it is indeed better than before - WriteToString calls internally WriteAsync, so we have 1 less method call and we do not hold another variable in memory |
src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/GraphQLMiddleware.cs
Outdated
Show resolved
Hide resolved
|
||
private async Task WriteAsync<T>(Stream stream2, T value, IDocumentWriter documentWriter, CancellationToken cancellationToken = default) | ||
{ | ||
// needs to be always async, otherwise __schema request is not working, direct write into response does not work as serialize is using sync method inside |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean that somewhere in our grapqhl code with have a call to a Serialize
method (NewtonSoft?) that is not async and this is triggered in IDocumentWriter.WriteaAsync
.
If buffering is required, maybe use a smaller reused buffer instead of a single one as big as the payload, and pool it too? Another option might be to use BufferedStream
between documentWriter
and context.Response.Body
.
…ware.cs Co-authored-by: Sébastien Ros <[email protected]>
…OrchardCore into update-grahpqlnet-4.6.1
await documentWriter.WriteAsync(stream, value); | ||
stream.Seek(0, SeekOrigin.Begin); | ||
await stream.CopyToAsync(stream2, cancellationToken); | ||
using (MemoryStream stream = new MemoryStream()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might use BufferedStream so not all the payload is serialized in memory.
Looks promising. What's left to do, and is it replacing the other PR that is meant to migrate to 4.x ? |
this one is targeted at that branch the other pr is in mate currently (that
branch is merged into this)
…On Thu, 16 Dec 2021 at 18:42, Sébastien Ros ***@***.***> wrote:
Looks promising. What's left to do, and is it replacing the other PR that
is meant to migrate to 4.x ?
—
Reply to this email directly, view it on GitHub
<#10782 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADRUEEFYTXLTD25WKK6DFDURIXKZANCNFSM5JCBLZKA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
In terms of what’s left .. could really do with testing the dataloaders are
still deferring execution ..
I think there’s many optimisations we can make around the dl’s as we can
probably remove the lockedresolver now you can use dataloaders with serial
execution … but those things can wait for a later pr.
|
I did not encounter any other problems after using it locally for month. |
I'm confused, what's the story with this, it's targetting the other branch Antoine and you were working on ? Can we merge it into there, so we can see review the two as one, and fix the stream buffering issue / look at what else is to do? |
yeah merge it to that branch and we can fix whats outstanding there
…On Wed, 5 Jan 2022 at 09:59, Dean Marcussen ***@***.***> wrote:
@carlwoodhouse <https://github.com/carlwoodhouse>
I'm confused, what's the story with this, it's targetting the other branch
Antoine and you were working on ?
Can we merge it into there, so we can see review the two as one, and fix
the stream buffering issue / look at what else is to do?
—
Reply to this email directly, view it on GitHub
<#10782 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADRUECQAOPJUIYIZZLYZVDUUQI77ANCNFSM5JCBLZKA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
and who can merge it? I can't.. |
merged to ##9087 |
Gatsby in version 3 and 4 is not working with current version of GraphQL in OrchardCore, so I have tried to update GraphQL.NET package.
I am currently testing it, so it does not break anything, right now it looks ok, but it definitely needs some more checking. I will be testing it further on existing projects.
It was quite a lot of work, so I decided to create a PR right away, so we can potentially merge it.
related to #10781
related also to #10760