Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions TAO/bin/tao_orb_tests.lst
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ TAO/tests/Native_Exceptions/run_test.pl:
TAO/tests/Servant_To_Reference_Test/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST
TAO/tests/Sequence_Unit_Tests/run_test.pl:
TAO/tests/Typedef_String_Array/run_test.pl:
TAO/tests/GIOP_Fragments/Big_String_Sequence/run_test.pl: !FIXED_BUGS_ONLY
TAO/tests/GIOP_Fragments/PMB_With_Fragments/run_test.pl: !CORBA_E_MICRO
TAO/tests/CodeSets/simple/run_test.pl: !GIOP10 !STATIC
TAO/tests/Hang_Shutdown/run_test.pl: !ST !ACE_FOR_TAO
Expand Down
9 changes: 3 additions & 6 deletions TAO/tao/Array_VarOut_T.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ TAO_FixedArray_Var_T<T,T_slice,TAG>::operator= (T_slice * p)
template<typename T, typename T_slice, typename TAG>
TAO_FixedArray_Var_T<T,T_slice,TAG> &
TAO_FixedArray_Var_T<T,T_slice,TAG>::operator= (
const TAO_FixedArray_Var_T<T,T_slice,TAG> & p
)
const TAO_FixedArray_Var_T<T,T_slice,TAG> & p)
{
if (this != &p)
{
Expand Down Expand Up @@ -62,8 +61,7 @@ TAO_VarArray_Var_T<T,T_slice,TAG>::operator= (T_slice * p)
template<typename T, typename T_slice, typename TAG>
TAO_VarArray_Var_T<T,T_slice,TAG> &
TAO_VarArray_Var_T<T,T_slice,TAG>::operator= (
const TAO_VarArray_Var_T<T,T_slice,TAG> & p
)
const TAO_VarArray_Var_T<T,T_slice,TAG> & p)
{
if (this != &p)
{
Expand All @@ -81,8 +79,7 @@ TAO_VarArray_Var_T<T,T_slice,TAG>::operator= (
template<typename T, typename T_slice, typename TAG>
void
TAO_Array_Forany_T<T,T_slice,TAG>::_tao_any_destructor (
void * _tao_void_pointer
)
void * _tao_void_pointer)
{
T_slice * tmp = static_cast<T_slice *> (_tao_void_pointer);
TAO::Array_Traits<FORANY>::free (tmp);
Expand Down
12 changes: 4 additions & 8 deletions TAO/tao/Array_VarOut_T.inl
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,15 @@ TAO_Array_Out_T<T,T_var,T_slice,TAG>::TAO_Array_Out_T (T_var & p)
template<typename T, typename T_var, typename T_slice, typename TAG>
ACE_INLINE
TAO_Array_Out_T<T,T_var,T_slice,TAG>::TAO_Array_Out_T (
const TAO_Array_Out_T<T,T_var,T_slice,TAG> & p
)
const TAO_Array_Out_T<T,T_var,T_slice,TAG> & p)
: ptr_ (const_cast<THIS_OUT_TYPE &> (p).ptr_)
{}

template<typename T, typename T_var, typename T_slice, typename TAG>
ACE_INLINE
TAO_Array_Out_T<T,T_var,T_slice,TAG> &
TAO_Array_Out_T<T,T_var,T_slice,TAG>::operator= (
const TAO_Array_Out_T<T,T_var,T_slice,TAG> & p
)
const TAO_Array_Out_T<T,T_var,T_slice,TAG> & p)
{
this->ptr_ = const_cast<THIS_OUT_TYPE &> (p).ptr_;
return *this;
Expand Down Expand Up @@ -250,17 +248,15 @@ template<typename T, typename T_slice, typename TAG>
ACE_INLINE
TAO_Array_Forany_T<T,T_slice,TAG>::TAO_Array_Forany_T (
T_slice * p,
CORBA::Boolean nocopy
)
CORBA::Boolean nocopy)
: ptr_ (p),
nocopy_ (nocopy)
{}

template<typename T, typename T_slice, typename TAG>
ACE_INLINE
TAO_Array_Forany_T<T,T_slice,TAG>::TAO_Array_Forany_T (
const TAO_Array_Forany_T<T,T_slice,TAG> & p
)
const TAO_Array_Forany_T<T,T_slice,TAG> & p)
: ptr_ (p.ptr_),
nocopy_ (p.nocopy_)
{
Expand Down
9 changes: 9 additions & 0 deletions TAO/tests/GIOP_Fragments/Big_String_Sequence/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.obj
.depend.Echo_Client
.depend.Echo_Server
.depend.echo_idl
.depend.echo_idl_Idl1
server_log.txt
client_log.txt
client
server
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// -*- MPC -*-
project(*idl): taoidldefaults {
IDL_Files {
Echo.idl
}
custom_only = 1
}

project(*Server): taoserver {
exename = server
after += *idl
Source_Files {
Echo_i.cpp
server.cpp
EchoS.cpp
EchoC.cpp
}
IDL_Files {
}
}

project(*Client): taoclient {
exename = client
after += *idl
Source_Files {
client.cpp
EchoC.cpp
}
IDL_Files {
}
}
13 changes: 13 additions & 0 deletions TAO/tests/GIOP_Fragments/Big_String_Sequence/Echo.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
interface Echo
{
// Defines an interface that encapsulates an operation that returns
// a string sequence, or a wstring sequence, respectively.

typedef sequence<string> List;
typedef sequence<wstring> WList;

List return_list ();
WList return_wlist ();

oneway void shutdown ();
};
79 changes: 79 additions & 0 deletions TAO/tests/GIOP_Fragments/Big_String_Sequence/Echo_i.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#include "Echo_i.h"

constexpr size_t BIG_LENGTH = 4 * 1024;

// Constructor.

Echo_i::Echo_i (CORBA::ORB_ptr o)
: orb_(o)
{
}

// Return a list of strings.
Echo::List *
Echo_i::return_list ()
{
Echo::List_var list;

{
Echo::List *tmp {};
ACE_NEW_RETURN (tmp,
Echo::List (2),
{});
list = tmp;
}

list->length (2);

// Just do something to get a 'big' list of strings.
CORBA::Char big[BIG_LENGTH + 1];
for (size_t i = 0; i < BIG_LENGTH; ++i)
big[i] = 'A';
big[BIG_LENGTH] = 0;
list[CORBA::ULong(0)] = CORBA::string_dup(big);
list[CORBA::ULong(1)] = CORBA::string_dup("Hello World");

return list._retn ();
}

Echo::WList *
Echo_i::return_wlist ()
{
Echo::WList_var list;

{
Echo::WList *tmp {};
ACE_NEW_RETURN (tmp,
Echo::WList (2),
{});
list = tmp;
}

list->length (2);

// Just do something to get a 'big' list of wide strings.
CORBA::WChar big[BIG_LENGTH + 1];
for (size_t i = 0; i < BIG_LENGTH; ++i)
big[i] = 'A';
big[BIG_LENGTH] = 0;
CORBA::WChar small[17 + 1];
for (size_t i = 0; i < 17; ++i)
small[i] = 'B';
small[17] = 0;
list[CORBA::ULong(0)] = CORBA::wstring_dup(big);
list[CORBA::ULong(1)] = CORBA::wstring_dup(small);

return list._retn ();
}

// Shutdown the server application.

void
Echo_i::shutdown ()
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("\nThe echo server is shutting down\n")));

