Skip to content

Commit 0bcac51

Browse files
authored
#103: exa.ReadData not working correctly under Windows (#104)
RCA: During the refactoring (#63), the magic number = 1 for closing the socket for sending was replaced with SD_RECEIVE, but it should have been replaced with SD_SEND. The consequence was that the socket might have been closed before the ok answered was sent to the database. Fix: Replace SD_RECEIVE with SD_SEND Fixes #103
1 parent 882cc58 commit 0bcac51

File tree

6 files changed

+73
-11
lines changed

6 files changed

+73
-11
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: exasol
22
Type: Package
33
Title: R Interface & SDK for the EXASOL Database
4-
Version: 7.0.1
4+
Version: 7.0.2
55
Date: 2021-10-07
66
Author: Ian Formanek, Marcel Boldt, Mathias Golombek, Muhammet Orazov, Pieterjan Spoelders, Sebastian Baer, Szilard Barany, Thomas Ubensee, Torsten Kilias, Valerie Wiedemann, Viliam Simko
77
Maintainer: Thomas Ubensee <ext.Thomas.Uebensee@exasol.com>

configure

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.69 for exasol 7.0.1.
3+
# Generated by GNU Autoconf 2.69 for exasol 7.0.2.
44
#
55
#
66
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -578,8 +578,8 @@ MAKEFLAGS=
578578
# Identity of this package.
579579
PACKAGE_NAME='exasol'
580580
PACKAGE_TARNAME='exasol'
581-
PACKAGE_VERSION='7.0.1'
582-
PACKAGE_STRING='exasol 7.0.1'
581+
PACKAGE_VERSION='7.0.2'
582+
PACKAGE_STRING='exasol 7.0.2'
583583
PACKAGE_BUGREPORT=''
584584
PACKAGE_URL=''
585585

@@ -1210,7 +1210,7 @@ if test "$ac_init_help" = "long"; then
12101210
# Omit some internal or obsolete options to make the list less imposing.
12111211
# This message is too long to be a string in the A/UX 3.1 sh.
12121212
cat <<_ACEOF
1213-
\`configure' configures exasol 7.0.1 to adapt to many kinds of systems.
1213+
\`configure' configures exasol 7.0.2 to adapt to many kinds of systems.
12141214
12151215
Usage: $0 [OPTION]... [VAR=VALUE]...
12161216
@@ -1272,7 +1272,7 @@ fi
12721272

12731273
if test -n "$ac_init_help"; then
12741274
case $ac_init_help in
1275-
short | recursive ) echo "Configuration of exasol 7.0.1:";;
1275+
short | recursive ) echo "Configuration of exasol 7.0.2:";;
12761276
esac
12771277
cat <<\_ACEOF
12781278
@@ -1360,7 +1360,7 @@ fi
13601360
test -n "$ac_init_help" && exit $ac_status
13611361
if $ac_init_version; then
13621362
cat <<\_ACEOF
1363-
exasol configure 7.0.1
1363+
exasol configure 7.0.2
13641364
generated by GNU Autoconf 2.69
13651365
13661366
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1538,7 +1538,7 @@ cat >config.log <<_ACEOF
15381538
This file contains any messages produced by compilers while
15391539
running configure, to aid debugging if configure makes a mistake.
15401540
1541-
It was created by exasol $as_me 7.0.1, which was
1541+
It was created by exasol $as_me 7.0.2, which was
15421542
generated by GNU Autoconf 2.69. Invocation command line was
15431543
15441544
$ $0 $@
@@ -4418,7 +4418,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
44184418
# report actual input values of CONFIG_FILES etc. instead of their
44194419
# values after options handling.
44204420
ac_log="
4421-
This file was extended by exasol $as_me 7.0.1, which was
4421+
This file was extended by exasol $as_me 7.0.2, which was
44224422
generated by GNU Autoconf 2.69. Invocation command line was
44234423
44244424
CONFIG_FILES = $CONFIG_FILES
@@ -4471,7 +4471,7 @@ _ACEOF
44714471
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
44724472
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
44734473
ac_cs_version="\\
4474-
exasol config.status 7.0.1
4474+
exasol config.status 7.0.2
44754475
configured by $0, generated by GNU Autoconf 2.69,
44764476
with options \\"\$ac_cs_config\\"
44774477

doc/changes/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Changes
22

3+
* [7.0.2](changes_7.0.2.md)
34
* [7.0.1](changes_7.0.1.md)
45
* [7.0.0](changes_7.0.0.md)
56
* [6.0.0](changes_6.0.0.md)

doc/changes/changes_7.0.2.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# r-exasol 7.0.2, released t.b.d.
2+
3+
Code name: Fix socket error under Windows.
4+
5+
## Summary
6+
7+
This release fixes a critical error under Windows which caused the
8+
high speed data channel to abort the connection with an error.
9+
10+
## Features / Enhancements
11+
n/a
12+
13+
## Bug Fixes
14+
- #103: exa.ReadData not working correctly under Windows
15+
16+
### Compile Dependency Updates
17+
18+
#### Linux
19+
n/a
20+
21+
#### Windows
22+
n/a
23+
24+
### Runtime Dependency Updates
25+
n/a
26+
27+
### Test Dependency Updates
28+
n/a

src/r_exasol/connection/socket/socket.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,33 @@ namespace exa {
1313
class Socket {
1414
public:
1515
virtual ~Socket() = default;
16+
/**
17+
* Receive a buffer from the socket. The method blocks until the buffer is received.
18+
* @param buf The pointer of the buffer to receive the data.
19+
* @param len The size of the buffer.
20+
* @return -1 if an error occurred. Otherwise the size of the buffer which was received.
21+
*/
1622
virtual ssize_t recv(void *buf, size_t len) = 0;
23+
/**
24+
* Send data to socket. The method is none-blocking.
25+
* @param buf Pointer to buffer to send.
26+
* @param len Length of the buffer to send.
27+
* @return -1 if an error occurred. Otherwise the length of the buffer which was sent.
28+
*/
1729
virtual ssize_t send(const void *buf, size_t len) = 0;
30+
/**
31+
* Closes socket for sending.
32+
* All ongoing send operations will be finished, but future send operations on the socket
33+
* are not allowed.
34+
* @see https://www.baeldung.com/cs/sockets-close-vs-shutdown#shutdown
35+
*/
1836
virtual void shutdownWr() = 0;
37+
/**
38+
* Closes socket for both sending/receiving.
39+
* All ongoing send/receive operations will be finished, but future send/receive operations on the socket
40+
* are not allowed.
41+
* @see https://www.baeldung.com/cs/sockets-close-vs-shutdown#shutdown
42+
*/
1943
virtual void shutdownRdWr() = 0;
2044
};
2145
}

src/r_exasol/external/socket_api.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,20 @@
1313
#define WIN32_LEAN_AND_MEAN
1414
#include <windows.h>
1515
#include <winsock2.h>
16+
//SOCKET SHUT_RDWR
17+
//See https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-shutdown
18+
//Send: "If the how parameter is SD_SEND, subsequent calls to the send function are disallowed. For TCP sockets, a FIN will be sent after all data is sent and acknowledged by the receiver."
19+
//Receive: "If the how parameter is SD_RECEIVE, subsequent calls to the recv function on the socket will be disallowed. This has no effect on the lower protocol layers. For TCP sockets, if there is still data queued on the socket waiting to be received, or data arrives subsequently, the connection is reset, since the data cannot be delivered to the user. For UDP sockets, incoming datagrams are accepted and queued. In no case will an ICMP error packet be generated."
20+
//SD_BOTH corresponds to Linux SHUT_RDWR
1621
#ifndef SHUT_RDWR
1722
#define SHUT_RDWR SD_BOTH
1823
#endif
24+
//SOCKET SHUT_WR
25+
//See https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-shutdown
26+
//"If the how parameter is SD_SEND, subsequent calls to the send function are disallowed. For TCP sockets, a FIN will be sent after all data is sent and acknowledged by the receiver."
27+
//SD_SEND corresponds to Linux SHUT_WR
1928
#ifndef SHUT_WR
20-
#define SHUT_WR SD_RECEIVE
29+
#define SHUT_WR SD_SEND
2130
#endif
2231

2332
#endif

0 commit comments

Comments
 (0)