web stats
Halt not working - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 02-08-2019, 09:54 AM
StickyBandit's Avatar
StickyBandit StickyBandit is offline
Mirth Guru
 
Join Date: Aug 2013
Location: Home Alone
Posts: 951
StickyBandit is on a distinguished road
Red face Halt not working

I have a channel that says "stopping" I have tried halt, it does not work.
The only way to stop this channel seems to be restarting Mirth Connect, but we don't want to do this because this is our live production box that is constantly getting data.

What can I do to get halt to actually halt the channel?

Mirth Connect Server 3.6.1
Built on July 13, 2018
Java version: 1.8.0_181
Reply With Quote
  #2  
Old 02-14-2019, 12:48 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,037
agermano is on a distinguished road
Default

Do you know where in your code the channel is getting stuck? Some endless loop condition that it isn't breaking out of or something?
Reply With Quote
  #3  
Old 02-14-2019, 02:49 PM
StickyBandit's Avatar
StickyBandit StickyBandit is offline
Mirth Guru
 
Join Date: Aug 2013
Location: Home Alone
Posts: 951
StickyBandit is on a distinguished road
Default

It happens when it is unable to execute a SQL DELETE statement, (maybe because a row is locked or something).
There is a grayed out message that never finishes and the channel just gets permanently stuck.
Reply With Quote
  #4  
Old 02-15-2019, 09:07 AM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,037
agermano is on a distinguished road
Default

I think it's possible to set a timeout on the connection before you issue the delete so that it won't hang forever. I don't know if timing out cancels the pending request or not. You might also want to turn auto-commit off to make sure it rolls back.
Reply With Quote
  #5  
Old 02-25-2019, 08:32 AM
StickyBandit's Avatar
StickyBandit StickyBandit is offline
Mirth Guru
 
Join Date: Aug 2013
Location: Home Alone
Posts: 951
StickyBandit is on a distinguished road
Red face more info

I am not using Javascript but rather the built in UI database writer destination.

See the attached image.

Can we do timeout and auto-commit on this screen?
Attached Images
File Type: jpg archive1.jpg (298.7 KB, 9 views)
Reply With Quote
  #6  
Old 06-20-2019, 05:53 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,037
agermano is on a distinguished road
Default

You can't do it there. It needs to be set on the Statement. This is untested, but I think it should work. If you do this in a Database Writer in javascript mode, it should Queue on error (including timeout.)

Code:
var dbConn, stmt;
var query = 'DELETE FROM usiis.load_arch_vac WHERE load_seq_no = ? AND load_seq_child = ?';
var timeout = 300; // in seconds

try {
    dbConn = DatabaseConnectionFactory.createDatabaseConnection('oracle.jdbc.driver.OracleDriver',$('usiis.connection-url'),$('usiis_username'),$('usiis_password'));

    stmt = dbConn.getConnection().prepareStatement(query);
    stmt.setQueryTimeout(timeout);
    stmt.setObject(1, $('load_seq_no'));
    stmt.setObject(2, $('load_seq_child'));
    stmt.execute();
    var numRows = stmt.getUpdateCount();
    stmt.close();

    return new Response(Status.SENT, null, "Database write success, " + numRows + " rows updated");
} finally {
    if (dbConn) { 
        dbConn.close();
    }
}

Last edited by agermano; 06-20-2019 at 05:58 PM.
Reply With Quote
  #7  
Old 08-14-2019, 09:34 AM
StickyBandit's Avatar
StickyBandit StickyBandit is offline
Mirth Guru
 
Join Date: Aug 2013
Location: Home Alone
Posts: 951
StickyBandit is on a distinguished road
Default

I want to know what to do without using javascript.
And I don't think the question on Halt is really answered with this.
Why does halt not halt?
Reply With Quote
  #8  
Old 08-15-2019, 02:14 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,037
agermano is on a distinguished road
Default

Halt interrupts the thread. If the thread is doing something that isn't interruptable, then it will continue doing what it's doing. That's why I asked if you were stuck in an infinite loop originally. If your code has the potential to loop for long periods of time, you need to manually check if the current thread has been interrupted in order to break out of the loop and make halt work.

The jdbc executeQuery method can't be interrupted (it doesn't throw an InterruptedException,) so a channel halt will have no affect on it.

Maybe there is a way for your db driver to set the timeout in the connection string url, but other than that, I don't know how you would do it without javascript. Probably wouldn't hurt to open a feature request to add that option to the database reader/writer.
Reply With Quote
  #9  
Old 10-12-2019, 08:15 AM
StickyBandit's Avatar
StickyBandit StickyBandit is offline
Mirth Guru
 
Join Date: Aug 2013
Location: Home Alone
Posts: 951
StickyBandit is on a distinguished road
Thumbs down

I also have another channel that does the same thing on a database writer trying to INSERT. Apparently the SQL is unable to INSERT so the channel is just stuck. I try stopping and it just says stopping and never stops.
Halt does not work. Re-deploy all does not fix it either.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 02:01 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation