summaryrefslogtreecommitdiffstats
path: root/tests/bugs/gfapi
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bugs/gfapi')
-rw-r--r--tests/bugs/gfapi/bug-1032894.t33
-rw-r--r--tests/bugs/gfapi/bug-1093594.c317
-rwxr-xr-xtests/bugs/gfapi/bug-1093594.t20
-rwxr-xr-xtests/bugs/gfapi/bug-1319374-THIS-crash.t27
-rw-r--r--tests/bugs/gfapi/bug-1319374.c130
-rw-r--r--tests/bugs/gfapi/glfs_vol_set_IO_ERR.c165
-rwxr-xr-xtests/bugs/gfapi/glfs_vol_set_IO_ERR.t20
7 files changed, 712 insertions, 0 deletions
diff --git a/tests/bugs/gfapi/bug-1032894.t b/tests/bugs/gfapi/bug-1032894.t
new file mode 100644
index 00000000000..88d110136e2
--- /dev/null
+++ b/tests/bugs/gfapi/bug-1032894.t
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+#Check stale indices are deleted as part of self-heal-daemon crawl.
+cleanup;
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1}
+TEST $CLI volume set $V0 cluster.self-heal-daemon off
+TEST $CLI volume start $V0
+TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0
+cd $M0
+TEST mkdir a
+cd a
+TEST kill_brick $V0 $H0 $B0/${V0}0
+# Create stale indices
+for i in {1..10}; do echo abc > $i; done
+for i in {1..10}; do rm -f $i; done
+
+TEST $CLI volume start $V0 force
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0
+TEST $CLI volume set $V0 cluster.self-heal-daemon on
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status
+
+#Since maximum depth of the directory structure that needs healin is 2
+#Trigger two self-heals. That should make sure the heal is complete
+TEST $CLI volume heal $V0
+
+EXPECT_WITHIN $HEAL_TIMEOUT "0" afr_get_index_count $B0/${V0}1
+cleanup
diff --git a/tests/bugs/gfapi/bug-1093594.c b/tests/bugs/gfapi/bug-1093594.c
new file mode 100644
index 00000000000..aff271e4caf
--- /dev/null
+++ b/tests/bugs/gfapi/bug-1093594.c
@@ -0,0 +1,317 @@
+#include <glusterfs/api/glfs.h>
+#include <glusterfs/api/glfs-handles.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define WRITE_SIZE (128*1024)
+#define READ_WRITE_LOOP 100
+#define FOP_LOOP_COUNT 20
+#define TEST_CASE_LOOP 20
+
+int gfapi = 1;
+static int extension = 1;
+
+static int
+large_number_of_fops (glfs_t *fs) {
+ int ret = 0;
+ int i = 0;
+ glfs_fd_t *fd = NULL;
+ glfs_fd_t *fd1 = NULL;
+ char *dir1 = NULL, *dir2 = NULL, *filename1 = NULL, *filename2 = NULL;
+ char *buf = NULL;
+ struct stat sb = {0, };
+
+ for (i = 0 ; i < FOP_LOOP_COUNT ; i++) {
+ ret = asprintf (&dir1, "dir%d", extension);
+ if (ret < 0) {
+ fprintf (stderr, "cannot construct filename (%s)",
+ strerror (errno));
+ return ret;
+ }
+
+ extension++;
+
+ ret = glfs_mkdir (fs, dir1, 0755);
+ if (ret < 0) {
+ fprintf (stderr, "mkdir(%s): %s\n", dir1, strerror (errno));
+ return -1;
+ }
+
+ fd = glfs_opendir (fs, dir1);
+ if (!fd) {
+ fprintf (stderr, "/: %s\n", strerror (errno));
+ return -1;
+ }
+
+ ret = glfs_fsetxattr (fd, "user.dirfattr", "fsetxattr", 8, 0);
+ if (ret < 0) {
+ fprintf (stderr, "fsetxattr(%s): %d (%s)\n", dir1, ret,
+ strerror (errno));
+ return -1;
+ }
+
+ ret = glfs_closedir (fd);
+ if (ret < 0) {
+ fprintf (stderr, "glfs_closedir failed with ret: %d (%s)\n",
+ ret, strerror (errno));
+ return -1;
+ }
+
+ ret = glfs_rmdir (fs, dir1);
+ if (ret < 0) {
+ fprintf (stderr, "glfs_unlink failed with ret: %d (%s)\n",
+ ret, strerror (errno));
+ return -1;
+ }
+
+ ret = asprintf (&filename1, "file%d", extension);
+ if (ret < 0) {
+ fprintf (stderr, "cannot construct filename (%s)",
+ strerror (errno));
+ return ret;
+ }
+
+ ret = asprintf (&filename2, "file-%d", extension);
+ if (ret < 0) {
+ fprintf (stderr, "cannot construct filename (%s)",
+ strerror (errno));
+ return ret;
+ }
+
+ extension++;
+
+ fd = glfs_creat (fs, filename1, O_RDWR, 0644);
+ if (!fd) {
+ fprintf (stderr, "%s: (%p) %s\n", filename1, fd,
+ strerror (errno));
+ return -1;
+ }
+
+ ret = glfs_rename (fs, filename1, filename2);
+ if (ret < 0) {
+ fprintf (stderr, "glfs_rename failed with ret: %d (%s)\n",
+ ret, strerror (errno));
+ return -1;
+ }
+
+ ret = glfs_lstat (fs, filename2, &sb);
+ if (ret < 0) {
+ fprintf (stderr, "glfs_lstat failed with ret: %d (%s)\n",
+ ret, strerror (errno));
+ return -1;
+ }
+
+ ret = glfs_close (fd);
+ if (ret < 0) {
+ fprintf (stderr, "glfs_close failed with ret: %d (%s)\n",
+ ret, strerror (errno));
+ return -1;
+ }
+
+ ret = glfs_unlink (fs, filename2);
+ if (ret < 0) {
+ fprintf (stderr, "glfs_unlink failed with ret: %d (%s)\n",
+ ret, strerror (errno));
+ return -1;
+ }
+ }
+}
+
+static int
+large_read_write (glfs_t *fs) {
+
+ int ret = 0;
+ int j = 0;
+ glfs_fd_t *fd = NULL;
+ glfs_fd_t *fd1 = NULL;
+ char *filename = NULL;
+ char *buf = NULL;
+
+ ret = asprintf (&filename, "filerw%d", extension);
+ if (ret < 0) {
+ fprintf (stderr, "cannot construct filename (%s)",
+ strerror (errno));
+ return ret;
+ }
+
+ extension++;
+
+ fd = glfs_creat (fs, filename, O_RDWR, 0644);
+ if (!fd) {
+ fprintf (stderr, "%s: (%p) %s\n", filename, fd,
+ strerror (errno));
+ return -1;
+ }
+
+ buf = (char *) malloc (WRITE_SIZE);
+ memset (buf, '-', WRITE_SIZE);
+
+ for (j = 0; j < READ_WRITE_LOOP; j++) {
+ ret = glfs_write (fd, buf, WRITE_SIZE, 0);
+ if (ret < 0) {
+ fprintf (stderr, "Write(%s): %d (%s)\n", filename, ret,
+ strerror (errno));
+ return ret;
+ }
+ }
+
+ fd1 = glfs_open (fs, filename, O_RDWR);
+ if (fd1 < 0) {
+ fprintf (stderr, "Open(%s): %d (%s)\n", filename, ret,
+ strerror (errno));
+ return -1;
+ }
+
+ glfs_lseek (fd1, 0, SEEK_SET);
+ for (j = 0; j < READ_WRITE_LOOP; j++) {
+ ret = glfs_read (fd1, buf, WRITE_SIZE, 0);
+ if (ret < 0) {
+ fprintf (stderr, "Read(%s): %d (%s)\n", filename, ret,
+ strerror (errno));
+ return ret;
+ }
+ }
+
+ for (j = 0; j < READ_WRITE_LOOP; j++) {
+ ret = glfs_write (fd1, buf, WRITE_SIZE, 0);
+ if (ret < 0) {
+ fprintf (stderr, "Write(%s): %d (%s)\n", filename, ret,
+ strerror (errno));
+ return ret;
+ }
+ }
+
+ glfs_close (fd);
+ glfs_close (fd1);
+ ret = glfs_unlink (fs, filename);
+ if (ret < 0) {
+ fprintf (stderr, "glfs_unlink failed with ret: %d (%s)\n",
+ ret, strerror (errno));
+ return -1;
+ }
+
+ free (buf);
+ free (filename);
+}
+
+static int
+volfile_change (const char *volname) {
+ int ret = 0;
+ char *cmd = NULL, *cmd1 = NULL;
+
+ ret = asprintf (&cmd, "gluster volume set %s stat-prefetch off",
+ volname);
+ if (ret < 0) {
+ fprintf (stderr, "cannot construct cli command string (%s)",
+ strerror (errno));
+ return ret;
+ }
+
+ ret = asprintf (&cmd1, "gluster volume set %s stat-prefetch on",
+ volname);
+ if (ret < 0) {
+ fprintf (stderr, "cannot construct cli command string (%s)",
+ strerror (errno));
+ return ret;
+ }
+
+ ret = system (cmd);
+ if (ret < 0) {
+ fprintf (stderr, "stat-prefetch off on (%s) failed", volname);
+ return ret;
+ }
+
+ ret = system (cmd1);
+ if (ret < 0) {
+ fprintf (stderr, "stat-prefetch on on (%s) failed", volname);
+ return ret;
+ }
+
+ free (cmd);
+ free (cmd1);
+ return ret;
+}
+
+int
+main (int argc, char *argv[])
+{
+ glfs_t *fs = NULL;
+ int ret = 0;
+ int i = 0;
+ glfs_fd_t *fd = NULL;
+ glfs_fd_t *fd1 = NULL;
+ char *topdir = "topdir", *filename = "file1";
+ char *buf = NULL;
+ char *logfile = NULL;
+ char *hostname = NULL;
+
+ if (argc != 4) {
+ fprintf (stderr,
+ "Expect following args %s <hostname> <Vol> <log file>\n"
+ , argv[0]);
+ return -1;
+ }
+
+ hostname = argv[1];
+ logfile = argv[3];
+
+ for (i = 0; i < TEST_CASE_LOOP; i++) {
+ fs = glfs_new (argv[2]);
+ if (!fs) {
+ fprintf (stderr, "glfs_new: returned NULL (%s)\n",
+ strerror (errno));
+ return -1;
+ }
+
+ ret = glfs_set_volfile_server (fs, "tcp", hostname, 24007);
+ if (ret < 0) {
+ fprintf (stderr, "glfs_set_volfile_server failed ret:%d (%s)\n",
+ ret, strerror (errno));
+ return -1;
+ }
+
+ ret = glfs_set_logging (fs, logfile, 7);
+ if (ret < 0) {
+ fprintf (stderr, "glfs_set_logging failed with ret: %d (%s)\n",
+ ret, strerror (errno));
+ return -1;
+ }
+
+ ret = glfs_init (fs);
+ if (ret < 0) {
+ fprintf (stderr, "glfs_init failed with ret: %d (%s)\n",
+ ret, strerror (errno));
+ return -1;
+ }
+
+ ret = large_number_of_fops (fs);
+ if (ret < 0)
+ return -1;
+
+ ret = large_read_write (fs);
+ if (ret < 0)
+ return -1;
+
+ ret = volfile_change (argv[2]);
+ if (ret < 0)
+ return -1;
+
+ ret = large_number_of_fops (fs);
+ if (ret < 0)
+ return -1;
+
+ ret = large_read_write (fs);
+ if (ret < 0)
+ return -1;
+
+ ret = glfs_fini (fs);
+ if (ret < 0) {
+ fprintf (stderr, "glfs_fini failed with ret: %d (%s)\n",
+ ret, strerror (errno));
+ return -1;
+ }
+ }
+ return 0;
+}
diff --git a/tests/bugs/gfapi/bug-1093594.t b/tests/bugs/gfapi/bug-1093594.t
new file mode 100755
index 00000000000..3f7223be15e
--- /dev/null
+++ b/tests/bugs/gfapi/bug-1093594.t
@@ -0,0 +1,20 @@
+#!/bin/bash
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+cleanup;
+
+## Start and create a volume
+TEST glusterd;
+TEST pidof glusterd;
+TEST $CLI volume info;
+
+TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2};
+TEST $CLI volume start $V0;
+logdir=`gluster --print-logdir`
+
+TEST build_tester $(dirname $0)/bug-1093594.c -lgfapi
+TEST $(dirname $0)/bug-1093594 $H0 $V0 $logdir/bug-1093594.log
+
+cleanup_tester $(dirname $0)/bug-1093594
+cleanup;
diff --git a/tests/bugs/gfapi/bug-1319374-THIS-crash.t b/tests/bugs/gfapi/bug-1319374-THIS-crash.t
new file mode 100755
index 00000000000..8d3db421c88
--- /dev/null
+++ b/tests/bugs/gfapi/bug-1319374-THIS-crash.t
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+cleanup;
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume info;
+
+TEST $CLI volume create $V0 $H0:$B0/brick1 $H0:$B0/brick2;
+EXPECT 'Created' volinfo_field $V0 'Status';
+
+TEST $CLI volume start $V0;
+EXPECT 'Started' volinfo_field $V0 'Status';
+
+TEST $CLI volume set $V0 diagnostics.client-log-flush-timeout 30
+
+logdir=`gluster --print-logdir`
+
+TEST build_tester $(dirname $0)/bug-1319374.c -lgfapi
+TEST $(dirname $0)/bug-1319374 $H0 $V0 $logdir/bug-1319374.log
+
+cleanup_tester $(dirname $0)/bug-1319374
+
+cleanup;
diff --git a/tests/bugs/gfapi/bug-1319374.c b/tests/bugs/gfapi/bug-1319374.c
new file mode 100644
index 00000000000..bf2da998d6e
--- /dev/null
+++ b/tests/bugs/gfapi/bug-1319374.c
@@ -0,0 +1,130 @@
+#include <glusterfs/api/glfs.h>
+#include <glusterfs/api/glfs-handles.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define NO_INIT 1
+
+glfs_t *
+setup_new_client(char *hostname, char *volname, char *log_file, int flag)
+{
+ int ret = 0;
+ glfs_t *fs = NULL;
+
+ fs = glfs_new (volname);
+ if (!fs) {
+ fprintf (stderr, "\nglfs_new: returned NULL (%s)\n",
+ strerror (errno));
+ goto error;
+ }
+
+ ret = glfs_set_volfile_server (fs, "tcp", hostname, 24007);
+ if (ret < 0) {
+ fprintf (stderr, "\nglfs_set_volfile_server failed ret:%d (%s)\n",
+ ret, strerror (errno));
+ goto error;
+ }
+
+ ret = glfs_set_logging (fs, log_file, 7);
+ if (ret < 0) {
+ fprintf (stderr, "\nglfs_set_logging failed with ret: %d (%s)\n",
+ ret, strerror (errno));
+ goto error;
+ }
+
+ if (flag == NO_INIT)
+ goto out;
+
+ ret = glfs_init (fs);
+ if (ret < 0) {
+ fprintf (stderr, "\nglfs_init failed with ret: %d (%s)\n",
+ ret, strerror (errno));
+ goto error;
+ }
+
+out:
+ return fs;
+error:
+ return NULL;
+}
+
+int
+main (int argc, char *argv[])
+{
+ int ret = 0;
+ glfs_t *fs1 = NULL;
+ glfs_t *fs2 = NULL;
+ glfs_t *fs3 = NULL;
+ char *volname = NULL;
+ char *log_file = NULL;
+ char *hostname = NULL;
+
+ if (argc != 4) {
+ fprintf (stderr,
+ "Expect following args %s <hostname> <Vol> <log file location>\n"
+ , argv[0]);
+ return -1;
+ }
+
+ hostname = argv[1];
+ volname = argv[2];
+ log_file = argv[3];
+
+ fs1 = setup_new_client (hostname, volname, log_file, NO_INIT);
+ if (!fs1) {
+ fprintf (stderr, "\nsetup_new_client: returned NULL (%s)\n",
+ strerror (errno));
+ goto error;
+ }
+
+ fs2 = setup_new_client (hostname, volname, log_file, 0);
+ if (!fs2) {
+ fprintf (stderr, "\nsetup_new_client: returned NULL (%s)\n",
+ strerror (errno));
+ goto error;
+ }
+
+ fs3 = setup_new_client (hostname, volname, log_file, 0);
+ if (!fs3) {
+ fprintf (stderr, "\nsetup_new_client: returned NULL (%s)\n",
+ strerror (errno));
+ goto error;
+ }
+
+ ret = glfs_fini (fs3);
+ if (ret < 0) {
+ fprintf (stderr, "glfs_fini failed with ret: %d (%s)\n",
+ ret, strerror (errno));
+ goto error;
+ }
+
+ /* The crash is seen in gf_log_flush_timeout_cbk(), and this gets
+ * triggered when 30s timer expires, hence the sleep of 31s
+ */
+ sleep (31);
+ ret = glfs_fini (fs2);
+ if (ret < 0) {
+ fprintf (stderr, "glfs_fini failed with ret: %d (%s)\n",
+ ret, strerror (errno));
+ goto error;
+ }
+
+ ret = glfs_init (fs1);
+ if (ret < 0) {
+ fprintf (stderr, "\nglfs_init failed with ret: %d (%s)\n",
+ ret, strerror (errno));
+ goto error;
+ }
+
+ ret = glfs_fini (fs1);
+ if (ret < 0) {
+ fprintf (stderr, "glfs_fini failed with ret: %d (%s)\n",
+ ret, strerror (errno));
+ goto error;
+ }
+
+ return 0;
+error:
+ return -1;
+}
diff --git a/tests/bugs/gfapi/glfs_vol_set_IO_ERR.c b/tests/bugs/gfapi/glfs_vol_set_IO_ERR.c
new file mode 100644
index 00000000000..68011171744
--- /dev/null
+++ b/tests/bugs/gfapi/glfs_vol_set_IO_ERR.c
@@ -0,0 +1,165 @@
+#include <glusterfs/api/glfs.h>
+#include <glusterfs/api/glfs-handles.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define WRITE_SIZE (128)
+
+glfs_t *
+setup_new_client(char *hostname, char *volname, char *log_fileile)
+{
+ int ret = 0;
+ glfs_t *fs = NULL;
+
+ fs = glfs_new (volname);
+ if (!fs) {
+ fprintf (stderr, "\nglfs_new: returned NULL (%s)\n",
+ strerror (errno));
+ goto error;
+ }
+
+ ret = glfs_set_volfile_server (fs, "tcp", hostname, 24007);
+ if (ret < 0) {
+ fprintf (stderr, "\nglfs_set_volfile_server failed ret:%d (%s)\n",
+ ret, strerror (errno));
+ goto error;
+ }
+
+ ret = glfs_set_logging (fs, log_fileile, 7);
+ if (ret < 0) {
+ fprintf (stderr, "\nglfs_set_logging failed with ret: %d (%s)\n",
+ ret, strerror (errno));
+ goto error;
+ }
+
+ ret = glfs_init (fs);
+ if (ret < 0) {
+ fprintf (stderr, "\nglfs_init failed with ret: %d (%s)\n",
+ ret, strerror (errno));
+ goto error;
+ }
+ return fs;
+error:
+ return NULL;
+}
+
+int
+write_something (glfs_t *fs)
+{
+ glfs_fd_t *fd = NULL;
+ char *buf = NULL;
+ int ret = 0;
+ int j = 0;
+
+ fd = glfs_creat (fs, "filename", O_RDWR, 0644);
+ if (!fd) {
+ fprintf (stderr, "%s: (%p) %s\n", "filename", fd,
+ strerror (errno));
+ return -1;
+ }
+
+ buf = (char *) malloc (WRITE_SIZE);
+ memset (buf, '-', WRITE_SIZE);
+
+ for (j = 0; j < 4; j++) {
+ ret = glfs_write (fd, buf, WRITE_SIZE, 0);
+ if (ret < 0) {
+ fprintf (stderr, "Write(%s): %d (%s)\n", "filename", ret,
+ strerror (errno));
+ return ret;
+ }
+ glfs_lseek (fd, 0, SEEK_SET);
+ }
+ return 0;
+}
+
+static int
+volfile_change (const char *volname) {
+ int ret = 0;
+ char *cmd = NULL, *cmd1 = NULL;
+
+ ret = asprintf (&cmd, "gluster volume set %s quick-read on",
+ volname);
+ if (ret < 0) {
+ fprintf (stderr, "cannot construct cli command string (%s)",
+ strerror (errno));
+ return ret;
+ }
+
+ ret = asprintf (&cmd1, "gluster volume set %s quick-read off",
+ volname);
+ if (ret < 0) {
+ fprintf (stderr, "cannot construct cli command string (%s)",
+ strerror (errno));
+ return ret;
+ }
+
+ ret = system (cmd);
+ if (ret < 0) {
+ fprintf (stderr, "quick-read off on (%s) failed", volname);
+ return ret;
+ }
+
+ ret = system (cmd1);
+ if (ret < 0) {
+ fprintf (stderr, "quick-read on on (%s) failed", volname);
+ return ret;
+ }
+
+ ret = system (cmd);
+ if (ret < 0) {
+ fprintf (stderr, "quick-read off on (%s) failed", volname);
+ return ret;
+ }
+
+ free (cmd);
+ free (cmd1);
+ return ret;
+}
+
+int
+main (int argc, char *argv[])
+{
+ int ret = 0;
+ glfs_t *fs = NULL;
+ char buf[100];
+ glfs_fd_t *fd = NULL;
+
+ if (argc != 4) {
+ fprintf (stderr,
+ "Expect following args %s <hostname> <Vol> <log file location>\n"
+ , argv[0]);
+ return -1;
+ }
+
+ fs = setup_new_client (argv[1], argv[2], argv[3]);
+ if (!fs)
+ goto error;
+
+ ret = volfile_change (argv[2]);
+ if (ret < 0)
+ goto error;
+
+ /* This is required as volfile change takes a while to reach this
+ * gfapi client and precess the graph change. Without this the issue
+ * cannot be reproduced as in cannot be tested.
+ */
+ sleep (10);
+
+ ret = write_something (fs);
+ if (ret < 0)
+ goto error;
+
+ ret = glfs_fini (fs);
+ if (ret < 0) {
+ fprintf (stderr, "glfs_fini failed with ret: %d (%s)\n",
+ ret, strerror (errno));
+ goto error;
+ }
+
+ return 0;
+error:
+ return -1;
+}
diff --git a/tests/bugs/gfapi/glfs_vol_set_IO_ERR.t b/tests/bugs/gfapi/glfs_vol_set_IO_ERR.t
new file mode 100755
index 00000000000..5893ef273bd
--- /dev/null
+++ b/tests/bugs/gfapi/glfs_vol_set_IO_ERR.t
@@ -0,0 +1,20 @@
+#!/bin/bash
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+cleanup;
+
+## Start and create a volume
+TEST glusterd;
+TEST pidof glusterd;
+TEST $CLI volume info;
+
+TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2};
+TEST $CLI volume start $V0;
+logdir=`gluster --print-logdir`
+
+TEST build_tester $(dirname $0)/glfs_vol_set_IO_ERR.c -lgfapi
+TEST $(dirname $0)/glfs_vol_set_IO_ERR $H0 $V0 $logdir/glfs_vol_set_IO_ERR.log
+
+cleanup_tester $(dirname $0)/glfs_vol_set_IO_ERR
+cleanup;