Plugin encountered an exception when compiling during logon  Topic is solved

Discussions relating to the REST API of Jiwa 7.

Plugin encountered an exception when compiling during logon

Postby Joe.Thorpe » Wed Sep 07, 2022 5:53 pm

Plugin encountered an exception when compiling during logon

Hi,

I'm getting these errors on my Production API server, it seems to happen within a few hours to a day of when these plugins are modified. It's not specific to any one plugin. I've seen at least three give this error.

Plugin 'plugin name' encountered an exception when compiling or loading during logon. Exception Message: 'System.IO.IOException: The process cannot access the file 'pluginname.dll' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at Microsoft.VisualBasic.FileIO.FileSystem.CopyOrMoveFile(CopyOrMove operation, String sourceFileName, String destinationFileName, Boolean overwrite, UIOptionInternal showUI, UICancelOption onUserCancel)
at Microsoft.VisualBasic.MyServices.FileSystemProxy.CopyFile(String sourceFileName, String destinationFileName, Boolean overwrite)
at JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin.LoadAssembly()
at JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin.Load()
at JiwaFinancials.Jiwa.JiwaApplication.Plugin.PluginCollection.()
at JiwaFinancials.Jiwa.JiwaApplication.StartupLog.Add(String Description, Action CallbackMethod)
at JiwaFinancials.Jiwa.JiwaApplication.Plugin.PluginCollection.Compile()

It's causing errors like "Custom field with Setting Name 'OpportunityID' not found" when making requests to our API, i'm guessing, because the plugin containing that custom field isn't compiling.
But it could be session based, because I made a request from a different device (with different user & token, and a SalesQuoteGETRequest instead of SalesQuotePOSTRequest) and it returned the Quote entity including the OpportunityID custom field. Therefore the custom field plugin was working for that session.

If i restart the API service the problem goes away.

This reminds me of https://service.jiwa.com.au/servicedesk ... /JIWA-9388 that we've reported, but have been unable to reliably reproduce. In that issue, the problem was always fixed by restarting the API, was difficult to reproduce, and behaviour could vary based on user/token.


Do you have any ideas what I could do to troubleshoot?


We're running JIWA SR12 7.2.1
REST API 7.2.1.23
API Server is using the self hosted service behind reverse proxy.
Joe.Thorpe
Occasional Contributor
Occasional Contributor
 
Posts: 19
Joined: Fri Jun 11, 2021 1:57 pm

Re: Plugin encountered an exception when compiling during lo

Postby Scott.Pearce » Wed Sep 07, 2022 5:55 pm

Is the API service configured to log in with it's own unique Jiwa username?
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Plugin encountered an exception when compiling during lo

Postby Joe.Thorpe » Wed Sep 07, 2022 5:57 pm

Scott.Pearce wrote:Is the API service configured to log in with it's own unique Jiwa username?

Hi Scott,

The API Server is using the same user as the clients calling the API. Is that ok?
Joe.Thorpe
Occasional Contributor
Occasional Contributor
 
Posts: 19
Joined: Fri Jun 11, 2021 1:57 pm

Re: Plugin encountered an exception when compiling during lo  Topic is solved

Postby Mike.Sheen » Wed Sep 07, 2022 6:05 pm

Joe.Thorpe wrote:The API Server is using the same user as the clients calling the API. Is that ok?


That's ok, provided the API is using a different windows account to anyone logging in to the same machine and logging into Jiwa with the same username.

We build a path based on Jiwa version, SQL Server name, Jiwa database name, Windows user name and Jiwa user name - and the conflict you are seeing suggests all of these things are the same for the API - AS WELL AS - another Jiwa process or instance.

You should also set the Exception Policy to Abort, so that if there a problem, it doesn't proceed so that you can't having missing custom fields.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Plugin encountered an exception when compiling during lo

Postby Joe.Thorpe » Wed Sep 07, 2022 6:15 pm

Mike.Sheen wrote:
Joe.Thorpe wrote:The API Server is using the same user as the clients calling the API. Is that ok?


That's ok, provided the API is using a different windows account to anyone logging in to the same machine and logging into Jiwa with the same username.

We build a path based on Jiwa version, SQL Server name, Jiwa database name, Windows user name and Jiwa user name - and the conflict you are seeing suggests all of these things are the same for the API - AS WELL AS - another Jiwa process or instance.

You should also set the Exception Policy to Abort, so that if there a problem, it doesn't proceed so that you can't having missing custom fields.


Here's an example path that gave the error 'System.IO.IOException: The process cannot access the file': C:\ProgramData\Jiwa Financials\Jiwa 7\7.2.1\SYSTEM\x.x.x.x\SHAccsV7\Plugins\API\Runtime\Tie Insurance to Primary Web Order\Tie Insurance to Primary Web Order.dll'

The only enabled and running JIWA service is the Self Hosted API, and the service is set to logon as the Local system account.
No one besides me can access the API server, and if i ever login to the JIWA client on that server, i use my own user.

I'll change the exception policy, cheers!
Joe.Thorpe
Occasional Contributor
Occasional Contributor
 
Posts: 19
Joined: Fri Jun 11, 2021 1:57 pm

Re: Plugin encountered an exception when compiling during lo

Postby Mike.Sheen » Wed Sep 07, 2022 6:18 pm

Joe.Thorpe wrote:Here's an example path that gave the error 'System.IO.IOException: The process cannot access the file': C:\ProgramData\Jiwa Financials\Jiwa 7\7.2.1\SYSTEM\x.x.x.x\SHAccsV7\Plugins\API\Runtime\Tie Insurance to Primary Web Order\Tie Insurance to Primary Web Order.dll'


You should try to find out what the other process is that has the file open.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Plugin encountered an exception when compiling during lo

Postby Joe.Thorpe » Wed Sep 07, 2022 6:20 pm

Mike.Sheen wrote:
Joe.Thorpe wrote:Here's an example path that gave the error 'System.IO.IOException: The process cannot access the file': C:\ProgramData\Jiwa Financials\Jiwa 7\7.2.1\SYSTEM\x.x.x.x\SHAccsV7\Plugins\API\Runtime\Tie Insurance to Primary Web Order\Tie Insurance to Primary Web Order.dll'


You should try to find out what the other process is that has the file open.


Oh, right. I'll have process explorer ready for the next time it happens. Cheers
Joe.Thorpe
Occasional Contributor
Occasional Contributor
 
Posts: 19
Joined: Fri Jun 11, 2021 1:57 pm

Re: Plugin encountered an exception when compiling during lo

Postby Scott.Pearce » Wed Sep 07, 2022 6:45 pm

Here's a potential workaround:

Configure the windows service to use it's own unique windows user account instead of "System".
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Plugin encountered an exception when compiling during lo

Postby Joe.Thorpe » Wed Sep 07, 2022 6:48 pm

Scott.Pearce wrote:Here's a potential workaround:

Configure the windows service to use it's own unique windows user account instead of "System".


Good point, i'll give it a shot. Thanks!
Joe.Thorpe
Occasional Contributor
Occasional Contributor
 
Posts: 19
Joined: Fri Jun 11, 2021 1:57 pm

Re: Plugin encountered an exception when compiling during lo

Postby pricerc » Thu Sep 08, 2022 4:00 pm

Scott.Pearce wrote:Here's a potential workaround:

Configure the windows service to use it's own unique windows user account instead of "System".


That's good advice for any windows service that may be accessed via the network. It allows security controls that don't apply to System. So even if someone manages to find an exploit in the service, you have a better chance of preventing carnage on your server.
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20


Return to REST API

Who is online

Users browsing this forum: No registered users and 2 guests