// Instruct the ORB to shutdown.
this->orb_->shutdown ();
}
47 changes: 47 additions & 0 deletions TAO/tests/GIOP_Fragments/Big_String_Sequence/Echo_i.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// -*- C++ -*-

//=============================================================================
/**
* @file Echo_i.h
*
* This class implements the Echo IDL interface.
*
*/
//=============================================================================


#ifndef ECHO_I_H
#define ECHO_I_H

#include "EchoS.h"

/**
* @class Echo_i
*
* @brief Echo Object Implementation
*
*/
class Echo_i : public POA_Echo
{
public:
/// Constructor.
Echo_i (CORBA::ORB_ptr o);

/// Destructor.
~Echo_i () override = default;

/// Return the result sequences to the cllient.
Echo::List *return_list () override;
Echo::WList *return_wlist () override;

/// Shutdown the server.
void shutdown () override;

private:
/// ORB pointer.
CORBA::ORB_var orb_;

void operator= (const Echo_i&) = delete;
};

#endif /* ECHO_I_H */
10 changes: 10 additions & 0 deletions TAO/tests/GIOP_Fragments/Big_String_Sequence/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# TAO GIOP Fragmentation Bug
## Reproduces a bug when GIOP fragmentation is used

The server returns a string sequence with two elements, the first is a
long 4kB string with repeating character 'A', the second element is
the string "Hello World". If one removes the command line parameters
`-ORBMaxMessageSize 1024` from `run_test.pl` everything
works as expected, but with these settings, which cause GIOP
fragmentation, the client receives an empty string as the second
element of the sequence.
107 changes: 107 additions & 0 deletions TAO/tests/GIOP_Fragments/Big_String_Sequence/client.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#include "EchoC.h"
#include "ace/Get_Opt.h"
#include <cstring>

const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior");

int parse_args (int argc, ACE_TCHAR *argv[])
{
ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("f:"));
int c;

while ((c = get_opts ()) != -1)
switch (c)
{
case 'f':
ior = get_opts.opt_arg ();
break;

case '?':
default:
ACE_ERROR_RETURN ((LM_ERROR,
"usage: %s "
"-f <ior> "
"\n",
argv [0]),
-1);
}
// Indicates successful parsing of the command line
return 0;
}

int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
try
{
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);

if (parse_args (argc, argv) != 0)
return -1;

CORBA::Object_var tmp = orb->string_to_object(ior);

Echo_var echo = Echo::_narrow(tmp.in ());

if (CORBA::is_nil (echo.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Nil Echo reference <%s>\n",
ior),
-1);
}

Echo::List_var list = echo->return_list();

ACE_DEBUG ((LM_DEBUG,
"Received list of length %u\n",
list->length()));
if (list->length() != 2)
{
ACE_ERROR_RETURN ((LM_ERROR, "Expected length 2\n"), -1);
}
const char* value = (*list)[0].in();
size_t length = std::strlen(value);
ACE_DEBUG ((LM_DEBUG,
"First element has length %u\n",
length));
for (size_t n = 0; n < length; ++n)
{
if (value[n] != 'A')
{
ACE_ERROR_RETURN ((LM_ERROR,
"Character at position %u should be 'A',"
" but is '%c'\n", value[n]), -1);
}
}
value = (*list)[1].in();
length = std::strlen(value);
ACE_DEBUG ((LM_DEBUG,
"Second element has length %u, value: <%C>\n",
length, value));
if (strcmp(value, "Hello World") != 0)
{
ACE_ERROR_RETURN ((LM_ERROR, "Expected \"Hello World\""), -1);
}

Echo::WList_var wlist = echo->return_wlist();

ACE_DEBUG ((LM_DEBUG,
"Received wide list of length %u\n",
wlist->length()));
if (wlist->length() != 2)
{
ACE_ERROR_RETURN ((LM_ERROR, "Expected length 2\n"), -1);
}

echo->shutdown ();
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return 1;
}

return 0;
}
Loading