Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Forked manages long running worker processes.
Processes that crash are restarted, whereas processes that exit successfully aren't. Errors that occur within forked processes are retried according to the configured retry strategy.
Once wait_for_shutdown
is called, the current process watches for shutdown
signals or crashed processes. On shutdown, each worker is sent a TERM signal,
indicating that it should finish any in progress work and shutdown. After a set
timeout period workers are sent a KILL signal.
require 'forked'
process_manager = Forked::ProcessManager.new(logger: Logger.new(STDOUT), process_timeout: 5)
# Default retry_strategy = Forked::RetryStrategies::Always
# Calling `ready_to_stop` within the loop ensures a shutdown is triggered if a TERM/INT signal is received
process_manager.fork('monitor', on_error: ->(e, tries) { puts e.inspect }) do |ready_to_stop|
loop do
ready_to_stop.call
# do something
end
end
# Using the ExponentialBackoff retry_strategy
# If there is an error, process_manager backs off for a time then restarts the loop
# The back off time increases as the number of errors increase
process_manager.fork('processor_1', retry_strategy: Forked::RetryStrategies::ExponentialBackoff) do |ready_to_stop|
loop do
ready_to_stop.call
# do something
end
end
# Using the ExponentialBackoffWithLimit retry_strategy
# Follows the ExponentialBackoff retry strategy, but if the error keeps occurring
# until a given limit (default: 8), the error bubbles up and the loop is not restarted
process_manager.fork('processor_1', retry_strategy: Forked::RetryStrategies::ExponentialBackoffWithLimit, retry_backoff_limit: 10) do |ready_to_stop|
loop do
ready_to_stop.call
# do something
end
end
# blocks the current process, restarts any crashed processes and waits for shutdown signals (TERM/INT).
process_manager.wait_for_shutdown
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/envato/forked.
FAQs
Unknown package
We found that forked demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.