Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4022472
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:28:45+00:00 2026-05-20T10:28:45+00:00

In my application which runs user submitted code[1] in separate threads, there might be

  • 0

In my application which runs user submitted code[1] in separate threads, there might be some cases where the code might take very long to run or it might even have an infinite loop! In that case how do I stop that particular thread?

I’m not in control of the user code, so I cannot check for Thread.interrupted() from the inside. Nor can I use Thread.stop() carelessly. I also cannot put those code in separate processes.

So, is there anyway to handle this situation?

[1] I’m using JRuby, and the user code is in ruby.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:28:46+00:00Added an answer on May 20, 2026 at 10:28 am

    With the constraints you’ve provided:

    1. User submitted code you have no control over.
    2. Cannot force checks for Thread.interrupted().
    3. Cannot use Thread.stop().
    4. Cannot put the user code in a process jail.

    The answer to your question is “no, there is no way of handling this situation”. You’ve pretty much systematically designed things so that you have zero control over untrusted third-party code. This is … a suboptimal design.

    If you want to be able to handle anything, you’re going to have to relax one (or preferably more!) of the above constraints.


    Edited to add:

    There might be a way around this for you without forcing your clients to change code if that is a(nother) constraint. Launch the Ruby code in another process and use some form of IPC mechanism to do interaction with your main code base. To avoid forcing the Ruby code to suddenly have to be coded to use explicit IPC, drop in a set of proxy objects for your API that do the IPC behind the scenes which themselves call proxy objects in your own server. That way your client code is given the illusion of working inside your server while you jail that code in its own process (which you can ultimately kill -9 as the ultimate sanction should it come to that).

    Later you’re going to want to wean your clients from the illusion since IPC and native calls are very different and hiding that behind a proxy can be evil, but it’s a stopgap you can use while you deprecate APIs and move your clients over to the new APIs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a client application which runs as a Java applet from a user's
I have an application which runs some multi-threading process. In each thread I'm sharing
I have an application which runs multiple threads. I use MadExcept to catch errors
I am writing an application which runs like a kiosk and should allow user
I've an application where user can schedule custom timer jobs which runs only one
I have an application which once the user runs the app it has a
I had an rcp application which runs for only first run, when a user
I have a server application which runs fine in most of the cases but
The application which runs smoothly on 4.0.1 when was tried on run on 4.2.1
I have written a application which runs in the background. I want to write

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.