Skip to content
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

Use authProvider instead of static jwt string in the SyncServiceImpl #141

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

benedekh
Copy link
Member

@benedekh benedekh commented Jul 24, 2024

Bug: if we test this branch with the courses example from modelix.samples on a model server where JWT auth is enabled, and we set the JWT token in the plugin's UI, (and start the upload process), then the whole model server will be paralized and the upload process is aborted due to timeout in the background.

However, from the sync plugin's perspective everything seems to be fine, because the Bindings got activated.

It's because the ModelClientV2 syncs the data on a different Coroutine than where the MPS to modelix transformation tasks are running, and that Coroutine finishes/aborts in the background with these exceptions:

2024-10-15 07:54:41,905 [ 142082]   INFO -                         STDOUT - 07:54:41.903 [DefaultDispatcher-worker-18] INFO  o.modelix.mps.sync.SyncServiceImpl - Connecting to branch branch_testrepo_main with initial version null (null = latest version). 
2024-10-15 07:54:42,761 [ 142938]   INFO -                         STDOUT - 07:54:42.760 [DefaultDispatcher-worker-18] INFO  o.modelix.mps.sync.SyncServiceImpl - Connected to branch branch_testrepo_main with initial version null 
2024-10-15 07:54:42,761 [ 142938]   INFO -                         STDOUT - 07:54:42.761 [DefaultDispatcher-worker-3] INFO  o.m.mps.sync.plugin.ModelSyncService - Connected to branch: branch_testrepo_main 
2024-10-15 07:54:46,713 [ 146890]   INFO -                         STDOUT - 07:54:46.712 [AWT-EventQueue-0] INFO  o.modelix.mps.sync.SyncServiceImpl - Binding Module 'University.Schedule.modelserver.backend.sandbox' to the server. 
2024-10-15 07:54:47,099 [ 147276]   INFO -                         STDOUT - 07:54:47.099 [AWT-EventQueue-0] INFO  o.modelix.mps.sync.SyncServiceImpl - Module- and Model Bindings for Module 'University.Schedule.modelserver.backend.sandbox' are created. 
2024-10-15 07:54:47,160 [ 147337]   INFO -                         STDOUT - 07:54:47.159 [AWT-EventQueue-0] INFO  o.m.mps.sync.bindings.ModelBinding - Binding of Model 'University.Schedule.modelserver.backend.sandbox' is activated. 
2024-10-15 07:54:47,206 [ 147383]   INFO -                         STDOUT - 07:54:47.206 [AWT-EventQueue-0] INFO  o.m.mps.sync.bindings.ModuleBinding - Binding of Module 'University.Schedule.modelserver.backend.sandbox' is activated. 
2024-10-15 07:54:47,255 [ 147432]   INFO -                         STDOUT - 07:54:47.254 [AWT-EventQueue-0] INFO  o.m.mps.sync.bindings.ModelBinding - Binding of Model 'A.M2' is activated. 
2024-10-15 07:54:47,297 [ 147474]   INFO -                         STDOUT - 07:54:47.296 [AWT-EventQueue-0] INFO  o.m.mps.sync.bindings.ModelBinding - Binding of Model 'A.M3' is activated. 
2024-10-15 07:54:47,337 [ 147514]   INFO -                         STDOUT - 07:54:47.337 [AWT-EventQueue-0] INFO  o.m.mps.sync.bindings.ModelBinding - Binding of Model 'A.M1' is activated. 
2024-10-15 07:54:47,375 [ 147552]   INFO -                         STDOUT - 07:54:47.375 [AWT-EventQueue-0] INFO  o.m.mps.sync.bindings.ModuleBinding - Binding of Module 'A' is activated. 
2024-10-15 07:54:47,409 [ 147586]   INFO -                         STDOUT - 07:54:47.409 [AWT-EventQueue-0] INFO  o.m.mps.sync.bindings.ModelBinding - Binding of Model 'B.N2' is activated. 
2024-10-15 07:54:47,446 [ 147623]   INFO -                         STDOUT - 07:54:47.446 [AWT-EventQueue-0] INFO  o.m.mps.sync.bindings.ModelBinding - Binding of Model 'B.N1' is activated. 
2024-10-15 07:54:47,470 [ 147647]   INFO -                         STDOUT - 07:54:47.469 [AWT-EventQueue-0] INFO  o.m.mps.sync.bindings.ModuleBinding - Binding of Module 'B' is activated. 
2024-10-15 07:54:59,156 [ 159333]   INFO - #com.intellij.ide.actions.RevealFileAction - Exit code 1 
2024-10-15 07:54:59,486 [ 159663]   INFO - jetbrains.mps.smodel.MPSModuleRepository - Saving of the repository took 0.001 s 
2024-10-15 07:55:17,117 [ 177294]  ERROR - #com.intellij.ide.plugins.PluginManager - Request timeout has expired [url=http://127.0.0.1:28101/v2/repositories/testrepo/branches/main, request_timeout=30000 ms] 
io.ktor.client.plugins.HttpRequestTimeoutException: Request timeout has expired [url=http://127.0.0.1:28101/v2/repositories/testrepo/branches/main, request_timeout=30000 ms]
	at io.ktor.client.plugins.HttpTimeout$Plugin$install$1$1$killer$1.invokeSuspend(HttpTimeout.kt:165)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:113)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:589)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:823)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:720)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:707)
	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@2e98e6cd, Dispatchers.IO]
2024-10-15 07:55:17,117 [ 177294]  ERROR - #com.intellij.ide.plugins.PluginManager - Request timeout has expired [url=http://127.0.0.1:28101/v2/repositories/testrepo/branches/main, request_timeout=30000 ms] 
io.ktor.client.plugins.HttpRequestTimeoutException: Request timeout has expired [url=http://127.0.0.1:28101/v2/repositories/testrepo/branches/main, request_timeout=30000 ms]
	at io.ktor.client.plugins.HttpTimeout$Plugin$install$1$1$killer$1.invokeSuspend(HttpTimeout.kt:165)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:113)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:589)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:823)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:720)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:707)
	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@4778574c, Dispatchers.IO]
2024-10-15 07:55:17,117 [ 177294]  ERROR - #com.intellij.ide.plugins.PluginManager - Request timeout has expired [url=http://127.0.0.1:28101/v2/repositories/testrepo/branches/main, request_timeout=30000 ms] 
io.ktor.client.plugins.HttpRequestTimeoutException: Request timeout has expired [url=http://127.0.0.1:28101/v2/repositories/testrepo/branches/main, request_timeout=30000 ms]
	at io.ktor.client.plugins.HttpTimeout$Plugin$install$1$1$killer$1.invokeSuspend(HttpTimeout.kt:165)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:113)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:589)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:823)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:720)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:707)
	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@7e421560, Dispatchers.IO]
2024-10-15 07:55:17,117 [ 177294]  ERROR - #com.intellij.ide.plugins.PluginManager - Request timeout has expired [url=http://127.0.0.1:28101/v2/repositories/testrepo/branches/main, request_timeout=30000 ms] 
io.ktor.client.plugins.HttpRequestTimeoutException: Request timeout has expired [url=http://127.0.0.1:28101/v2/repositories/testrepo/branches/main, request_timeout=30000 ms]
	at io.ktor.client.plugins.HttpTimeout$Plugin$install$1$1$killer$1.invokeSuspend(HttpTimeout.kt:165)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:113)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:589)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:823)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:720)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:707)
	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@6cff94ec, Dispatchers.IO]
2024-10-15 07:55:17,123 [ 177300]  ERROR - #com.intellij.ide.plugins.PluginManager - JetBrains MPS 2020.3.6  Build #MPS-203.8084.3437 
2024-10-15 07:55:17,117 [ 177294]  ERROR - #com.intellij.ide.plugins.PluginManager - Request timeout has expired [url=http://127.0.0.1:28101/v2/repositories/testrepo/branches/main, request_timeout=30000 ms] 
io.ktor.client.plugins.HttpRequestTimeoutException: Request timeout has expired [url=http://127.0.0.1:28101/v2/repositories/testrepo/branches/main, request_timeout=30000 ms]
	at io.ktor.client.plugins.HttpTimeout$Plugin$install$1$1$killer$1.invokeSuspend(HttpTimeout.kt:165)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:113)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:589)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:823)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:720)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:707)
	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@51cfee69, Dispatchers.IO]

@benedekh benedekh self-assigned this Jul 24, 2024
@benedekh benedekh changed the title refactor(mps-sync-plugin): use authProvider instead of static jwt string in the SyncServiceImpl Use authProvider instead of static jwt string in the SyncServiceImpl Oct 15, 2024
@benedekh benedekh force-pushed the fix/auth-provider-instead-of-jwt-token branch from 4f70c8d to 0c4e732 Compare October 15, 2024 06:11
@benedekh benedekh force-pushed the fix/auth-provider-instead-of-jwt-token branch from 0c4e732 to 35d926b Compare October 15, 2024 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant