Gtk-Gnutella is currently sponsored by www.locatemyname.com. Try it!
The Most Efficient Gnutella Client
gtk-gnutella is a server/client for the Gnutella peer-to-peer network. It runs on Microsoft Windows, MacOS and every Unix-like system which supports GTK+ (1.2 or above). The GNOME desktop environment is not required. It is currently developed and tested under Linux (Debian) as well as NetBSD. It is known to run at least on Linux, FreeBSD, NetBSD, Darwin, Solaris, Tru64 UNIX (OSF/1), SGI IRIX, BeOS whereas CPU architectures include x86, AMD64, PowerPC, SPARC, MIPS. And of course Microsoft Windows (XP at least).
gtk-gnutella is free open-source software and released under the GNU General Public License (GPL).
gtk-gnutella is not finished yet, but it is fully functional: you may share, search, and download. And it is stable too, users usually just leave it run unattended for days.
All ideas and comments are welcome to the gtk-gnutella-devel mailing list. Bugs should be reported to the SourceForge.net Bug Tracker
6 March 2016, Version 1.1.9 Released
This is mostly a bug-fixing release.
It fixes an important bug in the UPnP discovery path that led to a crash when it found more than one UPnP device on the network.
It also introduces a new Glossary that can be displayed to explain some terms that may be hard to understand for newcomers, so that they may in turn benefit from the tooltips and the information in the FAQ.
On Windows, one important change is that we now force all memory
allocations from the external DLLs to use our own
implementation. This proves that one of the DLLs is exhibiting a memory leak.
Plugging that leak will unfortunately require that a garbage collector be
implemented. Measurements indicate that 4K leak every second on average,
which eventually leads to an out-of-memory crash after a few days (2 to 3),
preventing high uptimes on Windows. The leak is not originating from
- [GTK2] Added menu to display the new glossary window.
- Define PTHREAD_STACK_MIN to 0 in case it is not supplied by <pthread.h>.
can_become_ultra(): don't account for upload fds if no upload will take place.
compat_sleep_ms(): fixed the fallback implementation using
dht_route_parse(): ensure we never use uninitialized variables.
entropy_collect_host(): no longer attempt to get the host IP addresses.
file_locate_from_path(): if pathname is qualified, duplicate argument!
ftw_foreach(): prevent memory leak on error path.
thread_lock_deadlock(): avoid de-referencing NULL if possible.
upnp_discovered(): avoid segfault when we have to pick the first device.
Under the Hood
- Disable warnings about the mem vtable being deprecated in recent glib.
- Suspend threads created after a global suspension is in effect.
- Warn when we cannot find a thread to record / release a lock.
- Added a new crash-level for deadlocks.
- Added optional debugging code to track reading threads on a read-write lock.
spinlock_in_crash_mode_raw()for raw spinlocks to avoid deadly recursion.
- Additional debugging code to track read spots per thread on a read-write lock.
- Added backtrace capture when threads are contending for a lock.
- On deadlocks, suspend the other threads and log origin quickly before handling.
- New strategy in lock "deadlock" routines: ignore when in pass-through mode.
- Do not perturb the lock waiting state of the crashing thread on a deadlock.
- Check for stack overflowing each time a lock is grabbed and recorded.
- Added thread diversion support.
thread_halt()to forcefully halt concurrently crashing threads.
- Refactored memory checks to avoid systematic locking in
- Try to divert crash processing to main thread when triggered in a sub-thread.
- On deadlock condition, attempt to collect stacktraces of other threads.
- Add the current process PID and the last crash level to the crash log.
- Use raw logging routines in spinlock / mutex deadlock tracing.
crash_getpid()for safe original PID computation, even across a
- Add dump of all the thread stacks to the crash log if we can't
implies()definitions to "casts.h".
xxx_to_string_grp()to optionally format xxx with thousand groupping.
- Adding win32 dynamic library patcher to trap
malloc()in all required DLLs.
- Windows: with win32dlp, no need for monitoring committed memory.
- Renaming of legacy G_GNUC_XXX into G_XXX for concision.
- Renamed G_N_ELEMENTS as N_ITEMS.
- Moved gcc-specific macros to a dedicated file.
- Added pragmas to shut up spurious warnings with the clang 3.4.1 compiler.
- On the lock recording path, we can now use
- Made sure symbols are thread-safe and properly locked.
- If stacktrace dumps could intertwine, prefix the second with the thread ID.
- Allow for nested lock waiting sequences.
- Added SIGSYS to the list of harmful signals we want to catch.
- Added THREAD_F_WAIT to let
thread_create()wait for the new thread to start.
- Windows: was not reconstructing correct stack frame pointer for WINAPI calls.
- Windows: improved backtracing through routines using a large amount of stack.
- No longer block signals when waiting for a read-write lock.
- Prevent signals during logging, to avoid recursion if logging from handler.
- rwlock: when waiting for too long, deadlock only when no activity is seen.
compat_gettid()and use it to record the system thread ID.
- Added support for
- Windows: make sure
s_read()can return EINTR and handle it properly.
- Windows: added support for
- xmalloc: count and loudly trace allocation attempts made from signal handler.
- omalloc: loudly warn when invoked from signal handler.
- VMM: warn when memory allocation / freeing attempted from signal handler.
- VMM: use groupped formatting for region sizes or large numbers.
- Make sure we do not dispatch thread signals when running in an interrupt.
s_minicarp_once()and a circular buffer to avoid memory allocation.
- Monitor when we issue blocking syscalls to flag signal handlers as safe/unsafe.
- Added plumbing to allow
siglongjmp()in a signal handler.
booleanize(): use version not causing any jump, for speed.
clamp_strlen(): use same optimization as
utf8_strlen()to compute length.
mingw_analyze_prologue(): fixed MOVL immediate offset parsing.
mingw_exception_log(): simplify processing on stack overflows.
mingw_getdtablesize(): don't call
_getmaxstdio(), hardwire 2048 instead.
mingw_signal(): only call
mingw_sigraise(): only log sent signal when asked to.
mingw_waitpid(): fixed compilation warning given that WAIT_OBJECT_0 is 0.
mingw_win2posix(): added mapping for ERROR_INVALID_USER_BUFFER.
mingw_win2posix(): added mapping of ERROR_NO_SYSTEM_RESOURCES to ENOMEM.
mingw_write(): for Windows 7 and maybe later, do not call
mutex_is_owned(): optimized by avoiding
thread_self()call if mutex not locked.
prop_save_to_file(): use file's timestamp, not the current time.
rwlock_not_owned(): ignore errors when the rwlock layer is in pass-through.
s_logv(): made recursion detection thread-safe.
s_logv(): use raw time computation when running in signal handler.
s_minierror(): enhanced to enter crash mode immediately and show thread ID.
s_rawlogv(): force "raw" mode when running in a signal handler.
s_stacktrace(): downgrade from decorated to plain stack before skipping traces.
signal_name(): added more items to signals, so cache linear lookup result.
spinlock_grab_try_from(): no crashing mode, don't say we locked if we couldn't.
stacktrace_get_symbols(): make sure we're running this only once.
stacktrace_unwind(): detect recursion in a thread-safe way.
stacktrace_unwind(): use gcc-style unwinding if recursing or within malloc.
str_vncatf(): added verbose assertion to ensure string is not overflowing.
symbols_name_only(): simplified code.
symbols_name_only(): simplify processing if we don't have to format an offset.
thread_check_suspended(): account for
thread_cond_waiting_element(): don't create the cond stack until necessary.
thread_exiting(): do not reset the QID range on Windows for an exiting thread.
thread_id_name(): be robust if called during crashes.
thread_launch_trampoline(): do not harvest entropy, this slows down creation.
thread_lock_got_swap(): missed accounting of new lock in discovered thread.
thread_lock_waiting_element(): warn when we detect recursive lock waiting.
thread_preallocate_element(): also pre-allocate the lock stack.
thread_sig_handle(): don't handle signals if thread is supposed to be blocked.
thread_small_id(): bet on the QID lookup success.
thread_sp(): simpler version defeating compiler optimizations.
tm_localtime_raw(): use exact time, as this is used during logging.
xmalloc_thread_alloc(): refuse to allocate if within a signal handler.
18 December 2015, Version 1.1.8 Released
This is an emergency bug-fixing release.
It addresses systematic crashes on some platforms, right at startup time, and prevents random deadlocks on OS/X.
The systematic crash was due to an innocent change, which actually perturbed the order of the initialization routines and, depending on the conditions, caused an assertion failure during one of the thread startup. Curiously, the error manifests randomly and does not seem to depend on the OS but rather on other subtle environment issues: one Linux distribution could be fine whilst another was hit by the bug.
13 December 2015, Version 1.1.7 Released
This release adds support for new features:
- TLS upgrade of existing connections.
- Inbound HTTPS connections.
- Use of a supervisor process to relaunch gtk-gnutella on crashes.
The TLS upgrade allows connections that have started without TLS to negotiate TLS on the fly without having to reconnect. They are flagged as "e" to show that encryption was dynamically added, as opposed to "E" which indicates an initial TLS connection.
Certificates are now automatically generated and this allows HTTPS connections from browsers. For now this is of limited use, but it will come handy in the near future when building a web-enabled GUI.
To be more resilient against crashes, gtk-gnutella now automatically
launches a supervisor process that will launch the real gtk-gnutella as a
child process and monitor its fate, restarting a new process when the old one
failed. This is far more robust than having the process
exec() itself at crash time since there are some crashing
conditions that do not even allow the process to go that far in the crash
On Windows, provided you have installed Cygwin's gdb, crash logs will now contain a gdb backtrace of the failing process, making analysis of what went wrong easier than with a simple stack trace.
Your previous GUID and KUID will be regenerated the next time you restart due to a new algorithm used to detect that a configuration file is not accidentally reused on another machine: the host name is now included, instead of just the physical file information. So when moving a disk to another machine, or simply cloning an existing virtual machine, we are no longer going to reuse these IDs which are supposed to be unique by properly detecting that the information was copied over.
A bug in
open_read() caused the Geo IP database to not be
loaded on Windows.
Finally, all the options given to gtk-gnutella can now be abbreviated as long as they are not ambiguous (i.e. enough is given to make them non-ambiguous). For instance, given the current set of options, --p would be ambiguous but --s will always mean --shell. However, --pi is not ambiguous and refers to --ping.
- By default, gtk-gnutella now supervises its children to restart them.
- Now allows incoming HTTPS connections.
- Added support for Gnutella connection upgrade to TLS.
- Added support of RFC-2817 for upgrading to TLS within HTTP/1.1.
- Dump symbolic stack when crashing in supervised mode with our parent.
- VMM: added new flag to signal OOM condition and be aggressive with the cache.
- Options can now be abbreviated as long as they are not ambiguous.
- Added support for Virtual Memory Emergency Allocation (VMEA).
- Pulled latest translations from Transifex.
- Make sure
node_by_guid()cannot return a G2 node!
- VMM: fixed memory allocation logic during crashes.
open_read(): fixed logic on Windows when no renaming is requested.
- Make sure we don't restart nor pause a failing process on --shell or --ping.
Under the Hood
spopen(), a simple
popen()bypassing the shell.
- Added Windows-specific PROT_GUARD protection type for
log_show_pid()to direct the logging layer to show or hide the PID.
- Added library support for file locks.
- Added ability to dynamically limit
walloc()usage, remapping to
- Added ability to disable
halloc()at runtime, remapping it to
- Added specific PID file for locking out the supervisor process.
- Do not install periodic
zgc()unless running in a long-term process.
main()initializations to limit memory usage in the supervisor.
- Windows: stop fatal recursion when the VMM layer extends the pmap.
- Windows: revisited exception logging to give more details and simplify code.
- Windows: reworked stack overflow detection logic.
- Windows: added
- Windows: added support for
waitpid()on launched processes.
- Windows: launch gdb in a separate thread to get symbols when crashing.
- Windows: re-worked early init code to allow memory allocation.
- Windows: will now be building with gnutls-3.4.5.
- Windows: added
- Windows: added
- Windows: try to have
SymInitialize()done as soon as possible.
- Windows: added support for getrusage(RUSAGE_CHILDREN).
- Make sure the logic used to construct fallback path is consistent.
- Refactored Windows socket initialization.
crash_mode()to include the notion of criticity level.
rand31()to the Park and Miller algorithm.
- SDBM: added
fadvise()hint for page accesses, with a "random" access mode.
short_time()in log messages.
- TLS: use our own random number generators.
- TLS: use new types, with the _t trailing prefix.
- TLS: added support for a global audit log, available since gnutls 3.0.
- TLS: added vectorized push routine.
- TLS: added generation of private server key at startup if missing.
- TLS: don't need anonymous server credentials if we have a certificate.
- TLS: added generation of self-signed certificate at startup if missing
- TLS: removed ARCFOUR-40 from the list of overrides for GnuTLS 3.4.5.
- TLS: enhanced to support GnuTLS 3.x and allow HTTPS connections.
- TLS: the "custom I/O" push/pull routines are now the norm.
- TLS: normalized logging to always use G_STRFUNC for non-informative messages.
SHA1_process_message_block(): make sure SHA1 is correct on big-endian systems.
cq_init(): always warn if callout queue exists, regardless of its thread.
cq_init(): loudly warn if the callout queue was created automatically before.
crash_generate_crashlog(): dump thread locks before current stack.
crash_init(): now calls
stacktrace_init()with immediate symbol loading.
crash_invoke_inspector(): also attempt to launch gdb on Windows.
crash_invoke_inspector(): force emission of decorated stacks.
crash_try_reexec(): do not
exec()ourselves when we have a supervising parent.
download_get_server_name(): when name changes, reset some internal attributes.
entropy_seed(): make sure we're correctly seeding our KISS RNG.
file_locate_from_path(): tweaked for Windows to add implicit "." in PATH.
gtk_gnutella_atexit(): do nothing if we're already crashing.
gwc_parse_dispatch_lines(): avoid using "eof", it shadows a global on Windows.
hash_table_replace(): fixed logic when inserting into a fix-sized table.
random_key_bytes()to generate unique KUID.
mingw_exception(): maintain exception recursive depth per thread.
mingw_execve(): redesigned to avoid using external resources.
mingw_fcntl(): added F_RDLCK (read-lock) support for F_SETLK operations.
mingw_fcntl(): return ENOSYS for unimplemented parts, not EINVAL!
mingw_signal(): be thread-safe, in case of concurrent updates.
mingw_sigraise(): trace signal, since it could be the prelude to a crash.
node_can_accept_connection(): even when "offline", accept nearby hosts.
node_is_now_connected(): watch out for disconnected nodes after RX injection.
pncs_convert(): avoid using the stack, prefer a thread-private buffer.
sdbm_set_volatile(): forgot to grab lock on entry.
sdbm_thread_datum(): avoid too many re-allocation overhead, sacrificing memory.
settings_random_save(): now merge randomness instead of just superseding it.
shell_exec_thread_list(): use configured stack size if available.
signal_perform_cleanup(): trace signals we get during cleanup.
spinlock_crash_mode(): dump PID as well in case process forked.
stack_print_decorated_to(): switch to lighter tracing if we hit an OOM.
thread_launch(): warn once if
pthread_attr_setstacksize()returns an error.
thread_launch_register(): force new PROT_GUARD protection on red-zone page.
tls_handshake(): log IP:port and whether remote is client or server.
tm_init(): now controls whether to start the time thread.
unique_file_token(): include the hostname into the unique file ID.
vxml_parser_remove_buffer(): application logic was done only when debugging!
xallocate(): when crashing, use
omalloc()for small blocks, instead of