Latest release of The Server Framework: 6.8

Version 6.8 of The Server Framework was released today.

This release includes important bug fixes. It also includes lots of code change due to: the removal of support for Visual Studio 2010, adding support for Visual Studio 2017 and the results of lots of static analysis.

This release is essential for users of Release 6.7.

As always, see the release notes here, for full details of all changes.

Bug fixes:

  • Bug fix to JetByteTools::Socket::CStreamSocketConnectionManager for writes that involve buffer chains. as with the bug in JetByteTools::Socket::CFilterDataBase::OnWrite(), we were relying on the Windows XP write sequencing code to ensure that multiple buffer writes were written sequentially without any other writes occurring in between the write of each buffer from the chain. Without the write sequence number it was possible that the buffers would be intermingled with those from another write on another thread and this the correctness of the stream would be destroyed. We now handle chains with more than one buffer as an atomic unit and pass the chain itself into the write using an array of WSABUF’s and deal with splitting the chain during completion handling. This bug was introduced in 6.7.
  • Bug fix to JetByteTools::Socket::CFilterDataBase::OnWrite() where a buffer chain is passed. We were previously dispatching the buffers separately by iterating the chain and pushing each buffer into the filter. This worked fine until we removed write sequencing in 6.7 as this was only required for Windows XP. The write sequencing was ensuring that our splitting the buffer chain as it entered the filter worked correctly as the filter then resequenced the buffers using the write sequence number. Without a write sequence number it is possible that the buffers would be intermingled with those from another write on another thread. We now handle chains with more than one buffer as an atomic unit and pass the chain itself into the filter and split it inside where we are guaranteed not to be preempted by another thread.
  • Bug fix to JetByteTools::Socket::CFilterDataBase where we were being too aggressive in recognising the read side of the connection being closed and restricting further application level reads. This resulted in a race condition during receipt of a client close whereby a filter could end up with data available to read inside it but no further application level reads would be processed. This would result in the final data on a cleanly closed connection being appearing to have been lost even though it had arrived successfully.
  • Bug fix to JetByteTools::Win32::CJob::QueryInformation() which limited the information returned to the first 10 processes.
  • Bug fix to JetByteTools::Win32::CThreadPoolEx so that it deals better with fixed sized thread pools.
  • Bug fix to JetByteTools::Win32::CUTF8StreamConverter::AtoUTF8() to remove a locale leak.
  • Bug fix to JetByteTools::IO::CAsyncFileWriter to do with how and when it notifies on the last write completion. This allows for setting the flag to notify multiple times through the lifetime of the object and makes the definition of ’last’ a little clearer in these circumstances.

Breaking changes:

  • Dropped support for Visual Studio 2010.
  • Removed support for Visual Studio 2013 Preview and code reliant on VS2013_PREVIEW_BROKEN_ISPRINT.
  • Removed support for STLPort. This is no longer required as the quality of the STL implementation supplied with Visual Studio has improved immeasurably.
  • JetByteTools::Win32::CThreadPoolCollection has been deprecated and is no longer available unless you define JETBYTE_DEPRECATE_THREAD_POOL_COLLECTION to 0 in Config.h. This code was only ever used for one client and should have been client specific.
  • JetByteTools::Win32::TSingleton has been deprecated and is no longer available unless you define JETBYTE_DEPRECATE_SINGLETON to 0 in Config.h. As the comments with the class say, “Remember, Singletons are EVIL! and what’s more they’re generally unnecessary”.
  • JetByteTools::Win32::TLinkedClass has been deprecated and is no longer available unless you define JETBYTE_DEPRECATE_LINKED_CLASS to 0 in Config.h.
  • Changed JetByteTools::Win32::CActivatableObject::Callback::OnActivatableObjectProcessCommands() and JetByteTools::Win32::CActivatableObject::Callback::OnActivatableObjectProcessCommand() to both return bool if you return false then you will not be called again if more commands are currently queued until another new command is queued or until JetByteTools::Win32::CActivatableObject::ProcessQueuedCommands() is called. This allows an activatable object to prevent itself from hogging a thread by only allowing a set number of commands to be processed before it forces the caller to ’take a break’. If more commands would have been processed at this time but cannot due to the callback returning false then JetByteTools::Win32::CActivatableObject::Callback::OnActivatableObjectMoreCommandsToProcess() is called to notify the object of the situation. The idea is that the object can then do something to schedule future processing of these unprocessed commands. The first time commands are processed a call to JetByteTools::Win32::CActivatableObject::Callback::OnActivatableObjectAboutToProcessCommands() is called so that the object can reset its ’number of commands processed this time around’ counter…
  • Changed JetByteTools::Win32::CActivatableObject::QueueCommandForProcessing() to take an enum for ProcessingFlags rather than just a boolean flag. This allows you to pass the following mutually exclusive flags; QueueOnlyDoNotProcess, ProcessAll and ProcessOnlyThisCommand.
  • Redesigned JetByteTools::Win32::IManageTimerQueue, see here for details.
  • Renamed the static JetByteTools::Win32::IWaitable::Wait() functions to JetByteTools::Win32::IWaitable::WaitForHandle() so that classes that implement the interface don’t hide the static functions by implementing the non-static wait function.
  • Renamed the #define that is used to cause a JetByteTools::Win32::CLockableObject to fall back on a reentrant implementation based on JetByteTools::Win32::CCriticalSection. This was called JETBYTE_HAS_SRW_LOCK_TRY_ENTER and it’s now called JETBYTE_LOCKABLE_OBJECT_USE_CRITICAL_SECTIONS. The reason for this is that now all supported platforms have JETBYTE_HAS_SRW_LOCK_TRY_ENTER set to 1 but there are still some good reasons for running with the critical section implementation in some situations. The renaming makes the choice more obvious.
  • Removed the entire TimerQueueImplementation enum from JetByteTools::Win32::CThreadedCallbackTimerQueue. Since 6.7 we have been ignoring everything except the locking flags and now that they have been removed there is no need for the enum at all. This is a breaking change. Where the enum was previously used you must delete it.
  • Changed function signature for JetByteTools::Win32::IRunnable::Run() so that it returns an unsigned in rather than a int.
  • JetByteTools::IO::CLockFreeBuffer and JetByteTools::IO::CLockFreeBufferAllocator have been deprecated and are no longer available unless you define JETBYTE_DEPRECATE_LOCK_FREE_BUFFERS to 0 in Config.h. If it’s found that there is widespread use of these buffers then we will refactor them so that there is less duplicate code between them and the non-lock free version.
  • Changed how JetByteTools::IO::CIOPool base calculates the number of threads required if 0 is passed in. Previously it was 2 * number of processors which worked fine back in the day but now it tends to create pools with too many threads. Now it caps this calculation at 4. If you’re relying on passing <0> to get a large number of threads then you should specify the required amount explicitly.
  • Removed JetByteTools::Socket::CCompressingDatagramSocketConnectionFilter, JetByteTools::Socket::CDeflatingStreamSocketConnectionFilter and JetByteTools::Socket::CCompressingStreamSocketConnectionFilter and associated code.
  • Removed JetByteTools::Socket::CFullAddress::GetStorage(), JetByteTools::Socket::CFullAddress::GetSize() and JetByteTools::Socket::CFullAddress::GetWritableAddressRef() as it doesn’t inherit from JetByteTools::Socket::IWritableAddress. If this breaks any code then I’ll put it back and ensure that it also inherits correctly.
  • Removed support for versions of OpenSSL prior to 1.1.0c
  • Removed JetByteTools::OpenSSL::CUsingOpenSSL as it is no longer required.